Write a command-line program to determine file type under Unix | Homework Helper

Write a command-line program to determine file type under Unix
When running your program with a file name as the input parameter, it should return the type of the file, such as ‘text file’, ‘executable file’, ‘C source code’, etc.
There are four possible ways to determine the type of a file:
Comparing the file extension to a list of known extensions;
By reading the first byte of the file and comparing it to a list of existing magic code;
Examining the return from a stat() system call;
For text files, read the contents of the file and try to figure it out;
For the purpose of this homework, you don’t have to implement all of the above four. Two will suffice. Any file that can’t be recognized should show ‘unknown type’.
Submit your source code and a test run result (either a ‘script’ file, or a screenshot).

Don't use plagiarized sources. Get Your Custom Essay on
Write a command-line program to determine file type under Unix | Homework Helper
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay
superadmin

Recent Posts

LDR 3302-21.01.01-1A24-S1, Organizational Theory and Behavior

LDR 3302-21.01.01-1A24-S1, Organizational Theory and Behavior Unit III Essay Top of Form Bottom of Form…

2 years ago

Psychology Question | My Essay Helpers

Chapter 9 What are teratogens? Give 5 examples. Define each of these stages: Germinal, embryonic,…

3 years ago

Financial Market Analysis | My Essay Helpers

You are a Financial Analyst that has been appointed to lead a team in the…

3 years ago

Decision theory | My Essay Helpers

This week’s discussion will focus on management decision-making and control in two companies, American corporation…

3 years ago

Literature Question | My Essay Helpers

Mary Rowlandson felt that the man who eventually came to own her, Quinnapin, was “the…

3 years ago