copy to clipboard current path from console with no mouse [duplicate]

You can use a program called xclip. For installing it type:

sudo apt-get install xclip

and 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 xsel

and then do

pwd | xsel -b

to copy the output of pwd to the clipboard.

To get the content of the clipboard you can use:

xsel -b

Here you can read a review of xclip and xsel:

http://trembits.blogspot.com/2009/09/clipboard-from-command-line-xclip.html