LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Accidentally Linked /usr/bin to /bin... (https://www.linuxquestions.org/questions/linux-software-2/accidentally-linked-usr-bin-to-bin-430778/)

worldgnat 04-01-2006 06:22 PM

Accidentally Linked /usr/bin to /bin...
 
Here's an interesting problem.... In order to run java on my computer, I tried to ln -s /opt/jdk1.something/bin/* /usr/bin. It didn't work, and I tried to run java, but it said there were too many levels of symbolic links. While screwing around with it I accidentally (forgetting I cd'ed into /usr/bin) did ln -s * /bin. Now everything in /usr/bin is in /bin, and make is complaining about too many levels on symbolic links. Since I'm running Gentoo this is a huge problem. Any ideas?

Thanks,
-Peter

KimVette 04-01-2006 06:35 PM

You could ls -l | grep -e ^l to find all the symbolic links in one directory (say, /usr/bin) then do the same in the other directory (/bin) and then compare the two results. Remove the ones which you don't need. Which ones "should" be there? it's hard to say, distributions vary so much, along with what one user has installed vs. another.

Worst case you could make a backup, use konqueror and sort by permissions so all the symbolic links are grouped together, and remove all but the ones which should be there with a default installation, and then recreate each symbolic link as required (tedious, I know :( )

worldgnat 04-01-2006 06:51 PM

I like that idea, but do you know of any way to use a bash script or the like to do that for me? Sorry, sounds really stupid, but I don't really have much time to filter through it. I was thinking about using grep to find out which files matched and then delete them. I don't know if this makes, any sense, it's a mix of bash and java, but, rm /bin/(ls /usr/bin). Or if one could isolate one file at a time. I might just write a java program... hmm...

Thanks,
-Peter


All times are GMT -5. The time now is 11:40 PM.