Linux Commands

What is a RAR file

RAR is a short form of the Roshal Archive that you can use to organize multiple folders, documents, photos, and other data. However, what distinguishes a RAR file is that it takes special software to access its contents. It’s one of the most used methods for compressing data and supports both archiving and compression, so you may store numerous files within a single RAR file.

Furthermore, RAR files can be encrypted and password-protected, which ensures that the contents of these files remain hidden until the password is known. In addition, a RAR file might be helpful if a colleague has a long list of images they want to share with you. Your buddy could aggregate all the photos into one RAR file and then send you that file, rather than having you download them individually. This guide can help unravel any doubts you may have regarding how to make and open a RAR file if you already didn’t know.

How to make a RAR file in Linux

To make a .rar file of your desired folder, you first need to install it and you can do that by using terminal. For that, you need to open a terminal and type the command mentioned below.

$ sudo apt install rar

Now to make a .rar file of a directory you need to follow the general syntax as mentioned below.

$ rar a <file-name>.rar <folder-name>

How to extract a RAR file in Linux

To extract a .rar file in Linux you need the “unrar” utility. To get the unrar utility on Linux use the command given below:

$ sudo apt install unrar

After installing unrar follow the below mentioned syntax to extract the any rar file:

$unrar e <rar-file-name>

For example, I am extracting “my_file.rar” with the “e” flag:

How to make a RAR file in Windows

To make a .rar file you first need to download and install the application that can do this job. For that, Winrar is among the most widely used software for this purpose, and it is also free.

After the installation, you first need to select those files which you want to compress and then right-click on them. In the context menu, you will find multiple options to compress files as shown below in the image. The instructions given in this article are based on Windows 11 which is the latest version of Windows but this application is available for all other Operating systems as well such as in Linux and macOS it is available as a command-line version.

You can create a .rar file in the same folder where the files are currently available as well as in a different folder. To save it in a different folder, you need to select the “Add to archive” option and then click on the Browse option to save the file in a specified folder as shown below.

How to make a password-protected RAR file in Windows

One of its important features is to make a file password protected so any unauthorized person won’t be able to access it. You can do that by selecting the “Add to archive” option first and then clicking on the “Set password..” button. This will open a new dialogue box where you will enter a password and select the “Encrypt file names” option for data encryption.

So only those who know the password can open that file as it will ask you to enter a password first before opening, as shown below.

How to Extract a RAR file in Windows

As stated earlier, if you receive a .rar file then you can’t open it without having software like Winrar or other software that can handle this extension. So if you like to see the content or want to extract the data of such files then you can do that too by using Winrar software by right-clicking on the .rar format file and selecting the option of extract as shown below.

Conclusion

RAR is a short form of Roshal Archive that you can use to organize several folders, documents, photos, and other things. Winrar is one of the most commonly used applications that can use to create as well as extract the data from such files. Furthermore, RAR files may be encrypted and password-protected, which ensures that the contents of these files remain hidden until the password is known. This article has worked on all the important parts to make you understand the RAR file. Later the installation and working of RAR have been discussed for both Windows and Linux OS.

About the author

Taimoor Mohsin