05/05/2016

Emulate pbcopy and pbpaste in Linux with xsel - Bash.

One of nice tools I did use before are "pbcopy" and "pbpaste", which are simply copy and paste any data to and from clipboard in command line! It's a Mac OS tool, and unfortunately there is no port for Linux!

However you still can get the same functionality on Linux using "xsel" command! But you need some modification to make it works as same as pb tools.

Just edit your ".bashrc" file and add:
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'

Once you did, you can use them just like original ones. e.g. if you want to copy a content of file:
cat /etc/fstab | pbcopy

And if you want to past what you have currently in your clipboard, just use pbpaste!
Now enjoy your Linux system! It's the best system as you know :-)
Powered by Blogger.

Hello, my name is Ahmed AbouZaid and this is my "lite" technical blog!

I'm a passionate DevOps, Linux system administrator, RedHat Certified Engineer (RHCE), AWS SysOps/Solutions Architect, Free/Open source geek, author, interested in environment, calligraphy, and I believe that “Details Matter”!

Automation, data, and metrics are my preferred areas. I have a built-in monitoring chip, and too lazy to do anything manually :D

Popular Posts