1

I've tried executing 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 is OK to remove everything in /tmp, I'm asking how to do it. Is there a shell script that can do it?

1

You can use

rm -rf *

-r for recursive (also subdirectories) and -f for force (also write-protected files). But be careful in using this.

0

From man rm:

By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents.

So try this:

sudo rm -r *

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.