Forrest logo
back to the echo tool

xclip:tldr:78260

xclip: Copy the output from a command to the system clipboard, using short notation.
$ echo 123 | xclip -sel clip
try on your machine

The command echo 123 | xclip -sel clip is used to store the text "123" in the clipboard using the xclip command-line utility.

Here's a breakdown of the command:

echo 123: This portion of the command uses the echo command to output the text "123" to the console.

|: The pipe symbol (|) is a command-line operator used to redirect the standard output of one command to the input of another command. In this case, it takes the output of the echo command and passes it as input to the xclip command.

xclip: This is a command-line utility that allows for interaction with the X Server clipboard. It provides commands to read from or write to the clipboard.

-sel clip: This option specifies that the data being passed should be stored in the "clipboard" selection.

So, when this command is executed, it will take the output of echo 123 (which is "123") and pass it to xclip, which will then store the text "123" in the clipboard, specifically in the "clipboard" selection.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the echo tool