The command which SOMETHING
tells the shell to search the path for an executable named SOMETHING and display it’s location:
tmartin:dart:~> which subl
/usr/local/bin/subl
This particular lookup is also done the first time you try to run SOMETHING
so that the shell knows where the thing is that it’s supposed to run. Once that has happened, the location is kept and the next time the same thing is searched for, it just uses the result from that first search.
The command hash -r
tells the shell that it should discard that cache of remembered searches, which makes it have to search again. You would do this if you for example installed a new version of something in a different location than where it used to be or if the location has otherwise changed,.
Taken together, the commands you printed above tell the shell to look for some executable named linter
, making sure to perform a fresh search just in case, and display the location it was found at.
If those commands are displaying nothing, there are two main reasons:
- There is nothing named
linter
installed on your system
- Something named
linter
is installed, but it’s not in one of the locations in the system PATH
, so it can’t be found.
In the first case, the solution would be to install the thing named linter
on your system. How you do that depends on your OS and what the thing actually is, so you would have to Google for how to do that.
Also keep in mind that even after you install linter
, the above commands may still not display anything, which means that you’ve traded case #1 for case #2.
The fix for case #2 would be to either update the PATH
to include the location where linter
is installed or move the thing named linter
to a place that’s in the path. However unless you know exactly what you’re doing, you shouldn’t move things around, so I would recommend updating the path. You can Google to see how to do that for your OS (MacOS in your case, I would guess).
Note that this requires you to know where the thing named linter
is stored, so if you don’t know where that is you’d have to search for it to know where it is. For this reason if you first had to install linter
, you should keep a note of where it was installed so that you can perform this step more easily.