Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is bash failing to create a symbolic link in /usr/local/bin?

Attempting to create a symbolic link for the subl command so that I can open flies in Sublime Test 3 from the terminal. However, it fails to find the /usr/local/bin directory, even though it is in my path.

 $ ln -s /D/ProgramsD/SublimeText3/subl /usr/local/bin/subl
 ln: failed to create symbolic link '/usr/local/bin/subl': No such file or directory
like image 952
Kevin Mangal Avatar asked Nov 08 '17 20:11

Kevin Mangal


People also ask

How do I fix symbolic links?

The only way to fix these broken symlinks is by deleting them. Your system contains hundreds of dangling links and no one has the time to check for these links manually. In such cases, Linux tools and commands prove to be really helpful.

How do you create a symbolic link in Shell?

You can create a symlink (symbolic) by using the ln command in the command line. Symbolic links are useful because they act as shortcuts to a file or directory.

Why are symlinks broken?

A symlink is broken (or left dangling) when the file at which it points is deleted or moved to another location. If an application's uninstallation routine doesn't work properly, or is interrupted before it completes, you might be left with broken symlinks.

How do I create a symbolic link in Linux?

Create Symbolic Link in Linux for Files There is nothing hard in creating Symbolic links in Linux – you just need to follow one simple step. The ln command in Linux creates links between source files and directories. -s – the command for Symbolic Links. [Symbolic filename] – name of the symbolic link.


1 Answers

ln: failed to create symbolic link '/usr/local/bin/subl': No such file or directory

This error can happen when one of the parent directories of /usr/local/bin/subl don't exist.

Create them with:

mkdir -p /usr/local/bin

However, it fails to find the /usr/local/bin directory, even though it is in my path.

As the output of ls -ld /usr/local/bin reveals, indeed there is no such directory. The fact that the directory is on your PATH is irrelevant, because being on the PATH doesn't imply that a directory actually exists. In your example it doesn't exist, you need to create it.

like image 199
janos Avatar answered Sep 30 '22 13:09

janos