The Tar Command Chronicles: Bundle, Zip, and Conquer!
Tar bundles multiple files into a single archive file, and can optionally compress them in Linux systems.
Compress
To compress a file or directory
tar -cvf archive_file_name.tar <location-to-the-directory-or-file>the options used in the above command are
-cfor creating a new archive-vto show the detailed output of the process.-fto specify the archive file.
to compress the archive using gzip use the option -z so the archive will be a .tar.gz file
tar -cvfz compressed_archive_file_name.tar.gz <location-to-the-directory-or-file>some other gzip (
-z) alternative to compress the archive are **bzip2* (-j) and **xz** (-J)
Extract
To compress a file or directory
tar -C <location-to-the-directory-where-to-uncompress> -xvf archive_file_name.tarthe options used in the above command are
xExtract files from an archive.-vto show the detailed output of the process.-fto specify the archive file.
List the contents
To see the files in an archive
tar -tvf compressed_file_name.tarFor a compressed archive provide the valid
-zor-jor-Joption
Senior Member of Technical Staff at Oracle. I build high-performance web applications and write about the intersection of software engineering and human creativity.
View Portfolio →You Might Also Like
My best stuff is in my email.
My goal is for it to be the most useful email you read that day.
No spam. Unsubscribe in one click.
Comments (0)
Loading comments...