tar命令在linux中是常使用的命令:(多以tar zxvf +文件 方式居多)
- 归档:将2个或2个以上的文件打包成一个文件的过程
归档:tar -cvf 名称.tar 文件1 文件2 ... 文件n
解挡:tar -xvf 名称
例如:
[root@localhost 1]# tar -cvf all.tar centos-release passwd
[root@localhost 1]# tar -xvf all.tar
例如:将centos-release和passwd打包成all.tar文件
[root@localhost 1]# ls
centos-release passwd
[root@localhost 1]# tar -cvf all.tar centos-release passwd
centos-release
passwd
[root@localhost 1]# ls
all.tar centos-release passwd
删除原文件,tar开后得到原文件:
[root@localhost 1]# ls
all.tar centos-release passwd
[root@localhost 1]# rm centos-release passwd
rm:是否删除普通文件 "centos-release"?y
rm:是否删除普通文件 "passwd"?y
[root@localhost 1]# ls
all.tar
[root@localhost 1