- Drag a file onto the terminal to get its path put on the command line
- In the Finder
⇧⌘G
gives a dialogue box to open a location, that can use tab completion. - Pressing
/
or⇧⌘G
in any file picker dialogue will give you the same file location dialogue box. - Show/hides hidden files in a save dialogue box:
⇧⌘.
You need this. Like now.
Why are you waiting? Install Homebrew
pbpaste
: output contents of the “pasteboard” to STDOUT
pbcopy
: write STDIN
to the pasteboard
Open a file or folder, as if it has been double clicked on in the Finder. Or a URL in the correct application.
Common uses:
open . # open current working directory in Finder
open -a Mail some-file.txt # open Mail.app, creating a new blank message with some-file.txt as an attachment
open http://daringfireball.net/ # open the most essential website for all Apple related news
open -a MyFavoriteEditor -W -n # -W: wait until quit, -n: open new instance. This is suitable to use for your VISUAL or EDITOR
More from Brett Terpstra on open(1)
Text to speech from the command line.
If there is an xkcd cartoon on the topic, you know that it’s worth knowing about.
Keep your mac from sleeping, or wake it if it is asleep.
defaults write com.apple.screencapture location ~/Screenshots
TidBITS has more on Quick Look, including plugins for other file types.
Search spotlight database.
mdfind -name query # search file names only
mdfind -0 # ASCII NUL after each file for piping output to other utils like `xargs -0`
mdfind -onlyin ../path/to/dir # limit search to specified directory
Open Quick Look from the command line. (This is one you might want to make a bash alias for).
qlmanage -p my-pretty-picture.jpg
alias qlook 'qlmanage -p' # create bash alias
Apple Support has a primer on Quick Look, in case you don’t know about.