Someday, you found that your linux server is out of space, and you need to digout what happened. To find the biggest files or directories in Linux, you can use the du (disk usage) and find commands. Here are some examples: Finding the Largest Files in a Directory: To find the larg...
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...
For example, we can run this script on the /usr/lib directory to find out the largest file in that directory: $ cp find_largest_file.sh /usr/lib/find_largest_file.sh $ ./find_largest_file.sh 92107656 x86_64-linux-gnu/libwireshark.so.13.0.3 The first command uses the cp tool to...
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. Advertisеment In one of our previous articles, we saw in detailHow to see the disk space usage for...
Here’s an example command using the “find” command to find the largest files on a Linux system: find $HOME -type f -printf '%s %p\n' | sort -nr | head -10 Please takenotethat you can either use “/” to search the entire system or replace “$HOME” with the directory you ...
There is not a single command in Linux to help us with this task, but we will use a combination of find, du, sort, and head command to recursively find and delete largest files and directories fast. If you don’t know the du command stands for disk usage and print size of each file...
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 ...
Read:How to find the largest files on Linux Use the stat command with awk: Here’s the command: find /path/to/directory -type f -exec stat -c%s {} + | awk ‘{sum+=$1} END {print sum/1024/1024 ” MB”}’ This method uses find to search for all files (-type f) in the ...
The du command performs a file size assessment within the home directory. This assessment data is then sorted using the sort command. Finally, the head argument constrains the output to only the top 20 largest files. How do I find 10 largest directories in Linux?
find-files-directories-particular-folder-linux (3) 从目录中按文件名查找文件 要在特定目录中按名称...