Code Yarns ‍👨‍💻
Tech Blog ❖ Personal Blog

How to open any file from the shell using xdg-open

📅 2013-Jun-05 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ xdg-open ⬩ 📚 Archive

The shell is great for working with text files. But, it would be convenient if you could open files of other types, like images, presentations or PDF files from the shell too.

Thankfully, this is possible because of the xdg-open program. This program can be used to open any file that could be opened on the desktop. It just opens the file using the default application that is registered for the type of the file you are opening. I find it convenient to alias this program name to a simpler and smaller name like op.

Tried with:  xdg-open 1.0.2 and Ubuntu 12.04 LTS