open -a Terminal /The -a option, when used with the open command, allows you to define which application that the item defined in the following position will open in. For example, you could open an XML file in Xcode
open -a Xcode /usr/share/postgresql/pg_hba.conf.sampleYou could then open Terminal by passing other commands into the command. For example, to open a new Terminal window to the current working directory:
open -a Terminal `pwd`Of course, you could accomplish the same thing with:
open -a Terminal .Or pass the output of other commands through the open command. For example, the following command opens a new file in TextEdit that contains the output of an ls command:
ls | open -fAdding -g to any of this leaves the new window in the background rather than bringing it to the foreground, which is the default behavior. Finally, open can also be used to open URLs, but I’ve covered that sort of use for open in the past.
krypted December 21st, 2011
Posted In: Mac OS X