disabling job control in bash (CTRL-Z)
You can add the following into your command line to stop using monitoring mode.
set +m
If you really need the ctrl-z functionality later, you can just type 'set -m' to enable monitoring for that session.
From man bash. Note that this is for '-m', with "+m" toggling that setting to disable.
set [+abefhkmnptuvxBCEHPT] [+o option] [arg ...]
....
-m
Monitor mode. Job control is enabled. This option is on by default for interactive
shells on systems that support it (see JOB CONTROL above). Background processes
run in a separate process group and a line containing their exit status is printed
upon their completion.
As a last ditch effort, you may want to manually compile a version of bash without the "--enable-job-control" flag. Here is a quick install guide from GNU. If you do choose to go this route, DO NOT replace /bin/bash just in case background processes run through bash expect job control. Instead, make a /bin/bash.alt or another file. Your default shell can be changed to this alternate one by running usermod or editing /etc/passwd as root.
stty susp undef
will disable the keyboard-initiated suspend signal for most programs, however commands like vim and emacs that have specific bindings for Ctrl-Z will have to be reconfigured individually. In emacs, you can run (global-unset-key "\C-z")
.
You can add that stty command to your ~/.bash_profile
or ~/.profile
, logout, login again.
Or am I missing something, and this feature can be useful?
To answer this part of the question: C-z / fg
combo is essential to my vim workflow. For example, I prefer C-z > git commit
> fg
to using git wrappers from within vim.
C-z helps with treating the shell as IDE, conforming to the "do one thing" principle. (This instead of "editor as IDE").