←back to thread

185 points thunderbong | 1 comments | | HN request time: 0s | source
Show context
lelandfe ◴[] No.43647389[source]
> Since I never remember which one is which, a good way to check is using the utility `file`: `file $(which useradd)`

While we're here, can someone explain why `which` prints some locations, and for others the whole darn file? Like `which npm` prints the location; `which nvm` prints the whole darn file.

replies(5): >>43647452 #>>43647455 #>>43647461 #>>43647472 #>>43648647 #
1. YardenZamir ◴[] No.43647452[source]
I can't say the reason, but i can note the pattern. If it's something in your path, like a program or a script which will show you where it is. If it's a shell function sourced you will see the whole thing.

If you write a function in your current session for example which will show you the content of that command. If you write that command in a file and put that file in your path which will show you where it is