Sobes.tech
Junior — Middle

How can disk space usage on a system be determined?

sobes.tech AI

Answer from AI

To determine disk space usage in the system, you can use standard utilities:

  • In Linux/macOS, the command df -h shows the total and available disk space in a human-readable format.
  • The du command allows you to find out the size of specific directories or files.

Example:

df -h
# Show disk usage by partitions

du -sh /var/log
# Show the size of the /var/log directory

In Windows, you can use dir or graphical tools, as well as PowerShell cmdlets, for example:

Get-PSDrive
# Show disk usage