File Type Definitions

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
anakirob
Level 1
Level 1
Posts: 12
Joined: Sat Sep 17, 2016 4:42 am

File Type Definitions

Post by anakirob »

How do I add/edit file type definitions in Linux? Surely it's possible, Linux must store this information somewhere! We're not Windows users who rely on three letter suffixes to identify everything now are we?

What I want to do is to check a file for a specific header string and then correctly identify that file in the file manager, and of course then open the corresponding application when double clicked. Where in the Linux Mint file system is this file type information located?

Any help would be greatly appreciated, Thanks.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rickNS
Level 9
Level 9
Posts: 2968
Joined: Tue Jan 25, 2011 11:59 pm

Re: File Type Definitions

Post by rickNS »

Linux knows what type a file is with, or without any extension. It will also (in most cases) know which software to use to open a file with, or without any extension.
anakirob wrote: Sat Sep 18, 2021 9:23 pm What I want to do is to check a file for a specific header string and then correctly identify that file in the file manager
You can get that information in the file manager by right clicking, then selecting "Properties".
If you use the icon view mode, the icon itself will tell you the type in many cases.

You can get that information in terminal by using the file command, file /path/to/file_name

Code: Select all

file ~/Documents/bike-trick-rider
/home/rick/Documents/bike-trick-rider: ASCII text
"How do I add/edit file type definitions in Linux? Surely it's possible,"
Maybe, but I don't know where.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
User avatar
deck_luck
Level 7
Level 7
Posts: 1577
Joined: Mon May 27, 2019 6:57 pm
Location: R-4808 North

Re: File Type Definitions

Post by deck_luck »

Alternately, you can associate a file with an application by right clicking the file and select "open with" and "open with Other Application" options. After selecting the appropriate application, you can select the "Use as default for this kind of file" check box.

It is surprising the file command would not recognize a file type unless it is totally custom code with a custom magic identity. Does the file command determine the appropriate file type?
🐧Linux Mint 20.3 XFCE (UEFI - Secure Boot Enabled) dual boot with Windows 11

Give a friend a fish, and you feed them for a day. Teach a friend how to fish, and you feed them for a lifetime. ✝️
anakirob
Level 1
Level 1
Posts: 12
Joined: Sat Sep 17, 2016 4:42 am

Re: File Type Definitions

Post by anakirob »

deck_luck wrote: Sun Sep 19, 2021 12:09 am It is surprising the file command would not recognize a file type unless it is totally custom code with a custom magic identity. Does the file command determine the appropriate file type?
Yes, the file command does correctly identify the files. However the file browser does not :(
User avatar
deck_luck
Level 7
Level 7
Posts: 1577
Joined: Mon May 27, 2019 6:57 pm
Location: R-4808 North

Re: File Type Definitions

Post by deck_luck »

anakirob wrote: Sun Sep 19, 2021 1:13 am ...
Yes, the file command does correctly identify the files. However the file browser does not :(
Are you able to associate a file to an application using the previous file browser right click instructions. If not, which file browser are you using, and what is the file type?

Sorry, RichNS I guess we were both replying to original post at the same time. I was slow about committing (dang typos) mine. :roll:
🐧Linux Mint 20.3 XFCE (UEFI - Secure Boot Enabled) dual boot with Windows 11

Give a friend a fish, and you feed them for a day. Teach a friend how to fish, and you feed them for a lifetime. ✝️
anakirob
Level 1
Level 1
Posts: 12
Joined: Sat Sep 17, 2016 4:42 am

Re: File Type Definitions

Post by anakirob »

deck_luck wrote: Sun Sep 19, 2021 2:41 am Are you able to associate a file to an application using the previous file browser right click instructions. If not, which file browser are you using, and what is the file type?
I am using the default file browser that comes with MATE, sorry I'm not sure of the exact name.

The files which are giving me the most grief are AHX music modules, which use a THX prefix by default when created in the AHX tracker program on an Amiga. No I am not able to associate an application with them unless I change the prefix to a suffix. The file browser is obviously identifying these files by the filename suffix and not the header.

But also the IFF suffix is used for both ILBM images and 8SVX samples and the default file browser identifies them both as IFF images.

The file command can correctly identify all of these files and more, but the file browser cannot :(
User avatar
deck_luck
Level 7
Level 7
Posts: 1577
Joined: Mon May 27, 2019 6:57 pm
Location: R-4808 North

Re: File Type Definitions

Post by deck_luck »

I use XFCE with Thunar, and I do not have access to a MATE machine. You might get a quicker response moving the thread to the MATE Section of the forum. If you do no know how to move the thread ask one of the moderators.
🐧Linux Mint 20.3 XFCE (UEFI - Secure Boot Enabled) dual boot with Windows 11

Give a friend a fish, and you feed them for a day. Teach a friend how to fish, and you feed them for a lifetime. ✝️
Locked

Return to “Beginner Questions”