Linux command line manual website backup

MySql database

mysqldump -u user_name -p database > /path/database.sql;

File management

rm -rf /path/*
mv /path/* .

zip -r /path/file.zip /path
unzip file.zip

service apache2 stop
service apache2 start
service apache2 restart

sudo chown -R www-data:group user_name

I tend to save the files in the user folder.

/home/pawel

Then I go ahead and download the compressed files and the database using sftp. I normally use Cyberduck or FileZilla client. Of course, the best way would be to create server image backup, however, it’s not always possible.

Leave a comment

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