Linux – Too many levels of symbolic links

linuxsymbolic-link

I want to simply link a source file to a destination file. However, I get Too many levels of symbolic links and don't know what is wrong with my files. Here are the information

[root@cluster ~]# ls /export/apps/mathematics/matlab2012a/bin/
activate_matlab.sh    insttype.ini     license.txt  mbuildopts.sh   
mw_mpiexec    registry    deactivate_matlab.sh  lcdata_utf8.xml
m3iregistry  mcc    mw_smpd     untitled.m    deploytool    
lcdata.xml     matlab     mex   optsetup.sh   util  
engopts.sh    lcdata.xsd     matopts.sh   mexext  output.txt    
worker    glnxa64   ldd    mbuild       mexopts.sh     ProductRoots

[root@cluster ~]# ln -s /export/apps/mathematics/matlab2012a/bin/matlab /usr/bin/matlab
ln: accessing `/usr/bin/matlab': Too many levels of symbolic links

[root@cluster ~]# ls /usr/bin/matlab
ls: cannot access /usr/bin/matlab: Too many levels of symbolic links

[root@cluster ~]# which matlab
/export/apps/mathematics/matlab2012a/bin/matlab



[root@cluster ~]# ls -l /usr/bin | grep matlab
lrwxrwxrwx 1 root root           8 Nov 20  2014 matlab -> ./matlab
[root@cluster ~]# /usr/bin/matlab
bash: /usr/bin/matlab: Too many levels of symbolic links

How can I fix that?

Best Answer

You created a symbolic link in /usr/bin called matlab that links to itself.

Related Question