Compression decompression files under Linux This is a very common command, we need to pack the files very often to do the transfer or other operations.
Sometimes the company's programmers need to download the program that is running the site, need to pack, but for example, the backup folder has more than 10 g, upload pictures of the folder is also very large, you can not write the other folders again?
By looking, I also found two ways to share with you here
1. $ (ls | grep-v xx)
TAR-ZCF tmp.tgz $ (ls | grep-v xx)
grep-v: anti-retrieval, displaying only rows that do not match. This excludes specific folders. This method also applies with the zip command.
2.--exclude
When you compress a directory, sometimes you want to exclude a directory
For example, if the 123 directory has 3 subdirectories, AA, BB, CC. I now want to package only the AA and BB directories for compression, the command is as follows:
TAR-ZCVF 123.tar.gz --EXCLUDE=CC 123
(Running outside of the 123 directory) uses the exclude parameter to filter unwanted directories or files, excluding the operation and directory of a file.
Exclude specific folders when "original" Linux compresses folders