From ed0c87bf203cde7cdc0d589f136ad9a399046a5a Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Sat, 25 Jun 2016 02:07:46 +0100 Subject: [PATCH] simplify xsel.md, add example using X11 selection Also add equivalence to standard operations, to make it clearer what each example does. --- pages/linux/xsel.md | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/pages/linux/xsel.md b/pages/linux/xsel.md index c8c69c3f5c..8594a7fff2 100644 --- a/pages/linux/xsel.md +++ b/pages/linux/xsel.md @@ -1,36 +1,27 @@ # xsel -> Selection manipulation tool. -> For example, xsel can copy STDIN to clipboard, or print clipboard to STDOUT. +> X11 selection and clipboard manipulation tool. -- Clipboard selection: +- Use a command's output as input of the clip[b]oard (equivalent to Ctrl+C): -`-b or --clipboard` +`echo 123 | xsel -ib` -- Primary selection: +- Use the contents of a file as input of the clipboard: -`-p or --primary` +`cat {{file}} | xsel -ib` -- Secondary selection: +- Output the clipboard's contents into the terminal (equivalent to Ctrl+V): -`-s or --secondary` +`xsel -ob` -- Copy output of a command into the clipboard: +- Output the clipboard's contents into a file: -`echo 123 | xsel -bi` - -- Copy contents of a file into the clipboard: - -`cat {{file}} | xsel -bi` - -- Print the clipboard to STDOUT: - -`xsel -bo` - -- Print the clipboard into a file: - -`xsel -bo > {{file}}` +`xsel -ob > {{file}}` - Clear the clipboard: -`xsel -bc` +`xsel -cb` + +- Output the X11 primary selection's contents into the terminal (equivalent to a mouse middle-click) + +`xsel -op`