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...]Essayer en direct dans le bac à sable interactif
Simulation côté client sans installation avec retour instantané.
bash — terminal
AST Sandbox (Free)
Aperçu et fonctionnement
tar regroupe des fichiers dans une archive unique et gère la décompression.
Options et drapeaux courants
| Flag / Option | Description |
|---|---|
| -c, --create | Create a new tar archive. |
| -x, --extract | Extract files from an existing archive. |
| -z, --gzip | Compress or decompress archive using gzip algorithm. |
| -v, --verbose | Verbosely list files processed. |
| -f, --file [ARCHIVE] | Use archive file specified. |
| -t, --list | List 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/projectsCreates a compressed archive named backup.tar.gz containing all files in projects.
#2Extract a .tar.gz archive
tar -xzvf backup.tar.gz -C /tmpExtracts all contents of backup.tar.gz into the /tmp directory.