DebugPointer
Published on

Enable or Disable clipboard copy and paste in Tmux

Enable or Disable clipboard copy and paste in Tmux

Tmux is one of the most useful tool when it comes to using a linux terminal.

Tmux is a terminal multiplexer, it allows a user to access multiple terminals (or windows), each running a separate program, while providing a single screen to work on. Tmux is useful for running more than one command-line program at the same time, increasing productivity and the way you work.

To enable clipboard copy-paste on Tmux

Enabling mouse gives you options to clipboard and copy-paste from tmux window and Windows or Linux or MAC Clipboard. Let's look at how to enable copy-paste and mouse behaviour on tmux.

You can either run a command to activate it temporarily for that session by running

Prefix
:set -g mouse on

By default the prefix is Ctrl-B

Ctrl-B
:set -g mouse on

You can also make this a default behaviour of tmux, by adding the setting in ~/.tmux.conf-

set -g mouse on

After adding the above line to the configuration file, you can reload tmux conf-

tmux source-file ~/.tmux.conf

To disable clipboard copy-paste on Tmux

Disabling mouse gives you options to prevent the clipboard and copy-paste option inside the tmux window or pane.

You can either run a command to activate it temporarily for that session by running

Prefix
:set -g mouse off

By default the prefix is Ctrl-B

Ctrl-B
:set -g mouse off

You can also make this a default behaviour of tmux, by adding the setting in ~/.tmux.conf-

set -g mouse off

After adding the above line to the configuration file, you can reload tmux conf-

tmux source-file ~/.tmux.conf

If you are a vi or vim enthusiast, then you can enable vi-like copy paste behaviour on tmux as well.

I hope this tutorial for enabling or disabling mouse actions in tmux was useful. You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.