command line for backup (linux)

One of the lovable features in linux is its wealth of command line tools. These tools can be used in various combinations to suit diverse tasks and can be implemented at different levels of expertises.

Hardware failure is not a question of if, but when. The best security is backup.

There is a large basket of tools for backuping data, for example,   cp,  dd, tar, rsync, scp, gzip/gunzip, bzip2 ftp/sftp etc.There are schemes to do backup, within PC, cross PC, between media etc.

cp A.txt B.txt # simple copy A.txt to B.txt, with various options

dd  if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=noerror # copies a file (from standard input to standard output, by default) with a changeable I/O block size, while optionally performing conversions on it. this is a very powerful toy, refer to man page or pedia

tar -cvf mytar.tar /home/mydir/ #saves many files together into a single tape or disk archive, and can
restore individual files from the archive.

gzip or bzip2 # compress a file for better storage, can be integrated with tar

scp # copy files bridged over internet via ssh

rsync -avlu -e “ssh -l remoteuser” remoteserver.domain:Dir2backup ./localdir # sync files locally or remotely.

ln # create hard or symbolic link to a file, can be used to duplicate file too.

ftp/sftp copy files over internet (with ssh)

Leave a comment