View the size of each folder linux Linux view folder size command

View the size of each folder linux
Linux view folder size command
View the space occupied by each file and folder in the current directory
du -sh *
View directory usage
df -h /opt

View current directory file and folder size
depth indicates that only one level of folder size is displayed, that is, the depth is 1
du -h –max-depth=1
du -h –max-depth=1 /home/docker

View the total size of a directory
du -sh ./ # View the total size of the current directory
du -sh /home/docker

View the size of files in a directory and sort them
du -sh *|sort -n # This cannot be sorted normally, need to remove -h
du -s *|sort -n
du -s *|sort -nr # reverse sort
du -s *|sort -n |head -5 # the first five largest
du -s *|sort -n |tail -5 # last five smallest

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.