Tar, archiving and compressing
Archiving and compressing in Linux
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 just need to remember a few letters to quickly create archives with tar. The tar command can extract the resulting archives, too.
The GNU tar command included with Linux distributions has integrated compression. It can create a .tar archive and then compress it with gzip or bzip2 compression in a single command. That’s why the resulting file is a .tar.gz file or .tar.bz2 file.
What is the difference between archiving and compressing? Archiving is the process of collecting and storing a group of files and directories into one file. The tar utility performs this action. Compression is the act of shrinking the size of a file, which is quite useful in sending large files over the internet.Compressing a directory or a single fileUse the following command to compress an entire directory or a single file on Linux. It’ll also compress every other directoryARCHIVING + COMPRESSION ON LINUX:
Compressing tool
We created MyTestFile and used bzip2
Check on man bzip2
We hope you like it ad learned with us, and if you did please click like Thanks 😀
inside a directory you specify–in other words, it works recursively.
tar -zcvf docs.tar.gz Documents/
Here’s what those switches actually mean:
- -c: Create an archive.
- -z: Compress the archive with gzip.
- -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
- -f: Allows you to specify the filename of the archive.
- -x :extract
Let’s say you have a directory named “Download” in the current directory and you want to save it to a file named mythings.tar.gz. You’d run the following command:
DECOMPRESS/UNARCHIVE ON LINUX
Compressing tool
By convention, files compressed with gzip are given the extension .gz, files compressed with bzip2 are given the extension .bz2, and files compressed with zip are given the extension .zip.
Files compressed with gzip are uncompressed with gunzip, files compressed with bzip2 are uncompressed with bunzip2, and files compressed with zip are uncompressed with unzip.
We created MyTestFile and used bzip2
We hope you like it ad learned with us, and if you did please click like Thanks 😀
Tar, archiving and compressing
Reviewed by ohhhvictor
on
November 13, 2018
Rating:
No comments: