Bash - process


This article is about the bash Process.

To see how to manage another general linux process, see Linux - Process



  • The process running the command is created.
  • The process inherits the stdin, stdout, and stderr from the shell. Because it inherits stdin, it stay connected to the same terminal.
  • If the shell receives a SIGHUP, it also sends a SIGHUP to the process (which normally causes the process to terminate).
  • Otherwise the shell waits (is blocked) until the process terminates.


  • & puts the job in the background: ie
    • it block on attempting to read input,
    • and makes the shell not wait for its completion.
    • removes the process from the shell's job control,
    • leaves the process connected to the terminal. The shell won't send it a SIGHUP. Obviously, it can only be applied to background jobs, because you cannot enter it when a foreground job is running.
    • disconnects the process from the terminal,
    • redirects its output to nohup.out
    • shields the process from SIGHUP. One of the effects (the naming one) is that the process won't receive any sent NOHUP. It is completely independent from job control and could in principle be used also for foreground jobs (although that's not very useful).

Builtin Stop


Environment variable


From the bash man page: $ Expands to the process ID of the shell. In a () subshell, it expands to the process ID of the current shell, not the sub-shell.

echo $$

The $$ variable often finds use in scripts to construct “unique” temp file names


BASHPID: Process ID of the current instance of Bash. <warning>bash 4</note>



The $PPID of a process is the process ID (pid) of its parent process.


The PID (process ID) of last job run in background

Documentation / Reference

Powered by ComboStrap