Middle
How to view disk usage on a server and how much space a specific folder occupies?
sobes.tech AI
Answer from AI
To view disk usage on a Linux server, the df command is usually used:
df -h
The -h option displays sizes in a human-readable format (KB, MB, GB).
To find out how much space a specific folder occupies, use the du command:
du -sh /path/to/folder
The -s option summarizes the total size, and -h makes the output human-readable.
If you want to see the size of all nested folders inside, you can run:
du -h --max-depth=1 /path/to/folder
This will show the size of each first-level folder within the specified directory.