Create archives and extract archive files with tar and gzip command
Create archives and extract archive files with tar and gzip command in Linux
tar
Use
Example
Archive files or directories
tar -cvf backup.tar /etc
This command creates an archive file named backup.tar, which is an archive of the /etc directory.
tar -xvf backup.tar
tar -tvf backup.tar
gzip
Gzip is a command often used in Linux systems to compress and decompress files. It is convenient and easy to use.
Use
Example
Compress each file in the /home directory into a .gz file
cd /home gzip *
Extract each compressed file in /home directory and list detailed information
gzip -dv *
gzip -l *