tar
sous
LinuxLes archives servent à regrouper
plusieurs fichiers et dossiers en un seul fichier.
Elles facilitent la sauvegarde, le transfert et le partage de
données.
Souvent, les archives sont aussi compressées pour
réduire leur taille (ex. .tar.gz
,
.tar.bz2
).
tar [options] archive.tar [fichiers...]
Option | Signification |
---|---|
-c |
Créer une nouvelle archive |
-x |
Extraire une archive existante |
-t |
Lister le contenu d’une archive |
-f |
Indiquer le nom du fichier archive (toujours en dernier avant le nom de l’archive) |
-v |
Mode verbeux (affiche les fichiers traités) |
-z |
Utiliser la compression gzip |
tar -cvf archive.tar dossier/
tar -cvzf archive.tar.gz dossier/
tar -xvf archive.tar
tar -xvzf archive.tar.gz
tar -tvf archive.tar
tar -tvzf archive.tar.gz
tar -cvzf cours.tar.gz fichier1.txt fichier2.txt
tar -xvzf archive.tar.gz -C /chemin/destination/
-f
avant le nom de
l’archive :tar -cvf archive.tar fichier1 fichier2
tar -czvf
(créer + compresser gzip + verbeux +
fichier).tar
, .tar.gz
,
.tar.bz2
) est une convention, pas une obligation.tar -czvf archive.tar.gz dossier/
tar -xzvf archive.tar.gz
tar -tvf archive.tar