Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Sign in to follow this  
glaukos

LinuxStories: How to Find Out Top Directories and Files (Disk Space) in Linux

Recommended Posts

1. Run the following command to find out top biggest directories under /home partition.  

# du -a /home | sort -n -r | head -n 5

2. If you want to display the biggest directories in the current working directory, run 

# du -a | sort -n -r | head -n 5

3. Some of you would like to display the above result in human readable format. i.e you might want to display the largest files in KB, MB, or GB. 

# du -hs * | sort -rh | head -5

4. To display the largest folders/files including the sub-directories, run: 

# du -Sh | sort -rh | head -5

5. To find the largest 10 files (linux/bash) 

find . -type f -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

6. To find the largest 10 directories: 

find . -type d -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

Only difference is -type {d:f}

d = directory
f = files

View the full article

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×