Linux – How to create a symbolic link without using ln

centos6linuxsymbolic-link

I deleted a critical symbolic link – libc.so.6. I have the file it should point at, but the basic commands such as ln or wget won't work anymore due to the link missing. However, echo or other Bash builtins work.

I am looking for a way to recreate this symbolic link.

Best Answer

you can use ldconfig, it recreates the symlink:

# rm /lib/libc.so.6 
rm: remove symbolic link `/lib/libc.so.6'? y
# ls -l /lib/libc*
ls: error while loading shared libraries: libc.so.6: cannot open shared object file:
# ldconfig 
# ls -l /lib/libc*
[skip]
lrwxrwxrwx. 1 root root      12 May 11 07:59 /lib/libc.so.6 -> libc-2.12.so

just tested it, as you see.