9. How do I “SSH”?
•
Terminal (Mac OS X) - If you don’t have it, you’re not on a Mac…
•
PuTTY (Windows) - http://enva.to/puttywin
•
Prompt (iOS) - http://enva.to/promptios
12. Command-Line 101 (Cheatsheet)
•
<command> --help - many programs have a built-in “help” to show you basic usage information
•
man <command> - “manual” program to show information on how to use a command
•
cd - change directory
•
~ - special shortcut to indicate my home directory
•
ls - list contents of the current directory
•
pwd - show the current (working) directory’s path
•
cp - copy
•
scp - secure copy
•
cat - output file contents
•
gzip - a compression program
•
gunzip - a decompression program
•
find - search for files
•
mysql - connect to a MySQL server
•
mysqldump - “dump” from a MySQL server
•
| - “pipe” output to another program
•
> - output to a file
•
< - input from a file
•
grep - regular expressions
•
rm - remove / delete (be careful on this one)
•
Tab completion!
18. wp db export - | gzip > ~/migration/moredemo.sql.gz
•
Firstly, gesundheit!
•
wp - WP-CLI FTW!
•
db - subset of WP-CLI commands to do database things
•
export - this is the particular database thing we want to do
•
- - don’t put the export data in a file, just output it
•
| - pass the output to another program…
•
gzip - compress the passed output
•
> - send the output (now compressed) to a file
•
~/migration/moredemo.sql.gz - the file, named appropriately so that we know what it is! (SQL, gzipped)
19. tar czvf ~/migration/moredemo.tar.gz ./wp-content/
•
tar - an archiver program for creating and extracting files from archives
•
c - create an archive
•
z - do compression
•
v - show output (so we know something is happening!)
•
f - create this archive as a file
•
~/migration/moredemo.tar.gz - the file to create as an archive
•
./wp-content/ - the files to put into the archive
20. scp ~/migration/* japheth@lessdevelopment.com:~/webapps/lessdemo/
•
scp - secure copy (can copy to a remote server through SSH)
•
~/migration/* - the files to copy, the * indicates all files in the directory
•
japheth@lessdevelopment.com: - my username and the remote
server’s address
•
•
The format for this is <username>@<domain name or IP address>:
~/webapps/lessdemo/ - the directory on the remote server to copy to,
must come after the :
21. scp wp-config.php japheth@lessdevelopment.com:~/webapps/lessdemo/
•
scp - secure copy (can copy to a remote server through SSH)
•
wp-config.php - the WordPress config file to copy
•
japheth@lessdevelopment.com: - my username and the remote
server’s address
•
•
The format for this is <username>@<domain name or IP address>:
~/webapps/lessdemo/ - the directory on the remote server to copy to,
must come after the :
22. scp .htaccess japheth@lessdevelopment.com:~/webapps/lessdemo/
•
scp - secure copy (can copy to a remote server through SSH)
•
.htaccess - the WordPress .htaccess file to copy, important for
permalinks and WordPress Multisite installations
•
japheth@lessdevelopment.com: - my username and the remote
server’s address
•
•
The format for this is <username>@<domain name or IP address>:
~/webapps/lessdemo/ - the directory on the remote server to copy to,
must come after the :
27. ls -l
•
ls - program for listing file information
•
-l - show the information in a long list (goes vertically instead of
horizontally, I find it easier to read)
28. wp core download
•
wp - WP-CLI FTW!
•
core - subset of WP-CLI commands to do core things
•
download - download the latest version of WordPress
29. tar xzvf moredemo.tar.gz
•
tar - an archiver program for creating and extracting files from archives
•
x - extract an archive
•
z - do compression
•
v - show output (so we know something is happening!)
•
f - create this archive as a file
•
moredemo.tar.gz - the archive file to extract from
•
Automatically re-creates the directory structure that is in the archive
32. gunzip < moredemo.sql.gz | wp db import •
gunzip - uncompress the passed output
•
< - pass the contents of file to be uncompressed
•
moredemo.sql.gz - the file
•
| - pass the output to another program…
•
wp - WP-CLI FTW!
•
db - subset of WP-CLI commands to do database things
•
import - this is the particular database thing we want to do
•
- - don’t get the import data from a file, just use the output being passed
33. wp search-replace moredevelopment.com lessdevelopment.com
•
wp - WP-CLI FTW!
•
search-replace - a WP-CLI command to do a find and replace on
the database (properly handles serialisation!)
•
moredevelopment.com - this is the string we want to replace
•
lessdevelopment.com - this is the string we want to replace it with