Questions tagged [nano]

nano is a simple command line text editor which comes preinstalled in Ubuntu by default.

Sample screenshot

GNU nano is an easy-to-use text editor originally designed as a replacement for Pico, the ncurses-based editor.

However, nano also implements many features missing in pico, including:

  • feature toggles;
  • interactive search and replace (with regular expression support);
  • go to line (and column) command;
  • auto-indentation and color syntax-highlighting;
  • filename tab-completion and support for multiple buffers;
  • full internationalization support.

nano comes installed in Ubuntu by default. It can be launched by typing nano in the Terminal, optionally followed by some options and/or a filename. For more information regarding usage, see this online man page.

Links

  1. Homepage
  2. Wikipedia link
174 questions
444
votes
7 answers

How to show line numbering in nano when opening a file

Is there a way to tell nano to automatically show line numbering each time I open a file?
Luis Alvarado
  • 211,503
146
votes
8 answers

Copy (only copy, not cutting) in Nano?

I need to copy some text in Nano, so I searched using Google and found a few posts here on Stack Exchange and other sites in which the OP asks "How can I copy?" and people usually answer "You can use ctrl+K". The person asks how to copy and they are…
user423047
136
votes
4 answers

How to save a file using nano

I am trying to install Java via the terminal using the guide How to Install Oracle Java JRE on Ubuntu Linux. Everything went perfectly fine until "Step 11: Save the /etc/profile file and exit": I spent maybe 30 minutes figuring out what ^ means…
user288690
  • 1,563
  • 3
  • 12
  • 8
42
votes
6 answers

Getting error while opening /etc/profile: Error reading lock file /etc/.profile.swp: Not enough data read

I am getting this error while opening /etc/profile file using nano. Error reading lock file /etc/.profile.swp: Not enough data read How can I fix this?
18
votes
4 answers

How to move the blinking cursor with the mouse in nano editor?

I am writing a text file through the terminal using nano; everytime I need to select a position of a certain line of my text I can't help but scrolling all the lines moving the blinking cursor using the keyboard arrows; is there a way to avoid this…
10
votes
2 answers

nano M-A hotkey

When using nano in the terminal, to do the "write file append" command, it lists the keystroke "M-A". I am completely confused what this key command actually means. I read somewhere that it means Alt-A, which didn't work. What am I supposed to…
Scorb
  • 770
6
votes
1 answer

Extend nano menu

Some hotkeys for nano are listed in the bottom depends on window scaling. How can I switch through this menu to see all the available hotkeys?
Hölderlin
  • 667
  • 1
  • 8
  • 24
5
votes
2 answers

How to insert timestamp in nano editor?

I need a time-stamp that is inserted with a hot key, like F5 in old notepad. Format should be: hh:mm dd.mm.yyyy. p.s. Dot in the end of the year is grammatically correct in Serbian language, so it is not a mistake.
Igor V.
  • 948
5
votes
1 answer

How to enable undo in nano?

How can I enable Undo in nano? I am using a ssh connection with a server. I can not update the version of nano that is installed on the server. Is there anyway to use GNU nano 2.3.1 to have Undo function?
3
votes
2 answers

Is there any way to search the Help screen in nano?

In nano, I can search for text in my document using Ctrl W, and I can bring up the Help screen using Ctrl G, but I can't search the Help screen using Ctrl W. Is there any other way to do it?
mwfearnley
  • 3,317
  • 2
  • 22
  • 28
3
votes
1 answer

Exit without saving from "nano -t"

Usually I use nano editor but with -t parameter. From man nano: -t (--tempfile) Always save changed buffer without prompting. Same as Pico’s -t option. It just doesn't ask me about saving yes/no and save to this file or another…
Kirby
  • 185
3
votes
1 answer

Nano - insert content, save and exit

I'm currently working on making a text file of the whole process of setting up my server for my normal usage. And would like to know if there is any way to write a shell script so that I can make the "nano" insert content, save it, exit it, and then…
3
votes
0 answers

nano syntax highlighting not working for all languages

I have a funny situation where I am unable to add custom highlighting definitions to my nano text editor. The funny thing is that the predefined work like a charm and can be edited. But I have created a new one for js with $ sudo touch js.nanorc $…
Dejan
  • 131
  • 3
3
votes
1 answer

Find and delete with nano

I want to find specific characters/strings with nano and delete all occurrences. How can this be done with nano and can this even be done?
3
votes
1 answer

How do I save and quit after making changes in a config file?

How do I save and quit after making changes in a config file? I was told to type out the command :wq but I do not know where. I'm met with this screen. Which keys do I press to type out the :wq command?
1
2