copy to clipboard current path from console with no mouse [duplicate]
I'm wondering if it possible to copy to clipboard output of pwd command.
I often need to copy some path and I have to select it with mouse, do several clicks and that is annoying for me.
What I want is piping output of pwd command to something that will copy it to clipboard so I do not have to touch my mouse
Edit: it will be great if it is possible with some built-in
02 Answers
You can use a program called xclip. For installing it type:
sudo apt-get install xclipand then do
pwd | xclip -- which copies output of pwd to xclip
Now to get the output type:
xclip -o
or to copy to the "standard" clipboard (to avoid having to use xclip -o)
pwd | xclip -selection clipboard
for more options use
man xclip
You can use xclip or xsel, to install xsel just do:
sudo apt-get install xseland then do
pwd | xsel -bto copy the output of pwd to the clipboard.
To get the content of the clipboard you can use:
xsel -bHere you can read a review of xclip and xsel:
1