13 05/2015

shell backup folder

最后更新: Wed May 13 2015 16:40:05 GMT+0800

cp

$ cp -avr /tmp/conf/ /tmp/backup

  • -a : Preserve the specified attributes such as directory an file mode, ownership, timestamps, if possible additional attributes: context, links, xattr, all.
  • -v : Explain what is being done.
  • -r : Copy directories recursively.

rsync

$ rsync -avz /home/vivek /media/backup

  • -a : Archive mode i.e. copy a folder with all its permission and other information including recursive copy.
  • -v : Verbose mode.
  • -z : With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted — something that is useful over a slow connection.