Tag Info

Hot answers tagged

62

The keyboard combination to display the current line number whilst you are using nano is CTRL+C. Alternatively, to display the line & column number position you could just use the -c parameter when launching nano i.e: nano -c [filename] To make this permanent, nano uses a configuration in your home folder ~/.nanorc Thus to display line numbers ...


47

Ctrl + W is the shortcut for searching. After entering the search term, press Enter. To repeat the search, issue Alt + W. In this menu, you can select earlier searches using the arrow up/ down keys. To toggle backwards searching, you need to press Alt + B in the search dialog. For more shortcuts, press F1


43

The nano editor provides syntax highlighting for a few languages and scripts by itself. Check out /usr/share/nano/ nits@nits-excalibur:~$ ls /usr/share/nano/ asm.nanorc fortran.nanorc man.nanorc ocaml.nanorc ruby.nanorc awk.nanorc gentoo.nanorc mgp.nanorc patch.nanorc sh.nanorc c.nanorc groff.nanorc mutt.nanorc ...


36

Ctrl + G will let you read the help. nano can do some pretty nice things so you might want to pootle around in there for a bit. When you see ^G (et al) it means Ctrl + G. In the help pages, M-H means Alt + H. How can I open text files for editing? This is the default in nano. Open and file and you're set to start editing: nano filename Note: you won't ...


16

Yes you can, however the default syntax definitions are quite poor and incomplete. I'm maintaining a more accurate set of definitions here, for anyone who finds them useful. To install, run: git clone https://github.com/nanorc/nanorc.git cd nanorc make install echo 'include ~/.nano/syntax/ALL.nanorc' >> ~/.nanorc


16

Ctrl + X will quit the editor and you will be asked if you want to save your changes. If you do, press Y for Yes. Ctrl + O should also work, since that means to save the file, but you won't be asked "Save modifier buffer ? " because you already told nano to save.


14

Nano's undo code is experimental. As you'll see from the nano manual (type "man nano" in a Terminal to read that), you'll need to start nano with the -u option (so "nano -u somefile.txt"), and then you can use Alt-U to undo.


12

nano does not support deleting a block of text, only cutting it (to the server's clipboard). Instead, if you are using Putty, do the following: Select the text you wish to copy to the clipboard with the mouse first -- this copies it to your local clipboard (i.e. Windows 7 clipboard), which nano can't touch: Then, select your block in nano and use Ctrl-K ...


12

From the nano Command Manual: -E, --tabstospaces Convert typed tabs to spaces. -T <#cols>, --tabsize=<#cols> Set the displayed tab length to #cols columns. The value of #cols must be greater than 0. The default value is 8. For four spaces, the appropriate command would therefore be nano -ET4. Consider creating a permanent alias.


10

Press the following keys in order, one at a time: F9 Activates the top menu. o Selects the Option menu. c Opens the configuration dialog. i Toggles the use internal edit option. s Saves your preferences.


8

Yes you could save it temporarily to your home directory.Press Ctrl+O to change the path to your home directory or in /tmp and then press Enter to save it.Then you can sudo mv it. Press CTRL+O will show you the path.Change that to your home directory or /tmp.For example File Name to Write: /tmp/filename and press enter.


8

CTRL-W Nano Basics Guide


7

He save the changes made through Ctrl+O which actually means Write Out while editing a file through nano. Where ^ means Ctrl. Note : You'll also have to press Enter to overwrite the existing file if it exists.


7

You can't select with mouse and delete text using nano editor. For faster delete you can use Ctrl + K to delete(cut) the present line of text. Note : Ctrl + K will cut the line of text. Using Ctrl + U you can paste it. EDIT: Additional Info from steeldriver You can select and cut something other than the current line using Ctrl-^ to mark the start of ...


6

With the image shown right now you can save just pressing "Y" for yes. To know what key combinations you need to do just check the White square besides the action, which are as follow: Y: yes N: no Ctrl + C: Cancel


5

You can select a specific syntax highlighting using the --syntax option, for example nano --syntax=python myscript


5

If you also have unwanted backup files in subfolders, it gets a bit more difficult: find . -type f -name '*~' -delete


4

You can simply run rm *~ if you're sure there is no other file that you need which ends in ~ If it is gedit that is creating the backup files, you can open gedit and select Edit->Preferences->Editor and uncheck the option "Create a backup copy of files before saving" And for nano, look in /etc/nanorc for: ## Backup files to filename~. set backup ...


4

Sadly, I don't think this is possible. I've found a thread where a nano developer said: Hi, I've searched high and low trying to find out if it's possible to navigate through the text with CTRL left/right-key to jump word by word... Unfortunately, no. Meta-Space and Ctrl-Space are the only keys to do that. This is because in ...


4

In the bottom text the ^ stands for Ctrl and M- stands for Alt So^G is Ctrl-G and M-Y is Alt-Y (that one toggles the colors). You can toggle line truncation with M-$. See the help pages (^G) for more functions.


4

The combination of ^ and a letter means you're supposed to press Ctrl and that letter. So when nano says ^X Exit that means you're gonna quit nano by pressing Ctrl+X. To open a file called /etc/nanorc you can start nano with: nano /etc/nanorc Note that /etc/groups is not writeable by regular users, therefore you need sudo: sudo nano /etc/nanorc If ...


4

Run MC as usual. On the command line right above the bottom row of menu selections type "select-editor" without the quotes. This should open a menu with a list of all of your installed editors. This is working for me on all my current linux machines.


4

I may have misunderstood your question. SHH doesn't exist, do you mean SH or SSH? Or maybe Bash? (EDIT: brought an edit to fix this) Anyway, nano won't be much of assistance here. echo will. echo "ServerName localhost" > /etc/apache2/conf-available/fqdn.conf sudo a2enconf fqdn The above shell code will send your text into the file. Replacing > ...


4

Within nano, use Ctrl+_ (that is, hold down ctrl and press underscore), and then you will be prompted to enter a line. If you want to open the file focused on a specific line, you can use from the command line: nano +514 file.txt


4

I suggest to create a Bash alias. I'm assuming you're using Bash as a shell here. alias nano='sudo nano' This will map nano to sudo nano. To make it permanent, see this Q&A: How do I create a permanent Bash alias?


3

Change this line (or similar, probably first non-comment line) in /usr/share/nano/c.nanorc syntax "c" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$" to: syntax "c" "\.(c(c|pp|u|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$" If you don't have permission to change /usr/share/nano/c.nanorc: copy it to your home, for example to ~/.c.nanorc change syntax as ...


3

You can start nano with the -m (--mouse) option. From man nano -m (--mouse) Enable mouse support, if available for your system. When enabled, mouse clicks can be used to place the cursor, set the mark (with a double click), and execute shortcuts. The mouse will work in the X Window System, and on the ...


3

Let's start with the two big ones: vi is installed by default on almost all Linux (and other Unix) systems for many decades. This makes it something like the lowest common denominator, the editor every Linux/Unix user should at least know a little bit about in order to fix small problems (and install other editors if they want). As a result of its ubiquity ...


3

You can changes keybinding in Geany from edit, preferences. The 2 you mention: But you probably want this one:



Only top voted, non community-wiki answers of a minimum length are eligible