Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Best way to capture output from term commands?

  1. #1
    Join Date
    Apr 2008
    Location
    Lower Gwynedd, PA
    Beans
    50
    Distro
    Ubuntu

    Best way to capture output from term commands?

    What is the best way to cut and paste multi-page terminal command output for delivery to the Forum? I am currently using xterm in ubuntu 14.04. Better terminal suggestions are welcome.

  2. #2
    Join Date
    Jan 2006
    Location
    Not heaven... Iowa
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Best way to capture output from term commands?

    You can redirect the output and attach it as a file.
    Code:
     less /etc/network/interfaces > output.txt
    output.txt

    There's a better way mentioned around here somewhere that pastes the content of the file - we strongly urge the use of code tags.
    Last edited by Iowan; October 17th, 2014 at 10:49 PM.
    Linux User #415691 Ubuntu User #8629
    Iowa Team (LoCo): [Wiki] [Launchpad]
    IRC channel: #ubuntu-us-ia on irc.freenode.net

  3. #3
    Join Date
    May 2010
    Location
    uk
    Beans
    9,299
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Best way to capture output from term commands?

    Hi

    Quote Originally Posted by loren41 View Post
    What is the best way to cut and paste multi-page terminal command output for delivery to the Forum? I am currently using xterm in ubuntu 14.04. Better terminal suggestions are welcome.
    I've used gnome-terminal and xfce4-terminal recently and you can set the scrollback size with them.

    You can use the script command.

    Code:
    man script
    Pastebin for long commands and post the url only.

    Code:
    man pastebinit
    You can also use screens scroll back mode and screen is great anyway.

    Code:
    sudo apt-get install screen
    man screen
    C-a [
    C-a C-[
    C-a esc (copy) Enter copy/scrollback mode.
    Along with Iowan's redirection suggestion, that should give you a number of options.

    Kind regards
    Last edited by matt_symes; October 17th, 2014 at 10:52 PM.
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  4. #4
    Join Date
    Jun 2008
    Location
    Ballard
    Beans
    2,409
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Best way to capture output from term commands?

    You can also use the bash redirections with either > or >> depending if you want to replace or append.

    Code:
    ls / >> ~/Desktop/file.txt
    "We're all in this together, kid." --H. Tuttle (a.k.a. H. Buttle)
    "Maybe it's a layer 8 problem." --thatguruguy
    A High-Tech Blech!

  5. #5
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,796
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Best way to capture output from term commands?

    Hi loren41.
    Quote Originally Posted by loren41 View Post
    Better terminal suggestions are welcome.
    The default desktop terminals are much mouse and shortcut-keyboard friendly.

    If you are using regular Ubuntu, I'd recommend gnome-terminal. If you got Xubuntu, xfce4-terminal should do the work. And so on.

    All of them support:
    • mouse selection, right-click menu for easy copy/paste.
    • scroll back using the mouse wheel, or the page_up, and page_down keys, so you can select text that was printed and scroll out of the screen.
    • Switching from fullscreen to regular window by pressing F11, thus allowing more text to be copied.

    If you are looking for a nice, cool, that works fairly the same in all desktops, I recommend taking a look at 'terminator'.

    Just my thoughts. Hope it helps.
    Regards.

  6. #6
    Join Date
    Apr 2008
    Location
    Lower Gwynedd, PA
    Beans
    50
    Distro
    Ubuntu

    Re: Best way to capture output from term commands?

    Thanks for all your suggestions. Good, quick assistance.
    Loren41

  7. #7

    Re: Best way to capture output from term commands?

    terminator has a logging feature.
    Windows assumes the user is an idiot.
    Linux demands proof.

  8. #8
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,269
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: Best way to capture output from term commands?

    Quote Originally Posted by Habitual View Post
    terminator has a logging feature.
    Does it logs everything? I can't find this on my terminator installed.

  9. #9

    Re: Best way to capture output from term commands?

    Quote Originally Posted by nerdtron View Post
    Does it logs everything? I can't find this on my terminator installed.
    Seems to. I have one running now and I'll leave open for a few days (what else is new?)

    I'll update this Monday with the result.

    Right Mouse click in any terminator pane and select "Start Logger" and name it and go.

    Code:
    terminator -v
    terminator 0.97
    Windows assumes the user is an idiot.
    Linux demands proof.

  10. #10
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,269
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: Best way to capture output from term commands?

    Lower version on mine.
    $ terminator -v
    terminator 0.95


    I guess it only records the commands on my local machine and not the commands on the remote machine I am ssh into?

Page 1 of 2 12 LastLast

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
  •