문제

Hi with a (bad) script of mine I filled up lots of files in /tmp folder. Now when I do ls in tmp folder it doesn't return anything (i waited for more than an hour). Hence I am not able to cleanup the directory. I tried reboot as well. I can see the tmpwatch is running but it is either too slow or not working at all.

Is there any (quick) way I can clean up /tmp files?

도움이 되었습니까?

해결책

How about:

find /tmp !-user root -delete

you can add -mtime <gracedays> switch if you want and cron it

다른 팁

If you have an idea of the filename structure you can do something like:

find . -name "stuff*" -exec rm {} \;

To clean up old php sessions in my tmp dir, I have find . -name "sess_*" -atime +1h -exec rm {} \; in a cron job.

If you're using rm, you might get an error that there are too many files, which is why

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top