Copy output from terminal directly to your clipboard! (Linux)
PROBLEM: It is difficult to copy and past outputs from and to terminal
SOLUTION: Use xclip!
Install xclip
To install xclip on Ubuntu just use apt get, on other use the equivalent command.
1 |
apt install xclip |
Basic commands
To copy output to your clipboard, just simply use | xclip (| means, everything before pipe is input for command after pipe)like this:
1 |
cat myfile | xclip |
And you have content of myfile in your clipboard!
To paste from your clipboard, just use:
1 |
xclip -o |
Advanced strategy!
To work better with xclip, you can use aliases to work faster 🙂
1 2 |
alias c="xclip" alias v="xclip -o" |
In use case:
1 2 3 4 |
#Copy content of myfile cat myfile | c #Paste content of myfile v |