How to Use the which Command on Linux

in dlike •  5 years ago 

Shared From Dlike

When you try to run a program or command from the terminal window, the shell (usually, Bash on modern distributions) has to find that command and launch it. Some commands, such as cd, history, and pwd, are built into the shell, Well, Bash uses the path, which is actually a collection of paths, each of which points to a directory. It then searches each of those directories for an executable that matches the command or program 

 use echo to check the $PATH environment variable and see the directories in your path.

The "echo $PATH" command in a terminal window.

The output list separates each path with colons (:). On the computer we’re using, Bash will search the following directories in this order:

  • /usr/local/sbin
  • /usr/local/bin
  • /usr/sbin
  • /usr/bin
  • /sbin
  • /bin
  • /user/games
  • /usr/local/games
  • /snap/bin


Shared On DLIKE

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

erm ... which command ? or we just doing the echo command