3 ms·
To replicate pbcoby on X11 systems, add to your bashrc: alias clip="xclip -selection clipboard" `echo hello | clip` will copy 'hello' to the clipboard, an
by the_pwner224 6y ago
To replicate pbcoby on X11 systems, add to your bashrc:
alias clip="xclip -selection clipboard"
`echo hello | clip` will copy 'hello' to the clipboard, and similarly `ls | clip` will copy a bunch of lines to the clipboard. You might need to install xclip through your package manger (the package is just named xclip on Arch).
- kevincox 6y agoI like `xsel --clipboard` which Does The Right Thing by automatically deciding if it should copy or paste. # Paste clipboard into command. xsel --clipboard | grep foobar # Copy into clipboard grep foobar somefile.txt | xsel --clipboard # Transform clipboard. xsel --clipboard | tr A-Z a-z | xsel --clipboard I find this so useful that I have it aliased to `c`.
- opan 6y agoOn Wayland there's wl-clipboard (with wl-copy and wl-paste commands) which works basically the same.
- jonS90 6y agoThis is how I make pbcopy/pbpaste work on both Linux and WSL (Windows Subsystem for Linux). if [[ "$(uname)" == "Linux" ]]; then if ! grep -q Microsoft /proc/version; then alias pbcopy='xsel --clipboard --input' alias pbpaste='xsel --clipboard --output' else alias pbcopy='clip.exe' alias pbpaste='powershell.exe -command "Get-Clipboard"' fi fi