Quick tip to change parameters in different files

2010-03-16 1 min read Linux
for i in *.cfg; do mv $i $i.bak;sed \’s/a/b/\’ $i.bak > $i; done

The above command is very useful to change certain regular expressions in couple of files in one directory. This can be used in variety of ways to achieve a lot of things which would normally take some time to do manually.

Linux find command – Find file and directories faster and easier

2010-03-16 1 min read Linux

 

This command is very powerfull when used with combination of filters and pipes and RE.

I will give some example:

find . -type f –» List all files
find . -type f -exec rm {} <a class=“zem_slink” title=“Path (computing)” href=“http://en.wikipedia.org/wiki/Path_%28computing%29" rel=“wikipedia”>\; –» Delete all files
find . -type d -exec rm {} \; –» Will through some common errors 🙂
find . -name "name"  –> find files containing name in the filename
find . -atime 12 –> Find files accessed 12 days ago

Continue reading

Edit a File When You Are Viewing It Using more / less Command

2010-03-16 2 min read Linux

<a href="http://www.cyberciti.biz/faq/edit-file-when-youre-viewing-withmore-less/">Aritcle here.

<a title="Permanent Link to Edit a File When You Are Viewing It Using more / less Command" rel="bookmark" href="http://www.cyberciti.biz/faq/edit-file-when-youre-viewing-withmore-less/">Edit a File When You Are Viewing It Using more / less Command<div style="color: #888888;">Posted by Vivek Gite [Last updated: November 1, 2008]

<div id="EchoTopic"> <div style="float: left; margin-top: 0px; margin-right: 5px;">
<div style="float: right; margin-top: 0px; margin-left: 5px;"><a title="See all Bash/Shell scripting related FAQ" href="http://www.cyberciti.biz/faq/category/bash-shell/"><img src="http://blog.amit-agarwal.com/wp-content/uploads/figs.cyberciti.biz/3rdparty/terminal.png" border="0" alt="" />

<span style="color: #ff0000;">Question: I can use <a href="http://www.cyberciti.biz/tips/less-is-more-the-hidden-treasure-of-less-command.html">less or more pagers to view a file. How do I start an editor (such as vi or other text editor) to edit the current file without leaving the less or more pager command?

Continue reading

Ubuntu Sucks Like a Shopvac and Other Linux Rants

2010-03-16 1 min read Linux

Almost 100 articles and blogs on the topic of “ubuntu sucks” were published in the past month alone, and about as many were published that unequivocally state Windows is better than Ubuntu.<table border="0">

<span style="font-size: x-small;">
But upon closer examination, I found that a substantial portion of these negative reactions to Ubuntu stem from unrealistic comparisons.

Almost all of the hurdles people seem to have when switching from Windows to Ubuntu appear to be errors in judgment and assessment, rather than actual problems with the OS.

Continue reading

Putting Linux on Parental Control

2010-03-16 1 min read Linux

<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category
Putting Linux on Parental Control
Over the years I?ve witnessed desktop Linux distros evolve
dramatically ? change the very core of the way we look at how an
operating system interacts with its users. However, I still find plenty
of forum posts on the Web stating that Linux as a

URL:<a href=" http://c.moreover.com/click/here.pl?r2243375620&w=2390512"> http://c.moreover.com/click/here.pl?r2243375620&w=2390512

prepend to a file with sponge from moreutils

2010-03-16 1 min read Linux

<a href="http://bashcurescancer.com/prepend-to-a-file-with-sponge-from-moreutils.html">A few weeks I wrote about a tool, which helps you easily prepend to a file. I submitted prepend to moreutils and Joey was kind enough to point out this could be done with `sponge&#8217;.? sponge reads standard input and when done, writes it to a file:
Probably the most general …<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://helpdeskgeek.com/linux-tips/crontab-howto-tutorial-syntax/">Automating Tasks in Linux Using Crontab (helpdeskgeek.com) <li class="zemanta-article-ul-li"><a href="http://www.slideshare.net/progrium/sxsw-evented-web">How WebHooks Will Make Us All Programmers (slideshare.net) <li class="zemanta-article-ul-li"><a href="http://almirkaric.com/2010/01/07/debugging-python-multiprocessing/">Debugging python (multi)processing (almirkaric.com) <li class="zemanta-article-ul-li"><a href="http://www.slideshare.net/royzimmer/you-can-do-it-start-using-perl-to-handle-your-voyager-needs">You Can Do It! Start Using Perl to Handle Your Voyager Needs (slideshare.net) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/b2b2afad-1679-46ab-831c-90ae0cc4d30f/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b14.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Continue reading

OpenDNS and Proxies: Putting it All Together on Ubuntu Karmic

2010-03-16 0 min read Linux
\"Ubuntu
Image via Wikipedia

I’ve been running <a class="zem_slink freebase/en/ubuntu" title="Ubuntu (operating system)" rel="homepage" href="http://www.ubuntu.com/">Ubuntu as my laptop <a class="zem_slink freebase/en/operating_system" title="Operating system" rel="wikipedia" href="http://en.wikipedia.org/wiki/Operating_system">operating system for quite some time (year or more) and find it to be quite wonderful. However, recently I had some nasty times getting everything to work with OpenDNS.

The easy thing to do is change /etc/<a class="zem_slink freebase/en/resolv_conf" title="Resolv.conf" rel="wikipedia" href="http://en.wikipedia.org/wiki/Resolv.conf">resolv.conf to contain the OpenDNS entries. However, this was complicated by my use of <a href="http://www.pps.jussieu.fr/~jch/software/polipo/">polipo (web cache), <a href="http://www.phys.uu.nl/~rombouts/pdnsd/">pdnsd (<a class="zem_slink freebase/en/name_server" title="Name server" rel="wikipedia" href="http://en.wikipedia.org/wiki/Name_server">DNS cache), and <a href="http://en.wikipedia.org/wiki/Resolvconf">resolvconf (a resolv.conf file manager) – not to mention the use of <a href="http://sourceforge.net/apps/trac/ddclient">ddclient to update the dynamic <a class="zem_slink freebase/en/internet_protocol" title="Internet Protocol" rel="wikipedia" href="http://en.wikipedia.org/wiki/Internet_Protocol">IP on the laptop, and the Gnome <a href="http://projects.gnome.org/NetworkManager/">NetworkManager.

Continue reading
Older posts Newer posts