How to remove a symbolic link to a directory?
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2 Looping
--
Chapters
00:00 Question
00:41 Accepted answer (Score 133)
00:59 Answer 2 (Score 24)
01:20 Answer 3 (Score 16)
01:45 Answer 4 (Score 1)
02:17 Thank you
--
Full question
https://superuser.com/questions/9181/how...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #bash #symboliclink
#avk47
ACCEPTED ANSWER
Score 136
Remove the trailing slash:
With prompt:
$ rm test5
Without prompt:
$ rm -f test5
ANSWER 2
Score 25
Try rm test5
(without the trailing slash).
The slash indicates that 'test5' is a directory whereas it's actually a file linking to a directory.
ANSWER 3
Score 16
You can run removing the trailing slash:
$ rm test5
This will remove the file (i.e. the symlink).
Alternatively you may use unlink:
$ unlink test5
Again you must omit the trailing slash since you are attempting to unlink the symlink not the directory.
ANSWER 4
Score 0
Sometimes if you use autocomplete to name the link that you want to delete you may not see a trailing slash but it's 'half there' and that invisible slash still gives the delete error when trying to remove that link.
So in that case type out character by character the link to be deleted as "test5" as eg. rm test5
.