DEV Community

Discussion on: Terminal: Copy Current Path

Collapse
 
fm profile image
Fayaz

You don't need the tr command. Just use the $PWD variable like this:

echo -n $PWD | pbcopy
Enter fullscreen mode Exit fullscreen mode
Collapse
 
brandoncharest profile image
Brandon Charest

Good to know! Thanks for sharing I should have known there was an easier way.😃

Collapse
 
fm profile image
Fayaz • Edited

Yeah. It's the -n option of echo that removes the newline.