{
  "$type": "site.standard.document",
  "canonicalUrl": "https://rednafi.com/misc/use-command-v-over-which/",
  "description": "Replace which with command -v for POSIX-compliant executable lookup. Learn why command -v is the portable alternative for finding program paths.",
  "path": "/misc/use-command-v-over-which/",
  "publishedAt": "2021-11-16T00:00:00.000Z",
  "site": "at://did:plc:fgtm2c26vfcj74rfmeggbyqj/site.standard.publication/3mnl6f7ob462z",
  "tags": [
    "Shell",
    "Unix",
    "TIL",
    "CLI"
  ],
  "textContent": "One thing that came to me as news is that the command which - which is the de-facto tool\nto find the path of an executable - is not POSIX compliant. The recent [Debian which hunt]\nbrought it to my attention. The POSIX-compliant way of finding an executable program is\ncommand -v, which is usually built into most of the shells.\n\nSo, instead of doing this:\n\nDo this:\n\n\n\n\n[debian which hunt]:\n    https://lwn.net/Articles/874049/",
  "title": "Use 'command -v' over 'which' to find a program's executable"
}