0%
压缩
GZIP (tar.gz, tgz)
1
| tar -czvf name-of-archive.tar.gz /path/to/directory-or-file /path2 --exclude=/path3
|
-c: Create an archive
-z: use gZip
-v: Verbose
-f: Filename of the archive
--exclude: exclude paths
BZIP2 (tar.bz, tar.bz2, tbz)
和GZIP一样, 除了把-z换成-j.
1
| tar -cjvf name-of-archive.tar.gz /path/to/directory-or-file /path2 --exclude=/path3
|
XZ (tar.xz)
和GZIP一样, 除了把-z换成-J.
1
| tar -cJvf name-of-archive.tar.gz /path/to/directory-or-file /path2 --exclude=/path3
|
解压
GZIP
1
| tar -xzvf archive.tar.gz -C /tmp
|
-x: eXtract
-z: gzip
-v: Verbose
-f: Filename of the archive
-C: destination folder
BZIP2
和GZIP一样, 除了把-z换成-j.
1
| tar -xjvf archive.tar.gz -C /tmp
|
XZ
和GZIP一样, 除了把-z换成-J.
1
| tar -xJvf archive.tar.gz -C /tmp
|