loading...

Copy file content to clipboard in terminal

0xbf profile image Bo ・1 min read

In Mac you can use pbcopy:

$ pbcopy < hello.txt

In Linux which is using X11 (I am using ubuntu), you can use xsel command:

$ sudo apt install xsel
$ xsel -b < hello.txt

To copy some program's output to clipboard, we can use pipe:

$ date | xsel -b

Then if you use "ctrl-v", you will see the copied date.

Discussion

markdown guide