The basic task of a computer is to process data. A file is used as a way to store this data on your computer. In addition, a directory (also called a folder) is created as a method of grouping multiple files according to their contents and purposes. The command is for manipulating this file.
The actual state of the command is a program, and the program is also a kind of file, and directories for programs such as / bin and / sbin are located. When you execute a normal command, you do not need to be aware of which directory the program for that command is located in. That's because the program directory is set in an environment variable called PATH. Take a look below.
$ pwd $ /bin/pwd $ ls $ /bin/ls
The result of both executions is the same. It also runs on
$ pwd because it is set in your PATH to run
$ / bin / pwd when
$ pwd is run. This setting is called ** passing through the PATH **.
It is a box to store the data you want to share in the terminal. So PATH is also one of the environment variables.
which command name
You can use which command to display the path of the command located under the directory included in PATH.