Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When in the 'lower level terminal' (not sure how this is called), the one opened by pressing Ctrl + Alt + F1, how can I copy the content of the command I used there, since there is no mouse and I can not move my cursor out for the command line?

share|improve this question
    
@Beniamin paste it here so i can get some support : ) –  silkAdmin Oct 25 '11 at 12:27
    
Do you want to copy the command, or its output? –  Kris Harper Oct 25 '11 at 12:28
    
The output, in this instance i am trying to run X -config and i am getting a couple of errors –  silkAdmin Oct 25 '11 at 12:29
    
you could just redirect the output to a file with > or &> –  hbdgaf Oct 25 '11 at 12:31
    
@aking1012 thanks, that was it, can you please post that as an answers so i can vote it ? –  silkAdmin Oct 25 '11 at 12:41

4 Answers 4

up vote 5 down vote accepted

you could just redirect the output to a file with > or &> ... I was asked to move it from comments to answers, so here it is.

By the way, a couple notes:

Putting > in between a command and a filename will overwrite the current contents of the file with standard out.

Putting >> appends to a file

Putting a & before the redirector will also catch standard error.

share|improve this answer

To send the output of a command to a file, you can use redirection.

For example, you could send your dmesg command to a file with

dmesg > ~/Documents/output.txt

Then the output will write to that file instead of the screen. When you come back to the GUI, you can find the file in your Documents folder and access the contents.

share|improve this answer
    
Thank you root45. I voted up but i ll kuddo Aking as he was the first to suggest this answer in the comments. –  silkAdmin Oct 25 '11 at 13:35

The last used command history is usually stored in your history file (.bash_history). You can open this file with the editor-of-your-choice and copy contents.

As for manipulating the command-line of the console window, you can rely on the command line editing functions of the bash shell. They are discussed in the READLINE section of the Bash manual page (man bash). But they will not allow you to paste the copied part into an editor.

Another way to work around this is to use the screen utility. There are several introductory tutorials on the web. Screen has a copy and paste function:

  1. Press CTRL+A then ESC to get into copy mode.
  2. By moving around the cursor keys you can position to the first character of your selected region, then press Space. You now have set the first mark.
  3. Move the cursor to the end of the text you'd like to select and press Space. You have now copied the selected region into the buffer.
  4. To paste the buffer press CTRL+A and then ].
share|improve this answer
    
Thanks a lot, very instructive answer! –  silkAdmin Oct 25 '11 at 13:36
sudo apt-get install gpm

GPM is just what you need & very useful. While in the console (ctrl+alt+f1), you can copy by dragging the left-hand mouse button, and then paste by clicking the right-hand mouse button.

share|improve this answer
    
Why? what does it do? You might want to edit your answer and explain for the benefit of the OP and other users –  Stephen Myall Mar 12 '13 at 11:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.