simplify xsel.md, add example using X11 selection

Also add equivalence to standard operations, to make it clearer what each example does.
waldyrious/alt-syntax
Waldir Pimenta 2016-06-25 02:07:46 +01:00 committed by GitHub
parent 5d7e09afc4
commit ed0c87bf20
1 changed files with 14 additions and 23 deletions

View File

@ -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`