Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

You can use

rm -rf *

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

share|improve this answer

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 *
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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