Copy file content to clipboard in terminal
In Mac you can use pbcopy:
1 | $ pbcopy < hello.txt |
In Linux which is using X11 (I am using ubuntu), you can use xsel command:
1 | $ sudo apt install xsel |
To copy some program’s output to clipboard, we can use pipe:
1 | $ date | sel -b |
Then if you use “ctrl-v”, you will see the copied date.