Archive and Compression

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

WELCOME TO COSS VIRTUAL TRAINING

RedHat

TODAY'S AGENDA

1. ARCHIVING IN LINUX (tar)


2. COMPRESSING IN LINUX
• BZIP
• GZIP
• XZ
RedHat WHAT IS ARCHIVING IN
LINUX?
The process of gathering large sets of files into a single file is called as archive.
It is a combination of multiple files into a single file.
example- if you download multiple photo or file from google drive it will be
downloaded in a single rar file and then you need to extract it.
RedHat COMMAND TO ARCHIVE:

 Archiving and compressing files are useful when creating backups


and transferring data across a network.

 One of the oldest and most common commands for creating and
working with backup archives is the tar command.

 A tar archive is a structured sequence of file data mixed in with


metadata about each file and an index so that individual files
can be extracted.
RedHat
TAR COMMAND OPTIONS:

[user@host ~]$ tar -cf archive.tar file1 file2 file3


LISTING CONTENTS OF AN ARCHIVE?
RedHat
[root@host ~]# tar -tf /root/etc.tar

EXTRACTING FILES FROM AN ARCHIVE:

A tar archive should usually be extracted in an empty directory to


ensure it does not overwrite any existing files. When root extracts
an archive, the tar command preserves the original user and group
ownership of the files. If a regular user extracts files using tar, the
file ownership belongs to the user extracting the files from the archive.
EXAMPLE OF EXTRACTING ARCHIVE
RedHat
[root@host etcbackup]# tar -xf /root/etc.tar

NOTE:

By default, when files get extracted from an archive, the umask is


subtracted from the permissions of archive content. To preserve
the permissions of an archived file, the p option when extracting an
archive.

Example- #tar -xpf /root/myscripts.tar


RedHat COMPRESSION
File compression is a process of "packaging" a file (or files) to use
less disk space. Compression software allows you to take many files
and compress them into one file, which is smaller than the combined
size of the originals.
The tar command supports three compression methods. There are
three different compression methods supported by the tar command.
The gzip compression is the fastest and oldest one and is most widely
available across distributions and even across platforms. bzip2
compression creates smaller archive files compared to gzip but is
less widely available than gzip, while the xz compression method
is relatively new, but usually offers the best compression ratio of
the methods available.
RedHat
OPTION TO COMPRESS FILES
RedHat

THANK YOU !
FUTURE ADMINS.

You might also like