Migrating a Website from the Terminal
The scp example uses /folder/. to include hidden files such as .htaccess. A /folder/* shell pattern normally omits them. The -l limit is measured in Kbit/s, so 10240 means 10,240 Kbit/s. rsync -a preserves common file attributes; application consistency still requires a suitable database backup and a check of the transferred files.
When transferring a website from the terminal, first of all we enter the receiving server. Of course you can do this from local machine too, but why add an extra link... So let's begin:
scp -r -l 10240 [email protected]:/home/path/to/folder/. /home/path/to/folder/local
-r - flag for copying directories
/. - if you want to copy all files in directory but not the root directory itself.
-l 10240 - limit bandwidth speed.
[email protected] - server credentials
/home/path/to/folder - source directory path
/home/path/to/folder/local - target directory path
Second option is rsync utility, it is more advanced and can show progress bars:
rsync -a -v --progress -e ssh user@remote-system:/address/to/remote/file /home/user/
Now create an empty database on the receiving side, save access values and proceed:
mysqldump -u db_user -h address.server.com -p db_name > backup-filename.sql - Export database backup
mysql -u db_user -h address.server.com -p db_name < backup-filename.sql - Import database backup
Now edit database connection settings files and everything is ready, simple, convenient, and without UI.
That's how simple we transferred a site from terminal.