Copy Text From a File in Terminal

If you just want to quickly copy the text of a file to the clipboard while in terminal you can just use:

cat [filename]

That will display the full text of the file to the terminal and you can just highlight the text and copy.

One case where this can be useful is as a quick and simple way to copy text to the clipboard of your laptop when you ssh into a remote server. If contents of the file are larger than a screen it can be difficult to scroll and copy the text you want to copy without using the cat command.

Related: How to Dump SQL Result to a Text File Using the command lineLocking and Unlocking a User in UbuntuHow to Manually Run Cron Tasks

As a reminder: The intention for this site is quick and easy sample code and syntax reminders. I frequently forget the basic syntax of some thing I don’t use frequently and at times find it hard to find the simple basic information I want.

Leave a Reply

Your email address will not be published.

This Blog will give regular Commentators DoFollow Status. Implemented from IT Blögg