Skip to main content

Additional Nano Tips

How to Select All in Nano

Here's a how you can perform a select all text in Nano editor.

Nano editor is a lot more user friendly than the likes of Vim and Emacs.

Yet, you cannot use the (universal) Ctrl+A shortcut to select all in Nano.

You can, of course, press the left click on the mouse and drag the mouse to the end but it's not very convenient for large text files.

If you want to select all the text and all the lines of the file in Nano, here's what you need to do:

  1. Press Alt+\ and jump to the start of the file.
  2. Press Ctrl+6 to set the marker.
  3. Press Alt+/ to move to the end of the file.
Select all in Nano editor

The above three steps emulate the select all functionality in Nano.

Let's see it in detail.

Select all text and lines in Nano

The entire process is composed of three steps.

You move to the beginning of the file. And then you set a marker. You then move to the end of the file. It is like holding the left click of the mouse and dragging it across and thus selecting all.

First, press the Alt+\ keys to ensure that you are at the beginning of the file in Nano.

Now you set the marker with Ctrl+6 (or Ctrl+^ i.e. Ctrl+Shift+6 in most keyboards).

And now press the Alt+/ keys to jump to the end of the file.

You'll notice that the entire text has been selected.

Select all lines in Nano

You can do press Ctrl+K to delete all lines or cut them or do whatever you want with it.

💡
If you don't want to do anything withe selected text, press Ctrl+6 again and it will unselect the text.

As you can see, there is no straightforward way to select all in Nano. Ctrl+A does not work here.

However, the workaround is not too complicated in my opinion. You just have to remember how to move to the beginning or end of file in Nano. And if you forget that, you can always press Ctrl+G to bring the help menu in Nano.

Abhishek Prakash