文件与文件系统压缩、打包与备份

文件压缩
[kingarthur@localhost ~]$ ls -ldSr /etc/*
-rw-r--r--. 1 root root 0 Jun 10 2014 /etc/wvdial.conf
-rw-r--r--. 1 root root 0 Oct 31 2018 /etc/subuid
-rw-r--r--. 1 root root 0 Oct 31 2018 /etc/subgid
-rw-r--r--. 1 root root 0 Jun 7 2013 /etc/motd
-rw-r--r--. 1 root root 0 Jun 7 2013 /etc/exports
-rw-r--r--. 1 root root 0 Oct 31 2018 /etc/environment
-rw-------. 1 root root 0 Mar 18 07:52 /etc/crypttab
-rw-------. 1 root root 0 Apr 11 2018 /etc/cron.deny
-rw-r--r--. 1 root root 1 Mar 19 16:30 /etc/resolv.conf.save
-rw-r--r--. 1 root root 1 Oct 31 2018 /etc/at.deny
drwxr-xr-x. 2 root root 6 Apr 11 2018 /etc/xinetd.d
drwxr-xr-x. 2 root root 6 Oct 31 2018 /etc/tmpfiles.d
...
-rw-r--r--. 1 root root 26832 Oct 31 2018 /etc/dnsmasq.conf
-rw-r--r--. 1 root root 51787 May 15 2013 /etc/mime.types
-rw-r--r--. 1 root root 121699 Mar 18 08:22 /etc/ld.so.cache
-rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services
[kingarthur@localhost ~]$ ls -ldS /etc/*
-rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services
-rw-r--r--. 1 root root 121699 Mar 18 08:22 /etc/ld.so.cache
-rw-r--r--. 1 root root 12589 Jul 23 2018 /etc/slp.conf
-rw-r--r--. 1 root root 12288 Mar 18 14:27 /etc/aliases.db
drwxr-xr-x. 2 root root 12288 Mar 18 08:07 /etc/brltty
...
-rw-r--r--. 1 root root 0 Jun 7 2013 /etc/motd
-rw-r--r--. 1 root root 0 Oct 31 2018 /etc/subgid
-rw-r--r--. 1 root root 0 Oct 31 2018 /etc/subuid
-rw-r--r--. 1 root root 0 Jun 10 2014 /etc/wvdial.conf
[kingarthur@localhost ~]$ cd /tmp/
[kingarthur@localhost tmp]$ cp /etc/services .
[kingarthur@localhost tmp]$ ls -l ./services
-rw-r--r--. 1 kingarthur kingarthur 670293 Apr 11 19:58 ./services
[kingarthur@localhost tmp]$ gzip -v services
services: 79.7% -- replaced with services.gz
[kingarthur@localhost tmp]$ ll /etc/services /tmp/services*
-rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services
-rw-r--r--. 1 kingarthur kingarthur 136088 Apr 11 19:58 /tmp/services.gz
[kingarthur@localhost tmp]$ zcat services.gz
$Id: services,v 1.55 2013/04/14 ovasik Exp $
tcpmux 1/tcp
tcpmux 1/udp
rje 5/tcp
rje 5/udp
echo 7/tcp
echo 7/udp
...
[kingarthur@localhost tmp]$ gzip -d services.gz
[kingarthur@localhost tmp]$ ls -l service*
-rw-r--r--. 1 kingarthur kingarthur 670293 Apr 11 19:58 services
[kingarthur@localhost tmp]$ gzip -9 -c services > services.gz
[kingarthur@localhost tmp]$ ls -l service*
-rw-r--r--. 1 kingarthur kingarthur 670293 Apr 11 19:58 services
-rw-rw-r--. 1 kingarthur kingarthur 135489 Apr 11 20:16 services.gz
[kingarthur@localhost tmp]$ zgrep -n 'http' services.gz
14: