Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a VPS. I want to delete some specific folder inside. /var/BACKUP 01

I want to delete all files in BACKUP 01

How can I do it with SSH access? I'm using linux,please type a command here.

share|improve this question

migrated from May 31 '11 at 11:01

This question came from our site for system and network administrators.

To delete a file in Linux, you use the 'rm' command.

You need to be careful as you have a space in that directory name - Ideally, you should name your directories and files with no spaces in the names. It's not mandatory to do this, but it makes life easier, and is less prone to accidentally deleting something. If there are spaces in the filename, it's best to use quotes around the name.

rm -fr "/var/BACKUP 01/"

If you want to see what files this will delete before you run it you could use this command

ls "/var/BACKUP 01/"
share|improve this answer
ls -r "/var/BACKUP 01/*" would recursively list the directories, just as rm -r recursively removes them. – stib May 31 '11 at 11:16
Do not use * inside quotes (unless you have a file named * in there). Just give the directory name. – grawity May 31 '11 at 18:30
@grawity - good catch - I've edited the post. – barryj May 31 '11 at 18:56
Oh, don't use it outside the quotes either. It would miss .dotfiles, and given many files it might even cause a "Command line too long" error. Just give the directory name. – grawity May 31 '11 at 18:58
@grawity Another good point. I was focussing on deleting the contents of the directory, but not the directory, which I think is what was asked for. A find with a -delete option might be better for that I guess - put probably overkill for what the OP wanted. – barryj May 31 '11 at 19:03

If you are logged in to your VPS then

cd "/var/BACKUP 01"
rm -r *

should do the trick. You need to put quotes around the path because of the space in the BACKUP 01 directory name.

share|improve this answer

I found a great article while googling, i recommend it.

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Ivo Flipse Apr 25 '12 at 12:48

Before deleting file ensure that you want to delete it really - if needed, make a back up copy.

1] With SSH use the following command to enter the directory where the file(you want to delete) is located:

cd foldername

2] After going to the particular folder use the following command(s):

To delete a single file:

rm filename.extension

rm readme.txt (Example to deleting readme.txt file)

To delete entire files of the folder after you entered the directory using the command mentioned in STEP 1 - use the following command:

rm -r *

NOTE: STEP 2 is irreversible if you don't create any back up.

share|improve this answer

Your Answer


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.