1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-03 12:55:23 +02:00
tldr/pages/linux/xsel.md

29 lines
782 B
Markdown
Raw Normal View History

2016-06-21 10:36:03 +12:00
# xsel
> X11 selection and clipboard manipulation tool.
> More information: <https://manned.org/xsel>.
2016-06-21 10:36:03 +12:00
2025-03-17 23:17:57 +02:00
- Use a command's output as input of the clipboard (equivalent to `<Ctrl c>`):
2016-06-21 10:36:03 +12:00
2025-03-17 23:17:57 +02:00
`echo 123 | xsel {{[-ib|--input --clipboard]}}`
2016-06-21 10:36:03 +12:00
- Use the contents of a file as input of the clipboard:
2016-06-21 10:36:03 +12:00
2025-03-17 23:17:57 +02:00
`cat {{path/to/file}} | xsel {{[-ib|--input --clipboard]}}`
2016-06-21 10:36:03 +12:00
- Output the clipboard's contents into the terminal (equivalent to `<Ctrl v>`):
2016-06-21 10:36:03 +12:00
2025-03-17 23:17:57 +02:00
`xsel {{[-ob|--output --clipboard]}}`
2016-06-21 10:36:03 +12:00
- Output the clipboard's contents into a file:
2016-06-21 10:36:03 +12:00
2025-03-17 23:17:57 +02:00
`xsel {{[-ob|--output --clipboard]}} > {{path/to/file}}`
2016-06-21 10:36:03 +12:00
- Clear the clipboard:
2016-06-21 10:36:03 +12:00
2025-03-17 23:17:57 +02:00
`xsel {{[-cb|--clear --clipboard]}}`
2016-06-21 10:36:03 +12:00
- Output the X11 primary selection's contents into the terminal (equivalent to a mouse `<MiddleClick>`):
2016-06-21 10:36:03 +12:00
2025-03-17 23:17:57 +02:00
`xsel {{[-op|--output --primary]}}`