2.16.3. Disk space analysis

Byconnecting to hosting via SSH, you can conduct a detailed analysis disk space using the commands below.

In commands:

  • To search not across the entire hosting account, but within a specific directory, specify the path to this directory instead of ~.
  • Instead 5 you can specify the number of files / directories to show in the results.

To view the five largest catalogs run the command:

du -smh ~/* | sort -rh | head -n 5

To view the five largest directories, including subdirectories, run the command:

du -Sh ~ | sort -rh | head -n 5

To view the five largest files and largest subdirectories in a given directory run the command:

du -sh ~/way/to/catalog/* | sort -rh | head -n 5

To view five largest files run the command:

find ~ -type f -exec du -Sh {} + | sort -rh | head -n 5

To view the five subdirectories of the current directory that take up the most inodes, run the command:

find . -xdev | cut -d "/" -f 2 | sort | uniq -c | sort -nr | head -n 5

To view five directories occupying the most inodes, including subdirectories, run the command:

find . -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -nr | head -n 5

To view the number of inodes occupied by the contents of the current directory (including subdirectories), run the command:

find . | wc -l
Content