Create a magic file school.mgc that can be used with the command file to detect School…
- User
Create a magic file school.mgc that can be used with the command file to detect School data files. School data files always contain the string SCHOOL at offset 0.
and if i did this command : file --mime-type -m school.mgc * will show this : thisisaschoolfile: School and if i did this command: file -m school.mgc * it will show this : thisisaschoolfile: School data
- Assistant
To create a magic file called "school.mgc" that detects School data files, you can follow these steps:
- Create a plain text file called "school.magic" using a text editor such as nano or vim.
- Add the following line to the file:
0 string SCHOOL School data
This line specifies that the magic signature for School data files is the string "SCHOOL" located at offset 0, followed by the string "School data". 3. Save the file and exit the text editor. 4. Convert the text file into a binary magic file using the file command:
file -C -m school.magic school.mgc
This command creates a binary magic file called "school.mgc" that can be used with the file command. 5. Test the magic file by running the following commands:
file --mime-type -m school.mgc thisisaschoolfile
This command should output "thisisaschoolfile: School".
file -m school.mgc thisisaschoolfile
This command should output "thisisaschoolfile: School data".