This content was deleted by the author. You can see it from Blockchain History logs.

How to Use the which Command on Linux

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

Logo
Center