To copy in a Linux terminal, select the text and press Ctrl+Shift+C. To paste, press Ctrl+Shift+V. The plain Ctrl+C and Ctrl+V you use everywhere else do not work here because the terminal already gives those keys a job: Ctrl+C interrupts the running command, and Ctrl+V tells the shell to insert the next key literally. Shift+Insert, the right-click menu and, on some desktops, the middle mouse button paste as well.
This guide shows how to paste in Linux terminal windows with each of those, plus the part most guides skip: copying a file or command output straight to the clipboard with wl-copy, xclip and xsel, and why those tools fail over SSH. Every command below was run on Ubuntu 26.04.1 LTS with its default Ptyxis terminal, and the CLI tools were also installed on Ubuntu 24.04, Debian 13 and Rocky Linux 10 in November 2026.
Use Ctrl+Shift+C and Ctrl+Shift+V
Select the text with the mouse (double-click grabs one word, triple-click grabs the whole line), press Ctrl+Shift+C, move the cursor where you want it and press Ctrl+Shift+V. Most Linux terminal emulators ship the same pair as their default, so it’s the one habit worth building. Text you copy this way lands on the normal desktop clipboard, so you can paste it into a browser or editor with plain Ctrl+V.
Blame the terminal line discipline for the extra Shift, not the terminal app. You can see the two bindings that clash with the usual shortcuts by asking stty for them:
stty -a | grep -o -E 'intr = \^C|lnext = \^V'
On the Ubuntu 26.04 test machine, both control keys are already claimed before any terminal shortcut gets a chance:
intr = ^C
lnext = ^V
intr is the key that sends SIGINT to the foreground process, which is why Ctrl+C stops a running ping instead of copying anything. lnext (literal next) makes the shell insert the following keystroke as a raw character, so Ctrl+V followed by Tab types a real tab. Terminal developers moved copy and paste to Ctrl+Shift to leave both of these alone. The same check on the desktop looked like this:

The last two lines of that capture show Bash with bracketed paste switched on, which matters later when you paste several lines at once. If you only need the keys, our Linux terminal shortcuts cheat sheet lists them next to the cursor and history bindings.
Copy and paste from the right-click menu
When the keyboard shortcut slips your mind, right-click inside the terminal window. Ptyxis, the terminal Ubuntu has shipped by default since it replaced GNOME Terminal in 25.10, puts Copy and Paste near the top of the menu and prints the shortcut beside each one, which makes the menu a decent reminder until the keys stick.

- 1Copy
- 2Paste
The same menu also offers Copy as HTML, which copies a selection with its formatting for pasting into a document or email. Select All grabs the whole scrollback in one go, which is quicker than dragging when you want to save a long session log before closing the tab.
Paste the selection with Shift+Insert
Linux desktops keep two separate buffers, and knowing which key reads which one saves a lot of confusion. CLIPBOARD is what Ctrl+Shift+C fills and what you paste with Ctrl+Shift+V. PRIMARY is filled the moment you highlight text, with no key pressed at all. In Ptyxis, Shift+Insert pastes PRIMARY, not CLIPBOARD.
To prove it, we put different text in each buffer with wl-copy and pressed both keys at the prompt:
echo CLIPBOARD-text | wl-copy; echo PRIMARY-text | wl-copy --primary
Shift+Insert inserted the highlighted text, and Ctrl+Shift+V inserted the copied text. The screenshot shows each key’s result as an echo line:

In practice that means you can highlight a path in one tab and press Shift+Insert in another without touching Ctrl+Shift+C, and your real clipboard stays intact. If Shift+Insert pastes something you did not expect, you highlighted other text after your last copy. Highlighting replaces PRIMARY every time, while CLIPBOARD only changes when you copy on purpose.
Turn middle-click paste back on
Middle-click paste is off by default on Ubuntu 26.04. GNOME 50 flipped the default of the gtk-enable-primary-paste key from true to false, and Ubuntu ships the GNOME default unchanged, so clicking the middle mouse button in a terminal pastes nothing. Ubuntu 24.04 still runs GNOME 46, where the key defaults to true and middle-click works as before. You can check the current value with gsettings:
gsettings get org.gnome.desktop.interface gtk-enable-primary-paste
A fresh Ubuntu 26.04 account returns the new default. There is no Ubuntu override and no per-user value behind it, just the GNOME schema:
false
If you rely on highlight and middle-click, set the key back to true. It applies to your user only, takes effect in open windows without logging out, and needs no sudo:
gsettings set org.gnome.desktop.interface gtk-enable-primary-paste true
Both halves of the test sit in one window below. With the stock setting, the middle-click after echo middle-click gives: inserted nothing. After the gsettings change, the same click inserted the PRIMARY text:

To go back to the GNOME default later, run gsettings reset org.gnome.desktop.interface gtk-enable-primary-paste. If you never use the middle button, leave it off: a stray click can’t drop old highlighted text into a root shell. The rest of our Ubuntu 26.04 desktop setup steps cover other defaults that changed in this release.
Check multi-line pastes before they run
Pasting several commands from a web page used to run each line the moment it hit the shell, because every newline acted as Enter. Modern Bash turns on bracketed paste in interactive shells, so the terminal wraps the pasted text in markers and the shell holds all of it at the prompt until you press Enter yourself. We copied two apt lines to the clipboard and pasted them with Ctrl+Shift+V:
printf 'sudo apt update\nsudo apt install -y xclip\n' | wl-copy
Both lines arrived highlighted and nothing ran, even though the copied text ended with a newline. Press Enter to run them, or Ctrl+C to throw the paste away:

That gives you a last look at anything copied from a forum before it touches the system. Confirm it’s on in your shell with bind -v | grep bracketed-paste, which should print set enable-bracketed-paste on. Over a non-interactive shell, such as a script run through SSH, the same check prints off, so the protection only covers the prompt you type at.
Change the copy and paste shortcuts
If your fingers insist on plain Ctrl+C and Ctrl+V, you can rebind the terminal’s own actions, but you give up the interrupt key in the process. In Ptyxis, press Ctrl+, (or pick Preferences from the main menu at the top right) to open Preferences, open the Shortcuts tab, then click Copy to Clipboard or Paste from Clipboard and press the new key combination.

- 1Shortcuts
- 2Copy to Clipboard
- 3Paste from Clipboard
Ptyxis stores the same bindings in gsettings, which is handy when you set up several machines from a script. This command lists the copy, paste and select-all entries:
gsettings list-recursively org.gnome.Ptyxis.Shortcuts | grep -E "copy|paste|select-all"
On Ubuntu 26.04 the defaults match the right-click menu. A rebinding you make in Preferences shows up here as the new value, so this is also a quick way to audit a machine:
org.gnome.Ptyxis.Shortcuts copy-clipboard '<ctrl><shift>c'
org.gnome.Ptyxis.Shortcuts paste-clipboard '<ctrl><shift>v'
org.gnome.Ptyxis.Shortcuts select-all '<ctrl><shift>a'
Our advice is to leave these alone. Once Ctrl+C copies, you need another way to stop a runaway command, and muscle memory from a rebound desktop will betray you on every server and colleague’s laptop you use.
Copy file contents to the clipboard
Selecting a 300-line config file with the mouse is slow and error-prone. Pipe it into a clipboard tool instead. Which tool you need depends on the display server your desktop runs:
- wl-copy and wl-paste for Wayland sessions
- xclip for X11 sessions
- xsel for X11 sessions, as an xclip alternative
A default Ubuntu 26.04 login is a Wayland session (loginctl show-session reports Type=wayland), so start with wl-clipboard. On the test desktop xclip and xsel worked too, because Xwayland shares one clipboard with native Wayland apps, and text copied with xclip came straight out of wl-paste. Install all three on Ubuntu or Debian:
sudo apt install -y wl-clipboard xclip xsel
On Rocky Linux 10, none of the three is in the base repositories, and AlmaLinux follows the same EPEL route. Without EPEL, dnf stops with Error: Unable to find a match: xclip xsel wl-clipboard. Enable EPEL first, as covered in our Rocky Linux and AlmaLinux post-install guide, then install them:
sudo dnf install -y epel-release
sudo dnf install -y xclip xsel wl-clipboard
Here are the package versions each distribution installed during testing. All of them are mature tools that change rarely, so any of these builds behaves the same way:
| Distribution | wl-clipboard | xclip | xsel |
|---|---|---|---|
| Ubuntu 26.04 | 2.2.1-2build1 | 0.13-4build1 | 1.2.1-1build1 |
| Ubuntu 24.04 | 2.2.1-1build1 | 0.13-3 | 1.2.1-1 |
| Debian 13 | 2.2.1-2 | 0.13-4 | 1.2.1-1 |
| Rocky Linux 10 (EPEL) | 2.2.1-3.el10_0 | 0.13-24.git11cba61.el10_1 | 1.2.1-4.el10_0 |
With the packages in place, the tools behave the same on every distribution above.
Copy and paste with wl-copy and wl-paste
The wl-clipboard pair is the simplest of the three to use. Redirect a file into wl-copy and the contents are on the clipboard, ready for Ctrl+V in a browser or Ctrl+Shift+V in another terminal. wl-paste prints the clipboard back to standard output:
wl-copy < /etc/hostname
wl-paste
wl-paste returned the hostname of the test desktop, followed by a blank line that was not in the file:
u2604-desk-job8987
That blank line is wl-paste adding a newline of its own. Pasting printf "line1\nline2\n" back through wc -l counted 3 lines instead of 2. Use wl-paste -n when the exact bytes matter, for example when you paste a key or token into another command. Command output works the same way as a file:
uptime | wl-copy && wl-paste
Here the uptime line went to the clipboard and came straight back out. The leading space is part of the uptime output itself, not something the clipboard added:
14:13:41 up 4 min, 2 users, load average: 0.69, 0.56, 0.25
Add --primary to either command to work with the highlight buffer instead of the clipboard, the one Shift+Insert reads. wl-copy --clear empties the clipboard, which is worth doing after you copy a password. A wl-paste with nothing to give prints Nothing is copied and exits with status 1, so a script can test for it.
Copy with xclip or xsel on X11
xclip writes to PRIMARY unless you tell it otherwise, which catches out most people who try it for the first time. Always pass -selection clipboard so the text lands where Ctrl+V looks:
echo "from xclip" | xclip -selection clipboard
xclip -selection clipboard -o
Adding -o prints the clipboard instead of writing it, so the second command returns the text we just copied:
from xclip
Leave out -selection clipboard on the -o line and you read PRIMARY instead, which is rarely what you want in a script. xsel spells the same thing with long options, --clipboard --input to copy and --clipboard --output to paste:
echo "from xsel" | xsel --clipboard --input && xsel --clipboard --output
Both tools, like wl-copy, leave a small background process running to serve the clipboard until something else replaces it. That is normal and is how X11 and Wayland clipboards work, so do not kill it, because on a plain X11 session the copied text goes with it. If you want shorter names, add alias pbcopy='xclip -selection clipboard' and alias pbpaste='xclip -selection clipboard -o' to ~/.bashrc, or point the same aliases at wl-copy and wl-paste on Wayland. For a tool that also handles files and images, look at the Clipboard tool for the Linux terminal.
Fix “Can’t open display” over SSH
Clipboard tools talk to a graphical session, and a server you reach over SSH has none. That’s the most common reason people say xclip is broken. We installed all three tools on headless Ubuntu 24.04, Debian 13 and Rocky Linux 10 servers and piped text into each. xclip failed straight away:
Error: Can't open display: (null)
The Rocky build prefixes the same message with xclip:. xsel prints its own version of the error, followed by a second line that looks unrelated but comes from the same missing display:
xsel: Can't open display: (null)
: Inappropriate ioctl for device
wl-copy is more specific and names the socket it looked for, which is useful when you suspect a broken session rather than no session at all:
Failed to connect to a Wayland server: No such file or directory
Note: WAYLAND_DISPLAY is unset (falling back to wayland-0)
Note: XDG_RUNTIME_DIR is set to /run/user/1000
Please check whether /run/user/1000/wayland-0 socket exists and is accessible.
All three exit with status 1. On a server, do not fight it, because the text is already on your own screen and your desktop owns that clipboard. Pick one of these instead:
- select the output locally and press Ctrl+Shift+C
catthe file and copy it from the scrollbackscpthe file to your workstation, then wl-copy it there
The first works for anything that fits on screen, and the last is the right call for long configs where a mouse drag would miss lines. Installing an X server on a production box just to feed xclip adds packages you’ll have to patch for no real gain.
Ctrl+Shift+C and Ctrl+Shift+V cover nearly every case, Shift+Insert handles quick highlight-and-paste, and on Ubuntu 26.04 middle-click needs one gsettings line to come back. For files and command output, wl-copy is the tool to reach for on a modern desktop, and on a remote server the copy belongs in your local terminal, not on the server.