Exploring file types in Linux
I don't actually run a Linux desktop, strictly speaking - I use MobaXTerm on my Windows laptop to ssh in. Moba runs an X server, so I can open windows from the Linux machine as if they were native Windows ... windows.
(I feel that sentence got away from me a little.)
My Linux usage is probably slightly atypical, but I'm willing to bet there's quite a few of us doing that now.
Recently I had a problem getting Firefox to open a file manager window. Since it was opening a filer window, rather than a specific file type, the usual Firefox settings didn't help me.
Brief tangent... MIME types
If you don't want to know the why, skip to the next section. 😊
MIME is (strictly speaking) an email standard. MIME types are a general/specific pair describing the nature of a resource. For example:
It turns out that (a) the database of file types that's been built up is quite extensive, and (b) this is useful for helping programs other than email apps to know how to handle something.
We finally got there.
The MIME type of a directory?
(“What's an inode?” is a whole other post... the Wikipedia article will have to do for now!)
So - what I needed was to change the default program used to open that type. Enter xdg-mime:
xdg-mime default nemo.desktop inode/directory
(Note: the tool takes .desktop files rather than the program path.)
I also found a couple of other useful things:
file -biwill give you file’s best guess at a MIME type
xdg-openshould act like
opendoes on macOS, which is great as I find that really useful.
- There's a whole ton of stuff in this area if people are curious for more.
(Post image thanks to Alexander Sinn.)