Where are commands `fg`, `bg` and `jobs` installed? [duplicate]

You are not getting any files against those commands because they are shell (bash) built-ins, not separate executable files (e.g. binary files, scripts). Actually, shell built-ins are compiled into the shell executable; if you want you can check the source code to be sure of it. As which or whereis only looks for external executable files, you are not getting any output for the built-ins.

To find if a command is a built-in or alias or function or external file, the best way is to use the type built-in:

$ type fg
fg is a shell builtin

$ type bg
bg is a shell builtin

$ type jobs
jobs is a shell builtin

Also note that your find command is not syntactically correct. The correct (simplest) syntax is find /where/to/search -name 'name_to_search'.

Also note that few commands are implemented as both a shell built-in and a separate standalone executable. For such commands, always remember that the built-in command will take precedence over the external one. So, when you run echo something, the built-in echo is run. If you want to run the binary executable echo you need to call it in a different way. One way is to use the full path to the executable: /bin/echo something.

To display all available versions of a command, run type with the -a option:

$ type -a echo
echo is a shell builtin
echo is /bin/echo

To get documentation for shell built-ins, you can check the manpage of bash or use the help command (which is a built-in command):

help jobs

Also as @terdon pointed out you should use type instead of which.


They are shell built-ins - you can get basic usage information by typing help fg or help jobs at the bash shell prompt, or more detailed information from the bash manpage.


Adding to heemayl's answer, it's worth pointing out that fg, bg, and jobs have to be built into the shell, because they manipulate data structures in the shell's memory and/or the kernel state associated with the shell's process. It would not be possible to write an external command that does what fg does.

Other commands that have to be built in include cd, eval, exec, exit, export, history, read, set, source (aka .), shift, trap, ulimit, umask, and wait. Your shell may have a longer list, depending on how much extended functionality it implements. POSIX has a different, but overlapping, list of "special built-in utilities" -- I'm not sure why things like break and continue count as commands rather than control-structure keywords, or why POSIX doesn't consider things like umask must-build-in when they can't be implemented any other way. (You could write a program called /bin/umask that called umask(2), but it would only change the setting for itself, not for subsequent processes created by the shell, so it wouldn't fulfill its specification.)


This are shell builtin commands. There is no binary for them as they are a part of Bash (or whatever shell you are using).

They are documented for example in the Bash manpage (see the section "SHELL BUILTIN COMMANDS")