Стиснення

RAR Archive Ubuntu

RAR Archive Ubuntu

How to create and open an archive with RAR on Ubuntu

To compress, archive and transfer large files or folders, rar package can be used on Ubuntu. Rar is a common archiving software to compress large files or folders. Suppose, if you want to transfer a folder from one location to another location which contains many files and folders, then the first option is to compress the folder and create an archive file. The compress file can be easily attached with email or transferred to other location. Many options are available on Ubuntu to compress files or folders. But if the files and folders are compressed using rar command then the created rar file can also be extracted on windows. Because rar files are also supported by windows. How you can install and use rar package to compress or decompress files and folder is shown in this tutorial.

Installing rar package

Rar package is not installed on Ubuntu by default. So, run the following command to install rar on Ubuntu.

$ sudo apt-get install rar

Rar package has various commands for creating archive files and folder. To get the list of rar commands just run rar without any command.

$ rar

The following output shows that trial version of RAR 5.40 is installed on the system. You can use any command from the list with rar for the particular purpose. Use of some basic commands of rar are shown in this tutorial.

Creating archive file

Select any large file or folder to compress and create archive file using rar command. In the following example, code folder is selected to create the archive file. code folder contains 7 files and the size of code folder is 4096 bytes.

To add the file into archive, a command is used with rar and next type the name of rar file and the name of the file or folder that you want to compress. Run the command to create the archive file, code.rar file by compressing code folder.

$ rar a code.rar code

After compression, the size of code.rar file is 1600 bytes. Run the following command to check the size of the code folder and the archive file.

$ ls  -la

Showing the content of archive file

Rar uses l command to show files and folder list of archive file. Run the following command to show the content of code.rar file.

$ rar l code.rar

Extracting archive file 

Move code.rar folder in different location. Suppose, the archive file is moved in mydir folder. x command is used with rar to extract the archive file. Run the following command to extract the file in the current location. When code.rar file will extract then code folder will be created after extraction.

$ rar x code.rar

Now, run ls -la command to check the folder is created or not after extraction.

$ ls -la

Creating and extracting password protected archive file

To create password protected archive, rar uses -p option with a command. After running the command, you have to set the same password for two times to create password protected archive file. The following command will create password protected archive file, pcode.rar of the folder code.

$ rar a -p pcode.rar code

Now, if you want to extract pcode.rar file then it will ask for the password which is set during the archive file creation. After setting the password, type a to use current password for all files and folders of the archive file.

$ rar x pcode.rar

The above command shows the mostly used commands of rar to create and extract any archive file. There are many other uses of rar, such as, recovering archive, updating archive, locking archive, setting archive comments, deleting archive etc.

Best Linux Distros for Gaming in 2021
The Linux operating system has come a long way from its original, simple, server-based look. This OS has immensely improved in recent years and has no...
Як зафіксувати та транслювати ігровий сеанс на Linux
Раніше грати в ігри вважалося лише хобі, але з часом ігрова індустрія спостерігала величезний ріст з точки зору технологій та кількості гравців. Аудит...
Найкращі ігри для гри з відстеженням рук
Нещодавно Oculus Quest представив чудову ідею відстеження рук без контролерів. Завдяки постійно зростаючій кількості ігор та заходів, які виконують пі...