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?
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?
You can use xclip or 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 pbcopy.