The Computer Oracle

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

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Digital Sunset Looping

--

Chapters
00:00 Question
00:29 Accepted answer (Score 26)
01:02 Answer 2 (Score 129)
01:35 Answer 3 (Score 73)
01:51 Answer 4 (Score 19)
02:17 Thank you

--

Full question
https://superuser.com/questions/196425/h...

Accepted answer links:
[xclip]: http://sourceforge.net/projects/xclip/

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #copypaste #nano

#avk47



ANSWER 1

Score 144


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



ANSWER 2

Score 84


you can use cat and then copy it from the console:

cat path/to/file.yml

Select the output printed in the console.




ACCEPTED ANSWER

Score 26


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.




ANSWER 4

Score 7


Actually, this answer might be a bit late but I was looking for an answer for the same question and I just figured it out. when you have the file you want to copy to open in nano. you can hit ctl-R and enter the file you want copied from. this will bring in the whole file.

In my case I was just copying my old fstab so it wasn't a big deal. but could get ridiculous with huge files.