①打包命令 gzip bz2

只能压缩文件 打包后会删除源文件

gzip 注释文件
[root@rstx-53 test]# gzip file1  #压缩
[root@rstx-53 test]# ls
1  file10  file1.gz  file2  file3  file4  file5  file6  file7  file8  file9

[root@rstx-53 test]# gzip -d file1.gz  #解压
[root@rstx-53 test]# ls
1  file1  file10  file2  file3  file4  file5  file6  file7  file8  file9

[root@rstx-53 test]# gzip 1/test.txt 
[root@rstx-53 test]# ls
1  file10  file1.gz  file2  file3  file4  file5  file6  file7  file8  file9
[root@rstx-53 test]# zcat 1/test.txt.gz 
1

zip
[root@rstx-53 test]# zip backup.zip ./*  打包文件
  adding: 1/ (stored 0%)
  adding: file1 (stored 0%)
  adding: file10 (stored 0%)
  adding: file2 (stored 0%)
  adding: file3 (stored 0%)
  adding: file4 (stored 0%)
  adding: file5 (stored 0%)
  adding: file6 (stored 0%)
  adding: file7 (stored 0%)
  adding: file8 (stored 0%)
  adding: file9 (stored 0%)

[root@rstx-53 test]# zip -r backup.zip  /etc/  目录打包
 adding: etc/migrations (stored 0%)
  adding: etc/resolv.conf.save (stored 0%)
  adding: etc/nsswitch.conf.rpmnew (deflated 58%)
  adding: etc/named/ (stored 0%)
  adding: etc/named.rfc1912.zones (deflated 60%)
  adding: etc/named.namedmanager.conf (stored 0%)
  adding: etc/subgid- (deflated 45%)
[root@rstx-53 test]# du -sh backup.zip 
1.4G	backup.zip
posted @ 2021-03-06 14:43  老夫聊发少年狂88  阅读(69)  评论(0编辑  收藏  举报