-
How to find large files in Linux using command line
Posted on September 10th, 2008 No commentsLinux find command is used to search for files on the hard disk. A few days back, one of the partitions on my hard disk filled up to 99% with only a few hundred mega bytes free space remaining. So I wanted to find out which files were taking up maximum space on this partition and also figure out if I can delete any of them.
In Linux, finding large files is quite easy and can be accomplished from the console using the
findcommand as follows :$ find <path> -size +10000k -print0 | xargs -0 ls -l
In the above find command,
<path>is the path of the directory or mount point which you want to search. The+(plus) sign preceding the 10000k figure tells find that it should search for all files which are over the 10 MB size.-print0tells find to print the full file name on standard output followed by a null character instead of the newline character that-printuses. This allows file names that contain newlines or other types of white space to be correctly interpreted by programs that process the find output. This option corresponds to the-0option ofxargs.The output of the
findcommand is piped to thexargscommand.For example, to conduct the above search in the directory
/media/windowson my hard drive, I can run the following command(s) :$ find /media/windows -size +10000k -print0 | xargs -0 ls -l
So the next time you want to know which files on your hard disk are using up the most space, you can rely on the Linux find command.
Related Posts
- Search for files in Linux using the locate command
- Print files with line numbers for each line in Linux
- Mogrify – How to resize images from the command line
- How to print a man page from the command line in Linux
- tar command in Linux










