I've been using Linux and, more importantly, the command line for about five years now (ever since I got into Computer Science school). It's great, really. I love the command line with all my heart: it's simple, direct and fast. But there's some things you just can't do as in a GUI.
Lately, I've been particularly busy doing networking stuff like copying (public) SSH keys from one machine and pasting them to the
authorized_keys file of another.
If you're not very familiar with
SSH or keys in general, don't worry, just picture a directory like this on my local machine:
.ssh ├── config ├── id_rsa ├── id_rsa.pub └── known_hosts
And another one on a remote machine like this:
.ssh ├── authorized_keys └── known_hosts
What I want to do is copy the contents of
id_rsa.pub and append them to
authorized_keys on the remote machine.
cat id_rsa.pub. Select the contents using a mouse (when you can).
Ctrl+Shift+C(to copy). Go to the remote machine.
scp id_rsa.pub remote_host_ip:/home/your_user/.ssh/mykey.pub(copy the
id_rsa.pubfile to the remote machine). Go to the remote machine.
cat mykey.pub >> authorized_keys(append the contents of the recently-copied
xclip. The clipboard command-line interface for the X desktop environment. It does exactly what you want, only that's completely cryptic and, like
tar, you'll never really remember that goddamn command and you'll have to google it every. single. time. For the sake of completeness here's one of the ways of doing this:
xclip -sel clip < ~/path/to/file.txt
What would you expect from
xclip instead? Probably something like this:
Oh gee, I wonder if anyone ever make something like tha-
xcreep you can simply
And boom! It's on your clipboard.
Stupid right? I thought so too, and I've been using it daily for the past three months now. It's by far the most useful piece of code I've ever written.
Don't want to install a Go script? There's also a shell script for it!