For demonstration purposes, we’re using Ubuntu 22.04 LTS.
Installing them is pretty straightforward.
Simply follow your specific Linux distribution’s installation command(s).
Hannah Stryker / How-To Geek
For testing purposes, we’re creating some text files and adding a line to them.
If you already have the files you want to archive, then you don’t need to do this.
Then you specify the name of the RAR file you want to create.
Lastly, list all the files and directories you want to add to the archive.
How to Extract RAR Files on Linux
The rar command lets you create an archive.
To extract an existing RAR file, you use the unrar command.
The syntax is pretty simple.
Let’s use unrar to extract files from the archive we created earlier.
Then, you input the RAR file name.
Otherwise, the command won’t work.
Extract RAR Files and List the Directory Structure
Suppose you have several directories in your archive.
If you extract it using the normal method, you might only see the files that were extracted.
However, the “x” option from the unrar command lets you see the directory structure as well.
That is, you’re able to see which file is inside which directory in the archive.
Let’s see that in action.
That’s where listing the files can help you.
If a file looks good, the command displays an “OK” status for that.
The “u” option of the rar command is for that purpose.
It updates your archive and lets you add new files.
But how do you repair or delete them?
For repairing or deleting, you have the “r” and “d” options, respectively.
To repair a RAR file, run:
The above command first creates a “fixed.test.rar” file.
Deleting files is simple.
Simply specify the name of the files you want to delete from the archive.
In our case, we want to delete “test6.txt” from the “test.rar” file.
you’ve got the option to also specify the size of each part.
Say, we want to split an archive into several 1MB archives.
For that, we run:
The “a” option adds new files to the archive.
We specify the size of each archive with the “-v” option.
The naming of the RAR file is important here.
Finally, add the file and directory names you’d like to include in the archive.
And that covers most operations you might do on RAR files on Linux.