8 ms·
Another really useful command is the open $ open filename.png $ open . $ open -e filename.txt $ open -a Pixen filename.png The first command w
by adventureloop 13y ago
Another really useful command is the open
$ open filename.png
$ open .
$ open -e filename.txt
$ open -a Pixen filename.png
The first command will open the file with the default application.
Open . will open the current directory in finder, which I find very helpful.
The -e flag will open the file in textedit.
The -a will open the file in the given application name.
- panzi 13y agoUnder Linux there is a similar command: xdg-open
- richardwhiuk 13y agoor gnome-open. On Windows the equivalent is start (e.g. start C:\ )
- Someone 13y agoI use start all the time, but also frequently curse at its stupid argument grammar and its interaction with auto-quoting on auto-completion. For example, type start C:\Doc Next, hit tab to get start "C:\Documents and Settings" Now, hit return, and watch a new command window open with title "C:\Documents and Settings". Reason? If the first argument is a quoted string, it is used as the title of the window being opened (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true http://www.microsoft.com/resources/documentation/windows/xp/..., http://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program http://stackoverflow.com/questions/154075/using-the-dos-star...) If you ever use start in batch scripts, pass a dummy first argument of ""
- krallja 13y agoYou can use `explorer`, which doesn't exhibit this behavior: explorer "C:\Documents and Settings" does what you'd expect.
- panzi 13y agoI think xdg-open defers to gnome-open/kde-open/... depending on what DE is currently running. Not sure about that. Anyway, xdg-open should be installed anywhere where any kind of DE is installed.
- jlgaddis 13y agoFor the lazy: $ echo "alias o='xdg-open'" >> ~/.bashrc
- LinaLauneBaer 13y agoopen -n is also useful: Allows you to run two instances of the same app at a time.
- micampe 13y agoAlso very useful for similar use cases is qlmanage. $ qlmanage -p <file>
- mjs 13y agoThis seems to run whatever code usually runs when you hit [space] on a filename in a Finder window. (Except that it outputs a bunch of debugging information.) Under what circumstances is that any better or more useful than "open"?
- lexy0202 13y agoBecause it essentially acts like quick look for the terminal.
- micampe 13y agoCorrect (man 1 qlmanage). Depending on the type of file, it is usually faster to open quicklook than opening the file in its default application, especially if you just want to take a look and you don’t actually need to edit the file.
- cooper12 13y agoYou can hide the debugging info by redirecting the output streams. $ qlmanage -p <file> &>/dev/null