Star Hype News.

Premium celebrity moments with standout appeal.

updates

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

By Sarah Smith

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

0

2 Answers

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

5

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:

1

Related Archive

More in updates