inotify -watch for file to change

2014-01-28 1 min read Learning Linux

Here is a simple command for you. It uses inotify tools. So first you need to install :

sudo yum install inotify-tools

and then you can try something like this:

while true; 
do 
inotifywait -r -e modify --exclude=".swp" . && make; 
done

Here, once the file changes, we are running make, but you can do anything you want.

 

 

Continue reading

vim – yank/xopy in different register to paste

2014-01-16 1 min read Vim Tips

Very quick update, to use registers, you can select and then yank in a register to paste using the same register. This could be a convinient way to copy multiple selections and then paste which ever selection you want. Here is the simple way to do it:

visuallly select with v/V

then “qy to yank (here we are yanking into register q, so in the command you can use any of a-z to use as register)

Continue reading

Find directory/file with inode number

2013-09-10 1 min read Fedora Linux

Couple of days back, I was getting the following error:

Directory inode 2362521 has an unallocated block #245823.  Allocate?

And this continued for hours together and I was in a hurry. Did not really care about the error and all I wanted was to get rid of the error but for that I needed to get to the file/directory with inode number  mentioned in the error and finally “find” command came to rescue:

Continue reading

vim maps – simple commands to do stuff.

2013-08-28 1 min read Vim Tips

Some time back, I was working on some script for logging and I wanted to change the class to function like this:

$logger->Debug("Test string");
loggerFunc("Debug", "Test String");

As you can see, this change could be quite frustrating if you have quite a few references. And thus vim comes to rescue.

Simple map like ::

:map ,mm :s/(.*)$logger->(.*)((.*)).*/1loggerFunc("2",3);/

and then I can do “/$logger->” and then “n” to go to next match. Just do “,mm” and the line is re-factored.

Continue reading

power save mode for battery in Fedora 19.

2013-08-20 1 min read Fedora

I was getting really bad battery life on my Fedora 19 system, and did not find much on how to tune it. Finally I found something that just does not need much configuration but works pretty well. So, here is what you need to do:

sudo yum install tuned tuned-adm

The second package, tuned-adm installs additional themes for power saving. It is optional and not mandatory. Once you have installed these, you can do the following:

Continue reading

systemadm – simpler way to manage the service files for systemd

2012-04-17 1 min read Fedora

Once the systemd unit and service files have come into being, understanding of the system services have changed a little bit and it might require some time to understand the cli tools for managing these services and units. That being the case, systemadm comes to rescue. This is a simple tool which :

Graphical front-end for systemd.

For installation :

sudo yum install systemd-gtk

And here’s a screenshot::

Continue reading

Your own local search engine.

2012-04-09 1 min read Fedora Learning Uncategorized

There are times when you would want to have a local search engine capable of indexing even pdf and doc files. So here is a solution.

You can use “Omega” and here are the instructions.

download omega from http:// xapian.org/download

yum install xapian libuuid-devel

And then make and install omega and for this you can follow the instructions.

Federated Search Engine Diagram
Federated Search Engine Diagram (Photo credit: Wikipedia)

Create index using command omindex
and then you can use quest or search.py to search or you can setup the cgi way so that you can use local browser to search.

Continue reading
Older posts