Simple and effective, if you know what you’re doing. That is the CLI, or terminal on any UNIX based system. I’ll just dump all one-line commands that might come in handy – here.

Sort pacakges by size on debian

Ever wondered how to sort out packages based on their sizes on Debian, Raspbian, Ubuntu, or whatever debian based?

dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n

Age of kids in days

If you are not sure how many days your kids roam the earth. Not exactly a oneliner, but could be… 

bday='2013/01/11 13:00'; expr $(expr $(expr `date +"%s"` - `date +"%s" --date "$bday"`) / 3600) / 24

Redirect ports.

If you love tunneling, you come to this need inevitably. For example, redirect all traffic to port 443 (on all addresses) to port 4433 – where an API is listening, but cannot listen on a non-privileged port. Tadaaa.

iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4433
# If you want to list your rules
iptables -L -t nat
# Delete the rule? 2 => rule number, count
iptables -t nat -D PREROUTING 2