← All commands
Topic hub Text Processing
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
Debian/Ubuntu same command
xclip / xsel
Fedora same command
xclip / xsel
Arch same command
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 optionUse
xclip -selection clipboardCopy to clipboard (X11)
xsel --clipboard --inputAlternative clipboard tool
wl-copyWayland clipboard tool
xclip -oPaste 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.

DistributionPackage manager / baseEquivalent commandDifference 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

Related Text Processing commands