Unix has always been rich in tools with the philosophy of "one tool
for one thing". Many of them work best when used in combination with
others. While there are dozens of very complex tools to do equally
complex tasks, there are some smaller but very useful ones.
I find the combination of 'more' and 'grep' most valuable in daily
usage. Does anyone agree? 'more filename | grep string' is something we
use almost everyday.
Some tools are not as visible in normal use. 'ncheck' is one tool I
came to know about much later in my Unix usage. An example:
To get info about a file like its permissions, owner, size, etc. we
just use ls -l. Let's get some info about vi file that we know resides
bash-3.00# ls -l /usr/bin/vi
-r-xr-xr-x 5 root bin 194404 Jan 23 2005 /usr/bin/vi
So the file actually has 5 hard links.
What are the other 4 files that link to it?
Let's ls with -i option to get its inode number.
bash-3.00# ls -li /usr/bin/vi
89215 -r-xr-xr-x 5 root bin 194404 Jan 23 2005 /usr/bin/vi
So its inode number is 89215.
How to get the other four links now that we have the inode number i.e.
find all files pointing to this inode. This seems a tough one but
another tool 'ncheck' comes to the rescue. 'ncheck' is slow but does
its work. For our example:
bash-3.00# ncheck -i 89215
So we found all the hard links to vi using simple commands.
Pretty cool, these tools are!