As the question goes, how does Ubuntu know what file type a file without extension is?
When I save a file as "Untitled Document" without any extension, how does it know? Same thing for video and music formats...
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
The file(1) command identifies the type of a file using, among other tests, a test for whether the file contains certain ''magic patterns''. The file /usr/share/misc/magic specifies what patterns are to be tested for, what message or MIME type to print if a particular pattern is found, and additional information to extract from the file.