This answer references ChatGPT
In Linux systems, the /usr and /opt directories are commonly used to install software. There are some differences between the two directories.
The/usr directory is system-level and is used to store the system's shared files and executables. These files are installed and maintained by the system administrator, and are visible and executable for all users. This directory contains subdirectories such as /usr/bin for executables, /usr/lib for shared libraries, /usr/include for header files, and so on.
The/opt directory is optional and is used to install third-party applications and software packages. It is usually installed and maintained by the vendor or author of the package, not by the system administrator. These packages are usually self-contained and do not depend on other libraries or files on the system. Software packages in the /opt directory are usually placed in separate subdirectories, such as /opt/softname.
The/usr/local directory is also used to store locally installed software, but unlike the /opt directory, it is usually manually installed by a system administrator rather than by the author or vendor of the software. Packages in /usr/local are usually stored in directories such as /usr/local/bin, /usr/local/lib, and /usr/local/include.
Therefore, the three directories differ in the source and maintainer of the software and files they use. Typically, the /usr directory is used for system-level shared files and executables, the /opt directory is used for third-party applications and software packages, and the /usr/local directory is used for local software packages manually installed by the system administrator.