How do I select all text from a file with nano?

There is a possible way:

  • Cursor at the beginning of a file

  • Ctrl6 to set a mark

  • AltShiftT (or try AltT) to cut to the end of the file

  • If AltT doesn't work, try CtrlK

  • to just copy the file content do CtrlU to uncut the text again

You can't use the buffer of nano to use it elsewhere, you need to use the buffer of X or Gnome.

xclip is the solution.

A command line interface to the X11 clipboard. It can also be used for copying files, as an alternative to sftp/scp, avoiding password prompts when X11 forwarding has already been setup.


Alternatively you can zoom out using Ctrl+- to fit all the file contents on 'one screen page' and select everything using the mouse. After you zoom back with Ctrl+0 or zoom in progressively with Ctrl++.

I don't like the mouse part, but this is a fast way to copy bulk text in nano.