diff --git a/pages/linux/xsel.md b/pages/linux/xsel.md new file mode 100644 index 000000000..20b8e362f --- /dev/null +++ b/pages/linux/xsel.md @@ -0,0 +1,36 @@ +# xsel + +> Selection manipulation tool. +> For example, xsel can copy STDIN to clipboard, or print clipboard to STDOUT. + +- Clipboard selection: + +`-b or --clipboard` + +- Primary selection: + +`-p or --primary` + +- Secndary selection: + +`-s or --secondary` + +- Copy output of a command into the clipboard: + +`echo 123 | xclip -bi` + +- Copy contents of a file into the clipboard: + +`cat {{file}} | xsel -bo` + +- Print the clipboard to STDOUT: + +`xsel -bo` + +- Print the clipboard into a file: + +`xsel -bo > {{file}}` + +- Clear the clipboard: + +`xsel -bc`