What is Tar XZVF


The tar command on Linux is often used to create .tar.gz or .tgz archive files, also called "tarballs". This command has a large number of options, but you only need to memorize a few letters to quickly tar archives. The tar command can also extract the resulting archives.

The GNU tar command that is included in Linux distributions has built-in compression. It can create a .tar archive and then compress it using gzip or bzip2 compression in a single command. Because of this, the resulting file is a .tar.gz file or a .tar.bz2 file.

Compresses an entire directory or a single file

Use the following command to compress an entire directory or a single file on Linux. It also compresses every other directory within a directory you specify, meaning it works recursively.

tar -czvf name-of-archive.tar.gz / path / to / directory-or-file

What these switches actually mean:

  • -c: C. Create an archive
  • -z: compress the archive with g z ip.
  • -v: view the progress in the terminal while creating the archive, also known as " v erbose "mode. The v is always optional in these commands, but it is useful.
  • -f: Allow you to f Enter the name of the archive.

Let's say you have a directory called "stuff" which is the current directory and you want to save it in a file called archive.tar.gz. You would run the following command:

tar -czvf archive.tar.gz stuff

Or let's say there is a directory under / usr / local / something on the current system and you want to compress it into a file named archive.tar.gz. You would run the following command:

tar -czvf archive.tar.gz / usr / local / something

Compress multiple directories or files at the same time

RELATIVE: How to manage files from Linux Terminal: 11 commands you should know

Although tar is often used to compress a single directory, it can also be used to compress multiple directories, multiple individual files, or both. Just provide a list of files or directories instead of a single list. Suppose you want to compress the / home / ubuntu / Downloads directory, the / usr / local / stuff directory, and the /home/ubuntu/Documents/notes.txt file. You would just run the following command:

tar -czvf archive.tar.gz / home / ubuntu / Downloads / usr / local / stuff /home/ubuntu/Documents/notes.txt

List just as many directories or files as you want to back up.

Exclude directories and files

In some cases, you may want to compress an entire directory, but not specific files and directories. You can do this by adding a switch for each directory or file that you want to exclude.

For example, suppose you want to compress / home / ubuntu, but you don't want to compress the / home / ubuntu / Downloads and /home/ubuntu/.cache directories. Here's how you would do it:

tar -czvf archive.tar.gz / home / ubuntu --exclude = / home / ubuntu / Downloads --exclude = / home / ubuntu / .cache

The switch is very powerful. It doesn't take directory and file names - it actually accepts patterns. You can do a lot more with it. For example, you can archive an entire directory and exclude all .mp4 files with the following command:

tar -czvf archive.tar.gz / home / ubuntu --exclude = *. Mp4

Use bzip2 compression instead

While gzip compression is most commonly used to create .tar.gz or .tgz files, tar also supports bzip2 compression. This allows you to create bzip2 compressed files, often referred to as .tar.bz2, .tar.bz, or .tbz files. To do this, simply replace the -Z for gzip in the commands here with a -J for bzip2.

Gzip is faster, but it generally compresses a little less, so you get a slightly larger file. Bzip2 is slower, but it compresses a bit more so you get a slightly smaller file. Gzip is also more common, with some stripped down Linux systems including Gzip support but not Bzip2 support. In general, gzip and bzip2 are practically identical and they both work similarly.

For example, instead of the first example provided for compressing the stuff directory, we would run the following command:

tar -cjvf archive.tar.bz2 stuff

Extract an archive

Once you have an archive you can extract it using the tar command. The following command extracts the contents of "archive.tar.gz" into the current directory.

tar -xzvf archive.tar.gz

It is the same as the archive command we used above, except that it replaces the switch. This indicates that you have an archive x instead of wanting to create one.

You can extract the contents of the archive to a specific directory. You can do this by appending the switch to the end of the command. For example, the following command extracts the contents of the archive.tar.gz file to the / tmp directory.

tar -xzvf archive.tar.gz -C / tmp

If the file is a bzip2 compressed file, replace the "z" with a "j" in the commands above.

This is the simplest possible use of the tar command. The command includes a large number of additional options so we cannot list them all here. For more informations. Run the command info tar in the shell to display the tar command's detailed information page. Press the key q to close the information page when you are finished. You can also read the tar manual online.

If you're using a Linux graphical desktop, you can also use the file compression utility or file manager that came with your desktop to create or extract .tar files. On Windows, you can extract and create .tar archives using the free 7-Zip utility.

How to Use Excel AutoRecover and AutoBackup Features

It's always a terrible tragedy when someone loses something important that they were working on because they didn't properly save their document. This happens more often than you'd think for Excel and Word users! Fortunately, in the last couple of versions Microsoft has added many features that help reduce the likelihood of data loss due to crashes, power outages, accidental deletions, etc.


Installing and Deleting Fonts in Windows the Easy Way

Starting with Windows 7 and moving on to Windows 10, the process of managing fonts in Windows has become a lot simpler and easier to use. Whether you're a professional who needs to install lots of fonts for your work or someone who wants to speed up their computer by getting rid of useless fonts, Windows makes it easy to do both of these tasks