Easier Reinstalls

2010-05-10 1 min read Bash Fedora Linux

<span style="font-size: x-large;"><a href="http://www.howtoforge.com/easier-reinstalls">E<a href="http://www.howtoforge.com/easier-reinstalls">asier Reinstalls

Easier Reinstalls

I typically reinstall my computer operating system every six months. The reasons for this are that it cleans out the system and reinstalls require me to be in front of the computer for a total of about ten minutes so it&#8217;s painless. Notice I said &#8221;in front of the computer&#8221;, the system does all of the work for me with some specially crafted bash scripts.

Continue reading

coproc help - a new feature in bash

2010-05-10 0 min read Bash Fedora Linux
\"Screenshot
Image via Wikipedia

In the <a class="zem_slink freebase/en/bash" title="Bash" rel="homepage" href="http://tiswww.case.edu/php/chet/bash/bashtop.html">bash version 4.0, there is a new concept called coproc. This is very useful for some of the daily tasks.

co-<a class="zem_slink freebase/guid/9202a8c04000641f800000000005a409" title="Process (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Process_%28computing%29">process starts a process in the background, optionally with a NAME, with which other processes can communicate. This can be a very <a class="zem_slink freebase/en/substitute_good" title="Substitute good" rel="wikipedia" href="http://en.wikipedia.org/wiki/Substitute_good">good substitution for <a class="zem_slink freebase/guid/9202a8c04000641f800000000048fac5" title="Pipeline (Unix)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Pipeline_%28Unix%29">pipes in lots of cases. You can learn more about coproc in the link below:

Continue reading

Download with browse with bash and wget

2010-05-09 1 min read Bash Fedora

Been pretty busy for last couple of days. Will be busy for another few days, but here&#8217;s something to munch in the meantime (Script may need changes depending on the type of file you want to download or the site you are browsing, but the chnages should be minimal):

file=&#8221;/tmp/temp.dir&#8221;
url=&#8221;URL Here&#8221;
IFS=&#8217;
&#8217;
cont=&#8221;y&#8221;
while [ $cont != &#8221;n&#8221; ]
do
name=&#8221;&#8221;
wget &#8221;$url&#8221; -O $file -o /dev/null
for i in $(grep href $file |grep -v Parent)
do
name=${i##href=&#8221;}
name=${name%%&#8221;>
}
echo $name
if [[ $name == *gz ]]
then
cont=&#8221;n&#8221;
fi
done
if [ ! $name ]
then
echo &#8221;No files here.. Exiting&#8221;
exit -1
fi
echo
if [ $cont == &#8221;n&#8221; ]
then
echo &#8221;Enter the filename for download :&#8221;
read file
fi
echo &#8221;Select one of the options:&#8221;
read product
url=&#8221;$url/$product&#8221;
echo &#8221;About to get $url&#8221;
done
wget &#8221;$url&#8221; -O $file -o /dev/null

Continue reading

Delete all files in a folder that don't match a certain file extension

2010-04-30 1 min read Bash Fedora Linux

$ rm !(.foo|.bar|*.baz)

Deletes all files in a folder that are NOT *.foo, *.bar or *.baz files. Edit the pattern inside the brackets as you like.

  • <a href="http://www.commandlinefu.com/commands/view/5351/delete-all-files-in-a-folder-that-dont-match-a-certain-file-extension">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/hutch">View all commands by <a href="http://feeds2.feedburner.com/commands/by/hutch">hutch

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/0/di" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/kewaFMgsXI4A1vQfeLscg2Vcv8o/1/di" alt="" align="bottom" />

<img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/TCRb2ku_V1Y" alt="" width="1" height="1" align="bottom" />

Continue reading
Older posts Newer posts