What does ‘set -e’ do, and why might it be considered dangerous?

set -e causes the shell to exit if any subcommand or pipeline returns a non-zero status. The answer the interviewer was probably looking for is: It would be dangerous to use “set -e” when creating init.d scripts: From http://www.debian.org/doc/debian-policy/ch-opersys.html 9.3.2 — Be careful of using set -e in init.d scripts. Writing correct init.d scripts requires … Read more

Is it possible to detach a process from its terminal? (Or, “I should have used screen!”) [duplicate]

You can press ctrl-z to interrupt the process and then run bg to make it run in the background. You can show a numbered list all processes backgrounded in this manner with jobs. Then you can run disown %1 (replace 1 with the process number output by jobs) to detach the process from the terminal. … Read more

SSL Certificate Location on UNIX/Linux

For system-wide use, OpenSSL should provide you /etc/ssl/certs and /etc/ssl/private. The latter of which will be restricted 700 to root:root. If you have an application that doesn’t perform initial privilege separation from root, then it might suit you to locate them somewhere local to the application with the relevantly restricted ownership and permissions.

When does /tmp get cleared?

That depends on your distribution. On some system, it’s deleted only when booted, others have cronjobs running deleting items older than n hours. On Ubuntu 14: using tmpreaper which gets called by /etc/cron.daily, configured via /etc/default/rcS and /etc/tmpreaper.conf. (Credits to this answer). On Ubuntu 16: using tmpfiles.d. (Credits to this answer). On other Debian-like systems: … Read more

Environment variables of a running process on Unix?

cat /proc/<pid>/environ If you want to have pid(s) of a given running executable you can, among a number of other possibilities, use pidof: AlberT$ pidof sshd 30690 6512 EDIT: I totally quote Dennis Williamson and Teddy comments to achieve a more readable output. My solution is the following: tr ‘\0’ ‘\n’ < /proc/<pid>/environ