Opening files from shell using the default application (xdg-open)
xdg-open is one of those commands that is so useful it suprises me how few people know about it.
After working with the terminal for some time, it becomes second nature to use it for everything. Using an actual file explorer feels slow and inefficient. There are some nice features present in file explorers that we might want to take with us though. One of them is the ability to open a file with the default application for that file type, whatever that might be.
A good example of this might be an archive file. You might be 10 levels deep inside some directory structure and want to open an archive with your default archive manager. The thing is, you can't for the life of you remember what that damn archive manager is called. This is where xdg-open comes into play.
The nugget
xdg-open some-file.ext
This will open some-file.ext with the default application for that type of file. Movies with a media player, images with your image viewer, text files with your favorite text editor and...
Folders with your favorite file explorer... That's right, the command
xdg-open .
will open the current directory using your default file explorer. This makes switching to and from the terminal especially easy!
