linux 系统下 tar 的压缩与解压缩命令

时间:2022-11-01 15:55:27

1、压缩

[small@sun shine]# tar  -zcvf  java.tar.gz  java
java/
java/default/
java/default/THIRDPARTYLICENSEREADME-JAVAFX.txt
java/default/LICENSE
java/default/man/
java/default/man/ja/
java/default/man/ja/man1/
java/default/man/ja/man1/rmid.1
java/default/man/ja/man1/unpack200.1
java/default/man/ja/man1/javapackager.1
java/default/man/ja/man1/tnameserv.1
java/default/man/ja/man1/orbd.1
java/default/man/ja/man1/rmiregistry.1
java/default/man/ja/man1/native2ascii.1

2、查看详情

[small@sun shine]# tar  -tvf   java.tar.gz
drwxr-xr-x small/shine 0 2018-11-21 10:57 java/
drwxr-xr-x small/shine 0 2018-11-21 10:57 java/default/
-rwxr-xr-x small/shine 63933 2017-09-06 02:47 java/default/THIRDPARTYLICENSEREADME-JAVAFX.txt
-rw-r--r-- small/shine 40 2017-09-06 10:29 java/default/LICENSE
drwxr-xr-x small/shine 0 2018-11-21 10:57 java/default/man/
drwxr-xr-x small/shine 0 2018-11-21 10:57 java/default/man/ja/
drwxr-xr-x small/shine 0 2018-11-21 10:57 java/default/man/ja/man1/
-rw-r--r-- small/shine 19715 2017-09-06 10:29 java/default/man/ja/man1/rmid.1
-rw-r--r-- small/shine 5382 2017-09-06 10:29 java/default/man/ja/man1/unpack200.1
-rwxr-xr-x small/shine 32362 2017-09-06 02:47 java/default/man/ja/man1/javapackager.1

3、解压缩

[small@sun shine]# tar  -zxvf  java.tar.gz
java/
java/default/
java/default/THIRDPARTYLICENSEREADME-JAVAFX.txt
java/default/LICENSE
java/default/man/
java/default/man/ja/
java/default/man/ja/man1/
java/default/man/ja/man1/rmid.1
java/default/man/ja/man1/unpack200.1
java/default/man/ja/man1/javapackager.1
java/default/man/ja/man1/tnameserv.1
java/default/man/ja/man1/orbd.1
java/default/man/ja/man1/rmiregistry.1
java/default/man/ja/man1/native2ascii.1

注:-c 压缩  -t 查看  -x 解压缩