Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Expanding on this, ^\ (Ctrl+\) means sigkill, and I don't think many people know about this one.


^\ is actually sigquit, which is a bit different from sigkill, since programs can catch QUIT and perform some cleanup.


Also ^| (as in, "control pipe") which is a synonym for ^\. At least for me, | is faster to hit than \

And since we're on this topic: if I write a for loop in bash that runs a slow command 1000 times (ImageMagick comes to mind), and I realise something has gone wrong, is there an easy way of breaking the outer loop?


If you wrote the for loop interactively, you can suspend it with ^Z and kill its jobspec with 'kill %n' (for n usually = 1).

If it's part of a script, your script probably wants to trap SIGINT.


> Also ^| (as in, "control pipe") which is a synonym for ^\. At least for me, | is faster to hit than \

How? Do you have a keyboard where | isn't Shift+\?


I have a Norwegian keyboard, where as you can see, pipe has its own key to the left of "1" (above Tab):

https://en.m.wikipedia.org/wiki/File:Keyboard_Layout_Norwegi...


On a Swedish keyboard, | is altgr+< (between shift and z), and \ is altgr++ (between 0 and ´).


Not a nice way, but the way that works best for me is:

^Z

fg

^C

the ^Z kills the loop, the fg and ^C cleans up the currently running one.


SIGQUIT also defaults to dumping core.


IIRC, on Unix, Ctrl-\ sends the quit signal, which causes the process receiving it to do a core dump (before exiting), which can be used for post-mortem debugging, whereas Ctrl-C sends the kill signal, which makes the process terminate without any core dump. Those are the default actions for the signals.

https://en.wikipedia.org/wiki/Control-%5C

https://en.wikipedia.org/wiki/Core_dump

https://en.wikipedia.org/wiki/Control-C

I remember doing:

sdb a.out . core

or something like that, in my C-on-Unix programming days earlier :)

sdb was a debugger.


Speaking of terminating Unix processes, here's a post I wrote a while ago:

UNIX one-liner to kill a hanging Firefox process:

http://jugad2.blogspot.in/2008/09/unix-one-liner-to-kill-han...

Some interesting comments on that post too, which go into slightly deeper details.


Wow, I can't believe I didn't know that. No more running killall in a new terminal!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: