范例一:将整个 /etc 目录下的文件全部打包成为 /tmp/etc.tar
[[email protected] ~]# tar -cvf /tmp/etc.tar /etc <==仅打包,不压缩!
[[email protected] ~]# tar -zcvf /tmp/etc.tar.gz /etc <==打包后,以 gzip 压缩
[[email protected] ~]# tar -jcvf /tmp/etc.tar.bz2 /etc <==打包后,以 bzip2 压缩
范例三:将 /tmp/etc.tar.gz 文件解压缩在 /usr/local/src 底下
[[email protected] ~]# cd /usr/local/src
[[email protected] src]# tar -zxvf /tmp/etc.tar.gz
时间: 2024-11-04 01:40:54