RAR est l’outil le plus populaire pour créer et extraire des archives compressées (.rar) des dossiers. Lorsque nous téléchargeons un fichier d’archive à partir du Web, nous avons besoin d’un rare outil pour les extraire.

RAR est disponible gratuitement sous les systèmes d’exploitation Windows pour gérer les fichiers compressés, mais malheureusement, rare L’outil n’est pas pré-installé sous les systèmes Linux.

Cet article explique comment installer unrar et rare outils de ligne de commande utilisant des fichiers tar binaires officiels sous les systèmes Linux pour ouvrir, extraire, décompresser ou décompresser un fichier d’archive.

Étape 1 : Comment installer Unrar sous Linux

Sur les distributions basées sur Debian et Ubuntu, vous pouvez facilement installer unrar package en utilisant le programme apt-get ou apt comme indiqué.

$ sudo apt-get install unrar
Or
$ sudo apt install unrar

Si vous utilisez des distributions basées sur RHEL, vous pouvez utiliser la commande dnf ou la commande yum pour l’installer.

Publicité
$ sudp dnf install unrar

Si vous utilisez d’autres distributions, vous devez télécharger le dernier fichier unrar/rar et installez-le à l’aide des commandes suivantes.

--------------- On 64-bit --------------- 
# cd /tmp
# wget https://www.rarlab.com/rar/rarlinux-x64-612.tar.gz
# tar -zxvf rarlinux-x64-612.tar.gz
# cd rar
# sudo cp -v rar unrar /usr/local/bin/

--------------- On 32-bit --------------- 
# cd /tmp
# wget https://www.rarlab.com/rar/rarlinux-x32-612.tar.gz
# tar -zxvf rarlinux-x32-612.tar.gz
# cd rar
# sudo cp -v rar unrar /usr/local/bin/

Étape 2 : Comment ouvrir/extraire un fichier RAR sous Linux

Pour ouvrir/extraire un RAR fichier dans le répertoire de travail actuel, utilisez simplement la commande suivante avec unrar e option.

# unrar e tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Extracting  index.php                                                 OK
Extracting  index.html                                                OK
Extracting  xyz.txt                                                   OK
Extracting  abc.txt                                                   OK
All OK

Pour ouvrir/extraire un RAR fichier dans un chemin ou un répertoire de destination spécifique, utilisez simplement le unrar e option, il extraira tous les fichiers dans le répertoire de destination spécifié.

# unrar e tecmint.rar /home/

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Extracting  /home/index.php                                           OK
Extracting  /home/index.html                                          OK
Extracting  /home/xyz.txt                                             OK
Extracting  /home/abc.txt                                             OK
All OK

Pour ouvrir/extraire un RAR fichier avec sa structure de répertoire d’origine, lancez simplement la commande ci-dessous avec unrar x option. Il extraira en fonction de leur structure de dossiers voir ci-dessous la sortie de la commande.

# unrar x tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Creating    tecmint                                                   OK
Extracting  tecmint/index.php                                         OK
Extracting  tecmint/index.html                                        OK
Extracting  tecmint/xyz.txt                                           OK
Extracting  tecmint/abc.txt                                           OK
Creating    default                                                   OK
Extracting  default/index.php                                         OK
Extracting  default/index.html                                        OK
Creating    include                                                   OK
Extracting  include/abc.txt                                           OK
Creating    php                                                       OK
Extracting  php/xyz.txt                                               OK
All OK

Étape 3 : Comment répertorier un fichier RAR sous Linux

Pour lister les fichiers à l’intérieur d’un fichier d’archive, utilisez unrar l option. Il affichera la liste des fichiers avec leur tailles, Date, temps, et autorisations.

unrar l tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Archive tecmint.rar

 Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.php           0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
-------------------------------------------------------------------------------
    8                0       64   0%

Étape 4 : Comment tester un fichier RAR sous Linux

Pour tester l’intégrité d’un fichier archive, utilisez l’option unrar t. La commande ci-dessous effectuera une vérification complète de l’intégrité de chaque fichier et affichera l’état du fichier.

unrar t tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Testing archive tecmint.rar

Testing     tecmint/index.php                                         OK
Testing     tecmint/index.html                                        OK
Testing     tecmint/xyz.txt                                           OK
Testing     tecmint/abc.txt                                           OK
Testing     default/index.php                                         OK
Testing     default/index.html                                        OK
Testing     include/abc.txt                                           OK
Testing     php/xyz.txt                                               OK
All OK

La unrar La commande est utilisée pour extraire, répertorier ou tester uniquement les fichiers d’archive. Il n’a pas d’option pour créer RAR fichiers sous Linux. Donc, ici, nous devons installer RAR utilitaire de ligne de commande pour créer des fichiers d’archive.

Étape 5 : Comment installer Rar sous Linux

Pour installer le RAR command sous Linux, exécutez simplement la commande suivante.

# sudo apt-get install rar
# sudo dnf install rar
# yum install rar
Exemple de sortie
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Dependencies Resolved
=========================================================================================
 Package			Arch			Version				Repository			Size
=========================================================================================
Installing:
 rar				i386            3.8.0-1.el5.rf      rpmforge			264 k

Transaction Summary
=========================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 264 k
Is this ok [y/N]: y
Downloading Packages:
rar-3.8.0-1.el5.rf.i386.rpm										| 264 kB     00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : rar                                          1/1

Installed:
  rar.i386 0:3.8.0-1.el5.rf

Complete!

Étape 6 : Comment créer un fichier RAR sous Linux

Pour créer une archive (RAR) fichier sous Linux, exécutez la commande suivante avec rar un option. Il créera un fichier d’archive pour un tecmint annuaire.

rar a tecmint.rar tecmint

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Creating archive tecmint.rar

Adding    tecmint/index.php                                           OK
Adding    tecmint/index.html                                          OK
Adding    tecmint/xyz.txt                                             OK
Adding    tecmint/abc.txt                                             OK
Adding    tecmint                                                     OK
Done

Étape 7 : Comment supprimer des fichiers de l’archive

Pour supprimer un fichier d’un fichier d’archive, exécutez la commande.

rar d filename.rar

Étape 8 : Comment récupérer des archives

Pour récupérer ou réparer un ou plusieurs fichiers d’archive, exécutez la commande avec l’option rar r.

rar r filename.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Building fixed.tecmint.rar
Scanning...
Data recovery record not found
Reconstructing tecmint.rar
Building rebuilt.tecmint.rar
Found  tecmint\index.php
Found  tecmint\index.html
Found  tecmint\xyz.txt
Found  tecmint\abc.txt
Found  tecmint
Done

Étape 9 : Comment mettre à jour les archives

Pour mettre à jour ou ajouter des fichiers au fichier d’archive existant, utilisez la commande suivante avec l’option tu es rare.

rar u tecmint.rar tecmint.sql

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Updating archive tecmint.rar

Adding    tecmint.sql                                                 OK
Done

Maintenant, vérifiez que le fichier tecmint.sql est ajouté au fichier d’archive.

rar l tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Archive tecmint.rar

 Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 tecmint             0        0   0% 18-08-12 19:23 drwxr-xr-x 00000000 m0  2.0
 tecmint.sql 0 8 0% 18-08-12 19:46 -rw-r--r-- 00000000 m3b 2.9
-------------------------------------------------------------------------------
    6                0       40   0%

Étape 10 : Comment définir un mot de passe pour les archives

C’est une caractéristique très intéressante de la Rare outil, il nous permet de définir un mot de passe pour les fichiers d’archive. Pour protéger par mot de passe les fichiers d’archive, utilisez l’option rar a -p.

rar a -p tecmint.rar

Enter password (will not be echoed):

Reenter password:

AR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Updating archive tecmint.rar

Updating  tecmint.sql                                                 OK
Done

Vérifiez-le maintenant en extrayant le fichier d’archive et voyez s’il nous demandera d’entrer un mot de passe que nous avons défini ci-dessus.

rar x tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Extracting from tecmint.rar

Creating    tecmint                                                   OK
Extracting  tecmint/index.php                                         OK
Extracting  tecmint/index.html                                        OK
Extracting  tecmint/xyz.txt                                           OK
Extracting  tecmint/abc.txt                                           OK
Enter password (will not be echoed) for tecmint.sql:

Extracting  tecmint.sql                                               OK
All OK

Étape 11 : Comment verrouiller les archives

Une autre fonctionnalité de verrouillage intéressante de l’outil rar, il offre une option pour verrouiller un fichier d’archive particulier après l’avoir extrait.

rar k tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Processing archive tecmint.rar
Locking archive
Done

Conclusion

Pour plus RAR et Annuler options et leur utilisation, exécutez la commande suivante, elle affichera une liste d’options avec leur description.

# man unrar
# man rar

Nous avons présenté presque toutes les options ci-dessus pour rare et unrar commandes avec leurs exemples. Si vous pensez que nous avons manqué quelque chose dans cette liste et que vous souhaitez que nous ajoutions, veuillez nous mettre à jour en utilisant le formulaire de commentaire ci-dessous.

Si vous appréciez ce que nous faisons ici sur TecMint, vous devriez considérer :

TecMint est le site communautaire à la croissance la plus rapide et le plus fiable pour tout type d’articles, de guides et de livres Linux sur le Web. Des millions de personnes visitent TecMint ! pour rechercher ou parcourir les milliers d’articles publiés accessibles GRATUITEMENT à tous.

Si vous aimez ce que vous lisez, pensez à nous acheter un café (ou 2) en signe d’appréciation.

Soutenez-Nous

Nous sommes reconnaissants pour votre soutien sans fin.

Rate this post
Publicité
Article précédentMeilleurs codes Fortnite Hide & Seek: juillet 2022
Article suivantMy Hero Academia Saison 6 révèle une nouvelle bande-annonce et confirme la première de l’automne 2022
Avatar
Violette Laurent est une blogueuse tech nantaise diplômée en communication de masse et douée pour l'écriture. Elle est la rédactrice en chef de fr.techtribune.net. Les sujets de prédilection de Violette sont la technologie et la cryptographie. Elle est également une grande fan d'Anime et de Manga.

LAISSER UN COMMENTAIRE

S'il vous plaît entrez votre commentaire!
S'il vous plaît entrez votre nom ici