What is the difference between the /usr/local and opt directories under Linux?

https://https://www.cnblogs.com/shan333/p/15362221.html

 Generally,  some subdirectories under the /usr/local command are often added to the PATH environment variable , and the software installed in the /usr/local directory can be executed and started on the command line.

The /opt directory is not in the PATH environment variable.

1. opt directory

■ The /opt directory is used to install additional packages

  □  It can be understood as D:/Software in the windows system . For programs installed in the /opt directory, all its data, library files, etc. are placed in the same directory.

     □  opt means optional , it can be used to place third-party large-scale software here, when you don’t need it, just rm -rf it.

      When the hard disk capacity is not enough, /opt can also be mounted separately on other disks for use.

2. /usr/local directory

/usr: system-level directory, which can be understood as C:/Windows/.
/usr/lib: understood as C:/Windows/System32.
 /usr/local: can be understood as C:/Progrem Files/

 □  It mainly stores the manually installed software , and some subdirectories under the /usr/local command are often added to the PATH environment variable.

Reference article:

"What is the difference between /usr/local and opt directories under Linux" What is the difference between /usr/local and opt directories under Linux_Baidu Know

"What is the difference between /usr/local and opt directories under linux" What is the difference between /usr/local and opt directories under linux_chenjinbo1982's blog-CSDN blog

The difference between the Linux program installation directory /opt and /usr/local_51CTO Blog_opt directory under linux

Both the /usr/local directory and the /opt directory are used to install third-party software. The so-called third-party software is actually the software installed by the user, which is different from the software that comes with the system.

  • /usr/local is generally the directory where you install the software, this directory is equivalent to the programfiles directory under windows;
  • /opt This directory is the installation directory of some large software, or the installation directory of some service programs.
  • The difference between /usr/local and /opt is that some subdirectories under the /usr/local command are often added to the PATH environment variable (the default is /usr/local/bin in PATH, you can use echo $PATH View), and the /opt directory is not in the PATH environment variable, so the software installed in the /usr/local directory can be executed and started on the command line.

        But this is not absolute. You can also install the software that needs to be started in the /opt directory, and then create a link file in the /usr/local/bin directory, so that you can also start the software with commands. Many Linux software installation tutorials on the Internet will Use this method.

        In fact, some software does not install the software in these two directories at all. For example, a game called NetHack was compiled and installed some time ago. After the make install command was executed, it was installed in the /home directory.
 

Guess you like

Origin blog.csdn.net/liuqinhou/article/details/131315895