Linux useful commands

This is a brief list of commands I use on a semi-regularly basis and therefore forget them on occasion.
This is mostly a reminder list for myself.

grep

grep -nr 'search term' ./
Search all files and subdirectories below this for the search term display file name and line number

PostgreSQL

$ pg_dump <database_name> | psql -h <hostname> -p <port> -U <username> -W <password> <database>
Dump database and restore on a remote machine

 

Amazon Web Services EC2 connection for Debian

ssh -i "my_aws_cert.pem" admin@ec2-###-###-###-###.us-east-7.compute.amazonaws.com

-i use this certificate
'admin' is the user for debian images on AWS EC2
Change everything after the @ to the EC2 external address assigned by AWS.