Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy to the clipboard the current path? [closed]

Tags:

linux

bash

pwd

How can I copy the current path in the bash terminal, using just one command?

like image 806
ziiweb Avatar asked Mar 28 '13 18:03

ziiweb


2 Answers

pwd | tr -d '\n' | pbcopy

Try this... Best I can come up with on my phone.

like image 20
stevenelberger Avatar answered Sep 28 '22 09:09

stevenelberger


Needs xsel installed:

pwd | xsel -i

(if you don't want the trailing newline, use printf %s "$(pwd)" | xsel -i (mostly correct) pwd | head -c -1 | xsel -i (perfectly correct))


Update August 2014: The xsel program is broken: See my bugreport.

Probably you can get along with xclip as well.

like image 79
Jo So Avatar answered Sep 28 '22 10:09

Jo So