LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   copy/paste output from shell (not terminal) (http://www.linuxquestions.org/questions/linux-newbie-8/copy-paste-output-from-shell-not-terminal-820032/)

bluegospel 07-15-2010 01:13 PM

copy/paste output from shell (not terminal)
 
Hi. I often have issues starting my window manager--xfce. My computer misbehaves in one of 3 ways, one of which is to fail to open X, but generate several screens of info. I want to paste that info to this site, but since I'm in the shell, not the terminal (please correct my vocabulary if it's wrong here), I don't know how to copy and paste the output, since right-clicking doesn't give me a menu. Even if I could copy I'm not sure the information would be accessible in X. Are there any other options?

trickykid 07-15-2010 01:15 PM

If you have gpm installed or running, you can use your mouse to copy and paste text in a terminal.

It would be the same as highlighting the text, then opening an editor on the command line to paste, like vi newfile to save the pasted text in the file.

alan99 07-16-2010 01:44 AM

Quote:

Originally Posted by trickykid (Post 4034347)
If you have gpm installed or running, you can use your mouse to copy and paste text in a terminal.

It would be the same as highlighting the text, then opening an editor on the command line to paste, like vi newfile to save the pasted text in the file.

You weren't listening. He said he was having problems and had no window manager and thus no graphic terminal, just a console. I don't know if there is anything for slackware, but in debian there is a package called gpm (general purpose mouse) which lets you do some limited cut and paste within your console, but it might be awkward to do it. Maybe you could cut and paste a line at a time into a command line

echo ' <place cursor here and right click after selecting the line> ' >> filename

this might allow you to copy the error messages to a test file and then if you could figure out a way to get that file copied into a post on the forum I guess that might do what you want.

alan99 07-16-2010 01:48 AM

Or, you could check to see if your system is logging any error messages when it boots. This would probably be in /var/log/

MTK358 07-16-2010 07:15 AM

Redirect both output and error messages to a file:

Code:

command &> file

alli_yas 07-16-2010 07:49 AM

@alan99
Quote:

You weren't listening. He said he was having problems and had no window manager and thus no graphic terminal, just a console. I don't know if there is anything for slackware, but in debian there is a package called gpm (general purpose mouse) which lets you do some limited cut and paste within your console, but it might be awkward to do it. Maybe you could cut and paste a line at a time into a command line

echo ' <place cursor here and right click after selecting the line> ' >> filename

this might allow you to copy the error messages to a test file and then if you could figure out a way to get that file copied into a post on the forum I guess that might do what you want.
No you were not reading properly. Read trickykid's post properly and you'll see that the same solution as yours is being suggested with no mention of the GUI.

alan99 07-16-2010 09:51 AM

Quote:

Originally Posted by alli_yas (Post 4035242)
@alan99


No you were not reading properly. Read trickykid's post properly and you'll see that the same solution as yours is being suggested with no mention of the GUI.

What do you mean I wasn't reading properly? It seems trickykid was not reading properly. The original poster said he was using xfce as a window manager, Not gnome (gdm), so please don't tell me I am "reading it wrong". As for the solution 'similar' to mine, since the messages are being generated at startup the only way for that redirect to work is in you put that somewhere in one of the startup scripts so that the redirect happens before the error messages and not after.

alan99 07-16-2010 09:57 AM

sorry, I guess I was reading wrong I thought He said gdm not gpm

alli_yas 07-16-2010 10:00 AM

Quote:

sorry, I guess I was reading wrong I thought He said gdm not gpm
No problem :D We all scan read stuff sometimes :)

trickykid 07-16-2010 10:56 AM

Quote:

Originally Posted by alan99 (Post 4035365)
sorry, I guess I was reading wrong I thought He said gdm not gpm

The great trickykid is never wrong.. except when I should have referred to terminal as console in my original reply. ;)

zagzagel 07-16-2010 11:12 AM

Although I agree redirection is the best choice, another possibility might be GNU Screen.

trickykid 07-16-2010 11:14 AM

Quote:

Originally Posted by MTK358 (Post 4035210)
Redirect both output and error messages to a file:

Code:

command &> file

This isn't helpful when it's a message not invoked by a command you might have run yourself, perhaps a system message or error during bootup process, etc.

bluegospel 07-21-2010 10:43 AM

Thank you all for your help. When the problem finally recurred I ended up following trickykid's advice in his first post: I selected the text, wrote to a file in parts using the gpm feature, and now I can post the information.

onebuck 07-21-2010 01:37 PM

Hi,

I'm late but wish to add the mouse buttons for 'gpm' usage. The middle button will insert the highlighted text at the cursor position on current line. Don't forget the pick by double-click to highlight then either copy, paste or insert from point. If setup properly you can use 'gpm' on console(s), terminals or GUI. Handy whenever you want to mix the cli with other apps. Great with 'vi'. :)

:hattip:


All times are GMT -5. The time now is 09:19 PM.