Tar, archiving and compressing files

Ace your homework & exams now with Quizwiz!

unzip

$ unzip [name of file] $ unzip file3zip.zip

Making file archives (or zip files)

-2 options: zip file format is for Windows, so Linux primarily uses: bzip and gzip to great Tars

compressing files

-3 ways: gzip, bzip2, zip

Tar

-archives things; does not compress or compact; it just sticks all your files together into one file -traditionally Tar was used to create tape backups. We used it to archive data on to tape backup drives. Tar stands for "Tape Archive" -e.g. could be used to archive a folder (e.g. folder1) which contains 3 files, and create one archived file out of it; you can also tar several files instead of a folder with files

gzip

-compressed file format -gzip utility to compress the size of a file -the tool used to compress is 'gzip' and we use 'gunzip' to uncompress/unzip it -to use: $ gzip [tar file] $gzip folder1.tar

tar -cf

-creates file; file.tar -e.g.: $ tar -cf folder1tar.tar folder1 (assuming folder1 has several files) OR $ tar -cf files.tar file1.txt file2.txt file3.txt

tar -xf

-extracts file; file.tar -e.g.: $ tar -xf folder1tar.tar

bzip2

-like gzip, but better, and does a better job at compressing -we use bzip2 to compress/zip, and bunzip2 to uncompress/unzip -to use: $ bzip2 [tar file] $ bzip2 folder1.tar

tar -jcf

-to do tar WITH compression with bzip2 -file.tar.bz2 or file.tb2 $ tar -jcf [desired folder name].tb2 [desired folder to archive/compress] $ tar -jcf folder1.tb2 folder1

tar -zcf

-to do tar WITH compression with gzip -file.tar.gz or file.tgz -e.g. $ tar -zcf [desired folder name].tgz [desired folder to archive/compress] $ tar -zcf folder1.tgz folder1

zip -r

-to recursively zip a directory $zip -r folderzip1.zip folder1

tar -tvf

-to test the tar first

bunzip2

-to uncompress -e.g.: $ bunzip2 [bz2 file] $ bunzip2 folder1.tar.bz2

tar -jxvf

-to uncompress and untar with bzip2 -e.g.: $ tar -jxvf folder1.tb2

tar -zxvf

-to uncompress and untar with gzip -e.g.: $ tar -zxvf folder1.tgz

gunzip

-to uncompress gzip file -e.g.: $ gunzip [file with gz file] $ gunzip folder1.tar.gz

zip

-used on Windows or OSX, but also Linux -zip tool is used for zipping/compressing, and unzip is used for uncompressing/unzipping -***both archives and compresses end result of file; this is the only tool that does both of these; however, we could use some flags with gzip or bzip2 which archive files and compress them at the same time -zip on CentOS/RedHat server is not installed already -to use: zip [desired zip file file name].zip [what we want to zip] $ zip file3zip.zip file3.txt

tar -xvf

-v = verbose, will show us the uncompression -***typically, the order of operation (e.g. xvf vs fxv vs vfx) doesn't matter, except when using tar -e.g. $ tar -xvf folder1.tar


Related study sets

Chapter 8 - Homeowners Insurance

View Set

The Crucible Act 1 Study Questions

View Set

Introduction to Communication - C464 UNIT 6

View Set