-

useful shell one liners

The following are a few one liner shell commands I occasionally use:
  • Get the current external ip address: GET checkip.dyndns.org | tr -d ' /:-z'
  • Get an estimation of postfix mail queue: mailq|wc -l
  • Find out if a process is running from name: ps uxa|grep -i processname
  • Get a list of directories sorted by size: du -s -h *|sort -h
  • ping a list of ips: cat file-of-ips | xargs -n 1 -I ^ -P 50 ping ^
  • ping a list of hosts in a file: cat hosts|xargs -n1 ping -c 1