Sometimes, Linux users may need to find the largest directory or the largest file on their disk drive. You can find this quickly with a single command. Let's see how it can be done. In one of our previous articles, we saw in detailHow to see the disk space usage for a file or fo...
--size print the allocated size of each file, in blocks-S sort byfilesize, largest first--sort=WORD sort by WORD instead of name: none (-U), size (-S),time(-t), version (-v), extension (-X)--time=WORD with -l, show time as WORD instead of defaultmodificationtime: atime...
To find the largest files on your system, you can use a command line tool such as “du” (short for disk usage). The “du” command shows the size of each file and directory in the current directory and its subdirectories. By using some options with the “du” command, you can sort...
Use ‘-size’ option in find command to search files based on the size. Run following command to find all files whose size is exactly 50MB. 使用-size 选项根据文件大小进行搜索 查找等于 50MB 的文件 $ find $HOME -size 50M /home/linuxtechi/dbstuff $ 查找大于 50MB 的文件 $ find $HOME ...
4. Find the largest files in a particular location or directory for example /var/log. # find /var/log -type f -exec du -Sh {} + | sort -rh | head -n 10 78M /var/log/nginx/ehowstuff.local.error.log-20160907 6.1M /var/log/audit/audit.log.2 ...
du apparent size By default, thedu command showsthe disk space used by the directory or file`. To findthe apparent size of a directory, use the--apparent-size option. The “apparent size” of a file ishow much...
Sometimes, Linux users may need to find the largest directory or the largest file on their disk drive. You can find this quickly with a single command.
Specifically, we can use the ls command with the -lS option to make the command list the files by their size in descending order. Then, to get the largest file, we take the first row of the output. For example, here’s how we can find the largest file in the /usr/bin directory ...
# find /home/tecmint/Downloads/ -type f -printf "%s %p\n" | sort -rn | head -n 5 Find the Top File Size in a Specific Location The above command will display the largest file from/home/tecmint/Downloadsdirectory. That’s all for now. Finding the biggest files and folders is no ...
find . -type f -size +100M 2.Use the same command, but this time specify a path to search.We can run the same command as in the previous section but replace the “.” with a specified path. This means we can search thetestdirectory from thehomedirectory. ...