Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When working with files on my mac I employ a mixed approach of shell/finder or keyboard/mouse, similar to working with 4NT and Explorer on Windows.

One thing I use(d) extensively on Windows is to copy the path of the current directory to the clipboard. This is an extended feature of TakeCommand by JPSoft, on Windows.

Is there a way to copy the current path from the bash shell to the mac's clipboard, so I can use it in 'file open' and/or similar dialogues?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
printf "$PWD" | pbcopy

There's also the program pbpaste that pastes (pb = pasteboard, i.e. clipboard).


Use Cmd-Shift-G in open file dialogs to insert that path.


Thanks to Dennis Williamson for the printf hint.

share|improve this answer
2  
printf "$PWD" | pbcopy or printf "$(pwd)" | pbcopy will eliminate the trailing newline. –  Dennis Williamson Jan 10 '11 at 7:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.