Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
printf "$PWD" | pbcopy or printf "$(pwd)" | pbcopy will eliminate the trailing newline. – Dennis Williamson Jan 10 '11 at 7:56

Your Answer


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.