Windows
Linux
Text Processing
Windows clip / clip.exe equivalent in Linux
Pipes command output directly into the clipboard so you can paste it elsewhere.
Windows
→
clip / clip.exe
Linux equivalents
xclip / xsel
xclip / xsel
xclip / xsel
Overview
What this command does
Pipes command output directly into the clipboard so you can paste it elsewhere.
Migration tip: You need to install
xclip or xsel first. On Wayland (newer desktops) use wl-copy instead. Many people add a shell alias to make this easier.Practical tasks
Common use cases
Copy output to clipboard
Pipes command output directly into the clipboard so you can paste it elsewhere.
xclip -selection clipboard
Copy to clipboard (X11)
xsel --clipboard --input
Alternative clipboard tool
wl-copy
Wayland clipboard tool
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
sudo apt install xclip
cat file.txt | xclip -selection clipboard
pwd | xclip -selection clipboard
alias clip='xclip -selection clipboard'
Walkthrough
Examples with explanations
# Windows: command | clip
# Install first:
sudo apt install xclip
# Copy output to clipboard:
cat file.txt | xclip -selection clipboard
pwd | xclip -selection clipboard # copy current path
# Handy alias — add to ~/.bashrc:
alias clip='xclip -selection clipboard'
# Then just: cat file.txt | clip
Reference
Common options and variations
| Command or option | Use |
|---|---|
xclip -selection clipboard | Copy to clipboard (X11) |
xsel --clipboard --input | Alternative clipboard tool |
wl-copy | Wayland clipboard tool |
xclip -o | Paste from clipboard to terminal |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | xclip / xsel |
Same command on this distribution. |
| Fedora | same command | xclip / xsel |
Same command on this distribution. |
| Arch | same command | xclip / xsel |
Same command on this distribution. |
Keep learning