Forums

How to clear /tmp

Hi this might be a silly question but I wasn't able to find answer online easily

I have a script that runs selenium and it generates bunch of (useless) files in /tmp/ daily. I want to make a scheduled script that delets everything in tmp (my script doesn't store anything helpful in here so its fine).

I tried opening bash but if I navigate to /tmp and run ls i can't see anything, despite seeing files/folders in 'Files' page. even if I run 'rm -r -f *' nothing changes

Can someone help me with a cleanup.sh bash script that will automate this?

If ls does not show files, they may be hidden - use ls -a to include hidden files in your ls output. Then, if you want to delete hidden files, use rm -rf .*

thank you! solved

Glad we could help!