logo
SearchAll PostsTagsNotesAuthor
instagramtwitterfacebookyoutubelinkedinmailgithubrss
Copyright © 2026 All rights reserved.
•
VIKI
Built with Vikramaditya Singh
Built with
VIKI - A posts created with Next.js and Tailwind.css

The Tar Command Chronicles: Bundle, Zip, and Conquer!

tar
linux
code
snippet
December 20, 2024
Vikramaditya SinghVikramaditya Singh
0
Vikramaditya Singh

Vikramaditya Singh

twittergithublinkedin

Software engineer III 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

#4
0
0

Port Wars: Hunt Down and Terminate Rogue Processes!

Stuck with a port already in use and don’t know which process is hogging it? This blog will guide you through finding the culprit and shutting it down like a pro.

linuxcodesnippet
View SourceDec 23, 2024

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...

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

  • -c for creating a new archive
  • -v to show the detailed output of the process.
  • -f to 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.tar

the options used in the above command are

  • x Extract files from an archive.
  • -v to show the detailed output of the process.
  • -f to specify the archive file.

List the contents

To see the files in an archive

tar -tvf compressed_file_name.tar

For a compressed archive provide the valid -z or -j or -J option