Mac OSX Copy and Paste Commands

Eight Terminal Utilities Every OS X Command Line User Should Know

One common approach to saving Terminal output is to redirect it to a file on disk, which can be done by appending to the command a greater-than symbol followed by a path to the file where you would like to save the output. For instance, the command "ls" will list the current directory's contents. By default this list will display in the Terminal, but if you use the following command it will save the listed items in a file called "files.

6 must-have Mac utilities

If the document "files. Of course, to look at the output, you'll still need to go to that file and open it. Another approach is to pipe the results of the command to Apple's "open" command and instruct it to open the file in a text editor like Apple's TextEdit program.

While redirecting with the greater-than symbol, as noted above, sends the command's output to a file, piping sends the output to another command, so it can manage the output parse it, save it, print it, or otherwise act on it. To pipe the output of a command, you simply use the vertical line character " " , such as in the following example, which will take the output of the "ls" command and pipe it to the "open" command, which the "-fe" tag will instruct to read the piped input and open it in TextEdit the default text editor :.

When you run this command, instead of the listed output appearing in the Terminal, the Terminal will simply drop to another command prompt, and the output will appear in a plain text window in TextEdit. You can then more easily parse or copy and paste the text, as you can now interact with it using a cursor and arrow keys. Opening the output in TextEdit this way is convenient, but if you wish to move it to another document such a manuscript you are working on in Microsoft Word or Apple's Pages programs, or if you would like to e-mail the command output to someone, then you will still need to select it and copy it.

tmux in practice: integration with system clipboard

If this was your intent all along, then you can skip the step of highlighting text by saving the output of the command directly to the OS X clipboard. To do this, pipe the output to the "pbcopy" pasteboard copy command, as follows:. With this done, you can now go to any program and paste by pressing Command-V, and the output should be preserved in formatted plain-text. Have a fix? Post them below or e-mail us!

Be respectful, keep it civil and stay on topic. We delete comments that violate our policy , which we encourage you to read. Like this: Like Loading Categories: Apple , Uncategorized , unix Tags: bash , mac osx , shell , tip , trick , unix. Comments 2 Trackbacks 0 Leave a comment Trackback. Leave a Reply Cancel reply Enter your comment here Fill in your details below or click an icon to log in:. Email required Address never made public.

macos - How do I capture bash output to the Mac OS X clipboard? - Stack Overflow

Name required. Email Subscription Enter your email address to subscribe to this blog and receive notifications of new posts by email. Tags amazon android annoyance apple bash blog book book review bug car talk color command line data dom ebook eventbus find functional functional programming git gmail golang google gotcha graphics grep GUI html iPhone iPod java javascript js json lego library mac map meta mule mysql netbeans netbeans platform open source oreilly p2pu productivity programming puzzler python R refactoring review scala scripting search sed shell stats swing testing textmate tr tufte UI unit testing unix usability user interface video web web design wordpress workaround xml.

Follow on twitter Follow ndunn2. Search the site Search for:. Stack Overflow profile.

Install Xclip / Xsel

Please wait a few minutes and refresh this page. Top Blog at WordPress.

Post was not sent - check your email addresses!