Command line snippet of the week: 53

Last one of this year!

Need to mass extract several RAR archives from different folders? Create a file called “massunrar” in /usr/bin and paste the following content:

find . -type f -name *.r01 -exec unrar e {} \;
find . -type f -name *.part01.rar -exec unrar e {} \;
echo "Found files:"
find . -type f -name *.r01
find . -type f -name *.part01.rar

Be sure to chmod “massunrar” to make it executable:

chmod +x /usr/bin/massunrar

Run “massunrar” in the parent folder to let it search for rar files in all subdirectories and extract them.
More to follow next year!

divider

Command line snippet of the week: 52

Need to have IP location information? Use:

curl -s "http://www.geody.com/geoip.php?ip=$(curl -s icanhazip.com)" | sed '/^IP:/!d;s/<[^>][^>]*>//g'

It returns with your IP information such as:

IP: 13.13.133.713 Location: Amsterdam, NOORD-HOLLAND, Netherlands   (N.V. XS4ALL)

Replace (curl -s icanhazip.com) to show a different IP than your own.

divider

Command line snippet of the week: 51

Need to empty a file fast? Try:

> file.txt

Shortest emptier in town!

divider