702-100 practice question 5 of 15

A file called mybackup is found while investigating a USB pen drive. Which utility can be used to determine the kind of data that is contained in that file?

Full set: 60 questions
Answer options
A: file mybackup Correct answer
B: Is -1 mybackup
C: tar -t mybackup
D: whatis mybackup
E: touch mybackup
Correct Answer:
A. file mybackup
Explanation

The file command is the standard Linux utility designed to determine the type of a file. It operates by performing a series of tests on the file's content. The primary test involves checking the file's header for "magic numbers," which are unique byte sequences that identify specific file formats (e.g., an ELF executable, a JPEG image, or a gzip compressed archive). This allows an investigator to identify the nature of the data within the mybackup file, regardless of its name or extension, which directly addresses the question's objective.

Why Incorrect

ls -l mybackup: This command lists file metadata such as permissions, size, and modification times, but does not inspect the file's content to determine its data type. tar -t mybackup: This command is specific to tar archives and lists their contents. It would fail or give an error if mybackup is not a tarball. whatis mybackup: This utility searches the manual page database for a command named mybackup, which is irrelevant for identifying the type of a user-created data file. touch mybackup: This command is used to update a file's access and modification timestamps or to create an empty file; it provides no information about the file's content. ---

References

1. file(1) - Linux man page: "This manual page documents version 5.41 of the file command. file tests each argument in an attempt to classify it. There are three sets of tests, performed in this order: filesystem tests, magic tests, and language tests. The first test that succeeds causes the file type to be printed."

Source: man file command output from a standard Linux distribution (e.g., Debian, Red Hat) or online man page repositories.

2. The GNU File Utilities Documentation: "The file command is a utility for determining the type of a file. It does this by examining the file's contents."

Source: GNU Coreutils manual, file invocation section.

3. MIT OpenCourseWare, 6.005 Software Construction, Fall 2016: In the context of command-line tools, the course material states: "The file command can tell you what kind of data is in a file."

Source: MIT OCW, 6.005, Fall 2016, Reading 19: Version Control. (This demonstrates the command's fundamental purpose in an academic context).

Scroll to Top