I have seen this post: how-can-i-copy-the-output-of-a-command-directly-into-my-clipboard
I have got this alias
# Redoes the last command and copies the output to clipboard
alias cl="fc -e -|pbcopy"
However I would like an alias or a function that doesn't redo the last command, but does copy the output of the last command.
Shells in common use on Linux (such as bash) do not preserve the output from the previous command, so re-execution is the only solution unless you add code to do the preservation yourself. Pbcopy isn't always installed, xclip seems more commonly installed:
ls -l
!! | xclip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With