What command can you use to display the disk usage of files and directories?

Prepare for the LPIC-2 Certification Test with our study tools, including flashcards and multiple choice questions with hints and explanations. Get ready to pass your exam!

The command used to display the disk usage of files and directories is "du." This command stands for "disk usage" and provides a summary of the amount of disk space used by specific files and directories. When you run "du" in the terminal, it calculates and presents the sizes of files and directories within the specified path (or the current directory if no path is provided).

By default, "du" shows the usage of each individual file and subdirectory, which can help users understand how much disk space each item is consuming. You can also use various options with "du" to format the output, show totals, or provide human-readable sizes (e.g., displaying sizes in kilobytes or megabytes).

The other commands, while related to disk usage and file attributes, serve different purposes. "df" is used to report the system's disk space usage for filesystems, "ls -lh" lists files in a directory along with their sizes in a human-readable format, but does not summarize cumulative disk usage, and "stat" provides detailed information about the attributes of a particular file, such as its size, creation date, and permissions, rather than overall disk usage.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy