Tag: Investing

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

bash – echo command with option to display the output on the same line.

Here is a nice little trick to display the output in the same line :

 echo -ne \"output\\r\"

The trick here is simple, first we disable the newline printed by echo command with the \”-n\” option and then we enable the interpretation of the backslash characters with the \”-e\” option. As the \”\\r\” is used as carriage return which brings you to the start of the line without the newline (like in typewriter), we will use the same to get the desired effect. So, if you wanted a stopwatch for a 100 seconds on the console then this simple bash for loop would do the same:

for i in `seq 100 1`


echo -ne \"$i\\r\"


Have fun playing with this and comment if you find some other interesting use of the same.