Open Files from Command Line on OS X
I'm as much of a fan of application UIs as anyone else but I'm finding myself working more and more from the command line lately. Much of that is becoming obsessed with media manipulation but I'm forcing myself to use less UIs so that I can understand what's under the hood of my favorite utilities.
One common case for running any app is opening an existing file, like an HTML file in a browser or a document in Pages. To open a file on Mac OS X from the command line, type the following:
open portrait.png
The above does not specify an app to open the given file in -- the default app for that file type will be used. To open a file in a specific app, use the -a
argument:
open -a /Applications/Firefox.app portrait.png
You can also open a URL directly from the command line:
open https://davidwalsh.name/
You'd expect opening a file from command line to be easy and I'm happy to confirm to you that it is.
Client-side APIs on mobile and desktop devices are quickly providing the same APIs. Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop. One of those APIs is the getUserMedia API...
I spent a few months experimenting with different approaches for writing simple, elegant and maintainable media queries with Sass. Each solution had something that I really liked, but I couldn't find one that covered everything I needed to do, so I ventured into creating my...
More often than not, I find myself wanting to upload more than one file at a time. Having to use multiple "file" INPUT elements is annoying, slow, and inefficient. And if I hate them, I can't imagine how annoyed my users would be. Luckily Safari, Chrome...
Let's be honest: even though we all giggle about how cheap of a thrill JavaScript accordions have become on the web, they remain an effective, useful widget. Lots of content, small amount of space. Dojo's Dijit library provides an incredibly simply method by which you can...
I was just wondering how to do this, thanks!
When you use
-a
, you don’t need to write the path.…would do the same. :)
The
-a
handler is great when you want to open some program one doesn’t really know (eg remember) exactly where it is.Like:
// that one is in /System/Library/CoreServices