Clipboards are an incredibly useful feature of modern PCs - allowing you to copy text, images, files, and directories, and paste them to other locations on your system. But standard clipboards are limited to one item at a time. The Clipboard Project is a fast and lightweight terminal-based clipboard manager that supports infinite clipboards, and allows you to copy and paste anything anywhere.
Here's how to install and use The Clipboard Project on Linux.
What is The Clipboard Project?
To Linux users who prefer a GUI (Graphical User Interface) users, the clipboard is available at the click of a mouse. You can highlight text, then right-click, and copy it to your clipboard, or you can right-click on a file or directory, and copy it to your clipboard. It's simple, and easy-to-use by design.
You can enhance the standard GUI clipboard functionality with clipboard managers such as CopyQ.
Copying items in the terminal is a little different. While it's easy to copy and paste text in the Linux terminal (Ctrl + Shift + C / Ctrl + Shift + V), you're still limited to a single item on a single clipboard. If you copy new text to your clipboard, it will erase the old text.
Copying files to your clipboard isn't a thing, either. You can use the cp command to copy a file to a new location, but can't temporarily store a file, and paste it elsewhere later.
The Clipboard Project addresses these shortcomings by giving you as many clipboards as you need, the ability to copy anything to them, and advanced clipboard management tools. It's a powerful weapon for the keyboard warrior, and once you've installed The Clipboard Project, you'll find yourself relying on it more and more.
How to install The Clipboard Project on Linux
The easiest way to install The Clipboard Project is to use the curl tool to download a script and pipe it to bash as follows:
curl -sSL https://github.com/Slackadays/Clipboard/raw/main/install.sh | sh
While this is quick and virtually effortless, executing unseen code in your terminal is a security risk, and you should take time to inspect the script first.
If your system supports snap, you can install The Clipboard Project with:
sudo snap install clipboard
...and create an alias to make it simpler and quicker to use:
echo -e "\nalias cb='snap run clipboard'" >> .bashrc
The Clipboard Project is also available in the Arch User Repository (AUR). Install it with:
yay -S clipboard
Or if you prefer Flatpak, install The Clipboard Project and alias it with:
flatpak install app.getclipboard.Clipboard
echo -e "\nalias cb='flatpak run app.getclipboard.Clipboard'" >> .bashrc
Use The Clipboard Project to manage your clipboards
Using The Clipboard Project is easy. To see the contents of your current clipboard, just enter:
As you haven't used the tool yet, you'll see the message "There is currently nothing in the clipboard."
To add text to your clipboard, enter:
cb note Your Text Note Here
To copy text to your clipboard, you'll need to make use of your system clipboard.
Highlight the text you want to copy, and press Ctrl + Shift + C, then enter:
...and press Ctrl + Shift + V to paste the text, then press Enter.
Simple so far, but stay with us. Copying text to your clipboard using the above command will overwrite any text that's already on the clipboard.
How about copying or adding a file to a new clipboard? You can do this by adding a number after your action to make a new temporary clipboard, or preface the number with an underscore to make a persistent one.
To copy a bunch of files to a persistent clipboard, you'd enter:
cb copy_18 this.file that.file theother.file
If you decide that.file kinda sucks and want to remove it, try:
cb remove_18 that.file
To paste the contents of a clipboard, you've guessed it:
Want to see what's on any one of your infinite clipboards?
...will do the job.
As you can see in the screenshot above, The Clipboard Project doesn't care what you copy to it, we have a text file, an sqlite database, a deb file for an awesome minesweeper CLI timewaster, a top secret archive, and a directory stuffed with evil QR codes to spread hijinx and mayhem.
Do bear in mind that after creating a clipboard with cb copy, using the same command again will wipe its contents, use add to add items to any of your terminal clipboards:
cb add_18 secret_stuff.7z
These are but a few examples of the use to which you can put The Clipboard Project to manage your clipboard in the Linux terminal. We could give examples for days, but instead, we're going to suggest that you vist the project homepage, where there are examples for days.
Some highlights include regex usage, aliases, and advanced use.
We could employ our new favourite clipboard tool to copy the whole lot into a table below, but we're not going to: visit the site instead.
Make The Clipboard Project your terminal best friend
It's hard to argue against The Clipboard Project's utility, and we have no doubt that if you spend a lot of time on the command line you'll be using it on a daily basis.
Give it a spin for a few months and see if it makes it into your list of most used commands.