Why doesn't the whereis command give any information about the export command? How does the export command work even if the shell path variable is set to null?

  • 3
    whereis is a nonstandard and not very useful command. type is better, because it is a builtin and should usually tell you how a command is resolved -- as a builtin, function, or non-builtin. Unfortunately POSIX has little to say about the details of type, so you have to check your shell's manual for what options it supports. whence is another command used by some shells and is similar to type. – ormaaj Dec 8 '12 at 16:12

whereis doesn't show you a binary for export because it's a shell builtin. You can find it in the bash man page. As it's a builtin, not a binary, the shell doesn't search the PATH for it, so it will work regardless of the current path. Incidentally, this is why you are advised to use type to see what is being executed when you give a command:

$ which export
$ whereis export
$ type export
export is a shell builtin
  • @Kevin Where could I get information about built in export. What are the other built ins? – user3539 Dec 8 '12 at 15:54
  • If you look at man bash, you'll see probably see BASH BUILTIN COMMANDS near the top. – goldilocks Dec 8 '12 at 15:56
  • @user3539 you can see all the builtins in bash's man page, or the bash reference manual. – Kevin Dec 8 '12 at 15:57
  • 4
    For documentation about a specific bash command, use help: help export. Also, type -a shows you all the ways the command is found (alias/function/builtin/external) – glenn jackman Dec 8 '12 at 18:53
  • 1
    Locally, you can browse them via man bash-builtins – yuvilio Jan 2 '15 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.