Tag Info

Hot answers tagged

81

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 ...


61

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


56

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 ...


40

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 ...


22

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 Add these lines to the ~/.nanorc include ~/.nano/syntax/html.nanorc include ...


22

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.


18

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.


17

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 ...


14

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.


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

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.


10

It is a nano emergency file where its buffer gets dumped. If your current file seems alright, you can delete the filename.save associated file. From nano manual notes: In some cases nano will try to dump the buffer into an emergency file. This will happen mainly if nano receives a SIGHUP or SIGTERM or runs out of memory. It will write the buffer into a ...


9

CTRL-W Nano Basics Guide


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

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


6

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


5

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.


5

I used this command to quickly enable all available languages. find /usr/share/nano/ -iname "*.nanorc" -exec echo include {} \; >> ~/.nanorc As mentioned in other answers, /usr/share/nano/ contains the definitions for different languages. $ ls /usr/share/nano asm.nanorc fortran.nanorc man-html ocaml.nanorc ruby.nanorc awk.nanorc ...


5

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


5

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 > ...


5

Type sudo update-alternatives --config editor You will get a text like below. There are 4 choices for the alternative editor (providing /usr/bin/editor). Selection Path Priority Status ------------------------------------------------------------ * 0 /bin/nano 40 auto mode 1 /bin/ed ...


4

Are you using the Nano text editor? If so, this two links might help The save file extension is associated with the command line text editor Nano that is a part of various Unix and Unix-based operating systems. The *.save file contains temporary saved text file. It is backup used to protect text document against system crashes. After the text is ...


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

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?


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

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 ...



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