1.文件归档
文件归档,就是把多个文件变成一个归档文件
2.
tar c ##创建
f ##指定归档文件名称
t ##显示归档文件中的内容
r ##向归档文件中添加文件
--get ##取出单个文件
--delete ##删除单个文件
x ##取出归档文件中的所有内容
-C ##指定解档目录
-z ##gz格式压缩
-j ##bz2格式压缩
-J ##xz格式压缩
实验步骤:
cd /mnt
rm -fr *
tar cf etc.tar /etc/ ##创建一个归档文件etc.tar里面有一个/etc的目录
tar tf etc.tar ##显示etc.tar归档文件中的内容
touch westos ##创建一个文件
tar rf etc.tar westos ##将westos文件添加到etc.tar中
tar xf etc.tar
tar f etc.tar --get westos ##将westos从etc.tar中拿出来
tar f etc.tar --get etc
tar f etc.tar --delete westos ##从etc.tar中删除westos文件