Skip to content

Instantly share code, notes, and snippets.

@hijak
Created December 10, 2014 08:04
Show Gist options
  • Save hijak/7d5c47f65db0ac77f4a3 to your computer and use it in GitHub Desktop.
Save hijak/7d5c47f65db0ac77f4a3 to your computer and use it in GitHub Desktop.
print ip of eth0
ip a s eth0 | sed -nr 's!.*inet ([^/]+)/.*!\1!p'
print groups
cut -d: -f1 /etc/group | sort
find external ip address
curl http://canihazip.com/s && echo
load of server/mem/disk
echo "DISK:";df -Pl | grep -v "Filesystem" | awk '{print $5,$6}' ; echo "MEM:" ; free -mto | awk '{ print $1,$2,$3,$4 }'; echo "CPU:"; top -b -d1 -n1 | grep Cpu | awk '{print $2,$3,$4,$5,$6,$7,$8,$9}';echo "LOAD:"; cat /proc/loadavg | awk '{print $1,$2,$3}'
apache log parser
sed 's^\[.*\]^^g' error.log | sed 's^\, referer: [^\n]*^^g' | sort | uniq -c | sort -n
print paths
echo $PATH | tr -s ':' '\n'
print no blank lines or comments
awk 'NF && ! /^[[:space:]]*#/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment