tar 命令打包文件与解压文件
打包文件
1、把/root目录下的test1整个打包为test1.tar文件,如下所示
[root@localhost ~]# pwd
/root
[root@localhost ~]# tar -cvf test1.tar test1
test1/
[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  my.cnf  test1 
test1.tar
[root@localhost ~]#
解压文件
2、把/root目录下的test1.tar文件解压到当前目录,如下所示:
[root@localhost ~]# rm -rf test1
[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  my.cnf  test1.tar
[root@localhost ~]# tar -xvf test1.tar
test1/
[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  my.cnf  test1  test1.tar
[root@localhost ~]#