-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update pbcopy-pbpaste.md, xclip.md, xsel.md and clipboard.md
- Loading branch information
1 parent
831f384
commit fcbcc48
Showing
4 changed files
with
136 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,7 @@ | ||
--- | ||
description: Copy to and paste from clipboard. Especially useful for very large files or when you use SSH with no GUI. | ||
--- | ||
# Clipboard | ||
|
||
Copy to and paste from clipboard. Especially useful for very large files or when you use SSH with no GUI. | ||
|
||
|
||
See [StackOverflow answer](https://stackoverflow.com/questions/749544/pipe-to-from-the-clipboard-in-bash-script) for usage and shortcuts. | ||
|
||
|
||
## Linux | ||
|
||
Use `xclip` - see [man page](https://linux.die.net/man/1/xclip). | ||
|
||
> xclip [OPTION] [FILE]... | ||
> | ||
> Description | ||
> | ||
> Reads from standard in, or from one or more files, and makes the data available as an X selection for pasting into X applications. Prints current X selection to standard out. | ||
### Read | ||
|
||
Store value in X selection. | ||
|
||
Command output. | ||
|
||
```sh | ||
$ COMMAND | xclip | ||
``` | ||
|
||
Read file. | ||
|
||
```sh | ||
$ xclip PATH | ||
``` | ||
|
||
This lets you paste using the middle mouse button. | ||
|
||
If you prefer to traditional pasting: | ||
|
||
```sh | ||
$ xclip -sel clip PATH | ||
``` | ||
|
||
Or according to the manpage: | ||
|
||
> -selection | ||
> | ||
> specify which X selection to use, options are "primary" to use XA_PRIMARY (default), "secondary" for XA_SECONDARY or "clipboard" for XA_CLIPBOARD | ||
### Output | ||
|
||
Print. | ||
|
||
```sh | ||
$ xclip | ||
``` | ||
|
||
Pipe. | ||
|
||
> -o, -out | ||
> | ||
> prints the selection to standard out (generally for piping to a file or program) | ||
```sh | ||
$ xclip -o > PATH | ||
``` | ||
|
||
## macOS | ||
|
||
Use `pbcopy` and `pbpaste`. | ||
|
||
### Read | ||
|
||
Copy file. | ||
|
||
```sh | ||
$ pbcopy < PATH | ||
``` | ||
|
||
### Output | ||
|
||
Print. | ||
|
||
```sh | ||
$ pbpaste | ||
``` | ||
|
||
Pipe. | ||
|
||
```sh | ||
$ pbpaste | head | ||
``` | ||
See [Clipboard commands]({% link cheatsheets/shell/commands/clipboard/index.md %}) cheatsheet section. |