To compress a directory in Linux, you can use the tar command:

tar -zcvf file.tar.gz folder

To exclude a specific folder or files, use the –exclude= option with the folder name:

tar -zcvf file.tar.gz –exclude='temp' –exclude='node_modules' folder

To decompress a file, use the -x option:

tar -xzvf file.tar.gz

To decompress a file to a different directory, add the directory path:

tar -xzvf file.tar.gz /home/debian/destination

Previous Post