查找linux的大文件

du -aBM 2>/dev/null | sort -nr | head -n 50 | more

效果:

cd /var
sudo du -aBM 2>/dev/null | sort -nr | head -n 10
7555M   .
6794M   ./lib
5902M   ./lib/mysql
3987M   ./lib/mysql/my_database_dir
1825M   ./lib/mysql/my_database_dir/a_big_table.ibd
997M    ./lib/mysql/my_database_dir/another_big_table.ibd
657M    ./log
629M    ./log/apache2
587M    ./log/apache2/ssl_access.log
273M    ./cache

du 参数:

sort 参数:

head 参数:

来源: 磁盘使用情况 - 查找大文件/目录以删除和释放空间的命令行方式是什么? - 询问Ubuntu — disk usage - What’s a command line way to find large files/directories to remove and free up space? - Ask Ubuntu

阅读量: | 柯西君_BingWong | 2024-04-23