Opening files from the Terminal in their default program

As a Mac OS X switcher, I’ve wanted an equivalent to the Mac OS X Terminal open command and came across xdg-open which pretty much behaves the same way. That’s too much to type though so I added an alias in my .bashrc file:

alias 'o'='xdg-open'

You can use whatever alias you like as long as it doesn’t conflict with an existing command.

Restart or reload your Terminal and you be able to open a file or directory in X from the command line.

For example:

#open a file    
$ o /path/to/text_file.txt

#open the current directory in Caja
$ o ./

Might save you some time and it’s useful for Mac switchers.

9 Likes

That is a really nice tip :smiley:

Great Tip :relaxed: It will be very useful