LINUX学习--命令备份系统文件

备份一个及其重要的一步。如果一个网站没有经常备份的话。那损失很大的,要养成备份的好习惯。

1.备份命令 主要有下面2种

  1.cp命令

  2.tar 命令

 1.cp命令用法  cp -Rup  /boot  /usr/backup

   参数:p (保留目录和文件的属性)

            u (增量备份=叠加)

2.tar 命令备份

  tar -zcf /back/2011.3.3_etc.tar.gz /etc (备份etc目录)

tar -zcf /back/2011.3.3_3fen.tar.gz /etc /usr/local ( 一次备份多个目录和文件)

tar -ztf /back/2011.3.3_etc.tar.gz (查看备份包里的文件--不是解压)

tar -zxf /back/2011.3.3_etc.tar.gz (恢复备份文件-注意:这里的解压时默认恢复到备份目录,但是默认恢复到的目录是etc而不是/etc了,所以大家这点注意。不过后面可以跟 -C / 目录来指定恢复目录)

 

相关文章

已有 2 条评论
  1. clothing

    Hi there, just became aware of your blog through Google, and found that it's really informative. I抦 going to watch out for brussels. I will appreciate if you continue this in future. Numerous people will be benefited from your writing. Cheers!

    clothing 回复
  2. nike free

    Hello to every , for the reason that I am really eager of reading this blog抯 post to be updated on a regular basis. It includes nice information.

    nike free 回复
发表新评论