1

I have the following situation:

[ORACLE]/u01/app/grid/12.1.0.2/network> ll
total 20
lrwxrwxrwx. 1 root root 36 May 11  2016 admin -> /u01/app/grid/12.1.0.2/network/admin
[ORACLE]/u01/app/grid/12.1.0.2/network> cd  /u01/app/grid/12.1.0.2/network/admin
-bash: cd: /u01/app/grid/12.1.0.2/network/admin: Too many levels of symbolic links

I am not sure who or why the symbolic link was created, but I would like to remove it without removing the contents of the admin folder. Is it just rm admin or is there a different command?

2 Answers 2

3

It is just rm admin, assuming there is no alias for rm defined. You could do /bin/rm -i admin, if you are nervous - the -i option will explicitly ask rm: remove symbolic link 'admin'?.

Just make sure you don't use Tab which might get you a / after admin, (although you would still need -rf to make that cause problems)

1
  • You might want to add mention of what the problem is - likely that there is a recursive tree of links going on.
    – DopeGhoti
    Nov 28, 2016 at 21:18
2

Or use the synonym of rm: unlink admin in your case.

B.T.W, from your console output

-bash: cd: /u01/app/grid/12.1.0.2/network/admin: Too many levels of symbolic links

you're creating a cyclic symbolic link, which in your case using cd /u01/app/grid/12.1.0.2/network/admin, you're actually cd <symlink> recursively. You probably want to create the symlink in another directory other than /u01/app/grid/12.1.0.2/network/, e.g. sudo ln -sf /u01/app/grid/12.1.0.2/network/admin /tmp/admin.

2
  • I looked up the history commands and see this: 220 su - oracle 221 cd /u01/app/grid/12.1.0.2/network/ 222 ll 223 mv admin admin.orig 224 ln -s /u01/app/grid/12.1.0.2/network/admin . Does the rm admin still apply in this situation if the folder is being linked to itself?
    – rman
    Nov 28, 2016 at 21:45
  • yes, just rm it will be fine, and relink it using ln -s [source] [target](target should be in different folder or at least with different name to source)
    – Allen
    Nov 28, 2016 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .