Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

largest Files on system

Status
Not open for further replies.

mcrook

Technical User
Jul 2, 2004
1
GB
I need to list the largest files that are present on my system. Is there any script that anyone knows of,can point me to etc that will do this ?

 
# ls -A . | while read name; do du -sk $name; done | sort -nr

This command sorts disk usage for all files in the current directory by size, in
decreasing order. If the file we suspect happens to be a directory, we can then
change into that directory, and re-run the preceding command to determine
what is taking up space within that directory. Continue these steps until you find the
desired file or files, at which point you can take appropriate actions.

OR

Large files can be located with the find command. For example,
to find all files in the root (/) directory
larger than 1 MB, type the following command:

find / -xdev -size +2048 -ls |sort -r +6

This will find all files greater than 1 MB and sort them in reverse
order with the largest files first.

I am sure there are lots of other ways to do it also? Maybe someone has a script
If I remember correctly there was a post in March 2002 that had a script I think it was March 22.........
 
I like to use:
Code:
du -sk * | sort -n
Which will display the size of all files and directories in the current directory with the biggest being at the bottom. If the bottom-most item is a directory, then cd into that directory and run the du command again. Keep drilling down until you find the biggest files on your system. Einstein47
(How come we never see the headline, "Psychic Wins Lottery"?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top