Linux学习笔记--查找,压缩及备份
which 查询可执行文件位置
locate=slocate 查找anything,需updatedb
locate -r ‘.*filename.*’ -ls -exec(执行程序) file {查找出来的路径} ;
find 从当前目录开始查找
find / -name -user -type -group -size -mtime -perm(777) filename 从根开始查
find /home -user maxwell -a(and,-o or,-type d) -group maxwell -ls
grep
grep -R -l maxwell /etc
gzip gunzip
gzip A (原文件会被删除)
gunzip = gzip -d A.gz
bzip2
bzip2 A
bunzip2 A.bz2 =bzip2 -d A.bz2
tar
-c: 将文件备份
-v: 将过程输出
-x: 从一个文件解出备份
-r: 将文件添加入已经存在的文件中
tar cvf /tmp/root.tar .
tar rvf /tmp/root.tar /etc/passwd /etc/shadow /etc/sysconfig 追上
tar xvf /tmp/root.tar -C /tmp/ddd/
tar tvf 查看包里内容
tar cvfz /tmp/root.tar.gz /root /etc.passwd 用gzip压缩打包
tar cvfj /tmp/root.tar.bz2
rvf 不能加z
dump
[root@www ~]# dump [-Suvj] [-level] [-f 备份档] 待备份数据 [root@www ~]# dump -W 选项与参数: -S :仅列出后面的待备份数据需要多少磁碟空间才能够备份完毕; -u :将这次 dump 的时间记录到 /etc/dumpdates 文件中; -v :将 dump 的文件过程显示出来; -j :加入 bzip2 的支持!将数据进行压缩,默认 bzip2 压缩等级为 2 -level:就是我们谈到的等级,从 -0 ~ -9 共十个等级; -f :有点类似 tar 啦!后面接产生的文件,亦可接例如 /dev/st0 装置档名等 -W :列出在 /etc/fstab 里面的具有 dump 配置的 partition 是否有备份过?
详细:http://vbird.dic.ksu.edu.tw/linux_basic/0240tarcompress_4.php
浙公网安备 33010602011771号