Lesson plan

File (command)

file is a shell command for reporting the type of data contained in a file. It is commonly supported in Unix and Unix-like operating systems. As the command uses relatively quick-running heuristics to determine file type, it can report misleading information. The command can be fooled, for example, by including a magic number in the content even if the rest of the content does not match what the magic number indicates. The command report cannot be taken as completely trustworthy. The Single UNIX Specification (SUS) requires the command to exhibit the following behavior with respect to the file specified via the command-line: # If the file cannot be read, or its Unix file type is undetermined, the command will report that the file was processed but its type was undetermined # The command must be able to determine the types directory, FIFO, socket, block special file, and character special file # A zero-length file is reported as such # An initial part of file is considered and the command is to use position-sensitive tests # The entire file is considered and the command is to use context-sensitive tests # Otherwise, the file is reported as a data file Position-sensitive tests are normally implemented by matching various locations within the file against a textual database of magic numbers (see the Usage section).…

Back to article

Article summary

file is a shell command for reporting the type of data contained in a file. It is commonly supported in Unix and Unix-like operating systems. As the command uses relatively quick-running heuristics to determine file type, it can report misleading information. The command can be fooled, for example, by including a magic number in the content even if the rest of the content does not match what the magic number indicates. The command report cannot be taken as completely trustworthy. The Single UNIX Specification (SUS) requires the command to exhibit the following behavior with respect to the file specified via the command-line: # If the file cannot be read, or its Unix file type is undetermined, the command will report that the file was processed but its type was undetermined # The command must be able to determine the types directory, FIFO, socket, block special file, and character special file # A zero-length file is reported as such # An initial part of file is considered and the command is to use position-sensitive tests # The entire file is considered and the command is to use context-sensitive tests # Otherwise, the file is reported as a data file Position-sensitive tests are normally implemented by matching various locations within the file against a textual database of magic numbers (see the Usage section).…

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.