Sort folders by directory size

  • Sort folders by directory size
du -hs * | sort -rh
  • du -hs : The du command is used to calculate the disk usage of a folder. The -h parameter displays the folder sizes in a human-readable format, and the -s parameter summarizes the total size of each folder. Indicates operating on all folders in the current directory.
  • sort -rh: The sort command sorts the input. The -r parameter means sorting in reverse order (largest to smallest), and the -h parameter means sorting in human-readable format (for example, 1K, 2M, 3G). This ensures that the folder sizes are sorted in a format suitable for reading.

Guess you like

Origin blog.csdn.net/u010953692/article/details/133313872