File Compression and Archiving in Linux (tar, gzip, zip)


 Introduction

Linux provides several tools to compress and archive files, helping save disk space and simplify backups.


Step 1: Create an Archive with tar


tar -cvf archive.tar file1 file2


➡️ -c create, -v verbose, -f file name.


Step 2: Extract an Archive


tar -xvf archive.tar


Step 3: Compress with gzip


gzip file.txt


➡️ Creates file.txt.gz.


Step 4: Decompress with gunzip


gunzip file.txt.gz


Step 5: Use zip and unzip


zip archive.zip file1 file2

unzip archive.zip


Conclusion

Archiving and compression are essential for storage management and data transfer.

Comments