Читать книгу Linux Bible - Christopher Negus - Страница 163
Finding files by size
ОглавлениеIf your disk is filling up and you want to find out where your biggest files are located, you can search your system by file size. The -size
option enables you to search for files that are exactly, smaller than, or larger than a selected size, as you can see in the following examples:
$ find /usr/share/ -size +10M $ find /mostlybig -size -1M $ find /bigdata -size +500M -size -5G -exec du -sh {} \; 4.1G /bigdata/images/rhel6.img 606M /bigdata/Fedora-16-i686-Live-Desktop.iso 560M /bigdata/dance2.avi
The first example in the preceding code finds files larger than 10MB. The second finds files less than 1MB. In the third example, I'm searching for files that are between 500MB and 5GB. This includes an example of the -exec
option (which I describe later) to run the du
command on each file to see its size.