1

As far as I've been able to tell, just about every command line utility has a path pointing to their binary.

For example, $ which which returns /usr/bin/which and $ which env returns /usr/bin/env.

But $ which export and $ which unset both return nothing and produce an exit code of 1 instead of 0. What's different about export and unset that they don't have a path?

Cara McCormack
  • 388
  • 1
  • 7
  • 21

1 Answers1

2

export and unset are built in to the shell (other examples are cd and alias). They aren't separate binaries and don't exist as separate entities.

man builtins will give you more info.

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
  • 1
    A lot of the commands listed by `man builtins` do exist, because Bash has them built in but there is a separate copy on your computer. The builtins `alias`, `cd`, `export`, `unset`, `shopt`, etc. are special because they *cannot* be implemented by external programs. – Daniel H Sep 14 '17 at 16:10