Linux Notes
Cron Job Scheduling
# second minute hour day-of-month month day-of-week*
# (0-59) (0-59) (0-23) (1-31) (1-12) (0-7)
# Run every hour at 20 minutes past the hour
0 20 * * * *
# Run every Sunday at 3am
0 * 3 * * 0
# Run every 5 minutes
0 */5 * * * *
Awk
Kill a process using ps, grep and awk
ps -A | grep <name> | awk '{print $1}' | kill
Listening ports
netstat -tulpn
iptables
iptables firewall to block ports
/etc/iptables.up.rules
Check out /etc/network/if-pre-up.d/iptables, it'll have a line like:/sbin/iptables-restore < /etc/iptables.up.rules
Use iptables -nL
to see all firewall rules
DNS
To query a dns server, try this:
dig -x <dns server ip or hostname>
To test if dns can translate an ip try this
host google.com <dns server ip or host>