How to Create and Extract RAR Files in Ubuntu: Step-by-Step Guide

How to Create and Extract RAR Files in Ubuntu: Alright, let’s talk about RAR files. Maybe you’ve received one and you’re wondering, “How on earth do I open this in Ubuntu?” Or, you’ve got a bunch of files that need to be packed up neatly, and you figure a RAR file is the way to go. Either way, you’ve come to the right place. We’ll walk through it, and trust me, you won’t believe how easy this is.

Ubuntu doesn’t come with RAR support built in, but no worries—it’s super simple to get set up. I’ve done this a hundred times myself, and I’ll share some tips to make sure you don’t hit any snags along the way. Ready?

Before you start learning how to extract rar, I would like to mention that we have a very informative article on compressive files in Ubuntu which will be very helpful for you.

Step 1: Install RAR and UNRAR on Ubuntu

The first thing we need to do is install the tools that allow Ubuntu to handle RAR files. Ubuntu doesn’t come with these by default, but they’re just a quick command away.

Here’s how to install RAR and UNRAR:

  1. Open up your Terminal. You can press Ctrl + Alt + T to do this quickly.
  2. Type the following command and hit Enter:
sudo apt update

This just updates your package list. Think of it as refreshing Ubuntu’s memory about what’s available.

  1. Next, you’ll want to install the RAR and UNRAR packages. Type:
sudo apt install rar unrar

Hit Enter again and follow any prompts (you might need to enter your password).

That’s it! You’re now all set to start creating and extracting RAR files.

Pro tip: If you’re like me and forget to update your system regularly, you might want to throw in sudo apt upgrade after the update command. It’ll ensure everything is fresh and ready to go!

Step 2: Extracting RAR Files in Ubuntu

Now that you’ve got the tools, let’s get to the fun part: extracting RAR files! Whether it’s a file a friend sent you or something you downloaded, you can extract it in just a couple of steps.

How to extract a RAR file:

  1. Locate the RAR file you want to extract. I usually keep my downloads in the ~/Downloads folder, but you’ll know where yours is.
  2. Open your Terminal and navigate to the folder where your RAR file is stored. You can do this with the cd command. For example, if it’s in your Downloads folder:
cd ~/Downloads
  1. Once you’re in the right folder, type the following command to extract the RAR file:
unrar x your-file-name.rar

Replace your-file-name.rar with the actual name of your file, of course!

The x in the command is like saying “extract this.” It’ll unzip the RAR file and place the contents in the same folder. If you want to extract it to a different folder, you can specify that by adding the path at the end of the command. For example:

unrar x your-file-name.rar /home/username/newfolder/

Pretty simple, right? You’ve got all the files out of that RAR in just a few steps.

Step 3: Creating RAR Files in Ubuntu

Alright, so now let’s say you have a bunch of files, and you want to compress them into a RAR file. Maybe it’s a folder full of photos you’re sending to a friend, or a project you’re backing up. Here’s how you do it:

How to create a RAR file:

  1. Open your Terminal and navigate to the folder where your files are located using the cd command. Let’s say you want to compress a folder called “my-files” located in your Documents:
cd ~/Documents
  1. Now, to create a RAR file, type this command:
rar a my-new-rar-file.rar my-files/

Here’s what’s happening:

  • a means “add to archive.”
  • my-new-rar-file.rar is the name of the RAR file you’re creating (feel free to name it whatever you want).
  • my-files/ is the folder you’re compressing.
  1. Hit Enter, and boom! You’ve just created a shiny new RAR file.

Real-world tip: I once tried compressing a massive folder without realizing how much space it would save me. After running the command, I was stunned! It went from a 1GB folder to just under 500MB. Seriously, compressing files like this can be a real space-saver.

Step 4: Listing Files Inside a RAR Without Extracting

Sometimes you might want to peek inside a RAR file to see what’s there before extracting. Kind of like peeking into a present before unwrapping it! You can easily do that in Ubuntu.

How to list files in a RAR:

  1. In the Terminal, navigate to the folder where the RAR file is stored.
  2. Run this command:
unrar l your-file-name.rar

It’ll show you a list of all the files inside without extracting anything. Pretty handy, right?

FAQs

1. What happens if I skip the installation step?

You’ll get an error when you try to work with RAR files. Ubuntu won’t know what to do with them unless you’ve installed the necessary tools.

2. Can I create a password-protected RAR file?

Absolutely! When creating the RAR, just add the -p option:

rar a -p my-protected-file.rar my-files/

You’ll be prompted to enter a password. It’s like locking your RAR file with a secret key.

3. Is there a graphical way to extract RAR files?

Yep, if you prefer using a graphical interface, you can use File Roller (the default archive manager). Just right-click the RAR file and choose Extract Here or Extract to…. Simple!

Conclusion: You’ve Got This

And that’s pretty much it! Creating and extracting RAR files in Ubuntu is straightforward once you’ve got the tools installed. Whether you’re sending a bunch of files to a friend, compressing for storage, or just organizing your digital life, RAR files can be a huge help.

So, next time you run into one of these pesky RAR files, you’ll know exactly what to do. Give it a try yourself, and you’ll see how easy it is. You’ve got this!

Deepak Maurya

About the Author: Deepak Maurya

I hold a Computer Science degree, which built my skills in programming and system administration. Over time, my passion for Linux grew, not just for its tech power but because of the supportive community around it. Writing about Linux, especially Ubuntu, lets me share what I’ve learned. I understand how challenging it can be to start with something as flexible as Linux, so my aim is to simplify complex topics for everyone, no matter their skill level.

Full Bio »

Leave a Comment