Last Updated: February 25, 2016
· aymanfarhat

Copy working directory to clipboard from command line in Ubuntu

Install xclip utility sudo apt-get install xclip

When you're in the desired directory
pwd | xclip -selection -clipboard

This will copy the current directory to clipboard.

For convenience you can also create an alias of the command in your .bashrc file
alias cpwd="pwd | xclip -selection clipboard"

Which makes copying the current directory as simple as cpwd