In Linux, archiving and compression are distinct but often used together to manage files efficiently. Archiving combines multiple files and directories into a single archive file, while compression reduces the file size for storage and transfer. This will optimize costs in your company.
Creating archives with tar: gzip can’t add multiple files into one archive, hence we use the tar
program.
c — create
v — tell the program to be verbose and let us see what it is doing
f — the filename of the tar file has to come after this option
tar -cvf file3.txt.tar file3.txt
Then to achive files and directories
tar -cvf archive.tar list the files and directories
Then to archive files and directories
tar -cvf archive.tar list the files and directories
tar xvf text.txt.tar
To extract a tarred file
: $ tar xvf archive.tar
List the files in a tarred file
Zip and unzip files (Before you do this make sure that there’s zip apt in your system)
tar -czvf lesson.js.tar.zp
gzip/gunzip: Compress/decompress files.
gzip file.txt: Compress to file.txt.gz.
gunzip file.txt.gz: Decompress.
zip/unzip: Work with ZIP archives.
zip archive.zip file.txt: Create a ZIP file.
unzip archive.zip: Extract a ZIP file.
Top comments (0)