<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.shell-fu.org" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>shell-fu</title>
<link>http://www.shell-fu.org</link>
<description></description>
<language>en</language><item>
<title>Tip #894: Watch for Ubuntu 9.10 Launch</title>
<link>http://www.shell-fu.org/lister.php?id=894</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=894</guid>
<pubDate>Thu, 29 Oct 2009 04:25:42 -0700</pubDate><description>
This script will run check a for the Ubuntu 9.10 launch once every 5 mins and let you know when it&apos;s available:
&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;while [ 1 ]; do if [ -z "`curl -I "http://cdimage.ubuntu.com/releases/9.10/release/"|grep "404"`" ];
then kdialog --msgbox "9.10 Released"; exit; fi; sleep 300;  done&lt;/pre&gt;
</description>
</item>
<item>
<title>Tip #892: Check memory and swap from command line</title>
<link>http://www.shell-fu.org/lister.php?id=892</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=892</guid>
<pubDate>Mon, 26 Oct 2009 03:21:56 -0700</pubDate><description>
Want to check the amount of used, free and total memory and swap from the command line? This script displays memory and swap information. Fully posix compliant and should work with all 2.[2-6].* kernels .
&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;
#fetch and process memory information
[ -f /proc/meminfo ] &amp;&amp; {
Buffers=`grep -we &apos;Buffers&apos; /proc/meminfo | cut -d&apos; &apos; -f2- | tr -d &quot;[A-Z][a-z] &quot;`
Cached=`grep -we &apos;Cached&apos; /proc/meminfo | cut -d&apos; &apos; -f2- | tr -d &quot;[A-Z][a-z] &quot;`
MemFree=`grep -ie &apos;MemFree&apos; /proc/meminfo | cut -d&apos; &apos; -f2- | tr -d &quot;[A-Z][a-z] &quot;`
MemTotal=`grep -ie &apos;MemTotal&apos; /proc/meminfo | cut -d&apos; &apos; -f2- | tr -d &quot;[A-Z][a-z] &quot;`
SwapCached=`grep -ie &apos;SwapCached&apos; /proc/meminfo | cut -d&apos; &apos; -f2- | tr -d &quot;[A-Z][a-z] &quot;`
SwapFree=`grep -ie &apos;SwapFree&apos; /proc/meminfo | cut -d&apos; &apos; -f2- | tr -d &quot;[A-Z][a-z] &quot;`
SwapTotal=`grep -ie &apos;SwapTotal&apos; /proc/meminfo | cut -d&apos; &apos; -f2- | tr -d &quot;[A-Z][a-z] &quot;`
}
MEMUSED=&quot;$(( ( ( ( $MemTotal - $MemFree ) - $Cached ) - $Buffers ) / 1024 ))&quot;
MEMTOTAL=&quot;$(( $MemTotal / 1024))&quot;
MEMFREE=&quot;$(( $MEMTOTAL - $MEMUSED ))&quot;
MEMPER=&quot;$(( ( $MEMUSED * 100 ) / $MEMTOTAL ))&quot;
[ &quot;$SwapTotal&quot; -gt &quot;1&quot; ] &amp;&amp; {
  SWAPUSED=&quot;$(( ( ( $SwapTotal - $SwapFree ) - $SwapCached ) / 1024 ))&quot;
  SWAPTOTAL=&quot;$(( $SwapTotal / 1024))&quot;
  SWAPFREE=&quot;$(( $SWAPTOTAL - $SWAPUSED ))&quot;
  SWAPPER=&quot;$(( ( $SWAPUSED * 100 ) / $SWAPTOTAL ))&quot; 
} || {
  SWAPUSED=&quot;0&quot;
  SWAPTOTAL=&quot;0&quot;
  SWAPPER=&quot;0&quot; 
}

# display the information
/bin/echo
/bin/echo &quot;Memory&quot;
/bin/echo &quot;Used: $MEMUSED&quot;
/bin/echo &quot;Free: $MEMFREE&quot;
/bin/echo &quot;Total: $MEMTOTAL&quot;
/bin/echo
/bin/echo &quot;Swap&quot;
/bin/echo &quot;Used: $SWAPUSED&quot;
/bin/echo &quot;Free: $SWAPFREE&quot;
/bin/echo &quot;Total: $SWAPTOTAL&quot;
/bin/echo
&lt;/pre&gt;
</description>
</item>
<item>
<title>Tip #889: Convert virtually any video into a DVD-valid MPEG2 stream</title>
<link>http://www.shell-fu.org/lister.php?id=889</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=889</guid>
<pubDate>Mon, 26 Oct 2009 03:12:14 -0700</pubDate><description>
&lt;pre&gt;mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 
-af lavcresample=48000 -lavcopts  
codec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:acodec=ac3:abitrate=192 
-ofps 30000/1001 -o output.mpg input.extension&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;Options you might want to change:
&lt;br /&gt;
&lt;br /&gt;scale: 720:480 for NTSC, 720:576 for PAL
&lt;br /&gt;ofps: 30000/1001 for NTSC, 25 for PAL
&lt;br /&gt;aspect: 16/9 or 4/3 depending on your video
</description>
</item>
<item>
<title>Tip #885: Random password generator.</title>
<link>http://www.shell-fu.org/lister.php?id=885</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=885</guid>
<pubDate>Wed, 16 Sep 2009 08:43:32 -0700</pubDate><description>
Generate a random 8 character password containing a-z, A-Z and 0-9:
&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;egrep -ioam1 '[a-z0-9]{8}' /dev/urandom&lt;/pre&gt;
</description>
</item>
<item>
<title>Tip #882: Find last modified files on a filesystem</title>
<link>http://www.shell-fu.org/lister.php?id=882</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=882</guid>
<pubDate>Tue, 15 Sep 2009 04:29:44 -0700</pubDate><description>
To find the last modified files in a directory you can use ls -ltr. To find the last modified file on a file system it will not work, but the following command will work:
&lt;br /&gt;
&lt;br /&gt;&lt;pre&gt;
find /etc -type f -printf "%T@ %T+ %p" | sort -n
&lt;/pre&gt;
</description>
</item>
<item>
<title>Tip #879: Learn not to mistype ls</title>
<link>http://www.shell-fu.org/lister.php?id=879</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=879</guid>
<pubDate>Mon, 14 Sep 2009 08:51:49 -0700</pubDate><description>
&lt;pre&gt;apt-get install sl&lt;/pre&gt;
(or equivalent on your particular distro).
&lt;br /&gt;&lt;br /&gt;
A "good" way of learning not to mistype ls.

</description>
</item>
<item>
<title>Tip #878: Random xkcd comic</title>
<link>http://www.shell-fu.org/lister.php?id=878</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=878</guid>
<pubDate>Mon, 14 Sep 2009 08:42:35 -0700</pubDate><description>
Displays a random xkcd comic. Requires ImageMagick.&lt;br /&gt;&lt;br /&gt;

&lt;pre&gt;wget http://dynamic.xkcd.com/comic/random/ -O -| grep &amp;lt;img src=&quot;http://imgs.xkcd.com/comics | 
 sed s/&amp;lt;img src=&quot;// | sed s/&quot;[a-z]*.*// | wget -i - -O -| display
&lt;/pre&gt;
</description>
</item>
<item>
<title>Tip #874: Count how many packages have been installed by pacman</title>
<link>http://www.shell-fu.org/lister.php?id=874</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=874</guid>
<pubDate>Thu, 10 Sep 2009 13:48:31 -0700</pubDate><description>
Count how many packages have been installed by pacman:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;pacman -Q|wc -l&lt;/pre&gt;
</description>
</item>
<item>
<title>Tip #873: Import ssh host keys without verification</title>
<link>http://www.shell-fu.org/lister.php?id=873</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=873</guid>
<pubDate>Wed, 09 Sep 2009 12:58:15 -0700</pubDate><description>
Automatically import host keys for cluster of machines named 'all'
&lt;br /&gt;
&lt;br /&gt;Using the 'dsh' command from the clusterit tools - http://sourceforge.net/projects/clusterit
&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;RCMD_CMD_ARGS='-o VerifyHostKeyDNS=yes -o StrictHostKeyChecking=no' dsh -g all -e true&lt;/pre&gt;
</description>
</item>
<item>
<title>Tip #872: Reverse geocode with bash</title>
<link>http://www.shell-fu.org/lister.php?id=872</link>
<guid isPermaLink="true">http://www.shell-fu.org/lister.php?id=872</guid>
<pubDate>Wed, 19 Aug 2009 10:12:26 -0700</pubDate><description>
The following bash script, which depends on lynx web browser, uses Google's reverse geocode service to find a nearby address given a latitude and longitude pair:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;#!/bin/bash
# findnearest
# Usage: findnearest latitude longitude
# Ex.  findnearest  17.976227 -66.111016

lat=$1
long=$2
result=$(lynx -dump &quot;http://maps.google.com/maps/geo?output=csv&amp;oe=utf-8&amp;ll=$lat,$long&quot;)
echo $result | cut -f3- -d,
&lt;/pre&gt;
</description>
</item>
</channel>
</rss>