Online Linux Terminal Logo
OnlineLinuxTerminal
Archives et compressionCLI Manual

$tar

Créer et extraire des archives de fichiers compressées (.tar.gz, .tgz).

Syntaxe de la commandePOSIX Standard
tar [OPTIONS] [ARCHIVE-FILE] [FILE...]
Communauté Linux2.4k En ligne

Échangez avec des utilisateurs Linux, apprenez des commandes et téléchargez des PDF.

Essayer en direct dans le bac à sable interactif

Simulation côté client sans installation avec retour instantané.

Ouvrir dans le terminal plein écran ↗
bash — terminal

Aperçu et fonctionnement

tar regroupe des fichiers dans une archive unique et gère la décompression.

Options et drapeaux courants

Flag / OptionDescription
-c, --createCreate a new tar archive.
-x, --extractExtract files from an existing archive.
-z, --gzipCompress or decompress archive using gzip algorithm.
-v, --verboseVerbosely list files processed.
-f, --file [ARCHIVE]Use archive file specified.
-t, --listList the contents of an archive without extracting it.

Exemples pratiques du monde réel

#1Compress a folder into a .tar.gz archive
tar -czvf backup.tar.gz /home/user/projects

Creates a compressed archive named backup.tar.gz containing all files in projects.

#2Extract a .tar.gz archive
tar -xzvf backup.tar.gz -C /tmp

Extracts all contents of backup.tar.gz into the /tmp directory.