In Linux we use zip, gzip, bzip, etc for compression however, tar for archiving. CREATE FILES AND FOLDERS FOR ARCHIVING AND COMPRESSION Create Directories, mkdir RHEL RHCSA Linux Create file, seq 1000000 > File1.txt ARCHIVING USING TAR TAR stands for Tape ARchive. It is used to archive data. • It is not used to compress. • By not compressing and only archiving means - a bunch of files spread around the system can be grouped together in single file/folder for them to be easily moved around. • There is NO SPACE SAVING! Using Tar. • Without a compression algorithm applied, Tar just archives. Use .tar extension on the file to be created. • We Un-Tar files - or extract/expand when and where needed to deploy. • FACTS about TAR, Achiving, Removing and Extracting using Tar Example below to put Files and Folders to a common Tar file - Archive.tar, No Space Saving - Verification Verify File Size FILE COMPRESSION & ARCHIVING 04 August 2018 07:23 PM MODULE 1 - PERFORMING BASIC SYSTEM MANAGEMENT TASKS Page 1
4
Embed
FILE COMPRESSION & ARCHIVING - s3-ap-southeast … · Compress/Zip using Tar Using bzip for File Compression, tar -cvjf DesktopBackup.bz2 RHEL RHCSA Linux File1.txt To View To view
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
In Linux we use zip, gzip, bzip, etc for compression however, tar for archiving.
CREATE FILES AND FOLDERS FOR ARCHIVING AND COMPRESSIONCreate Directories,mkdir RHEL RHCSA Linux
Create file,seq 1000000 > File1.txt
ARCHIVING
USING TARTAR stands for Tape ARchive.
It is used to archive data.•It is not used to compress.•By not compressing and only archiving means - a bunch of files spread around the system can be grouped together in single file/folder for them to be easily moved around.
•
There is NO SPACE SAVING! Using Tar.•Without a compression algorithm applied, Tar just archives. Use .tar extension on the file to be created.•We Un-Tar files - or extract/expand when and where needed to deploy.•
FACTS about TAR,
Achiving, Removing and Extracting using TarExample below to put Files and Folders to a common Tar file - Archive.tar,
No Space Saving - VerificationVerify File Size
FILE COMPRESSION & ARCHIVING04 August 2018 07:23 PM
MODULE 1 - PERFORMING BASIC SYSTEM MANAGEMENT TASKS Page 1
COMPRESSINGFiles can be Archived and then Compressed as separate steps; Or, can be combined as one step.
Gzip•Bzip•
Various Compression Algorithm/Utilities are available to archive this like,
COMPRESSION AS SEPARATE ACTION
Using Gzip
CompressFiles which are Archived above can be compressed as separate action as below.We use same archive tar file to compress,
ExtractExtract using Gunzip command to extract above created file back to original,
Using BZip2
CompressFiles which are Archived above can be compressed as separate action as below.We use same archive tar file to compress,
MODULE 1 - PERFORMING BASIC SYSTEM MANAGEMENT TASKS Page 2
ExtractExtract using Gunzip command to extract above created file back to original,
COMPRESSION AS WE ARCHIVE
Compress/Zip using TarUsing bzip for File Compression,tar -cvjf DesktopBackup.bz2 RHEL RHCSA Linux File1.txt
To ViewTo view content of Zipped file.tar -tvf DesktopBackup.bz2
Check SizeCheck file size of individual Files and Folders,du -h RHEL RHCSA Linux File1.txt
MODULE 1 - PERFORMING BASIC SYSTEM MANAGEMENT TASKS Page 3
Check file size of zipped file,du - h DesktopBackup.bz2
UnzipExtracts in present working directory.tar -xvjf DesktopBackup.bz2
Used switches-c to create-v for verbose (shows as compression happens)-z to use gzip compression -j to use bz2 compression-t to list the content-x to Extract Content
MODULE 1 - PERFORMING BASIC SYSTEM MANAGEMENT TASKS Page 4