What command can be used to view the disk usage of a specific 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 view the disk usage of a specific directory is "du -h." The "du" stands for "disk usage," and when invoked with the "-h" option, it presents the sizes in a human-readable format, using suffixes like K, M, G for kilobytes, megabytes, and gigabytes, respectively.

When you run "du -h /path/to/directory," it calculates the space used by the specified directory and its subdirectories, providing a clear view of how much disk space each part is consuming. This is particularly useful for managing storage and identifying which directories are using the most space, enabling efficient disk usage monitoring and management.

The other commands listed do not serve this purpose. "df -h" shows disk space usage for mounted file systems, rather than specific directories. "ls -l" lists files in a directory along with their permissions and other information but does not summarize the total disk usage. "free -m" displays information about memory usage, not disk space.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy