SSH: Backup all databases

You can dump all the databases into a single .sql file like so:

mysqldump --all-databases > database_backup.sql

Or you can dump them individually to a directory with the date of backup to /home/ by using a for loop, such as this:

now=$(date +"%m_%d_%Y");mkdir /home/mysql.back.$now && for i in $(mysql -BNe 'show databases'| grep -v _schema);do echo $i; sudo mysqldump $i > /home/mysql.back.$now/$i.sql ; done 

Split and merge large files

Use the split command to do this:

split --bytes=1024m bigfile.iso small_file_

That command will split bigfile.iso into files that are 1024 MB in size (1GB) and name the various parts small_file_aa, small_file_ab, etc. You can specify b for bytes, k for Kilobytes and m for Megabytes to specify sizes.

To join the files back together on Linux:

cat small_file_* > joined_file.iso

Similarly to join the split files on a Windows machine, use the copy command:

copy /b small_file_* joined_file.iso


Pin It on Pinterest