Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a symlink?

Tags:

macos

symlink

i just created the symlink sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib and am wondering how i get rid of it if I wanted to. How would i do this?

like image 640
locoboy Avatar asked Oct 28 '11 17:10

locoboy


People also ask

Does removing symbolic link remove the file?

The symbolic link does not contain any data, but you can perform all operations on the symbolic link file. Removing a symbolic link does not delete the original file, but deleting a file makes the symlink a dangling link.

What happens when you remove a symbolic link?

Note that removing a symbolic link does not affect the file it points to. Before removing a file, you can verify whether it is a symbolic link using the ls -l command. It will also show you the file or directory that it points to. The l in permissions (lrwxrwxrwx) confirms that it's a symbolic link.

How do I remove a symbolic link in Windows 10?

To delete a symbolic link, treat it like any other directory or file. If you created a symbolic link using the command shown above, move to the root directory since it is "\Docs" and use the rmdir command. If you created a symbolic link (<SYMLINK>) of a file, to delete a symbolic link use the del command.


2 Answers

Remove it just like you would any other file: rm /usr/lib/libmysqlclient.18.dylib. rm will remove the symlink itself, not the file the link is pointing at.

like image 177
Marc B Avatar answered Oct 22 '22 08:10

Marc B


You could also use the unlink command: unlink /path/to/sym/link

I believe just deleting the file within Finder works fine also, it will have a little shortcut icon on it.

like image 27
AlecRust Avatar answered Oct 22 '22 08:10

AlecRust