Hacker News new | ask | show | jobs
by jwilk 3029 days ago
Instead of which(1), you could use type, which is aware of builtins and aliases:

  $ type cd
  cd is a shell builtin
2 comments

if you use zsh on the other hand..

  % which which
  which: shell built-in command
command is also useful for this sort of thing (with the -v and -V options). It can also be used to ignore shell functions and aliases (without options) so:

  $ alias cd=ls
  $ cd foo
   <lists contents of foo>
  $ command cd foo
   <changes to directory foo>