3

There is a command written in bash I found from documentation from people who previously worked in this project. Now I need to locate the command's source and modify it.

I tried

which my_command

It cant find the command.

edit:

whereis outputs:

mycommand:

  • Try whereis. It does the same thing, but gives binary, man page, and source. – Torger597 Apr 13 '15 at 03:28
  • type command -- This will tell you what the shell would actually execute (which might be built-in to the shell) – John1024 Apr 13 '15 at 03:28
  • 1
    I invite you to read: http://unix.stackexchange.com/q/85249/38906 – cuonglm Apr 13 '15 at 03:33
  • @John1024 It could have to do with the fact I'm trying to do work during the night. Apologies. The link given to me by @cuonglm was extremely informative. Not thinking about it, I tried type ls type cat which returned the aliases I had those commands set to. Then my brain threw together junk and typed it... I need sleep. – Torger597 Apr 13 '15 at 03:42
  • @Torger597 Quite understandable. Happens to me too. – John1024 Apr 13 '15 at 04:15
  • which -s in xonsh – Andrew Nov 16 '22 at 01:58

1 Answers1

2

the which command you're using assumes the argument "my_command" is inside your PATH. which searches via your global environment variable PATH for the argument that you type and lists the complete path to the first match it finds.

You can find your path by typing env on the command line and looking for PATH=.

whereis - searches for files in a restricted set of locations, such as standard binary file directories, library directories, and man page directories. This utility is a quick way to find program executables and related files like documentation or configuration files.(This does not search user directories or many other locations that are easily searched by find or locate)

and of course if you know the general location you can use the find or locate command.