View Single Post
Posts: 540 | Thanked: 387 times | Joined on May 2009
#2
All the fun shell functions use BASH and/or coreutils (;
http://www.commandlinefu.com/commands/browse

*opens up my snipplr account*
Output local IP addresses
Code:
ipconfig() { /sbin/ifconfig | grep "inet addr" | grep -v 127.0.0.1 | awk '{print $2}' | awk 'BEGIN{FS=":"};{print $2}'; }
Round up or round down the minute
Code:
minute() { foo=`date +%S`; echo $foo; if [ "$foo" -lt "30" ]; then echo "under half"; else echo "over half"; fi; }
List installed packages
Code:
dpkg -l | grep ii | awk '{print $2}'

Last edited by linuxeventually; 2010-08-21 at 09:08.