linux How To Tar Files – Learning Drives

linux How To Tar Files – Learning Drives .Introduction The HTML0 Linux”tarball” ( “tar.gz” or “tar.bz2” file ) is nothing more than an operating system-specific file format that blends and compresses several files. Tarballs are a common format for files that is used on Linux operating system. They are typically used to distribute media or software, or for backup for backup purposes. This guide will show you how to tar files using Linux with the Linux command line option tar.

It is possible to use the Linux the command tar to create uncompressed or compressed Archive files. We can also manage and alter them.

Suggested Read: Cool Words, Nouns That Start With Alphabets (A-Z) .Nouns That Start With Z Positive Words That Start With Z. Christmas Words That Start With Z

linux how to tar a file, linux how to tar files,how to tar a file in linux,how to unzip tar.gz file in linux,	 how to unzip tar gz file in linux,tar a file in linux,how to tar a file linux,how to tar files in linux	, linux how to tar a file	,how to tar a file in linux


tar [options] [archive file[directory or file to be archived[directory or file to be archived


  • -c : Creates Archive
    -x: Take the archive
    -f: creates archive with the given filename
    -t: lists or displays archives of files
    -u: archives and enhances an archive file that is already in existence
    -v : Displays Verbose Information
    A : Concatenates archive files
    –z : zip, informs the tar command to create a an tar file by using Gzip
    -j: Filter archive tar files by using the tbzip
    -W: Verify an archive file
    -r: Add or update directories or files to already existing .tar file
Tutorial details
The difficulty levelEasy
Root privilegesNo
RequirementsLinux terminal
Prerequisitestar command
OS compatibility*BSD * Linux * macOS * Unix * WSL
Est. reading time3 minutes

How to tar a document on Linux by using the command line

The process is as follows to tar a file on Linux:

Start the terminal application in Linux

Compress the entire directory by using the the tar –zcvf file.tar.gz the /path/to/dir option in Linux.

To compress one file by running the the tar the -zcvf file.tar.gz path/to/filename option on Linux.

Compress and tar multiple directories files by running the tar with -zcvf file.tar.gz dir1 dir2 dir3 command in Linux.

How do you create a tar file on Linux

If you’re trying to compress an entire directory called”/home/vivek/data/,” then enter:
$ tar -czvf file.tar.gz /home/vivek/data/
In order to compress several directories or files run:
$ tar -czvf file.tar.gz /home/vivek/data/ /home/vivek/pics/ /home/vivek/.accounting.db
One can utilize Bzip2 compression instead of Gzip by taking the -j alternative to the command tar:
$ tar -c J Vf file.tar. bz2 /home/vivek/data/

  • -c : Create a brand new archive
  • V : Verbose output
  • with a f file.tar.gz : Use archive file
  • –z filter the file with Gzip
  • -j Filter the archive using the bzip2

How do you exclude directories and files from using the tar

You can exclude certain files while making the Tarball. It is as follows:
$ the tar command Zcvf archive.tar.gz --exclude='dir1'" dir1
For instance, you should exclude /Downloadsor directories:
$ tar -czvf /nfs/backup.tar.gz --exclude="Downloads" /home/vivek/

How can I access the files that are stored in an archive?

Now you’ve got an archive to display what’s inside a tar.gz file with the tar command:
$ tar -ztvf file.tar.gz
$ tar -jtvf file.tar.bz2
The command above would display all files with a verbose manner.

How do I extract an archive?

You can extract the contents of an archive using an tar command. This syntax can be described as:
$ tar -xzvf file.tar.gz
$ tar $ -xjvf file.tar.bz2
Want to extract the contents of the archive into a specific directory such as /home/vivek/backups/? Try using the -C DIR option:
$ tar -xzvf my.tar.gz -C /home/vivek/backups/
$ the tar file -xjvf archive.tar.bz2 -C TMP/

  • -x Extract files from archives
  • –t : The details of an archive
  • –v : Verbose output
  • –f file.tar.gz : Use archive file
  • –C DIR : Switch to DIR prior to making any operation
  • –exclude files with PATTERN/DIR/FILENAME

When you’re running a graphic Linux desktop computer, you can make use of the file compression utility or file manager integrated into the desktop for creating or extraction of .tar files. On Windows you can also create and extract .tar archives with the no-cost 7-Zip software.

Linux Commands
Filestar * pv * tac the grep compare * diff arch * pushd popd * fsck * testdisk seq Fd * pandoc * cd * $PATH * awk Join * JQ * Fold uniq * journalctl * stat * Ls fstab * echo * less * chgrp * chown * rev * look * strings * type * rename * zip * unzip * mount * umount * install * fdisk * mkfs * rm * rmdir * rsync * df * gpg * vi * nano * mkdir * du * LN * Patch* Convert shred * rclone * srm
ProcessesScreen * alias * nice * renice progression * strace * tmux* chsh * the history of * in * batches no cost * which usermod * ps* chroot * redy * vmstat * lsof timeout * wall * kill * sleep sudo * su * time grupadd, usermod and groups lshw * shutdown * stop * poweroff passwd * lscpu Date * Bg fg
Networkingnetstat * traceroute * ping * ip * SSS * whois * fail2ban * Bmon * dig nmap * Ftp * curl * wget”who * whoami w * iptables * SSH-Keygen * ufw


You’ve learned how to extract an image in Linux by using the tar command. For more details, please visit the visit the tar command’s help page below or download it locally by using man command: man command:

Suggested Read.

How To Get Dark Mode on Google?-Learning Drives
How To Make A PDF On iPhone? -Learning Drives
How To Make Desktop Icons Smaller? -Learning Drives
How to Play YouTube in Background? -Learning Drives
How to Post GIFs on Facebook? -Learning Drives
How to Post Live Photos on Facebook? -Learning Drives
How To Post live Photos on Instagram? -Learning Drives


1 Times Table (Times Tables) – Learning Drives2 Times Table (Times Tables) – Learning Drives
3 Times Table (Times Tables) – Learning Drives4 Times Table (Times Tables) – Learning Drives
5 Times Table (Times Tables) – Learning Drives6 Times Table (Times Tables) – Learning Drives
7 Times Table (Times Tables) – Learning Drives8 Times Table (Times Tables) – Learning Drives
9 Times Table (Times Tables) – Learning Drives10 Times Table (Times Tables) – Learning Drives
11 Times Table (Times Tables) – Learning Drives12 Times Table (Times Tables) – Learning Drives
13 Times Table (Times Tables) – Learning Drives14 Times Table (Times Tables) – Learning Drives
15 Times Table (Times Tables) – Learning Drives16 Times Table (Times Tables) – Learning Drives
17 Times Table (Times Tables) – Learning Drives18 Times Table (Times Tables) – Learning Drives
19 Times Table (Times Tables) – Learning Drives20 Times Table (Times Tables) – Learning Drives
21 Times Table (Times Tables) – Learning Drives22 Times Table (Times Tables) – Learning Drives
23 Times Table (Times Tables) – Learning Drives24 Times Table (Times Tables) – Learning Drives
2S Times Table (Times Tables) – Learning

Leave a Comment