Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

On the Linux command line, I want to delete 3 files in one command, how would I do it?

For instance, I want to delete:

public_html.tar.gz
dbapp.sql
dbwp.sql
share|improve this question
up vote 3 down vote accepted

rm takes as many arguments as you pass it. Up to the maximum command line length, usually 32,760 odd characters.

In this case:

rm public_html.tar.gz dbapp.sql dbwp.sql

To forcibly delete, without confirmation prompts (potentially dangerous!)

rm -f FILE1 FILE2 ...

See also: man 1 rm

share|improve this answer
    
Thanks Daniel, how would you take off the prompts on whether or not I want to delete? – u1sonderzug Feb 21 '14 at 15:08
    
@u1sonderzug: Those are not shown by default unless you're removing read-only files, or unless you add the -i option. It could be that you have an alias for rm to rm -i; try type rm to check, unalias rm to temporarily remove the alias, and look in your shell initialization scripts (the ~/.bashrc file`) for removing it permanently. – grawity Feb 21 '14 at 15:10
    
See update: Use the --force/-f option. – Daniel B Feb 21 '14 at 15:11

Just list them all in a singe line command using rm -f. It won't restrict you to a single file entry per delete. The -f options ensures it doesn't prompt you when removing a file.

rm public_html.tar.gz dbapp.sql dbwp.sql

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .