Hacker News new | past | comments | ask | show | jobs | submit
Few additions.

open -n file.pdf : opens new instance of Preview application which is useful if you want to open the same file twice (for example to look at different pages at once).

caffeinate -d : prevents display turning off, useful if you want to look at display without moving mouse.

loading story #42069659
I use this all the time:

open -a <GUI Application> <File>

Handy for distinguishing between editing and consuming media.

open -a is nice, i use it with alias, ex:

  alias qt='open -a "quicktime player"'
  alias vlc='open -a "vlc"'
loading story #42064357
open -a "Finder" . - open Finder in the current directory.

Standard apps usually just need the name, like Finder and Safari but you can also specify the path "/Applications/DifferentFinder.app"

loading story #42064242
loading story #42065860
loading story #42066681
loading story #42065896
loading story #42068855
Also, `cd .` to open the current directory in a Finder window.

Not mine (found online years ago), but here's the opposite. `cd` into the frontmost Finder window:

  cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')";
loading story #42062836
loading story #42064862
Does `open` give focus? It used to, but since a few releases ago the app opens in the background, which is pretty annoying.

My poor workaround is to use osascript: `tell application "System Events" to set frontmost of process "Finder" to true`

loading story #42060712
loading story #42068883
`caffeinate -disu` is the best combination (that is, enable all options): your laptop won't go to sleep, won't dim the screem etc.
loading story #42068484