Clipboard (or CB) is one of the most advanced clipboard managers you can get!
When we started writing CB, we needed something way more powerful than other terminal tools like xclip
, xsel
, wl-clipboard
, pbcopy
, or clip
, and something really easy to use by truly anyone.
Enjoy support for...
- copying files and directories in addition to text,
- an infinite number of compartmentalized clipboards,
- persistent clipboards that stick around just for you,
- connecting with your desktop clipboard system,
- more languages like espaรฑol, portuguรชs, and Tรผrkรงe,
- any POSIX/Windows platform with C++20 compat,
- superb scripting to automate your workflows,
- customizable for your viewing pleasure,
- a unique filesystem-based implementation,
- your freedom by being 100% free and open source,
- and tons more!
In short, we're here to help you save time and effort.
curl -sSL https://github.com/Slackadays/Clipboard/raw/main/install.sh | sh
(Invoke-WebRequest -UseBasicParsing https://github.com/Slackadays/Clipboard/raw/main/install.ps1).Content | powershell
Alpine Linux (you'll need to enable the Community packages first)
apk add clipboard
AUR (Use your favorite AUR helper such as yay
. You can also get clipboard-bin
and clipboard-git
)
yay -S clipboard
Homebrew
brew install clipboard
Nix
nix-env -iA nixpkgs.clipboard-jh
Scoop
scoop install clipboard
Void Linux
sudo xbps-install -S clipboard
You can also get the latest revision of the Clipboard Project from GitHub Actions or the latest release from GitHub Releases.
You'll need CMake and C++20 support, and if you want X11 and/or Wayland compatibility, you'll also need libx11 and/or libwayland plus Wayland Protocols.
Get the latest release instead of the latest commit by adding --branch 0.6.0
right after git clone...
.
Change the system installation prefix by adding -DCMAKE_INSTALL_PREFIX=/custom/prefix
to cmake ..
, or the library install location by adding -DCMAKE_INSTALL_LIBDIR=/custom/dir
.
$ git clone https://github.com/Slackadays/Clipboard
$ cd Clipboard/build
$ cmake -DCMAKE_BUILD_TYPE=MinSizeRel ..
$ cmake --build .
$ cmake --install .
Remove everything listed in install_manifest.txt
. If you're not using Windows, you can also do xargs rm < install_manifest.txt
.
# Let's start by copying a file, adding a note to it, changing the note, then pasting the file.
$ cb copy NuclearLaunchCodes.pdf
$ cb note "Keep this a secret"
$ echo "Keep this a secret OR ELSE" | cb note
$ cb paste
# What if we cut a directory, added a file, and then removed that file? That's what we're doing here, all in the "69" clipboard.
$ cb cut69 MyDirectory
$ cb add69 SomeFile
$ cb remove69 SomeFile
$ cb paste69
# You can copy multiple files at the same time. We're using the "_420" persistent clipboard this time.
$ cb cp_420 foo.bar NotAVirus.bar.mp3.exe
$ cb remove_420 "*.mp3\.exe"
$ cb note_420 "Some kosher content here"
$ cb sh_420
# Now let's see our original note and then clear that clipboard.
$ cb note
$ cb clr
# This is the same as "cb note" but for clipboard "_420" again.
$ cb note_420
# Get a bird's eye view of everything so far.
$ cb
Add a number to the end of your action to choose which clipboard you want to use (the default is 0), or also add _
to use a persistent clipboard.
โ Copy โ cb ([--]copy|[-]cp)[(num)|_(id)] (file) [files]
or (something) | cb [([--]copy|[-]cp)][(num)|_(id)]
Copy a file.
$ cb copy FooFile
$ cb --copy FooFile
$ cb cp FooFile
$ cb -cp FooFile
# These are the same!
Copy a file and a directory.
$ cb copy FooFile BarDir
# These are also the same!
Copy piped in data.
$ echo "Foobar" | cb
$ echo "Foobar" | cb copy
# The "copy" action is optional here since the only possible action here in the first place is "copy"
Copy text directly.
$ cb copy "Aventura was the best bachata band"
Note: This happens instead of copying a file/directory if there is only one item present and that item doesn't exist as a file/directory.
Copy a file to the clipboard named "4"
$ cb copy4 FooFile
Copy piped in data to the persistent clipboard named "hello"
$ echo "Foobar" | cb copy_hello
Copy text to the clipboard named "hey"
$ cb --clipboard hey copy "Aventura was the best bachata band"
$ cb -c hey copy "Aventura was the best bachata band"
# These are the same!
Copy a file with spaces and many directories to clipboard "50" using the abbreviated action name.
$ cb cp50 "Aventura/God's Project/04 Un Chi Chi.flac" BarDir BazDir
โ Cut โ cb ([--]cut|[-]ct)[(num)|_(id)] (file) [files]
or (something) | cb [([--]cut|[-]ct)][(num)|_(id)]
Cut a file.
$ cb cut FooFile
$ cb --cut FooFile
$ cb ct FooFile
$ cb -ct FooFile
# These are the same!
Cut a file and a directory.
$ cb cut FooFile BarDir
# These are also the same!
Cut piped in data.
$ echo "Foobar" | cb cut
Note: Cutting piped in data is the same as copying, except that CB will delete all content after you paste it somewhere.
Cut text directly.
$ cb cut "Hunter2"
Note: This happens instead of cutting a file/directory if there is only one item present and that item doesn't exist as a file/directory.
Cut a file to the clipboard named "4"
$ cb cut4 FooFile
Cut piped in data to the persistent clipboard named "hello"
$ echo "Foobar" | cb cut_hello
Cut text to the clipboard named "hey"
$ cb --clipboard hey cut "Aventura was the best bachata band"
$ cb -c hey cut "Aventura was the best bachata band"
# These are the same!
Cut a file with spaces and many directories to clipboard "50" using the abbreviated action name.
$ cb ct50 "Aventura/God's Project/04 Un Chi Chi.flac" BarDir BazDir
โ Paste โ cb ([--]paste|[-]p)[(num)|_(id)] [regex] [regexes]
or cb [([--]paste|[-]p][(num)|_(id)] | (something)
or cb [([--]paste|[-]p)][(num)|_(id)] > (some file)
Start by copying or cutting something.
$ cb copy FooFile WhyAventuraIsTheBest.pdf
Paste in the current working directory.
$ cb paste
$ cb --paste
$ cb p
$ cb -p
# These are the same!
Note: If you paste after cutting, then CB will delete the original files that you cut.
Paste anything containing "Aventura."
$ cb p ".*Aventura.*"
Now, let's copy some raw data.
$ echo "Bananas!" | cb
Paste the raw data file in the current working directory.
$ cb paste
# Also the same
Pipe everything out to some file.
$ cb paste > SomeFile
Pipe everything from clipboard "42" out to some file.
$ cb paste42 > SomeFile
$ cb p42 > SomeFile
$ cb -c 42 > SomeFile
# These three versions all work great!
Pipe everything out to some program.
$ cb | cat
# These three versions also all work great.
$ cb | Write-Output
# The version for PowerShell
Pipe everything from persistent clipboard "2" out to some program.
$ cb paste_2 | cat
$ cb p_2 | cat
$ cb -c _2 | cat
# These three versions also all work great.
$ cb -c _2 | Write-Output
# The version for PowerShell
Note: If you paste after cutting, then CB will delete the raw data afterwards, effectively only letting you paste once.
โ Add Contents โ cb ([--]add|[-]ad)[(num)|_(id)] (file|text) [files]
or (something) | cb [([--]add|[-]ad)][(num)|_(id)]
Start by copying something.
$ cb copy FooFile
Add a file.
$ cb add SomeOtherFile
$ cb --add SomeOtherFile
$ cb ad SomeOtherFile
$ cb -ad SomeOtherFile
# CB now holds FooFile and SomeOtherFile
Add a directory.
$ cb add "We Broke The Rules"
Now let's copy some raw data.
$ cb copy "'Let me find that'"
Add raw data to the end of what's stored.
$ cb add " is one of Romeo Santos' catchphrases."
# The content is now: 'Let me find that' is one of Romeo Santos' catchphrases.
Add raw data by piping it in.
$ echo " What's yours?" | cb add
# The content is now: 'Let me find that' is one of Romeo Santos' catchphrases. What's yours?
โ Remove Contents โ cb ([--]remove|[-]rm)[(num)|_(id)] (regex) [regexes]
or (some regex) | cb [([--]remove|[-]rm)][(num)|_(id)]
Start by copying something.
$ cb copy FooFile BarDir BazDir
Remove everything starting with "B"
$ cb remove "B.*"
$ cb --remove "B.*"
$ cb rm "B.*"
$ cb -rm "B.*"
# CB will match this against "BarDir" and "BazDir" and remove them
Remove everything matching a specific name
$ cb remove "BarDir"
# CB will match this against "BarDir" only and remove it
Now let's copy some raw data.
$ cb copy "A bachatero is someone who makes bachata music."
Remove anything with a space beforehand and that ends with "-ero"
$ cb remove "(?<= ).*ero"
# The content is now: A is someone who makes bachata music.
Remove anything matching "music" by piping the pattern in.
$ echo "music" | cb remove
# The content is now: A is someone who makes bachata .
โ Show Contents โ cb ([--]show|[-]sh)[(num)|_(id)] [regex] [regexes]
or cb ([--]show|[-]sh)[(num)|_(id)] [regex] [regexes] | (something)
Start by copying something.
$ cb copy FooFile BarDir BazDir
List all the items in the clipboard.
$ cb show
$ cb --show
$ cb sh
$ cb -sh
# These all work great!
Now let's copy some raw data.
$ cb copy "Those who are tired of bachata are tired of life"
Show the contents of the clipboard.
$ cb show
Show the raw filepaths of everything in the clipboard.
$ cb sh | cat
Show raw filepaths to a program.
$ cb copy "02 I Believe.flac"
$ eval vlc $(cb sh)
# Use the eval command here to process the raw filepath (which in this case looks like "/tmp/Clipboard/0/02 I Believe.flac") as if it were entered in a shell
# Otherwise, you'll likely get errors complaining about being unable to process quote characters.
โ Clear Contents โ cb ([--]clear|[-]clr)[(num)|_(id)]
Start by copying something.
$ cb copy FooFile BarDir BazDir
Clear the clipboard of all data.
$ cb clear
$ cb --clear
$ cb clr
$ cb -clr
# These all work great!
โ Load Contents โ cb ([--]load|[-]ld)[(num)|_(id)] [clipboard] [clipboards]
Start by copying something.
$ cb copy "Yo dawg! I heard you liked bachata music."
Load the contents of the clipboard into other clipboards.
$ cb load 1 2 3 _foo
$ cb --load 1 2 3 _foo
$ cb ld 1 2 3 _foo
$ cb -ld 1 2 3 _foo
# All work great!
Note: If you don't provide a destination clipboard, then the Load action will load the contents into the default clipboard.
Load the contents of some clipboard into the default.
$ cb load_foo
Note: This is useful if you want to load content into GUI clipboard systems, as they only connect to the default clipboard.
โ Set Note โ cb ([--]note|[-]nt)[(num)|_(id)] (text)
or (something) | cb [([--]note|[-]nt)][(num)|_(id)]
Add a personal note to a clipboard.
$ cb note "For my Aventura music collection"
$ cb --note "For my Aventura music collection"
$ cb nt "For my Aventura music collection"
$ cb -nt "For my Aventura music collection"
# All work great!
Add a personal note to a clipboard by piping it in.
$ echo "For my Aventura music collection" | cb note
Remove a note from a clipboard.
$ cb note ""
โ Show Note โ cb ([--]note|[-]nt)[(num)|_(id)]
Start by adding a note to a clipboard.
$ cb note "For my Aventura music collection"
Show the note you added.
$ cb note
$ cb --note
$ cb nt
$ cb -nt
โ Show Detailed Info โ cb ([--]info|[-]in)[(num)|_(id)]
Show helpful details for a clipboard.
$ cb info
$ cb --info
$ cb in
$ cb -in
# Both are the same!
โ Show Help Message โ cb (-h|[--]help)
Show the help message.
$ cb help
$ cb --help
$ cb -h
# These three versions all work great!
โ Check All Clipboards' Status โ cb [[--]status|[-]st]
Check the status of all clipboards that have content.
$ cb status
$ cb --status
$ cb st
$ cb -st
$ cb
# These all work great!
Need to paste a funky symbol somewhere a lot? Just copy it to a persistent clipboard.
$ cb cp_theta ฮธ
Copy a password securely by deleting it once you've pasted it.
$ cb cut "AVeryStrongPassword!"
$ cb | some-program
# Now gone
On a slow system? Cache certain things so you don't have to do them again.
$ neofetch | cb cp_neo
$ cb | cat
Need to share or pore over log files? Just copy them!
$ journalctl | cb
# For systemd
$ sudo dmesg | cb
# For Linux; note that you're not running "sudo cb" here
$ cb copy logs/latest.log
# For Minecraft servers
Want CB to look different? Change up the color scheme.
# This one looks like The Matrix
$ export CLIPBOARD_THEME=green
$ cb
# This one is for light backgrounds
$ export CLIPBOARD_THEME=light
$ cb
# Check out the other themes too!
Make your own scripts that can fully automate your workflows.
#!/bin/sh
# This script does nothing except serve as an example of automating CB.
link="https://SomeWebsiteWithLotsOfContent"
wget link
cb copy *.jpg *.png
cb remove "AZ.*\.png"
cb | tar -cf foobar.tar
cb -c footar < foobar.tar
cb note "Latest files from website ABCXYZ"
โ --all
, -a
โ Add this when clearing to clear all clipboards at once.
Start from a blank slate.
$ cb --all clear
WARNING! This will get rid of everything you've stored with CB, so be very careful when clearing with this option.
โ --clipboard (clipboard)
, -c (clipboard)
โ Add this to choose which clipboard you want to use.
Choose a non-default clipboard.
$ cb -c 5 copy Foobar
$ cb --clipboard 10 copy BarBaz
Copy to a temporary clipboard that doesn't start with a number.
$ cb -c SomeCB copy "A really really long sentence, and I mean really realy super DUPER long!"
Note: Although copying to a temporary clipboard that doesn't start with a number is impossible using the conventional method of adding it to the end of the action, this alternative method is completely supported and works great.
Choose a persistent clipboard.
$ cb -c _ copy "Generation Next"/*
โ --fast-copy
, -fc
โ Add this to use links when copying, cutting, or pasting. If you modify the items that you used with this flag, then the items you paste will have the same changes.
Copy a lot of files in much less time than before.
$ cb --fast-copy copy /usr/bin/*
โ --mime
, -m
โ Add this to request a specific content MIME type from GUI clipboard systems.
Save GUI clipboard content of a specific MIME type to the main clipboard.
$ cb --mime text/html | cb
โ --no-confirmation
, -nc
โ Add this to disable confirmation messages from CB.
Reduce distractions after showing some text content.
$ cb -nc sh | cat
โ --no-progress
, -np
โ Add this to disable progress messages from CB.
Reduce distractions while doing a search that takes a while.
$ fzf | cb -np
โ CI
โ Set this to anything to make CB overwrite existing items without a user prompt when pasting. This variable is intended for Continuous Integration scripts where a live human is not present to make decisions.
Use CB in a CI script.
...
cb cp Temp/*
...
cb p
...
โ CLIPBOARD_LOCALE
โ Set this to the locale that only CB will use for its commands and output, like en_US.UTF-8
or es_DO.UTF-8
.
Change the locale to match what you're more comfortable with.
$ export CLIPBOARD_LOCALE=es_DO.UTF-8
$ cb cp "Amo a Aventura"
> $Env:CLIPBOARD_LOCALE=es_DO.UTF-8
# Powershell version
Override the locale case-by-case.
$ export CLIPBOARD_LOCALE=fr_CA.UTF-8
...
$ CLIPBOARD_LOCALE="" cb cp Foobar
โ CLIPBOARD_TMPDIR
โ Set this to the directory that only CB will use to hold the items you cut or copy into a temporary directory.
Choose a special place to put your temporary clipboards this one time.
$ CLIPBOARD_TMPDIR=/home/jackson/SomeDirectory cb copy *
Choose a special place to put your temporary clipboards every time.
$ export CLIPBOARD_TMPDIR=/home/jackson/SomeDirectory
$ cb copy *
> $Env:CLIPBOARD_TMPDIR = /home/jackson/SomeDirectory
# Powershell
โ CLIPBOARD_PERSISTDIR
โ Set this to the directory that only CB will use to hold the items you cut or copy into a persistent directory.
Choose a special place to put your persistent clipboards this one time.
$ CLIPBOARD_PERSISTDIR=/home/jackson/SomeDirectory cb copy *
Choose a special place to put your persistent clipboards every time.
$ export CLIPBOARD_PERSISTDIR=/home/jackson/SomeDirectory
$ cb copy *
> $Env:CLIPBOARD_PERSISTDIR = /home/jackson/SomeDirectory
# Powershell
โ CLIPBOARD_ALWAYS_PERSIST
โ Set this to anything to make CB always use persistent clipboards.
Make everything you copy persistent.
$ export CLIPBOARD_ALWAYS_PERSIST=1
$ cb copy Foo Bar Baz
# This puts everything in the persistent directory but still with the clipboard name "0"
โ CLIPBOARD_NOEMOJI
โ Set this to anything to strip emojis from all messages.
Get rid of those ugly emojis.
$ export CLIPBOARD_NOEMOJI=1
$ cb cp "You won't be annoyed ๐ by these things ever again! ๐๐๐ฅต"
โ CLIPBOARD_NOGUI
โ Set this to anything to disable integration with GUI clipboards.
Debug a flaky GUI system by disabling its integration with CB.
$ CLIPBOARD_NOGUI=1 cb show
$ export CLIPBOARD_NOGUI=1
$ cb show
โ CLIPBOARD_NOPROGRESS
โ Set this to anything to disable only progress messages from CB.
Reduce distractions while doing a search that takes a while.
$ fzf | CLIPBOARD_NOPROGRESS=1 cb
Disable progress messages from CB entirely.
$ export CLIPBOARD_NOPROGRESS=1
$ fzf | cb
โ CLIPBOARD_SILENT
โ Set this to anything to disable progress and confirmation messages from CB.
Rest in peace by seeing nothing that isn't an error.
$ export CLIPBOARD_SILENT=1
$ cb cp "I'm running out of Aventura references"
โ CLIPBOARD_THEME
โ Set this to the color theme that CB will use. Choose between light
, darkhighcontrast
, lighthighcontrast
, amber
, and green
(the default is dark
).
Remind yourself of the terminals of the past.
$ export CLIPBOARD_THEME=green
$ cb cp "I'm in the Matrix now"
$ export CLIPBOARD_THEME=amber
$ cb cp "Yellow terminals feel just like sitting in front of a nice campfire"
Make CB more accessible.
$ export CLIPBOARD_THEME=darkhighcontrast
$ cb show
โ FORCE_COLOR
โ Set this to anything to make CB always show color regardless of what you set NO_COLOR
to.
Override somebody else's choice to disable colors.
$ export NO_COLOR=1
...
$ FORCE_COLOR=1 cb copy "There are almost no bachateros where I live right now"
Note: CB also supports CLICOLOR_FORCE
.
Override somebody else's choice to disable colors, but in a different way.
$ export CLICOLOR=0
...
$ CLICOLOR_FORCE=1 cb copy "There are almost no bachateros where I live right now"
โ NO_COLOR
โ Set this to anything to make CB not show any colors.
Make CB look boring.
$ export NO_COLOR=1
$ cb cp "From the 1960s until the 1990s, bachata was perceived as boring music for poor Dominicans."
Note: CB also supports CLICOLOR
.
Make CB look boring, but in a different way.
$ export CLICOLOR=0
$ cb cp "In the 1990s, though, several innovative musicians reinvigorated bachata by using electric guitars with fancy effects."
We're here for you! Check out the Clipboard Project Wiki for even more information, ask all your burning questions in GitHub Discussions, or join the awesome Discord group!
Say thank you to all our beautiful contributors who have helped make the Clipboard Project incredible. Want to join the club? We're always accepting new contributions too.
And if you're feeling generous, feel free to give us a โญ! We appreciate every single one - including yours.
cb copy haters && cb > /dev/null