OMG! This is super useful! I can’t tell you how many times I’ve used these commands after cleaning up some file or output in terminal. It’s way better then highlighting all or the classic, using the mouse to highlight thousands of lines lol.
For OSX you can use the pbcopy command.
For example
cat file | pbcopy
Now the content is in your clipboard which is easily pasted wherever you want.
Alternatively, you can use pbpaste to put the clipboard content into the terminal!
pbpaste > pasted
Lucky for you, both of these commmands are baked into every version of modern OSX!
Now for Kali you can use the xclip command. Which of course is a little longer of a process to get set up. But is very painless.
First lets do the usual
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
Once that’s done lets do
sudo apt-get install xclip
Once that’s done lets add the aliases to our .zshrc file
nano ~/.zshrc
CRTL + V to the bottom
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'

Now you can run the same command as OSX to directly copy terminal output to your clipboard!
cat file | pbcopy

Now feel free to paste it anywhere you like!
If you want to output the what’s currently in the clipboard you can do
echo `pbpaste`

If you want to save it to a file you can do
echo `pbpaste` > pasted

Now just cat the file to confirm
cat pasted
