Last active
April 12, 2025 18:09
-
-
Save sabrysuleiman/84c900a3e317b6714bc55c90383e501d to your computer and use it in GitHub Desktop.
Website Migration Via SSH & SCP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# π Connect to Remote Server via SSH | |
# Establishes a secure SSH connection to a remote server using a specific port (e.g., 6543). Useful for accessing and managing remote systems. | |
ssh -p port [email protected] | |
ssh -p 6543 [email protected] | |
# π¦ Compress Website Directories into .tar.gz Archives | |
# Creates compressed .tar.gz archives of the uploads, themes, and plugins directories. Ideal for backup or transfer. | |
tar -czf uploads.tar.gz ./uploads | |
tar -czf themes.tar.gz ./themes | |
tar -czf plugins.tar.gz ./plugins | |
# ποΈ Backup MySQL Database and Compress | |
# Exports a MySQL database into a .sql file using mysqldump, then compresses it into a .tar.gz archive. | |
mysqldump -u DB_USER -p DB_NAME > db.sql | |
tar -czf db.tar.gz db.sql | |
# π Transfer Files to New Server via SCP | |
# Securely copies the uploads.tar.gz file to a remote server's public_html directory over a specific port using SCP. | |
scp -P port ./uploads.tar.gz [email protected]:~/public_html/ | |
scp -P 6543 ./uploads.tar.gz [email protected]:~/public_html/ | |
# π§Ή Clean Up Local Archive Files | |
# Removes the previously created .tar.gz files from the local system to free up space or tidy up after transfer. | |
rm ./uploads.tar.gz ./plugins.tar.gz ./themes.tar.gz` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment