Kompresja

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.

5 najlepszych ergonomicznych myszy komputerowych dla systemu Linux
Czy długotrwałe korzystanie z komputera powoduje ból nadgarstka lub palców?? Cierpisz na sztywne stawy i ciągle musisz uścisnąć dłonie? Czy czujesz pa...
Jak zmienić ustawienia myszy i touchpada za pomocą Xinput w systemie Linux?
Większość dystrybucji Linuksa jest domyślnie dostarczana z biblioteką „libinput” do obsługi zdarzeń wejściowych w systemie. Może przetwarzać zdarzenia...
Remap your mouse buttons differently for different software with X-Mouse Button Control
Maybe you need a tool that could make your mouse's control change with every application that you use. If this is the case, you can try out an applica...