Command Line Cheat Sheet

I started this post years ago to collect commands I need from time to time, but it never got published. That said, years later I still need such a resource so I figured I would post this fairly idiosyncratic resource  as a personal guide that I hope to update and maybe even organize over time. I kept most of these as bookmarks in my Known site, but that is proving increasingly untenable as a useful resource. Anyway, here it is, and if you have any favorites I might benefit from share away—not to mention any I forgot Tim 🙂

Command for importing existing installs into Installatron:

/usr/local/installatron/installatron --send-update-report --user cpanelusername

Command for listing IP addresses hitting a server: 

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1

List all IP addresses connected to your Server: 

netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head

Grep a domain in a cPanel server’s email logs:

exigrep /var/log/exim_mainlog

Fix permissions for a cpanel account

sh ./ -acpanelusername

Display last portion of a file:

tail -f filename

Import a MySQL database:

mysql -u root databasename < dbaname.sql

Dump a MySQL database:

mysqldump -u database user -p password > dbname.sql

Restart Shibboleth:

service shibd restart

Restart MySQL:

service mysql restart

Restart Apache:

service httpd restart

Restart Nginx:

service nginx restart

Changing ownsership permissions recursively:

chown -R someuser:somegroup /your/folder/here/*


Show Docker container names:

docker ps

Bootstrap a container (taken from this post on spinning up Discourse instance):

sudo ./launcher bootstrap web

Start the container instance (taken from this post on spinning up Discourse instance):

sudo ./launcher start web

Example of Rsyncing from local computer to AWS EC2 instance (update-this guide worked well):

rsync -rave "ssh -i your_aws_key.pem" /path/to/local/files ec2-user@EC2_INSTANCE:/path/to/remote/files

SCP command to copy locals files to a remote server:

scp backupfile.tar.gz
This entry was posted in sysadmin and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.