欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Centos 7 壓縮與解壓縮命令小結(jié)

  發(fā)布時(shí)間:2023-03-28 00:34:15   作者:佚名   我要評(píng)論
這篇文章主要介紹了Centos 7 壓縮與解壓縮命令小結(jié),需要的朋友可以參考下

 1.zip文件壓縮

語(yǔ)法:zip 加壓縮后的文件名 加要壓縮的文件名。

[root@localhost ~]# zip test.zip test.txt
  adding: test.txt (deflated 100%)
[root@localhost ~]# 

后面出現(xiàn)進(jìn)度條百分比數(shù)字說明已經(jīng)壓縮好了然后你在ll驗(yàn)證一下看看有沒有你命名的文件包。

[root@localhost ~]# ll
總用量 820004
-rw-------. 1 root root      1587 3月  22 16:58 anaconda-ks.cfg
-rw-r--r--. 1 root root      1635 3月  22 17:00 initial-setup-ks.cfg
-rw-r--r--. 1 root root 838860800 3月  26 14:56 test.txt
-rw-r--r--. 1 root root    814270 3月  26 14:57 test.zip
[root@localhost ~]# 

2. zip 文件解壓縮

zip 解壓縮就在zip 前面加個(gè)un ,要指定路徑的話就加個(gè) -d

語(yǔ)法就是 unzip 要解壓的文件名 -d 指定解壓路徑

[root@localhost ~]# unzip test.zip -d /tmp/
Archive:  test.zip
  inflating: /tmp/test.txt           
[root@localhost ~]# 

是不是很簡(jiǎn)單,然后再ls 加你指定的路徑去驗(yàn)證一下有沒有你解壓出來的文件,有的話就說明你成功了。恭喜你成功學(xué)會(huì)了zip 壓縮和zip 解壓?。?!然后我們繼續(xù)....

[root@localhost ~]# ls /tmp
test.txt
[root@localhost ~]# 

3.tar壓縮與解壓縮

tar參數(shù)有

-c 建立一個(gè)壓縮文件

-x 解開一個(gè)壓縮文件

-t 查看tar壓縮文件里面的文件

-z 使用gzip壓縮

-j 使用bzip2壓縮

-v 壓縮過程中顯示文件*(常用)但不建議用在背景執(zhí)行過程

-f 使用檔名,注意:f之后要立即接檔名,不能再接參數(shù)

注意:以上是tar常用的參數(shù),以上三個(gè)參數(shù)不能同時(shí)使用,只能存在一個(gè)!??!

tar 創(chuàng)建一個(gè)文件命令

語(yǔ)法:tar [參數(shù)] 文件與目錄... ...

[root@localhost ~]# tar -czvf user /etc
tar: 從成員名中刪除開頭的“/”
/etc/
/etc/fstab
/etc/crypttab
/etc/mtab
/etc/resolv.conf
/etc/fonts/
/etc/fonts/conf.d/
/etc/fonts/conf.d/57-dejavu-serif.conf
/etc/fonts/conf.d/65-1-vlgothic-gothic.conf
/etc/fonts/conf.d/31-cantarell.conf
/etc/fonts/conf.d/65-0-lohit-nepali.conf
/etc/fonts/conf.d/59-liberation-mono.conf

后面還有一堆看不懂的東西然后就到后面在ls查看一下是否存在。

[root@localhost ~]# ls
anaconda-ks.cfg  initial-setup-ks.cfg  test.txt  test.zip  user
[root@localhost ~]# 

然后再說解壓縮.....

4. tar 解壓縮

tar 加參數(shù)加文件名

[root@localhost ~]# tar -xvf user
etc/
etc/fstab
etc/crypttab
etc/mtab
etc/resolv.conf
etc/fonts/
etc/fonts/conf.d/
etc/fonts/conf.d/57-dejavu-serif.conf

后面還有一堆的解壓過程就省略了反正就是解壓成功了

下面是其他網(wǎng)友的補(bǔ)充

一、Linux版本

二、解壓縮.tar.gz包到當(dāng)前目錄

tar -xzvf apache-tomcat-7.0.90.tar.gz


三、將指定文件壓縮成.tar.gz包

tar -czf apache-tomcat-7.0.90.tar.gz ./bin/ ./conf/ ./BUILDING.txt ./README.md

四、解壓縮.war包到當(dāng)前目錄

jar -xvf file.war


五、將當(dāng)前目錄所有文件壓縮成.war包

jar -cvfM0 file2.war ./


六、解壓縮.tar包到當(dāng)前目錄

tar -xvf desk.tar

七、將指定文件壓縮成.tar包

tar -czf desk2.tar ./file.pdf ./abc/ 

到此這篇關(guān)于Centos 7 壓縮與解壓縮命令小結(jié)的文章就介紹到這了,更多相關(guān)Centos7 壓縮和解壓縮內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論