Re:Shell Tricks That Make Life Easier (and Save Your Sanity)
by drzaiusx11 on Thursday March 26, 2026 @07:40AM
(#47529250)
ctrl-z pauses the process, it doesn't terminate. I think of z as in zombie as you can then run fg to bring it back from paused state or as you suggested kill in it for good
Re:Shell Tricks That Make Life Easier (and Save Your Sanity)
by dasyatidprime on Thursday March 26, 2026 @10:06AM
(#47530641)
All of the keyboard-driven terminal signals can be intercepted; catching INT (^C) for cleanup is just more common than the others. Only KILL and STOP cannot be caught.
^Z sends TSTP (not STOP, though they have the same default behavior) to suspend; some programs catch this to do terminal state cleanup before re-raising it to accept the suspension. Catching it to do full backout doesn't make as much sense because the program anticipates being resumed.
^\ sends QUIT, which normally causes a core dump and is rarely caught. If you have core dumps disabled (via ulimit -c 0 or other system configuration) then you can often use it as a harder version of ^C; this is how I would tend to get out of ‘sl’ in places where I found it unwantedly installed.
Re:Shell Tricks That Make Life Easier (and Save Your Sanity)
by tzot on Thursday March 26, 2026 @04:17PM
(#47535178)
For the most simple case of a single job, I use the job number (`[1]` in the example) with %-notation for the background jobs in kill (which is typically a shell builtin):
$ cat
^Z[1] + Stopped cat
$ kill %1
It's often faster than hitting CTRL+C and waiting for process cleanup, especially when many resources are used. Then you can do e.g. `kill -9 $(jobs -p)` to kill the stopped tasks.