- How to Open, Extract and Create RAR Files in Linux
- Step 1: How to Install Unrar in Linux
- Step 2: How to Open/Extract a RAR File in Linux
- Step 3: How to List a RAR File in Linux
- Step 4: How to Test a RAR File in Linux
- Step 5: How to Install Rar in Linux
- Step 6: How to Create Rar File in Linux
- Step 7: How to Delete files from Archive
- Step 8: How to Recover Archives
- Step 9: How to Update Archives
- Step 10: How to Set Password to Archives
- Step 11: How to Lock Archives
- Conclusion
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- How To Extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar File in Linux
- Extract .zip file in Linux
- Extract .gz file in Linux
- Extract .tar file in Linux
- Extract .tar.gz file in Linux
- Extract .tar.xz file in Linux
- Extract .tar.bz2 file in Linux
- Extract .7z file in Linux
- Extract .rar file in Linux
- How to Extract (Open) a RAR File in Linux
- Install unrar/rar tool
- 1. Extract (open) rar file
- 2. Extract files with full path
- 3. List content of a RAR file
- 4. Check archive integrity
- 5. Create a rar single file
- 6. Create multiple rar files
- 7. Set password for RAR file
- Conclusion
- Как распаковать rar в Linux
- Как распаковать RAR в Linux
- Выводы
- How to Extract RAR Files in Ubuntu Linux
- What is a .RAR File Extension?
- Extracting RAR Files in Linux distributions
- How to Install Unrar tool in Linux
- How to Extract a RAR File in Linux
- How to View Contents inside a RAR File in Linux
- Testing a RAR File in Linux
- Installing RAR in Linux
- Creating RAR Files in Linux
- Deleting Files from any Archive
- Recovering deleted Archives
- Setting password on a Particular Archive
- Wrap Up
How to Open, Extract and Create RAR Files in Linux
RAR is a most popular tool for creating and extracting compressed archive (.rar) files. When we download an archive file from the web, we required a rar tool to extract them.
RAR is available freely under Windows operating systems to handle compressed files, but unfortunately, rar tool doesn’t pre-installed under Linux systems.
This article explains how to install unrar and rar command-line tools using official binary tar file under Linux systems to open, extract, uncompress or unrar an archive file.
Step 1: How to Install Unrar in Linux
On Debian and Ubuntu based distributions, you can easily install unrar package using the apt-get or apt program as shown.
If you are using Fedora distribution, you can use the dnf command to install it.
If you are using a CentOS / RHEL distribution, you need to download the latest unrar/rar file and install it using following commands.
Step 2: How to Open/Extract a RAR File in Linux
To open/extract a RAR file in current working directory, just use the following command with unrar e option.
To open/extract a RAR file in specific path or destination directory, just use the unrar e option, it will extract all the files in specified destination directory.
To open/extract a RAR file with their original directory structure. just issue below command with unrar x option. It will extract according their folder structure see below output of the command.
Step 3: How to List a RAR File in Linux
To list a files inside a archive file use unrar l option. It will display the list of files with their sizes, date, time and permissions.
Step 4: How to Test a RAR File in Linux
To test an integrity of a archive file, use option unrar t. The below command will perform a complete integrity check for each file and displays the status of the file.
The unrar command is used to extract, list or test archive files only. It has no any option for creating RAR files under Linux. So, here we need to install RAR command-line utility to create archive files.
Step 5: How to Install Rar in Linux
To install RAR command option in Linux, just execute following command.
Sample Output
Step 6: How to Create Rar File in Linux
To create a archive(RAR) file in Linux, run the following command with rar a option. It will create archive file for a tecmint directory.
Step 7: How to Delete files from Archive
To delete a file from a archive file, run the command.
Step 8: How to Recover Archives
To recover or fix a archive file or files, run the command with option rar r.
Step 9: How to Update Archives
To update or add files to existing archive file, use the following command with option rar u.
Now, verify that the file tecmint.sql is added to archive file.
Step 10: How to Set Password to Archives
This is very interesting feature from Rar tool, it allows us to set a password to archive file. To password protect archive file use option rar a -p.
Now verify it by extracting the archive file and see whether it will prompt us to enter password that we have set above.
Step 11: How to Lock Archives
Another interesting lock feature from rar tool, it provides a option to lock a particular archive file from extracting it.
Conclusion
For mor RAR and Unrar options and usage, run the following command it will display a list of options with their description.
We have presented almost all of the options above for rar and unrar commands with their examples. If you feel that we’ve missed anything in this list and you would like us to add, please update us using comment form below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник
How To Extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar File in Linux
An archive file is a file composed of one or more files in compressed format. It’s useful for saving disk storage, managing a single file is easier than managing multiple files. This tutorial will help you to decompress or extract an archive file in the Linux system via command line. You can also list archive file content without extracting it.
Extract .zip file in Linux
This is the most common compression format used by various IT professions on many operating systems. For this you must of unzip binary installed on your system.
Extract .gz file in Linux
Gz files are compressed files created using the Gzip compression utility. In general, GZIP is better compared to ZIP, in terms of compression, especially when compressing a huge number of files. Use gunzip command to extract .gz archive file.
Extract .tar file in Linux
Tar is the sort of Tape Archive and also referred to as the tarball. This is another popular archiving method which is also known as the consolidated Unix archive format. To extract .tar file use following command
Extract .tar.gz file in Linux
TAR.GZ file is a combination of TAR and GZIP archives. If provides more compression format of data. You can use -z switch to extract these files.
Extract .tar.xz file in Linux
The XZ format is a single file compression format and does not offer archiving capabilities. It preserves the original data with no loss in quality. You can use -J switch to extract these files.
Extract .tar.bz2 file in Linux
Tar.bz2 is an combination of tar and bzip2 archive formats. You can use -j to filter the archive through bzip2. Use the following to extract .tar.bz2 compressed file.
The latest version fo tar automatically detects the archive format. So you can simply use the following command.
Extract .7z file in Linux
These files are 7zip archive files. This is not generally used on Linux systems, but sometimes you may need to extract some source files. You must have the 7zip package installed on your system. Use the following command to extract these files.
Extract .rar file in Linux
These are common archive format for Windows systems, but Linux users avoid to use this. Still you may need sometimes to extract .rar file on Linux. You can use 7z command to extract this or unrar.
Источник
How to Extract (Open) a RAR File in Linux
RAR is a file format used for data compression and archiving. The RAR format supports data compression, error recovery and files archives. It also supports files larger than 4 gigabytes. RAR files can only be created through commercial software. You can extract rar file using free unRAR command line tool in Linux.
By default, unRAR is not being installed on Linux or UNIX distro. You need to install unRAR/rar tools with the help of below linux commands.
Install unrar/rar tool
If you are using Redhat Linux or Centos, then use yum command as follows to install unRAR command.
Listed below are some practical examples of RAR and unRAR command in linux to open,extract and compress files.
1. Extract (open) rar file
If you want to extract all files within the ‘.rar’ file in the current directory run below command
2. Extract files with full path
If you want to extract the files in full path. Run below command
3. List content of a RAR file
To list files inside rar archive file without extracting. Then use ‘l’ option
4. Check archive integrity
To test the integrity of file archive use ‘t’ option
5. Create a rar single file
To create a .rar archive file use ‘a’ option.
6. Create multiple rar files
To compress say ‘file1′, ‘file2′ and ‘file3′ simultaneously, use below command
You can also use the following method to RAR multiple files.
7. Set password for RAR file
While archiving, you can set a password (using -p option). If you omit the password on the command line, you will be prompted with a message “enter password” and the password is case sensitive.
Conclusion
In this tutorial we learned how to use rar/unrar command in linux to open,extract and create rar files. Hope you enjoyed reading this and please leave your comments below.
Источник
Как распаковать rar в Linux
В операционной системе Windows часто используются два формата архивов, это ZIP и RAR. Они наиболее часто применяются для сжатия файлов и хранения их на компьютере. Но в Linux немного другая система, здесь для сжатия всех данных используется формат tar.gz. По умолчанию в системе не поставляются инструменты для работы с архивами форматов Linux.
В одной из предыдущих статей мы рассматривали как распаковать zip в Linux. В сегодняшней статье мы сосредоточимся на втором формате и рассмотрим как распаковать rar linux. Рассмотрим несколько способов и утилит, с помощью которых вы сможете решить эту задачу.
Как распаковать RAR в Linux
Формат RAR был разработан российским программистом, Евгением Рошалом, отсюда и название формата — Roshal ARchiver. Изначально формат был разработан для DOS и поддерживал несколько улучшений по сравнению с уже использовавшимся тогда ZIP. Сразу была поддержка большого количества файлов, разбиения архива на части и создания самораспаковывающихся архивов.
Распаковка rar linux выполняется с помощью утилиты unrar. А упаковка архива командой rar. Обычно она не поставляется в системе по умолчанию, но вы можете очень просто установить ее из официальных репозиториев. Для установки утилиты в Ubuntu выполните такую команду:
sudo apt install unrar
В Fedora и других системах, использующих пакеты rpm, имя будет точно таким же, только будет отличаться пакетный менеджер:
sudo yum install unrar
sudo dnf install unrar
Перед тем как перейти к работе с командой и рассмотрению того как распаковать rar linux давайте рассмотрим ее синтаксис:
$ unrar команда опции архив файлы путь_для_расспаковки
Основной смысл работы утилиты уже понятен, но рассмотрим ее параметры подробнее:
- e — распаковать архив;
- l — вывести список файлов внутри архива;
- p — вывести распакованный файл в стандартный вывод;
- t — проверить архив;
- v — вывести подробную информацию про архив;
- x — извлечь файлы, сохраняя полный путь внутри архива.
Опции настраивают поведение утилиты, рассмотрим основные опции, которые могут вам понадобиться:
- -ad — добавить имя архива к пути распаковки;
- -ai — игнорировать атрибуты файлов;
- -inul — не выводить сообщения об ошибках;
- -p — указать пароль архива;
- -sl — распаковывать только файлы, меньше указанного размера;
- -u — обновить уже распакованные файлы;
- -y — отвечать y на все вопросы;
- -x — не распаковывать указанные файлы;
- -ts — сохранять временную метку исходных файлов.
Основные опции, которые вам могут понадобиться мы рассмотрели, теперь давайте приведем несколько примеров как работать с утилитой. Чтобы извлечь файлы из архива в текущую папку достаточно передать утилите имя архива и команду e:
unrar e file.rar
Вы можете вывести содержимое архива, ничего не распаковывая с помощью команды l:
unrar l file.rar
Чтобы сохранять полный путь, который прописан в архиве нужно использовать команду x:
unrar x file.rar
Также вы можете проверить архив на целостность с помощью команды t:
unrar t file.rar
Кроме того, вы можете указать папку, в которую стоит распаковывать файлы:
unrar e file.rar
Это все команды unrar, которые вам могут понадобиться при повседневной работе с архивами, обратите внимание, что после установки утилиты unrar многие менеджеры архивов, например, Arc, теперь тоже поддерживают этот формат:
Но без этой утилиты вы получите ошибку что утилита не знает что это за формат архива. Всем графическим программам нужен этот rar архиватор linux.
Выводы
В этой небольшой статье мы рассмотрели как выполняется распаковка rar linux с помощью утилиты unrar или других графических утилит. Как видите, все делается очень просто, если у вас остались вопросы о том, как разархивировать rar linux, спрашивайте в комментариях!
Источник
How to Extract RAR Files in Ubuntu Linux
What is a .RAR File Extension?
For users who don’t know, a RAR file is a compressed file that is split into a set of multi-volume files. This is usually done in cases where there are large file sets that are needed to be shared or transferred, hence are compressed into a zip file. Similarly, for zip files, when they are transferred or downloaded from the internet need to be extracted. A number of tools are available to help extract and compress these files within seconds, regardless of their size or quantity.
Extracting RAR Files in Linux distributions
RAR is a free tool that is pre-installed on Windows operating systems but unfortunately doesn’t support Linux platforms. If you will try extracting in Ubuntu, the archive manager will show you the following dialogue box:
This is because the system won’t recognize the file type like Windows and does not have any supported tool to extract it. In other cases, it will also display an error somewhat like this:
Read on below to find out how you can install RAR tools on Linux and use those to open, extract, and compress a file.
How to Install Unrar tool in Linux
Unrar is compatible mostly for Linux distributions where you can easily install the package from the command terminal using the apt programs.
Open Command Terminal and type the following command(s) if you’re using Ubuntu or Debian based distros:
If you are using Fedora distro, type the command in your command prompt:
For users using CentOS/ RHEL 64-bit distros, you can install the Unrar tool using these commands:
(Just remove ‘x64’ from the above command if you want to alter it for 32-bit systems)
How to Extract a RAR File in Linux
To open or extract a .rar extension file in your current working directory, type the following command in the terminal:
This will start extracting your file using the Unrar tool like this below:
Note: Since you have the Unrar tool, you can also perform these operations directly through the right click, besides using these commands on the terminal.
To open or extract a .rar extension file in any specific path or directory, type the following command in the terminal. This will extract the files and locate them in the specified directory.
If you want to open or extract a .rar extension file in their original directory, use the following command:
How to View Contents inside a RAR File in Linux
A compressed file contains multiple files of large sizes that are zipped together inside it. If you want to list out all the file contents inside an archive file, use the command below. This will display a list of files with their name, size, time, date created and permissions.
Testing a RAR File in Linux
If for instance, you have downloaded a file from the internet and would like to test its integrity, the Unrar tools offers that too. The following command will do a complete check on the archive file and its contents, and then show the results. Type:
The unrar tool that we just downloaded uses the unrar command to carry out the above tasks. It lets you extract, list out and test files. There is no option for creating a rar file with this particular tool. Therefore, we will install another Linux command-line utility called RAR to create compressed/archive files.
Installing RAR in Linux
To install the RAR command option, type the following commands in the terminal:
After you execute the commands, the result will be:
Creating RAR Files in Linux
In order to create a .rar file in Linux distribution, you will need to run the following command:
This will create an archive file name ‘filename’ for the directory filename1. See how this will look like below:
Deleting Files from any Archive
Out of the multiple files in an archive, if you want to delete a particular file through the command terminal, type the following command:
Recovering deleted Archives
If you deleted an archive file by accident or lost it through data loss, don’t worry, you can always recover it back. The following command will recover the file back or will fix it if there has been any loss or damage.
Setting password on a Particular Archive
This incredible Rar tool lets you do a number of interesting things with your archive files from creating, deleting, and adding, to changing their directories and protecting them through passwords.
If you want to protect your files from unknown access or extraction, you can set a password on them. To password-protect your file, type the following command:
Now, to verify the changes, type the command to open the directory to see if it asks for password.
Wrap Up
RAR and UNRAR are very useful when it comes to handling and managing files in Linux. They provide multiple options to make your work easier and more convenient. When compared to Windows, things get a little complicated for Ubuntu, but these commands are simple, easy to execute and give results within seconds.
If you need more description on the commands, just the run the following two:
Источник