Historically, job control was written by Bill Joy for the csh, while he was working on a new, cheap serial terminal - the Lear-Siegler ADM-3A. This terminal is famous for defining the arrows for Joy's vi editor, and assigning the ~ tilde character as the home directory in all POSIX shells.<p><a href="https://en.wikipedia.org/wiki/ADM-3A" rel="nofollow">https://en.wikipedia.org/wiki/ADM-3A</a><p>It is unfortunate that Bill Joy was both the first and last word in job control (even as his csh has been largely abandoned), as this functionality has been copied first into the Korn shell, then into the POSIX shell, and hasn't seen any substantial improvement since the 1970s.<p>It would be very helpful if shell job control could address available processors (and become aware of asymmetric big/LITTLE configurations), hold jobs until CPUs become available, and keep a list of failed jobs for retry.<p>The standards will likely never implement this functionality. This is the fault of the Austin Group.
I love job control! And as usual, Julia Evans explains it in a clear and straightforward fashion.<p>I would add that as a shortcut, you can just type % (without fg) to foreground the current job, or % and a number to foreground a particular job. (In Bash, anyway.)<p>I use tmux, but I often use job control as an extra dimension, having several jobs in any given tmux window. (Yes, this leads to the inevitable "There are stopped jobs." warning when I attempt to exit a shell/window, which makes cleanup slightly more tedious.)
One nitpick on disown:<p>It <i>will</i> prevent the process from getting SIGHUP when the terminal is closed, but it won't change the pty or stdin/stdout/stderr of the process, so it may still abort if/when I/O is performed. Using e.g. nohup solves this problem more completely. If you see programs abort even with disown, they are probably aborting on I/O errors to the terminal.<p>Also, some terminals (e.g. kitty) will not auto-close when bash exits if there are still processes having the PTY open. Here's a simple example to play around with to see some different possibilities (and check how your shell handles things). <i>NB: It runs "exit" at the end, so run in a fresh terminal window/tab</i><p><pre><code> { set -e; rm -f /tmp/got-here; sleep 5; echo hi; touch /tmp/got-here; } 2>/tmp/test-stderr & disown; exit
</code></pre>
If you run this in a terminal that doesn't close when your shell exits if any other process still has the pty open, then the tab/window will hang around for 5 seconds and then disappear; /tmp/got-here will exist. If you run in a terminal that <i>does</i> close when your shell exits (e.g. xterm), then /tmp/got-here will never be created and you'll see an IO error message in /tmp/test-stderr
I'm curious to see how many engineers here use shell/*nix tooling on a day to day basis. My experience has been that newer engineers have no experience nor desire to learn any of it, whereas it was basically required when I was coming up.