The two clipboards in Linux

If you have come to Linux from Windows or Mac, you might have observed some strange behavior when copying or pasting content. This confusing behavior is caused because there are usually two clipboards in Linux.

X clipboard

The X window system has its own clipboard. It is also known as a cutbuffer. Any text or content you mark by highlighting with the mouse cursor is automatically copied to this clipboard. This is known as the PRIMARY selection or X Window selection or just selection in X jargon. When you middle-click the mouse cursor at the destination location, this copied content is pasted there.

Window manager clipboard

In addition to the X clipboard, your window manager or desktop environment (like KDE or GNOME) typically maintains its own clipboard. It might even have a clipboard manager which can maintain a historical buffer of content copied to the clipboard.

Typically, text or content is copied to this clipboard when you highlight it and use the keyboard shortcut Ctrl+C or right-click with mouse and choose Copy. Content from this clipboard is pasted when you use the keyboard shortcut Ctrl+V or right-click with mouse and choose Paste.

Syncing clipboards

Typically, the window manager or its clipboard manager will have an option that allows you to sync this clipboard with the X window selection clipboard. That is, content copied in either clipboard appears in the other ready for pasting.


3 thoughts on “The two clipboards in Linux

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.