Release and recycle disk space on Linux
未在使用的文件删除
rm -f filename
如果该文件句柄正在被打开/写入,直接rm
会导致磁盘空间并没有释放,可以考虑通过重定向方式释放文件空间。
正在使用的文件清空
cat /dev/null > filename
: > filename
> filename
echo "" > filename
echo > filename
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here