Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to copy terminal output into clipboard

Good morning.

Sorry for posting this topic in mavericks, but there is no standard software part...


Ok.

I use the screen command in terminal to communicate with a serial interface.

The problem is, when the output is too long I can't see the beginning of ot , because screen only writes at the screen size of terminal and the user is not able to scroll above ... if u try this, u'll see earlier history of terminal.


It would be helpful to copy an output to the clipboard so I can paste it in vim, gedit, pages,... whatever.

I tried:

<command> |xclip

<command> |pbcopy


but both commands weren't found and have not worked yet.

Who can help me? :-)


Thanks in advance.

MacBook Pro, OS X Mavericks (10.9)

Posted on Mar 11, 2014 1:33 AM

Reply
4 replies

Mar 12, 2014 6:27 AM in response to jonasander

When you in a 'screen' sesssion, everything you type is going to the serial port you are controlling, so normal Mac OS X commands are not going to apply, including pbcopy. If the serial device you are talking to is another Mac, then at best you would be telling that Mac to put the output into its paste buffer, which will not do you any good on your Mac.


The fact that you found <command> | less works, implies that your serial port is connected to a Unix type system.


Accourding to "man screen", screen has its own scrollback history buffer.


It also has the ability to log screen output to a screen.<n> file where <n> is the screen number.


Once you have something in a log file on your Mac, you can then extract the information using any utilitiy you want (nano, vim, gedit, pages, cat, grep, awk, perl, etc...), including pbcopy if that is the way you want to go.


NOTE: While I've used screen years ago, my use was very minimum and I never became all that good at it. My initial use was to preserve sessions when comm-lines were unreliable and screen would let me reconnect and continue the existing session, but they were not so unreliable that I spent that much time using screen.

How to copy terminal output into clipboard

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.