Wednesday, 1 September 2010

MacOSX: Opening documents, folders, and applications from the command line

The Mac OSX command line has a very handy 'open' cp,,amd which tells the Mac OS UI to open the item you pass in. This is great for switching from using the terminal to using the UI for those times when the UI is more convenient.

Open the current folder in Finder
open .


Open a file using the default application
open mydoc.txt


Open a file a specific application
This is the same command as right-clicking on an item in finder and choosing 'Open With'. It can be really handy for testing an html file in a specific browser.

open -a /Applications/Safari.app index.html

No comments:

Post a Comment