Debian: UnRAR multiple files with password

by on Jul.01, 2012, under Linux (Ubuntu)

This article describes how I usually unpack multiple password protected rar archives in Linux from a terminal. The reason one would ever need to do this is I do have lots of rar archives on my Debian box which are protected by the same password. Unfortunately there’s no graphical user interface available on my server and I therefore have to unpack them using the command line.

I am using the nonfree version of RAR for Linux. If you’re using the free version you’ll simply have to replace rar x with unrar e as far as I remember.

This is the command I’m using:

for f in *.rar;do rar x -pMYPASSWORD "$f";done

It will seek for all files ending with .rar in the current directory and will extract the archives with the provided password.

There’s an even shorter solution:

rar x -p"mypassword" '*.rar'


1 Comment for this entry

  • Cv

    Hi! I had tried that “same” line before, unsuccessfully… BUT putting *.rar between apostrophos is PURE GENIUS!!! Incredibly, it works! Thank you so much!

Leave a Reply


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!