May 2025posted on 05.22.2025Using the tar command Create a compressed tar archive $ tar -czvf archive.tar.gz ./directory -c: Create archive. -z: Compress using gzip algorithm. -f: Specify filename of archive. -v: Verbose (show progress). Uncompress a tar archive $ tar -xvf archive.tar.gz -x: Extract from archive. -f: Specify filename of archive. -v: Verbose (show progress). Extract tar archive to a different directory $ tar -xvf archive.tar.gz -C ./another-directory -C: Changes the directory. Extract specific files from tar archive $ tar -xvf archive.tar.gz file1 file2 file3 Extract specific files from tar archive using wildcard $ tar -xvf archive.tar.gz --wildcards '*.js' List the content of tar archive $ tar -tf archive.tar.gz -t: List the content. No reactions yet
Using the
tarcommandCreate a compressed tar archive
-c: Create archive.-z: Compress usinggzipalgorithm.-f: Specify filename of archive.-v: Verbose (show progress).Uncompress a tar archive
-x: Extract from archive.-f: Specify filename of archive.-v: Verbose (show progress).Extract tar archive to a different directory
-C: Changes the directory.Extract specific files from tar archive
Extract specific files from tar archive using wildcard
List the content of tar archive
-t: List the content.