Saturday, February 3, 2018

Compressing Files And Archiving In Linux Command

There are strong compression utilities in Linux that can be run easily from the command line. Linux features an archiving utility called tar in which you can add many files, and the tar file will be treated as a single file. You may wonder how this is different from a folder.


Linux features the zip and a gzip utilities to compress and extract (uncompress) files. There is also a bzip and bzip2, but we will talk about zip and gzip.


At the command prompt, use this format compress a file: “gzip filename” The file will be compressed and saved as filename.gz


To extract a compressed file: gunzip filename.gz

The file filename.gz will be deleted, and the extracted file, that is, “filename”, is created in the current folder.


Similarly, to use the zip format so that the file can be opened even on a Windows machine, you can use the zip utility:


zip filename.zip filename (to compress)
unzip filename.zip (to extract)

Archiving at the command prompt

You will need to know the four basic options of the tar command generally used.


C: create a new archive
V: verbose; show the files being archived
X: extract files from an archive
F: when used with C, it means "use the filename specified for creation for the file," "or when used with X, it means use the filename specified for the extracted file."

You can add several files to the archive with the tar utility as follows:


tar -cvf filename.tar /dir1/dir2/dir3 /dir1/dir2/dir3

The files in dir1, dir2 (which is a subdirectory under dir 1) and dir3 (which is a subdirectory under dir2) will be added to the tar archive such that the directory structure is maintained in the form of dir1, dir2 (created under dir1) and dir3 (created under dir2) in the archive. You can of course, specify different folder names in the second set of directories.


Most distributions give you a GUI interface to do this. Having explained the harder way to do this, we leave you to figure out how it is done with the GUI. Have fun!


Compressing Files And Archiving In Linux Command

These are questions that has been asked randomly for by different peoples around the world and answers are already been explained above. linux unzip zip file linux create tar create tar file how to unzip a file in linux how to extract gz file in linux windows unzip command untar linux zip file linux command linux unzip gz unzip tgz command to zip a folder in linux gzip command in linux uncompress gz unzip file linux gz format create tar file windows gzip linux tar gz linux command tar directory linux zip unzip tar file in unix unzip tar gz extract bz2 tar list files gzip example gzip command example tar command in unix linux gzip folder tar gz file unzip command in linux man gzip gzip command gzip command in unix how to compress a folder unzip linux untar file tar windows


bz2 linux linux zip file how to zip a folder in linux linux zip folder tar command in linux gz archive linux unpack tar how to untar a file linux zip command what is a tar file tgz linux linux tar how to unzip gz file in linux linux zip directory tar name gzip compression tar zxvf tar compress tar xvf tar command tar xvzf how to untar untar extract tgz linux tar example untar tar file unzip command line tar xvfz tgz extension If there is anything else that you are not sure about then please do let us know in comment section. We will try to resolve the same in time.

I’m selfish, impatient and a little insecure. I make mistakes, I am out of control and at many times hard to handle. But if you can’t handle me at my worst, then i'm sure as hell that you don’t deserve me at my best.


EmoticonEmoticon