I am working on my project using network simulator2. I installed it and everything is fine. I attempted to create a symbolic link between this installation and /usr/bin
, so I could invoke the software by running ns
from the command-line. Namely, I ran:
sudo ln -s /home/vinaychalluru/ns-allinone-2.34/ns-2.34/ns /usr/bin/ns
which generated the following output:
ln: creating symbolic link '/usr/bin/ns': File exists
How can I delete the already created symlink or can I replace it with any other commands?
ln
has-f
switch that 'forces' a symlink to be created whether it exists or not.I tried
ln -sf
while replacing but it didn't work for me, but doingln -sfn directory link_name
asroot
worked.To add to all answers above, a symbolic link can be treated as a regular file in many cases (the link, not the target).
rm
on a symbolic link will remove it. If the link is owned by root, you will need to sudo.You should be able to
rm /usr/bin/ns
or rathersudo rm /usr/bin/ns
don't forget ownership.