Skip to content

Instantly share code, notes, and snippets.

@abraham
Created August 10, 2010 02:17
Show Gist options
  • Save abraham/516537 to your computer and use it in GitHub Desktop.
Save abraham/516537 to your computer and use it in GitHub Desktop.
Terminal commands for migrating sites

Dump a MySQL database to a file

mysqldump -h example.com -u username -p database > file.sql

Import sql file into MySQL

mysql -u username -p
mysql: source file.sql

Compress a directory into a tar file and maintain permissions

tar -pczf files.tar.gz directory

Copy file to remote server over ssh

scp file.tar.gz username@example.com:/path/to/save/file.tar.gz

Expand compressed file

tar -xvzf file.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment