« Engineers Sexy? | Main | Army Training »

April 22, 2005

Vi is missing

Help me, I deleted vi....

Don't laugh - it can happen. In this case, it is not a serious problem because there are usually multiple links to vi.

Find the directory where vi used to be (probably /usr/bin):

bash# ls -li vedit
        245 -r-xr-xr-x   5 root     bin       227956 Nov 26  2003 vedit

The inode (leftmost number is 245). For interest, you can check which other files also have this inode in this directory:

bash# ls -i | grep " 245 "
       245 edit
       245 ex
       245 vedit
       245 view

Now link any one of these to vi: ln ex vi. Done.

Note that you may not be so lucky if you are using BSD/Linux because they are more likely to use softlinks:

user$ ls -li | grep vim

1080938 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 ex -> vim

1080939 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 rview -> vim

1080940 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 rvim -> vim

1080942 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 view -> vim

1080943 -rwxr-xr-x 1 root wheel 1040376 Mar 21 21:12 vim

1080944 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 vimdiff -> vim

1080945 -rwxr-xr-x 1 root wheel 1068 Mar 21 21:12 vimtutor

In this case the fix would be: ln -s vim vi...

Posted by Ozguru at April 22, 2005 06:00 AM