Simply backups under Linux

Backup a folder

tar -cvpzf /BackupDirectory/backupfilename.tar.gz /ImportantData/directory/path

c =  Create
v =  Verbose mode
p = Preserving Files and Directory Permissions.
z = This will tell tar that compress the files further to reduce the size of tar file.
f =  It is allows to tar get file name.

Backup a MySQL database

mysqldump --opt -u [username] -p[password] [dbname] > [dbname.sql]

Backup all MySQL databases

mysqldump -u root -p --all-databases > all_databases.sql


Leave a Reply

Your email address will not be published. Required fields are marked *