How can one copy the entire contents of a Linux Terminal / "man" pages to a a text editor (gedit in this instance)?


Answer: 1

15 hours ago

Before I start - I am a 69-year-old Linux newbee - take it easy on me!

Is there an easy way to copy the entire contents of a Terminal (many pages) - "man pages", which I am told are not the same as Terminal pages but look the same to newbee me - see comment below - so that I can transfer it to a text editor? Presently I have to highlight and copy one page at a time, which is rather laborious.

I have seen the explanations of how to copy only a section of the contents of a many-paged Terminal - and this is a little tricky for me - - - I was hoping there was a quick and easy way to do the entire contents?

Thank you for your patience.

Added by: Catherine Stracke

Answer: 2

23 hours ago

Two options that don't require selecting, copying and pasting text are:

save output from a single command to a file: this question has several useful answers covering different ways you can pipe command output to a file. Such as: command 2>&1 | tee ~/outputfile.txt which will write both standard and error output to outputfile.txt (refer to above link for other variations).


save a whole session to a log with: script logfile

(as mentioned here). everything that follows will be logged to "logfile"

then type exit when your done to stop logging.

Added by: Chelsea Boyle Sr.

Answer: 3

34 hours ago

The default terminal emulator on Ubuntu, gnome-terminal should have a "Select all" option in its "Edit" menu.

Once everything is selected, you can copy it with Ctrl+Shift+C, or right-click and selecting "Copy", or "Copy" from the "Edit" menu.

Note however that the terminal buffer is limited by default to a few thousand lines. If your session accumulates more lines, those will be truncated and you only get the most recent part. If you need more, you can change the size of the scrollback buffer in the menu "Edit" > "Profile preferences" > "Scrolling" > "Limit scrollback to ___".

Update based on your clarification in comments:

man uses a pager (should be less by default) which uses a different terminal mode to provide scrollable text on a single screen, instead of relying on the terminal emulator to let you scroll through the backlog.

To get the whole content of a man page in your terminal at once, so that you can select and copy it all, you can tell it to not use any pager by adding the argument --pager=, like:

man --pager= find

If you want this behaviour to be the default, you can append the line below to your ~/.bashrc file:

export MANPAGER=""

Alternatively, the pages is also disabled if you pipe the output through any other command, like e.g. cat, which just reproduces it as it is:

man find | cat

Or if your actual goal is to save the manual to a text file, you can redirect the command output to a file directly:

man find > find.txt
Added by: Lucienne Lang

Answer: 4

23 hours ago

If you want many pages but not all

You can right click at the bottom of the terminal window and drag your mouse up to the window title bar.

The text will scroll as it is highlighted. After appropriate number of pages are highlighted, press the mouse's right button. A context sensitive menu appears where you can select copy.

Move cursor to your editor and right-click again. Now select paste.

Added by: Dorothy Grimes

Answer: 5

26 hours ago

I use Ubuntu 16. I am trying to learn Linux and the use of the Terminal. I was wanting to know how to find files. I was directed to "man find" to find the information of how to use the "find" function in the Terminal. So, I went to the Terminal, typed "man find" which took me to those particular pages of the manual - many pages long. I wanted to copy all of that text and transfer it elsewhere (to a text file editor) but did not know how to copy all the text at once - I could only copy one page at a time from the Terminal pages.

SOLUTION: One does not need to use the Terminal at all - one just goes to the text editor and "man find" within that - and here one can copy all the text easily. Hope this helps some other newbee!

Answer: 6

6 hours ago

I have found the easiest ways to address my problem: 1. The "script" command works: It makes a copy of what is in the terminal / man pages and formats it in a way which can be printed from a text file. 2. just add " >> tempfile.log" at the end of every command - one can then edit it later as you want in libreoffice

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9