Commands Reference

EXIM

DescriptionCommand
Delivery message by IDexim -M id
Delete all messages in the queueexiqgrep -i | xargs exim -Mrm
Remove message from queueexim -Mrm id
View Message by ID (Header)exim -Mvh id
Display Exim's Configurationexim -bP
Show all messages in the queue (only ID)exiqgrep -i
Process queueexim -q -v
Force a message delivery by IDexim -M id
Remove all frozen messagesexiqgrep -z -i | xargs exim -Mrm
View Message by ID (Body)exim -Mvb id

LIST FILES

DescriptionCommand
Show all filesls -a
Show results in long list formatls -l
Print file size in human readable sizesls -h
List subdirectories recursivelyls -R
Sort by file sizels -S
Sort by modification datels -t
Do not sortls -U
Sort alphabetically by extensionls -X
Reverse order when sortingls -r
List inodels -i
List all files by size (human readable)ls -laSh
List users home directoryls ~
List parent directoryls ..
List all files with extension (.log)ls *.log
List directories onlyls -d

IPTABLES

DescriptionCommand
Drop traffic on port 80 (POST /xmlrpc.php)iptables -I INPUT -p tcp --dport 80 -m string --string 'POST /xmlrpc.php' --algo bm -j DROP
Drop traffic on port 80 (POST data)iptables -I INPUT -p tcp --dport 80 -m string --string 'POST /' --algo bm -j DROP
Drop traffic on port 80 (GET /readme.txt)iptables -I INPUT -p tcp --dport 80 -m string --string 'GET /readme.txt' --algo bm -j DROP
List iptables with line numbersiptables -L --line-numbers
List with numeric formatiptables -L -n
List specific chain (INPUT)iptables -L INPUT
Delete specific rule (Line 4 from INPUT)iptables -D INPUT 4
Zero countersiptables -Z
Show countersiptables -vL
Show exact countersiptables -xvL
Insert a rule at top of a chain (OUTPUT)iptables -I OUTPUT -p tcp --sport 80 -j ACCEPT
Insert rule at line number (3)iptables -I INPUT 3 -p tcp --dport 80 -j ACCEPT
Replace rule at line number (6)iptables -R INPUT 6 -p tcp --dport 80 -j ACCEPT
Flush chain (INPUT)iptables -F INPUT
Append rule to end of chain (INPUT)iptables -A INPUT -p tcp --dport 80 -j ACCEPT
Set chain default policy (DROP)iptables -P INPUT DROP
Specify adapter (eth0)iptables -I INPUT -i eth0 -p tcp --dport 80 -j ACCEPT

MYSQL

DescriptionCommand
Export all databasesmysqldump -u[user] -p[pass] --all-databases > All_Databases.sql
Export single databasemysqldump -u[user] -p[pass] [db_name] > db.sql
Export multiple databasesmysqldump -u[user] -p[pass] --databases [db1] [db2] > dbs.sql
Export specific tablemysqldump -u[user] -p[pass] [db] [table] > table.sql
Import single databasemysql -u[user] -p[pass] [db] < db.sql
Import specific tablemysql -u[user] -p[pass] -D [db] < table.sql
Show global variablesmysql -u[user] -p[pass] -e 'show variables;'
Show a specific variablemysql -u[user] -p[pass] -e 'show variables like "max_connections";'
Change global variablemysql -u[user] -p[pass] -e 'set global max_connections = 200;'
Show process listmysql -u[user] -p[pass] -e 'show processlist;'

MYSQL SHELL

DescriptionCommand
Show databasesshow databases;
Select a specific databaseuse databaseName;
Show tablesshow tables;
Describe a tabledescribe tableName;
Show all data inside a tableselect * from tableName;
Show column from a tableselect URL from tableName;
Show column based on valueselect URL from tableName where ID=2;

CHANGE DIRECTORY

DescriptionCommand
Change to directorycd /var/log
Change to users home directorycd ~
Return to previous directorycd -
Change to root directorycd /
Change to parent directorycd ..

IDENTIFY HARDWARE (LINUX)

DescriptionCommand
View CPU Informationcat /proc/cpuinfo
View Memory Informationcat /proc/meminfo

SHUTDOWN

DescriptionCommand
Shutdown the system nowshutdown -h now
Shutdown in 10 minutesshutdown -h 10
Cancel pending shutdownshutdown -c
Send shutdown messageshutdown -h 10 "System is being taken offline"
Shutdown at specific timeshutdown -h 20:15
Reboot the systemshutdown -r now
Reboot and skip fsckshutdown -rf now
Reboot and force fsckshutdown -rF now
Reboot and force fsck (reliable)cd / && touch /forcefsck && shutdown -r now