We all know(or will know one day) that Ubuntu(or GNU/Linux in general) does not work with extensions of file to recognize what kind of file it is.Rather it uses Magic Numbers.
A Magic Number is a number associate with every Linux file and is generally the first few bytes of the file, which identifies the file type. It is used by the Linux command line utility file which displays the information related to a file.
So when we check a file type with the file
command, it gives appropriate file type regardless of it's extensions.
So a mp3 file gives
aditya@aditya-desktop:~/Music$ file 'music.mp3'
music.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 64 kbps, 44.1 kHz, JntStereo
aditya@aditya-desktop:~/Music$ file 'music'
music: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 64 kbps, 44.1 kHz, JntStereo
aditya@aditya-desktop:~/Music$ file 'music.txt'
music.txt: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 64 kbps, 44.1 kHz, JntStereo
aditya@aditya-desktop:~/Music$
The same expt , when tried with Nautilus, it considers the file a music file when it has .mp3 or no extension, but when it is given .txt extension, it considers it a text file.
So the main question,
- Does nautilus use extensions to recognize file?
- How can I force nautilus to ignore extensions and use magic numbers?