RAR Archive Ubuntu

29/12/2020

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.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Installing Apache Spark on Ubuntu 17.10

Apache Spark is a data analytics tool that can be used to process data from HDFS, S3 or other data sources in memory. In...
28/12/2020

Install Sqlite on Arch Linux

How to Install SQLite on Arch Linux SQLite is a lightweight file based database system. It does not have any dependencies...
28/12/2020

Các cách sử dụng proxy để bảo vệ máy tính của bạn khỏi các cuộc tấn công mạng.

Khi sử dụng proxy để lướt web, bạn có thể trải nghiệm nhiều lợi ích hữu ích như bảo vệ thông...
27/02/2023
Bài Viết

Bài Viết Mới Cập Nhật

Dịch vụ thuê mua proxy Grass siêu rẻ, nhanh chóng và an toàn
10/05/2024

Thuê mua proxy Pixel giá tốt, tốc độ CỰC ĐỈNH
10/05/2024

Dịch vụ thuê mua proxy v4 an toàn, tốc độ, giá siêu rẻ
10/05/2024

Thuê mua proxy Iphone uy tín, chất lượng cao
10/05/2024

Thuê mua proxy android uy tín, giá tốt nhất hiện nay
10/05/2024