how to find largest file?

Answer Posted / souravpoddar

There is no simple command available to find out the largest files/directories on a Linux/UNIX/BSD filesystem. However, combination of following three commands (using pipes) you can easily find out list of largest files:

du command : Estimate file space usage.
sort command : Sort lines of text files or given input data.
head command : Output the first part of files i.e. to display first 10 largest file.
find command : Search file.
Type the following command at the shell prompt to find out top 10 largest file/directories:
# du -a /var | sort -n -r | head -n 10

Sample outputs:

1008372 /var
313236 /var/www
253964 /var/log
192544 /var/lib
152628 /var/spool
152508 /var/spool/squid
136524 /var/spool/squid/00
95736 /var/log/mrtg.log
74688 /var/log/squid
62544 /var/cache

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name the various commands that are used for the user information in unix.

543


Write a command to display a file’s contents in various formats?

629


How to display no of records in oracle using unix command?

591


How can we use grep command in unix?

621


What does pipe () return?

599






What are filter commands in unix?

555


Who command in unix?

579


how to sort the content of the file based on numeric values

1256


What is the behavioural difference between cmp and diff commands?

682


Why is it called grep?

565


What is the size of time_t?

655


What is {} in find command?

584


What are reported commands?

570


What is the command to compare two files in unix?

625


What are bash commands?

601