pwd

How to copy the macOS Terminal path to the clipboard alvin May 15, 2017 - 9:24am

If you want to copy the current macOS Terminal path to the clipboard, you can do it with this simple command:

$ pwd | pbcopy

pwd prints the path to STDOUT, and pbcopy reads that and copies it to the macOS clipboard. Once the path is on the clipboard you can paste it into your other applications.

Of course you can also create an alias, like this:

alias path="pwd | pbcopy"

The Linux pwd command (and Linux command line prompts)

Linux current directory FAQ: How do I show what directory I'm currently in on a Unix or Linux system?

Just use the Unix/Linux pwd command, like this:

pwd

If you're in a directory named /home/al, the output looks like this:

$ pwd
/home/al

If you're in a directory named /tmp, the output looks like this:

$ pwd
/tmp

That's all there is to the pwd command.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

A long Unix "file management" tutorial page

If you happen to be looking for a collection of Unix "file management" commands, look no further than the Unix/Linux file management page of my "Introduction to Unix" tutorial.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.