I present to you a compilation of the most useful Linux commands regarding Packaged and Compressed Files
TAR Files
Show content of TAR file
To view the contents of a .tar
file without extracting it.
tar -tf archive.tar
Create TAR file
Generates a TAR file from a directory.
tar -cvf archivo.tar directorio1
Create TAR file with multiple files and directories
Allows you to package multiple files and directories into a single TAR file.
tar -cvf archivo.tar archivo1 archivo2 directorio1
Create compressed TAR file in bzip2
Generates a compressed TAR file using the bzip2 algorithm.
tar -cvfj archivo.tar.bz2 directorio1
Create compressed TAR file in gzip
Creates a TAR file compressed in gzip format.
tar -cvfz archivo.tar.gz directorio1
Extract TAR file
Decompresses a TAR file.
tar -xvf archivo.tar
Extract TAR file to a specific directory
Extracts the contents of a TAR file to the desired directory.
tar -xvf archivo.tar -C /directorio
Extract TAR file preserving user permissions
Extracts a TAR file while preserving user permissions.
tar -xpvf archivo.tar
Decompress bzip2 compressed TAR file
Extracts a TAR file that has been compressed with bzip2.
tar -xvfj archivo.tar.bz2
Decompress gzip compressed TAR file
Extracts a TAR file compressed in gzip format.
tar -xvfz archivo.tar.gz
ZIP Files
Create a compressed ZIP file
Generates a ZIP file from a directory.
zip archivo.zip directorio1
Compress in ZIP with multiple files and directories
Allows you to package multiple files and directories into a single ZIP file.
zip -r archivo.zip archivo1 archivo2 directorio1
Decompress a ZIP file
Extracts the contents of a ZIP file.
unzip archivo.zip
BZ2 Files
Compress BZ2 file
Generates a compressed file in BZ2 format.
bzip2 archivo
Decompress BZ2 file
Extracts the contents of a BZ2 file.
bunzip2 archivo.bz2
GZ Files
Compress GZ file
Generates a compressed file in GZ format.
gzip archivo
Decompress GZ file
Extracts the contents of a GZ file.
gunzip archivo.gz
Decompress GZ file with maximum compression
Decompresses a GZ file applying the maximum compression.
gzip -9 archivo