inotify -watch for file to change

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.

 

 

Enhanced by Zemanta

vim – yank/xopy in different register to paste

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)

then “qp to paste..

To, view all the registers, you can use the command “registers”.

 

Enhanced by Zemanta

Find directory/file with inode number

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:

find . -inum

This gave me the directory with the inode number in the error and all I had to do was delete that directory 🙂

Enhanced by Zemanta