Windows clip / clip.exe equivalent in Linux
Pipes command output directly into the clipboard so you can paste it elsewhere.
clip / clip.exe
xclip / xsel
xclip / xsel
xclip / xsel
Overview
What this command does
On Windows, "clip / clip.exe" is used to copy output to clipboard. On Linux, the closest practical mapping shown here is "xclip / xsel". Pipes command output directly into the clipboard so you can paste it elsewhere. This reference is grouped under Text Processing.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows clip / clip.exe maps to xclip / xsel for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
For the broader concept behind this mapping, read Linux command-line basics.
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
Debian/Ubuntu, Fedora and Arch all use "xclip / xsel" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| 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