在CentOS系统中,你可以使用find命令来查找大文件,并使用rm命令来删除它们。以下是一些示例:
find /path/to/directory -type f -size +100M 将/path/to/directory替换为你想要搜索的目录路径。
find /path/to/directory -type f -size +100M -exec rm -f {} \; 这将删除所有满足条件的文件。请注意,这个操作是不可逆的,所以在执行之前请确保你真的想要删除这些文件。
.log文件,可以使用以下命令:find /path/to/directory -type f -name "*.log" -size +100M -exec rm -f {} \; 这将删除所有大于100MB的.log文件。
find /path/to/directory -type f -size +100M -exec ls -lh {} \; | sort -rh -k5 这将显示所有大于100MB的文件,按照文件大小降序排列。
在执行删除操作之前,请确保你已经备份了重要数据,以防万一。