I know that Linux Desktops with a windowing manager such as X11-based systems have a system clipboard, but if not using a windowing manager, is there any clipboard?

For example, in Vim, the system clipboard can be accessed via the + register, but this only works in the GUI version of Vim running on X-windows since it is using the window manager's clipboard. If you are using text-based version of Vim, such as from a terminal or from a virtual console, it does not work. For example, if you open two different instances of Vim in different virtual consoles, how would you copy and paste between them?

  • Actually, X11 uses Selections, which require inter-client communication (and when the client terminates, the selection is gone). There is no system-wide clipboard, unless you run a client like xclipboard that takes over the selection from the client providing it.
    – dirkt
    Jan 3, 2018 at 10:38
  • 1
    Interesting how none of the existing clipboard solutions can be decoupled from their parent application, be it X, gpm, tmux, or whatever. A clipboard facility that is accessible from all of these without requiring heavyweight solutions like a GUI would be very desirable.
    – phg
    Jul 24, 2018 at 7:15

4 Answers 4


screen and tmux support copy-paste buffers, so that’s one possible approach (see the other answer for details).

Using only Linux virtual consoles, you can run gpm (or its libinput replacement, consolation) to provide mouse-based copy-paste: select text with the left mouse button, paste it with the middle mouse button.

Neither of these have direct integration with Vim as far as I’m aware, so you’re limited to copying what’s visible on screen or in the scrollback buffers if anything.


tmux has "paste buffers" which are similar to the X clipboard, and are accessible across different sessions running on the same host. Start each vim instance in a tmux session (either both in a single session, or each in its own - it doesn't matter for these purposes), and you can copy and paste text between them with ease:

Assuming the default key bindings for tmux, you can enter copy mode by pressing CTRL+B[. Navigate to the start of the text you want to copy and hit CTRL+SPACE, move the cursor to highlight the text you want and hit ENTER. This copies the selection to a paste buffer. Now you can switch to the other vim session (or any other program running under tmux), and press CTRL+B] to paste the buffer contents in the current pane.

tmux maintains multiple paste buffers; you can press CTRL+B# to see them all, or CTRL+B= to visually select a paste buffer and insert its contents in the current pane.


When X is running, Vim is just pulling from xclip. This means copy-paste between applications that most people are thinking of really is an X feature.

While many applications have copy-paste functions or buffers to really be a clipboard it needs to be a shared function between applications through some form of IPC.

The 2 big toolkits below actually support this in a way over dbus. Even if in the background they are using X anyway the point is that these are interfaces that other applications can use.



Both interfaces abstract the underlying Windowing systems clipboard so this would include working with Wayland which is more generic concept of "data sharing"


On the console technically copy and paste is the same thing as saving and loading any buffer so just redirect what you need. So this is copy and paste at the OS level:

mkfifo clipboard && (echo -e "$copy" > clipboard && rm clipboard) &

At the bash/command interpreter level copy and paste is just:

copy="some text"
echo $copy

Also I realize the first also uses variables. But it is using features of the OS as a demonstration.



in init.vim, use '+': ['tmux', 'load-buffer', '-w', '-'] instead of '+': ['tmux', 'load-buffer', '-'], (shown in :help g:clipboard) ,

then ctrl-v on local win10 gets want you copied with "+y in nvim.

About my network

I use win10 as my local machine, ssh to a ubuntu machine in the campus (through a VPN, with the help of a software called easy connection). On the local machine, this works: ssh [email protected] (using pwsh7, windows terminal).

Then in the remote shell, echo $SSH_CLIENT gets 50859 22; let's denote as win_ip. Still in the remote shell, ssh -v win_ip gets :

.....something ... 
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to win_ip [win_ip] port 22.
ssh: connect to host win_ip port 22: Connection timed out

If I use wsl2 (ubuntu) on the same local machine to that remote machine, the same thing happens.

Also, scp , xclip, xlogo fail.


In ~/.config//tmux/tmux.conf, I have:

bind -n M-v  run-shell "tmux copy-mode"
bind  'v' run-shell "tmux copy-mode ; tmux send -X begin-selection"
bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel

So if I press the sequence :

  • Alt-v
  • v
  • and select some text (e.g. I_am_remote) with h j k or l ...
  • y

In tmux, ctrl-b = shows that "I_am_remote" is there(see fig.1), and ctrl-b ] can paste "I_am_remote" .

In applications like chrome on local win10, ctrl-v gets the selected text.

nvim and tmux

in init.vim, I have set g:clipboard. :echo g:clipboard gets

    \ 'paste': {
        \ '*': ['tmux', 'save-buffer', '-'],
        \ '+': ['tmux', 'save-buffer', '-'],
       \ },
    \ 'cache_enabled': 1,
    \ 'name': 'ClipboarD-no-x11',
    \ 'copy': {
        \ '*': ['tmux', 'load-buffer', '-w', '-'],
        \ '+': ['tmux', 'load-buffer', '-w, '-'],
       \ },
   \ }

then ctrl-v on local win10 gets want you copied with "+y in nvim.

ps: "+y sometimes makes nvim show: clipboard: error invoking xclip: Error: Can't open display: win_ip:47 Even with the error message, "I_am_remote" can be found byctr-b = or ctrl-b ] .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .