Quick Linux Tip #97:
Question: My binary exists but Linux says 'command not found'. What's wrong?
Try: file /usr/local/bin/mytool && ldd /usr/local/bin/mytool
Info: "No such file or directory" when executing an existing binary typically points to a missing dynamic loader/interpreter or missing shared libraries (.so). ldd reveals unresolvable dependencies.
Examples:
- $
file /path/to/binary# Verify binary type, architecture, and executable status - $
ldd /path/to/binary | grep 'not found'# Quickly filter missing shared library dependencies - $
sudo ldconfig -p | grep libfoo# Query system shared library cache for missing libraries
Note: Also verify architecture compatibility (e.g., 32-bit execution on a 64-bit kernel), invalid shebang paths in scripts (#!/bin/python when missing), or missing execute flags (chmod +x).
Leave a Reply