TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A guide to Linux signals

128 pointsby benevover 9 years ago

10 comments

thatcksover 9 years ago
A note: SIGHUP is far from obsolete in its original purpose. We may have stopped using modems but people still log in to Unix machines in ways that can get disconnected. If you SSH in to a machine and your SSH session is cut off by a network issue, your shell (and any command you have running) will get a SIGHUP.
评论 #10619906 未加载
danieltillettover 9 years ago
Catching signals is a great way of catching nasty bugs in production code. I use them to be able to log information on the cause of an error before the code exits due to some sort of catastrophic bug (e.g. null pointer deference, etc). This also allows you to clean up to clean up temp files, etc. They are much nicer to use than the Windows equivalent.
评论 #10619378 未加载
评论 #10619363 未加载
throw7over 9 years ago
One thing that might have been nice to note is the rules regarding what you can and can't do in signal handler code.
评论 #10621226 未加载
评论 #10621767 未加载
sohkamyungover 9 years ago
For a more in-depth look at Signals, there&#x27;s Michael Kerrisk&#x27;s Linux Man Pages on Signals [1]. AFAIK, the best reference on Signals is in the book by Stevens and Rago [2].<p>[1] <a href="http:&#x2F;&#x2F;man7.org&#x2F;linux&#x2F;man-pages&#x2F;man7&#x2F;signal.7.html" rel="nofollow">http:&#x2F;&#x2F;man7.org&#x2F;linux&#x2F;man-pages&#x2F;man7&#x2F;signal.7.html</a> [2] Advanced Programming in the Unix Environment, Second Edition
Symbioteover 9 years ago
<p><pre><code> ps -ef | grep foobar </code></pre> is more easily done with<p><pre><code> pgrep foobar </code></pre> or perhaps<p><pre><code> pgrep -a foobar</code></pre>
评论 #10621018 未加载
mixblastover 9 years ago
What about SIGSTOP and SIGCONT? They&#x27;re quite useful to pause and resume processes (Ctrl-Z).
评论 #10620258 未加载
评论 #10620879 未加载
jackgaviganover 9 years ago
Aren&#x27;t these Unix (or, more accurately, POSIX) signals, rather than Linux signals?
wnoiseover 9 years ago
WINCH comes from the terminal driver, not from the &quot;window manager&quot;.
positron4over 9 years ago
Thank you for this excellent article. Much appreciated!
rewqfdsaover 9 years ago
The trouble with signals is that there are so few of them and we can&#x27;t add more without breaking the ABI.
评论 #10619566 未加载