4 ms·
it doesn't, ctrl-z only suspends process and switches to backgroud - the thing is still alive try ctrl-z and then type bg command - you will see a list, you can
by emergie 11y ago
it doesn't, ctrl-z only suspends process and switches to backgroud - the thing is still alive
try ctrl-z and then type bg command - you will see a list, you can resume with fg [number]
- Anderkent 11y agoWell, it might still run but it lets you out of the editor, which is the goal here. You can just kill -9 it afterwards.
- mcguire 11y agoIf you have good reflexes, you can type "^Z" right after "kill -9", before the syscall to send the signal is executed. Legend has it that, if you do, you bring on the Singularity immediately.
- dllthomas 11y agoThere is no reason for -9 here - all the major unix editors happily exit on SIGTERM.
- jokr004 11y agoCtrl-z by itself doesn't actually switch the process to run in the background, it stops the process. Running 'bg' is what starts the process back up running in the background, 'fg', like you said, resumes the process in the foreground and 'jobs' is the command you can run to see a list of processes that are running.
- dllthomas 11y agoWith bg, it is likely to suspend itself again by attempting to read from the terminal (which a text editor is likely to do basically all the time).
- waterhouse 11y agoSince the question was "Ctrl-z works universally", I feel obliged to point out that ctrl-z sends SIGTSTP, which can be blocked--not to be confused with SIGSTOP, which cannot be blocked. I don't know of any program that does intercept SIGTSTP (except a test program I wrote that tries to print the name of any signal it receives), and I suspect that "polite" interception would be to release a few resources and then accept being paused--but, in theory, a program could ignore it.
- FreeFull 11y agoMany curses programs (for example vim) intercept ^Z to set the terminal back into a more normal mode and then pause.
- Touche 11y agoThis is probably a stupid question, didn't know about bg and fg before. But after playing around with it, it feels pretty amazing, why even use screen/tmux when you have these?
- wutbrodo 11y agoScreen has aaugh easier interface for multitasking, including things like stderr not bleeding out from whatever background tasks you're running. Not to mention that switching back and forth between screens is what it's designed for and thus a lot easier than switching between job numbers. Also the ability to detach your screen and its running processes from being coupled to a specific login session, which is probably the main reason I started using screen instead of multiple terminals in the first place.