Wednesday, 28 April 2021

Terminal PATH

 PATH is a system-level vari­able that holds a list of direc­to­ries. When you enter a command in the terminal, it’s short­hand for a program with the same name. The system looks in each of the PATH direc­to­ries for the program corre­sponding to the command. When it finds a matching program, it runs it. If it doesn’t find a match, it raises an error.

for instance if you type $echo $PATH, first terminal will look for the echo program in system, if its present terminal will execute it with argument $PATH. then its echo programs responsibility to print something on the screen.

if you want to know where the echo program is located in your system you can find it using which program. like this $ which echo. again which is also a program located somewhere in system even you can do this $ which which

If we enter a command name that doesn’t exist in any PATH direc­tory, we get an error: command not found.

No comments:

Post a Comment