Search code examples
bashctagsexuberant-ctagsln

Cannot run ctags after executing "ln -s /usr/bin/ctags-exuberant"


By mistake I have executed the following command on my redhat office machine and now I cannot run ctags -R * any more.

ln -s /usr/bin/ctags-exuberant

Hope following info helps,
[ypp:~]$ ls /usr/bin/ctags-exuberant
[ypp:~]$ ls: /usr/bin/ctags-exuberant: No such file or directory

[ypp:~]$ unlink /usr/bin/ctags-exuberant
unlink: cannot unlink /usr/bin/ctags-exuberant': No such file or directory

[ypp:~]$ which ctags
alias ctags='/usr/bin/ctags'
/usr/bin/ctags

[ypp:~]$ ln -s /usr/bin/ctags-exuberant /usr/bin/ctags
ln: creating symbolic link '/usr/bin/ctags' to '/usr/bin/ctags-exuberant': File exists

[ypp:~]$ ln -s /usr/local/bin/ctags /usr/bin/ctags-exuberant
ln: creating symbolic link ,/usr/bin/ctags-exuberant' to '/usr/local/bin/ctags': Permission denied

So far I have tried,

[ypp:~]$ rm /usr/bin/ctags-exuberant
/bin/rm: cannot lstat /usr/bin/ctags-exuberant': No such file or directory

[ypp:~]$ rm -i /usr/bin/ctags-exuberant
/bin/rm: cannot lstat /usr/bin/ctags-exuberant': No such file or directory

[ypp:~]$ unlink /usr/bin/ctags
unlink: cannot unlink /usr/bin/ctags': Permission denied

Please tell me how do I get my ctags working back to normal, I don't have superuser privilege also.


Solution

  • According the manpage, ln creates a link to file TARGET with the name LINKNAME. If LINKNAME is omitted, as was your case, a link to TARGET is created in the current directory, using the name of TARGET as the LINKNAME. As a result, when you executed ln -s /usr/bin/ctags-exuberant a symbolic link (sometimes called soft link) named ctags-exuberant would have been created in your present working directory pointed at /usr/bin/ctags-exuberant.


    There seems to be more at play than what you have shared with us here. Simply creating a link to ctags-exuberant in any directory should not have resulted in the changes you are experiencing. Where there other changes made to your path?

    If, somehow just creating the link has caused all your troubles, then you need to focus on finding the resulting link and removing it. If you don't know what directory it was created in, you could find it via the following:

    find / -type l -name 'ctags-exuberant' 2>/dev/null
    

    Once it is found, remove it and see if that fixes your problems. Let us know what you find.

    Else, you might do better to try the wise minds over at https://unix.stackexchange.com/