Inotify Example - Introduction to Inotify with a C Program Example

2010-05-24 1 min read C Programs Learning Linux

<a href="http://www.thegeekstuff.com/2010/04/inotify-c-program-example/">Inotify Example: Introduction to Inotify with a C Program Example:

<a class="zem_slink freebase/en/inotify" href="http://en.wikipedia.org/wiki/Inotify" title="Inotify" rel="wikipedia">inotify utility is an effective tool to monitor and notify <a class="zem_slink freebase/en/file_system" href="http://en.wikipedia.org/wiki/File_system" title="File system" rel="wikipedia">filesystem changes. You can specify a list of files and directories that needs to be monitored by inotify. This <a class="zem_slink freebase/guid/9202a8c04000641f8000000000023d0f" href="http://en.wikipedia.org/wiki/Library" title="Library" rel="wikipedia">library is used by various other programs. For example, <a class="zem_slink freebase/en/cpan" href="http://www.cpan.org/" title="CPAN" rel="homepage">CPAN module Linux::Inotify is developed based on this library.
iNotify Execution Flow

Continue reading

Awk Introduction Tutorial – 7 Awk Print Examples

2010-05-19 0 min read Bash Fedora Linux
\"LAS
Image by Getty Images via Daylife

awk examples

Awk Introduction Tutorial – 7 Awk Print Examples This is the first article on the new awk tutorial series. We’ll be posting several articles on awk in the upcoming weeks that will cover all features of awk with practical examples. In this article, let us review the fundamental awk working methodology along with 7 practical awk print examples. Note: Make sure you review our earlier […]

Continue reading

vim – get names of the scripts and the details from the command line

2010-05-19 1 min read Learning Linux Vim Tips

For the below commands either you can set the two variables in bold and then run the scripts or change the following in the commands and run the scripts.

If you have html2text installed then you can use this:

wget -o /dev/null -O $script_id_file &#8217;http://www.vim.org/scripts/script.php?script_id=&#8217;$script_id |html2text

If you dont have html2text installed then you can use:

wget -o /dev/null -O $script_id_file &#8217;http://www.vim.org/scripts/script.php?script_id=&#8217;$script_id<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.inquisitr.com/55496/twilight-eclipse-script-allegedly-leaked/">Twilight Eclipse Script Allegedly Leaked (inquisitr.com) <li class="zemanta-article-ul-li"><a href="http://huddledmasses.org/powershell-script-club-in-rochester-on-wednesday/">PowerShell Script Club in Rochester on Wednesday (huddledmasses.org) <li class="zemanta-article-ul-li"><a href="http://blogs.adobe.com/acrolaw/2010/02/add_a_flatten_document_menu_item.html">Add a Flatten Document Menu Item to Acrobat (blogs.adobe.com) <li class="zemanta-article-ul-li"><a href="http://codebetter.com/blogs/james.kovacs/archive/2010/02/25/the-exec-problem.aspx">The Exec Problem (codebetter.com) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/d25e9b6c-aca3-4008-9a3c-3403140d32e0/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e38.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related pretty-attribution">

Continue reading

top - looks better and is more useful with a rc file...

2010-05-07 1 min read Fedora Learning Linux

top is a very useful command to find out who is eating up the <a class="zem_slink freebase/en/central_processing_unit" title="Central processing unit" rel="wikipedia" href="http://en.wikipedia.org/wiki/Central_processing_unit">CPU or the memory. But sometimes the plain and simple look simply would be boring so how about some fun. Copy the below code to file : ~/.toprc

RCfile for &#8221;top&#8221;
Id:a, Mode_altscr=1, Mode_irixps=0, Delay_time=5.000, Curwin=0
Def    fieldscur=mfcAbdEgHIursOpQTvyzWjKNLX
winflags=32184, sortindx=10, maxtasks=0
summclr=4, msgsclr=5, headclr=5, taskclr=4
Job    fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
winflags=62777, sortindx=0, maxtasks=0
summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem    fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
winflags=62777, sortindx=13, maxtasks=0
summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr    fieldscur=ABDECGfhijlopqrstuvyzMKNWX
winflags=62777, sortindx=4, maxtasks=0
summclr=3, msgsclr=3, headclr=2, taskclr=3

Continue reading

Find out why a program can't seem to access to a file

2010-05-05 2 min read Fedora Linux

$ strace php tias.php -e open,access 2>&1 | <a class="zem_slink freebase/en/grep" href="http://en.wikipedia.org/wiki/Grep" title="Grep" rel="wikipedia">grep foo.txt Sometimes a program refuses to read a file and you&#8217;re not sure why. You may have display_errors turned off for <a class="zem_slink freebase/en/php" href="http://www.php.net/" title="PHP" rel="homepage">PHP or something. In this example, fopen(&#8217;/var/www/test/foo.txt&#8217;) was called but doesn&#8217;t have read access to foo.txt.

Strace can tell you what went wrong. E.g., if php doesn&#8217;t have read access to the file, strace will say &#8221;EACCESS (Permission denied)&#8221;. Or, if the <a class="zem_slink freebase/guid/9202a8c04000641f8000000000220ffa" href="http://en.wikipedia.org/wiki/Path_%28computing%29" title="Path (computing)" rel="wikipedia">file path you gave doesn&#8217;t exist, strace will say &#8221;ENOENT (No such file or directory)&#8221;, etc.

Continue reading

String and Array Creation

2010-04-28 0 min read Learning Linux Perl
\"Perl\"
Image via Wikipedia

<img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/perl-one-liners.jpg" alt="Perl One Liners" align="bottom" />This is the fourth part of a nine-part article on famous <a class="zem_slink freebase/en/perl" title="Perl" rel="homepage" href="http://www.perl.org/">Perl one-liners. In this part I will create various one-liners for string and array creation. See <a href="http://www.catonmat.net/blog/perl-one-liners-explained-part-one/">part one for introduction of the series.

Famous Perl one-liners is my attempt to create “perl1line.txt” that is similar to “<a href="http://www.catonmat.net/blog/awk-one-liners-explained-part-one/">awk1line.txt” and “<a href="http://www.catonmat.net/blog/sed-one-liners-explained-part-one/">sed1line.txt” that have been so popular among Awk and Sed programmers.

Continue reading

vim understanding the various modes and using the yanking more efficiently.

2010-04-06 0 min read Linux Vim Tips
\"MacVim
Image via Wikipedia

We will look at the vim modes today. Sometime back , I was looking at copying a function body. So I was basically looking to copy the lines till matching &#8221;}&#8221;. I found a plugin called <a href="http://www.vim.org/scripts/script.php?script_id=1234" target="_blank">yankring which would allow me to yank the text in various combinations. So I can copy a function by going to the begining of the function and then &#8221;y}&#8221;. That is very simple to understand right? Wrong!!!

Continue reading
Older posts Newer posts