
It is, however, one of those little utilities that really comes in handy when you need it.

I'm sure you can find more uses to fit your needs. Is that all you can do with xclip? Definitely not. For example: cat /etc/letsencrypt/live/website/fullchain.pem | xclip -sel clip Combining the cat command and xclip is faster and more efficient than using an editor.

I generate the HTTPS certificates for those sites using a tool called Certbot, and I need to copy the certificate for each site to GitLab whenever I renew it. Two of my websites are hosted using GitLab Pages. By using this command, I can convert a Markdown-formatted file to HTML using Pandoc and copy it to the clipboard in one fell swoop: pandoc -t html file.md | xclip -sel clip That said, many of those editors have an HTML mode.
SSH COPY LONG TEXT FILE OFFLINE
However, I never use a CMS's WYSIWYG editor to write-I write offline in plain text formatted with Markdown. Quite a bit of my writing goes into some content management system (CMS) or another for publishing on the web. Why not use xclip and the tail utility to quickly and easily do the deed? Run this command to copy those last 30 lines: tail -n 30 logfile.log | xclip -sel clip Opening the file in a text editor, scrolling down to the end, and copying and pasting is a bit of work. Say you're a system administrator and you need to copy the last 30 lines of a log file into a bug report. The pipe redirects the output of one command line application to another. There are other ways you can use xclip, and those involve pairing it with another command-line application. Chances are, you won't be doing that very often. Using xclip with other applicationsĬopying the contents of a file directly to the clipboard is a neat parlor trick. If you're one of those people (I am!), using the -sel clip option ensures you can paste what you want to paste. Many people are conditioned to use a right-click menu or to press Ctrl+V to paste text. What's the difference between the two commands (aside from the second one being longer)? The first command works if you use the middle button on the mouse to paste text. There are two ways to do that with xclip. Let's say you want to copy the contents of a file to the clipboard.

SSH COPY LONG TEXT FILE CODE
Or, if you're adventurous, grab the source code from GitHub and compile it yourself. To do that, use your distribution's package manager.
