Senior
Where are binary files located in Linux? How to find a compiled binary placed in /opt?
sobes.tech AI
Answer from AI
In Linux, binary files are usually located in directories like /bin, /usr/bin, /usr/local/bin, and similar, which are included in the environment variable PATH.
If you have a compiled binary placed in /opt, you can find it in several ways:
- Use the
findcommand:
find /opt -type f -executable -name 'binary_name'
This will find the executable file with the specified name.
- If the filename is unknown, you can search for all executable files:
find /opt -type f -executable
- You can use
lsto view the contents:
ls -l /opt
- If the binary is run through a symbolic link, you can use
whichorwhereis, but they only search in PATH.
Therefore, the best way to find a binary in /opt is to use find with the -executable option.