Profile:
Tar is the main file compression and decompression, is a more commonly used command.
Command format:
tar [-cxtzjvfppn] pathname [pathname ...]
Parameters:
-C: Create an archive
-X: Unlocking an Archive
-T: View an archived content
-Z: Archive compression or decompression with gzip
-j: Compress or decompress archive with bzip2
-V: Show detailed process
-F: Use file name, followed by file name directly
-r: Append file to end of file
--delete: Deleting files from files
-P: Do not change the original properties of the file
-N: Archive only updated files, followed by date (YYYY/MM/DD)
--exclude file: Do not package the following files
Example:
1, packaging/home but not compression
Tar-cvf/filepath/filename.tar/home
2, to gzip compression and packaging
Tar-zcvf/filepath/filename.tar.gz/home
3. Compress and pack with BZIP2
Tar-jcvf/filepath/filename.tar.bz2/home
4, view the tar file content
Tar-tvf/filepath/filename.tar
5, view the content of gzip files,
Tar-ztvf/filepath/filename.tar.gz
6, view bzip2 file contents
tar-jtvf/filepath/filename.tar.bz2
7, back up the/home directory and save permission settings
Tar-zxvpf/filepath/filename.tar.gz/home
8, Backup/home in the directory than the 2009/05/28 new files
Tar-n "2009/05/28"-zcvf/filepath/filename.tar.gz/home
9, Backup/home directory, but do not back up the/home/slyar directory
Tar--exclude/home/slyar-zcvf/filepath/filename.tar.gz/home
10, back up the/home directory for home.tar.gz, only extract/home/slyar.sh files
TAR-ZXVF home.tar.gz home/slyar.sh