Is the linux clipboard a file?
We all know the saying: in linux, everything is a file.
My question is: how is the clipboard handled in linux? Is it an accessible and definite file? Would it be possible to read it with a cat or to write in it with a redirection, for example? (Given you have sufficient privilege)
If my assumption is correct, where is it located, and is it implementation distribution-specific?
linux clipboard
add a comment |
We all know the saying: in linux, everything is a file.
My question is: how is the clipboard handled in linux? Is it an accessible and definite file? Would it be possible to read it with a cat or to write in it with a redirection, for example? (Given you have sufficient privilege)
If my assumption is correct, where is it located, and is it implementation distribution-specific?
linux clipboard
It's not really "everything is a file" it's "everything looks like a file" . Think APIs, not physical files.
– MZB
Feb 15 at 13:08
add a comment |
We all know the saying: in linux, everything is a file.
My question is: how is the clipboard handled in linux? Is it an accessible and definite file? Would it be possible to read it with a cat or to write in it with a redirection, for example? (Given you have sufficient privilege)
If my assumption is correct, where is it located, and is it implementation distribution-specific?
linux clipboard
We all know the saying: in linux, everything is a file.
My question is: how is the clipboard handled in linux? Is it an accessible and definite file? Would it be possible to read it with a cat or to write in it with a redirection, for example? (Given you have sufficient privilege)
If my assumption is correct, where is it located, and is it implementation distribution-specific?
linux clipboard
linux clipboard
asked Jan 31 at 13:45
PoutchiPatchPoutchiPatch
33319
33319
It's not really "everything is a file" it's "everything looks like a file" . Think APIs, not physical files.
– MZB
Feb 15 at 13:08
add a comment |
It's not really "everything is a file" it's "everything looks like a file" . Think APIs, not physical files.
– MZB
Feb 15 at 13:08
It's not really "everything is a file" it's "everything looks like a file" . Think APIs, not physical files.
– MZB
Feb 15 at 13:08
It's not really "everything is a file" it's "everything looks like a file" . Think APIs, not physical files.
– MZB
Feb 15 at 13:08
add a comment |
1 Answer
1
active
oldest
votes
No. Unless you have a 3rd party program that copies the clipboard's contents to a file somewhere.
Here's the basic answer from askubuntu's Where are the contents of the clipboard stored?:
You seem to be lacking an understanding of clipboards in Linux. There are 3 usually available to users.
These clipboards are called "Selections"
There is:
- PRIMARY - This is normally used for middle mouse button = copy/paste
- SECONDARY - Normally not used by much, but it exists. Usually as an in app specific copy and paste.
- CLIPBOARD - Usually Ctrl+c and Ctrl+v style copy and paste.
All of them are stored, by default in memory of the controlling application (usually Xorg, but not always). And every child application has access to it.
Clipboard monitors and managers exist that can monitor the clipboards and store their contents in a file, or more commonly, let you review your clipboard history.
Here's a little more interesting info from archlinux's wiki on the Clipboard
History
In X10, cut buffers were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as xterm) may have legacy support for them, it is both not likely and not recommended that they be used.
Selections
Freedesktop.org describes the two main selections as follows:[1]
PRIMARY
Used for the currently selected text, even if it is not explicitly copied, and for middle-mouse-click pasting. In some cases, pasting is also possible with a keyboard shortcut.
CLIPBOARD
Used for explicit copy/paste commands involving keyboard shortcuts or menu items. Hence, it behaves like the single-clipboard system on Windows. Unlike PRIMARY, it can also handle multiple data formats.
The majority of programs for Xorg, including Qt and GTK+ applications, follow this behavior. While ICCCM also defines a SECONDARY selection, it does not have a consensually agreed upon purpose. Despite the naming, all three selections are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections.
See the Keyboard shortcuts page which lists the default shortcuts in many programs.
It is also important to realize that according to the selection protocols, nothing is copied until it is pasted. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a clipboard manager.
Note: Clipboard managers can significantly change the user experience, for example they might synchronize the PRIMARY and CLIPBOARD selections to emulate a single-clipboard system.
Great answer. I would just note that in some Desktop Environments such as KDE, a clipboard manager may be installed by default. In this case, the contents of the clipboard (and some history of selections) may be stored somewhere by the clipboard manager because they may be available at the next login.
– Joe
Feb 4 at 18:34
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400572%2fis-the-linux-clipboard-a-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
No. Unless you have a 3rd party program that copies the clipboard's contents to a file somewhere.
Here's the basic answer from askubuntu's Where are the contents of the clipboard stored?:
You seem to be lacking an understanding of clipboards in Linux. There are 3 usually available to users.
These clipboards are called "Selections"
There is:
- PRIMARY - This is normally used for middle mouse button = copy/paste
- SECONDARY - Normally not used by much, but it exists. Usually as an in app specific copy and paste.
- CLIPBOARD - Usually Ctrl+c and Ctrl+v style copy and paste.
All of them are stored, by default in memory of the controlling application (usually Xorg, but not always). And every child application has access to it.
Clipboard monitors and managers exist that can monitor the clipboards and store their contents in a file, or more commonly, let you review your clipboard history.
Here's a little more interesting info from archlinux's wiki on the Clipboard
History
In X10, cut buffers were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as xterm) may have legacy support for them, it is both not likely and not recommended that they be used.
Selections
Freedesktop.org describes the two main selections as follows:[1]
PRIMARY
Used for the currently selected text, even if it is not explicitly copied, and for middle-mouse-click pasting. In some cases, pasting is also possible with a keyboard shortcut.
CLIPBOARD
Used for explicit copy/paste commands involving keyboard shortcuts or menu items. Hence, it behaves like the single-clipboard system on Windows. Unlike PRIMARY, it can also handle multiple data formats.
The majority of programs for Xorg, including Qt and GTK+ applications, follow this behavior. While ICCCM also defines a SECONDARY selection, it does not have a consensually agreed upon purpose. Despite the naming, all three selections are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections.
See the Keyboard shortcuts page which lists the default shortcuts in many programs.
It is also important to realize that according to the selection protocols, nothing is copied until it is pasted. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a clipboard manager.
Note: Clipboard managers can significantly change the user experience, for example they might synchronize the PRIMARY and CLIPBOARD selections to emulate a single-clipboard system.
Great answer. I would just note that in some Desktop Environments such as KDE, a clipboard manager may be installed by default. In this case, the contents of the clipboard (and some history of selections) may be stored somewhere by the clipboard manager because they may be available at the next login.
– Joe
Feb 4 at 18:34
add a comment |
No. Unless you have a 3rd party program that copies the clipboard's contents to a file somewhere.
Here's the basic answer from askubuntu's Where are the contents of the clipboard stored?:
You seem to be lacking an understanding of clipboards in Linux. There are 3 usually available to users.
These clipboards are called "Selections"
There is:
- PRIMARY - This is normally used for middle mouse button = copy/paste
- SECONDARY - Normally not used by much, but it exists. Usually as an in app specific copy and paste.
- CLIPBOARD - Usually Ctrl+c and Ctrl+v style copy and paste.
All of them are stored, by default in memory of the controlling application (usually Xorg, but not always). And every child application has access to it.
Clipboard monitors and managers exist that can monitor the clipboards and store their contents in a file, or more commonly, let you review your clipboard history.
Here's a little more interesting info from archlinux's wiki on the Clipboard
History
In X10, cut buffers were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as xterm) may have legacy support for them, it is both not likely and not recommended that they be used.
Selections
Freedesktop.org describes the two main selections as follows:[1]
PRIMARY
Used for the currently selected text, even if it is not explicitly copied, and for middle-mouse-click pasting. In some cases, pasting is also possible with a keyboard shortcut.
CLIPBOARD
Used for explicit copy/paste commands involving keyboard shortcuts or menu items. Hence, it behaves like the single-clipboard system on Windows. Unlike PRIMARY, it can also handle multiple data formats.
The majority of programs for Xorg, including Qt and GTK+ applications, follow this behavior. While ICCCM also defines a SECONDARY selection, it does not have a consensually agreed upon purpose. Despite the naming, all three selections are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections.
See the Keyboard shortcuts page which lists the default shortcuts in many programs.
It is also important to realize that according to the selection protocols, nothing is copied until it is pasted. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a clipboard manager.
Note: Clipboard managers can significantly change the user experience, for example they might synchronize the PRIMARY and CLIPBOARD selections to emulate a single-clipboard system.
Great answer. I would just note that in some Desktop Environments such as KDE, a clipboard manager may be installed by default. In this case, the contents of the clipboard (and some history of selections) may be stored somewhere by the clipboard manager because they may be available at the next login.
– Joe
Feb 4 at 18:34
add a comment |
No. Unless you have a 3rd party program that copies the clipboard's contents to a file somewhere.
Here's the basic answer from askubuntu's Where are the contents of the clipboard stored?:
You seem to be lacking an understanding of clipboards in Linux. There are 3 usually available to users.
These clipboards are called "Selections"
There is:
- PRIMARY - This is normally used for middle mouse button = copy/paste
- SECONDARY - Normally not used by much, but it exists. Usually as an in app specific copy and paste.
- CLIPBOARD - Usually Ctrl+c and Ctrl+v style copy and paste.
All of them are stored, by default in memory of the controlling application (usually Xorg, but not always). And every child application has access to it.
Clipboard monitors and managers exist that can monitor the clipboards and store their contents in a file, or more commonly, let you review your clipboard history.
Here's a little more interesting info from archlinux's wiki on the Clipboard
History
In X10, cut buffers were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as xterm) may have legacy support for them, it is both not likely and not recommended that they be used.
Selections
Freedesktop.org describes the two main selections as follows:[1]
PRIMARY
Used for the currently selected text, even if it is not explicitly copied, and for middle-mouse-click pasting. In some cases, pasting is also possible with a keyboard shortcut.
CLIPBOARD
Used for explicit copy/paste commands involving keyboard shortcuts or menu items. Hence, it behaves like the single-clipboard system on Windows. Unlike PRIMARY, it can also handle multiple data formats.
The majority of programs for Xorg, including Qt and GTK+ applications, follow this behavior. While ICCCM also defines a SECONDARY selection, it does not have a consensually agreed upon purpose. Despite the naming, all three selections are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections.
See the Keyboard shortcuts page which lists the default shortcuts in many programs.
It is also important to realize that according to the selection protocols, nothing is copied until it is pasted. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a clipboard manager.
Note: Clipboard managers can significantly change the user experience, for example they might synchronize the PRIMARY and CLIPBOARD selections to emulate a single-clipboard system.
No. Unless you have a 3rd party program that copies the clipboard's contents to a file somewhere.
Here's the basic answer from askubuntu's Where are the contents of the clipboard stored?:
You seem to be lacking an understanding of clipboards in Linux. There are 3 usually available to users.
These clipboards are called "Selections"
There is:
- PRIMARY - This is normally used for middle mouse button = copy/paste
- SECONDARY - Normally not used by much, but it exists. Usually as an in app specific copy and paste.
- CLIPBOARD - Usually Ctrl+c and Ctrl+v style copy and paste.
All of them are stored, by default in memory of the controlling application (usually Xorg, but not always). And every child application has access to it.
Clipboard monitors and managers exist that can monitor the clipboards and store their contents in a file, or more commonly, let you review your clipboard history.
Here's a little more interesting info from archlinux's wiki on the Clipboard
History
In X10, cut buffers were introduced. These were limited buffers that stored arbitrary text and were used by most applications. However, they were inefficient and implementation of them varied, so selections were introduced. Cut buffers are long deprecated, and although some applications (such as xterm) may have legacy support for them, it is both not likely and not recommended that they be used.
Selections
Freedesktop.org describes the two main selections as follows:[1]
PRIMARY
Used for the currently selected text, even if it is not explicitly copied, and for middle-mouse-click pasting. In some cases, pasting is also possible with a keyboard shortcut.
CLIPBOARD
Used for explicit copy/paste commands involving keyboard shortcuts or menu items. Hence, it behaves like the single-clipboard system on Windows. Unlike PRIMARY, it can also handle multiple data formats.
The majority of programs for Xorg, including Qt and GTK+ applications, follow this behavior. While ICCCM also defines a SECONDARY selection, it does not have a consensually agreed upon purpose. Despite the naming, all three selections are basically "clipboards". Rather than the old "cut buffers" system where arbitrary applications could modify data stored in the cut buffers, only one application may control or "own" a selection at one time. This prevents inconsistencies in the operation of the selections.
See the Keyboard shortcuts page which lists the default shortcuts in many programs.
It is also important to realize that according to the selection protocols, nothing is copied until it is pasted. For example, if you select some word in a terminal window, close the terminal and then want to paste it somewhere else, it will not work because the terminal is gone and the text has not been copied anywhere. If you want the word to be preserved after closing terminal window, consider installing a clipboard manager.
Note: Clipboard managers can significantly change the user experience, for example they might synchronize the PRIMARY and CLIPBOARD selections to emulate a single-clipboard system.
edited Jan 31 at 15:01
answered Jan 31 at 14:49
Xen2050Xen2050
11.3k31637
11.3k31637
Great answer. I would just note that in some Desktop Environments such as KDE, a clipboard manager may be installed by default. In this case, the contents of the clipboard (and some history of selections) may be stored somewhere by the clipboard manager because they may be available at the next login.
– Joe
Feb 4 at 18:34
add a comment |
Great answer. I would just note that in some Desktop Environments such as KDE, a clipboard manager may be installed by default. In this case, the contents of the clipboard (and some history of selections) may be stored somewhere by the clipboard manager because they may be available at the next login.
– Joe
Feb 4 at 18:34
Great answer. I would just note that in some Desktop Environments such as KDE, a clipboard manager may be installed by default. In this case, the contents of the clipboard (and some history of selections) may be stored somewhere by the clipboard manager because they may be available at the next login.
– Joe
Feb 4 at 18:34
Great answer. I would just note that in some Desktop Environments such as KDE, a clipboard manager may be installed by default. In this case, the contents of the clipboard (and some history of selections) may be stored somewhere by the clipboard manager because they may be available at the next login.
– Joe
Feb 4 at 18:34
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400572%2fis-the-linux-clipboard-a-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It's not really "everything is a file" it's "everything looks like a file" . Think APIs, not physical files.
– MZB
Feb 15 at 13:08