Alexandre Dos Reis

tar

Que ce soit pour compresser ou décompresser des fichiers ou des dossiers, cela se fait avec la commande tar.

Créer

$ tar -c

Tester / lister

$ tar -t

Extraire

$ tar -x

Le mode verbeux, affiche les résultats dans le terminal.

$ tar -v

Format de compression bzip2

$ tar -i

Format de compression gzip

$ tar -z

Permet de spécifier le fichier à traiter

$ tar -f

Création d’une archive nommée archive.tar contenant le fichier fichier1.

$ tar -cvf archive.tar fichier1

Création d’une archive contenant deux fichiers fichier1 et fichier2.

$ tar -cvf archive.tar fichier1 fichier2

Création d’une archive à partir d’un répertoire.

$ tar -cvf archive.tar repertoire/

Création d’une archive au format tar.gz.

$ tar -czvf archive.tar.gz repertoire/

Création d’une archive au format tar.bz2.

$ tar -cjvf archive.tar.bz2 repertoire/

Extraction de l’archive tar.gz.

$ tar -xzvf archive.tar.gz

Extraction de l’archive tar.bz2.

$ tar -xjvf archive.tar.bz2

Liste tous les fichiers contenus dans une archive.

$ tar -tf mon_fichier.tar