Is there a command to output the current value of the clipboard?
Example (this command doesn't exists, it's just an example of what I'm looking for:
cat clipboard > Hello world!
Also, if the clipboard is stored somewhere, where is it located?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You can use
xsel to do this.
xclip -o xsel -o
Bear in mind that there are multiple X clipboards (well, "selections", including the major two,
PRIMARY (typically used when you select text) and
CLIPBOARD (typically used when you explicitly request a copy)). You may need to select which clipboard you are referring to:
# XA_PRIMARY xclip -o -selection primary xsel -op # XA_CLIPBOARD xclip -o -selection clipboard xsel -ob # XA_SECONDARY (you probably don't want this) xclip -o -selection secondary xsel -os
For the macOS clipboard, use