I want to remove multiple (all) files with different suffixes (.log,.bin) in a particular directory (/home/username) in a one-line command. How could I do that?


If you want to delete all files of format '.log' and '.bin' in one command you can use:

rm *.bin *.log

and if you want a particular folder that different from your current path you can use:

rm /home/username/*.bin /home/username/*.log

Where /home/username is the particular folder.

This is what I understood from your question, if you meant something else please clarify.

  • i can only remove 7 days older files – Venkatesh Dec 13 '18 at 5:58
  • This is not making any sense... rm supposed to remove files/dirs in any scenario except when you don't have the w permission to that directory... in my machine its working for files I just created. do you got any prompt? – Z E Nir Dec 13 '18 at 12:05

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.