Program file exists in /usr/bin, but cannot be used

Clearly my file exists in /usr/bin

$ ls /usr/bin/ngrok
/usr/bin/ngrok

However, when I attempt to chown it I receive an error

$ sudo chown my_user:users /usr/bin/ngrok
chown: cannot dereference '/usr/bin/ngrok': No such file or directory

Further attempts to run it also fail!

$ ngrok
bash: ngrok: command not found
$ sudo /usr/bin/ngrok
sudo: /usr/bin/ngrok: command not found

What is happening here?


/usr/bin/ngrok will be a symlink that points nowhere (or rather to a non-existing file). Check with ls -l.


Given the chown error, the most likely possibility is that it's a symlink, as answered by Sven. However, just for reference in case somebody ends up here for cases where the file exists and is not a link, but gives a command-not-found/file-not-found error, one more possibility is that the executable is dynamically linked and for some reason it's not able to load libraries:

  • missing library (run ldd on the binary to see those)
  • missing loader
  • apparmor denying access to a library or loader
  • ...

Also, for a script, if the interpreter in the shebang could not be executed for similar reasons, you'd get the same error.