I add this to my .zshrc, .bashrc, etc… files to quickly copy directory paths from the command line:

alias pwc="pwd | tr -d '\n' | pbcopy"

It runs pwd, clips the newline off then sends it to the pasteboard (aka clipboard).

Super handy.


Side note: "pwd" stands for "print working directory". Using "cwd" would make more sense grammatically (i.e. "copy working directory") but the keystrokes are cumbersome. Hence, I use "pwc". Your mileage may vary. Season to taste.