Linux – How to delete everything in the /tmp/ folder

linuxtmpunix

I do "sudo rm *" and it does not remove everything. (I probably have lots of objects in there which I don't need.)

I'm not asking whether it's ok to remove everything in tmp – i'm asking how to do it 🙂

Is there a shell script that can do it?

Best Answer

You shouldn't do that, since there may be unix sockets in use (or needed) there, etc.

But still, if you wish:

rm -rf /tmp/*