Archivos y compresiónCLI Manual
$tar
Empaquete y comprima múltiples archivos en un archivo tar (.tar.gz).
Sintaxis del comandoPOSIX Standard
tar [OPTIONS] [ARCHIVE-FILE] [FILE...]Prueba en vivo en la terminal interactiva
Simulación del lado del cliente sin instalación y con respuesta inmediata.
bash — terminal
AST Sandbox (Free)
Descripción general y funcionamiento
tar crea paquetes de archivos combinados y extrae archivos comprimidos en Linux.
Opciones y banderas comunes
| 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. |
Ejemplos prácticos del mundo real
#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.