Can all files under /tmp be safely removed

I wanted to know whether all files under /tmp can be safely removed. I guess that /tmp may also have temporary files for applications currently being worked on, so at the most those applications may just shut down.

I hope that my question is clear whether all files under /tmp can be safely removed.

Please revert with the reply to my query.

Regards

Usually cleaning up /tmp is done at (shutdown or) reboot time... to avoid embarasing situations... So "All" files isnt a good idea at all...

1 Like

As an addendum to vbe's reply...

Short answer - No!

If however you know EXACTLY what the temporary files are, and, are for, then you can
delete those particular temporary files at your leisure.

1 Like

RedHat has a tool "tmpwatch" for a relative safe cleaning.

rpm -q tmpwatch
ls -l /etc/cron.daily/tmpwatch
file /etc/cron.daily/tmpwatch

The script has hard-coded 10 days for /tmp. You can change to e.g. 1 day.

1 Like

Thanks for your reply. I was wondering why I did not receive the mail notification for your reply.

From which reply? You only get notified once for each subscribed thread until you visit the forums again.

1 Like