Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Here's how to do it with the unrar program provided by the unrar package under Ubuntu, which identifies itself like this when the --help option is passed:
Code:
UNRAR 3.70 beta 3 freeware Copyright (c) 1993-2007 Alexander Roshal
If the files are found in the path /home/me/rarfiles, and you want to unrar them into /home/me/unrarfiles:
Code:
cd /home/me/unrarfiles
for f in /home/me/rarfiles/*.rar; do
unrar -o+ x "$f"
done
The -o+ means to overwrite any files which already exist, so if some rar files contain files with similar names, you will end up with only the last one from the last rar file which contained that file name. Omit this and you will be prompted if there are duplicates if you want to overwrite.
The > will be printed if the shell is expecting the end of a quote, or a done after a do, or a fi after an if and so on. Just keep entering the mini-script and after the done it will execute.
If you really prefer it to be all on one line to avoid seeing the > prompt, you can do it like this:
Code:
cd /home/me/unrarfiles ; for f in /home/me/rarfiles/*.rar; do unrar -o+ x "$f"; done
You can also install wine and then download winrar and install that using the command line wine winrar.exe from the directory where you downloaded it to. It even places an icon on your desktop and works perfectly. I have used it for several years this way.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.