Results 1 to 8 of 8

Thread: How to copy/paste output from tty console?

  1. #1
    Join Date
    Dec 2009
    Location
    Arizona, USA
    Beans
    15
    Distro
    Ubuntu 9.10 Karmic Koala

    Question How to copy/paste output from tty console?

    Hi~

    On all the extra tty consoles shown when pressing CTRL+ALT+F1,F2,etc, how can I copy the output from there?

    I'm trying to solve another problem where the tty console is messed up and doing crazy things, but I can't even ask on this forum properly until I can copy and paste what it's showing.

    I also don't know where it saves the output, in case I'm supposed to find it somewhere... there are so many "logs" in the log viewer, but no information saying what logs are logging what.

    Thanks for any help~~ O_O
    Last edited by Zeniff; March 17th, 2010 at 09:11 AM. Reason: Solved with answer and other good tips from people.

  2. #2
    Join Date
    Dec 2007
    Location
    Secunda, South Africa
    Beans
    363
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to copy/paste output from tty console?

    You could try to redirect the output
    it will look something like

    (command that does weird things) > cat >> /home/(your username)/Desktop/1.txt

    or something like that
    Just tested this and it works but someone with more command line knowledge could maybe give you a better command
    POWER: Intel xeon 4x2.66GHz,4GB quad channel ecc DDR400(800MHz),210GB SCSI raid0(6x36GB) 512MB cache.
    PC: Intel E6600 @ 3.24GHz. NVIDIA 9800GT. 2GB DDR @ 833MHz. Ubuntu UE 2.6 64 (10.04)

  3. #3
    Join Date
    Dec 2009
    Location
    Arizona, USA
    Beans
    15
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to copy/paste output from tty console?

    Thanks! That will be useful for me in the future~

    But in the meantime, I'm looking more for something that will let me copy what's already on the screen. This is because what's happening on my tty console seems to be random and crazy, so I was hoping to get the earlier stuff that happened.

    I'll definitely try what you said at least from now on to make sure I can at least get that.

  4. #4
    Join Date
    Oct 2007
    Location
    Chennai, India
    Beans
    3,804
    Distro
    Ubuntu Development Release

    Re: How to copy/paste output from tty console?

    Quote Originally Posted by Zeniff View Post
    On all the extra tty consoles shown when pressing CTRL+ALT+F1,F2,etc, how can I copy the output from there?

    tty console is messed up and doing crazy things, but I can't even ask on this forum properly until I can copy and paste what it's showing.
    You can install "screen"
    Code:
    sudo apt-get install screen
    and then, from your tty console, launch it with the command
    Code:
    screen -L
    Everything that occurs in this screen session will be logged into a file "screenlog.n" (n=0,1,2,3...) which will be in the same directory from where the screen command will be executed.

    If your console gets weird characters when you type, you can "reset" it with the command
    Code:
    reset
    This will just reset your console to defaults, it will not reboot your computer or so.
    Cheers,PRShah
    Make your own: Ubuntu, Kubuntu, Xubuntu, Mythbuntu All-in-One Live DVD
    "I never make mistakes; I thought I did, once.. but I was wrong."

  5. #5
    Join Date
    Dec 2007
    Location
    Secunda, South Africa
    Beans
    363
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to copy/paste output from tty console?

    If it is random, I know my laptop does random errors(I think only in tty1) but i believe it's related to my bluetooth device that is not functioning properly. But to solve your problem it might be worth it to type out what you see...
    POWER: Intel xeon 4x2.66GHz,4GB quad channel ecc DDR400(800MHz),210GB SCSI raid0(6x36GB) 512MB cache.
    PC: Intel E6600 @ 3.24GHz. NVIDIA 9800GT. 2GB DDR @ 833MHz. Ubuntu UE 2.6 64 (10.04)

  6. #6
    Join Date
    Apr 2008
    Location
    Australian in Germany
    Beans
    4,010
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: How to copy/paste output from tty console?

    ctrl+shift+c to copy
    ctrl+shift+v to paste

    in the terminal

    but that's not what you need is it?

    does the "print" button on the keyboard do anything useful?
    Last edited by audiomick; January 13th, 2010 at 10:36 AM.
    Michael

  7. #7
    Join Date
    Dec 2009
    Location
    Arizona, USA
    Beans
    15
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to copy/paste output from tty console?

    Hmmm... well, after my clock reset to UTC suddenly and the admin password stopped working, I decided to reboot. So, unless it logged the output from tty1, I guess it's lost...

    My reason for this thread was originally so I could provide more info for another problem:
    http://ubuntuforums.org/showthread.php?t=1379862

    Thanks, I'll try the screen program. But, how could I get it started so that it would capture stuff in my case in the other thread?

    Thanks about the ctrl+shift+c, but what about for tty consoles, how can I highlight the text if it's not in an X environment?
    Nope, sorry. It doesn't seem like "printscreen" button does anything either.
    Last edited by Zeniff; January 13th, 2010 at 11:13 AM.

  8. #8
    Join Date
    Dec 2009
    Location
    Arizona, USA
    Beans
    15
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How to copy/paste output from tty console?

    I just now found out the (almost) exact thing I had been looking for that would have been perfect for the situation I was in when I started this post.

    In a tty console, you can save about one whole screen's worth of previous output from stdout (standard output) which is great because you can save after it's already on the screen:
    Code:
    sudo screendump N > screenoutput.txt
    Where N is the number of the tty console you want and screenoutput.txt is the text file to which to create and save.
    Apparently, you need to be root to access the stdout, so that's why sudo is there.
    Unfortunately, it only seems to save the last page worth of output. I don't know how to get more, yet.

    You can also have the error output (debug stuff?) save to a file if you do it ahead of time:
    Code:
    nautilus 2> erroroutput.txt
    This will make the errors only go the file, though. I don't know other options, yet.
    My nautilus always gives errors if run from the terminal, so I used it to test the command.

    However, that seems to only get error messages. Here are two ways that seem to get all the other standard output minus the standard error:
    Code:
    pidgin -d | tee -a PidginDebugStuff.txt
    pidgin -d >> PidginDebugStuff.txt
    The tee command will put stdout into the file, and also still show it onscreen, while >> will only send it to the file and it won't appear onscreen.

    Cut and Paste:
    Ctrl+K to cut everything to the right of cursor.
    Ctrl+Y to paste to the right of the cursor.
    Only can cut and paste within the same tty, though.

    You can scroll up or down after lots of output with Shift+PageUp and Shift+PageDown.

    From man pages of screendump and bash ("kill" and "yank" commands) and www.linux.org's free beginner Linux course.

    The advice everyone gave was all very useful in many situations. Thank you very much! I've used your advice several times! ^^/
    Last edited by Zeniff; April 20th, 2010 at 09:10 AM. Reason: Added tee and >> commands.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •