What command would you use to measure the disk usage of a directory?

Prepare for the Linux Professional Institute Certification Level 1. Use flashcards and multiple choice questions, complete with hints and explanations. Enhance your understanding and get ready to ace the exam!

The command used to measure the disk usage of a directory is 'du'. This command stands for "disk usage" and provides a way to estimate the space used by files and directories. When you run 'du' with a specific directory as an argument, it calculates the total size of that directory, including all of its subdirectories and files, and reports the result in a human-readable format.

For example, executing 'du -sh /path/to/directory' will display the total size of the specified directory, where the '-s' option signifies "summary" (show only the total size), and the '-h' option makes the output human-readable by using appropriate size units (KB, MB, GB, etc.).

In contrast, other options such as 'df' provide information about disk space usage on file systems rather than specific directories, while 'diskusage' and 'size' are not standard Linux commands for measuring disk usage. Therefore, 'du' is definitively the appropriate choice for this task.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy