Skip to content
JayBeeDe edited this page Jan 6, 2024 · 1 revision

Linux Signals

Signal Name Number Description
SIGHUP 1 Hangup (POSIX)
SIGINT 2 Terminal interrupt (ANSI)
SIGQUIT 3 Terminal quit (POSIX)
SIGILL 4 Illegal instruction (ANSI)
SIGTRAP 5 Trace trap (POSIX)
SIGIOT 6 IOT Trap (4.2 BSD)
SIGBUS 7 BUS error (4.2 BSD)
SIGFPE 8 Floating point exception (ANSI)
SIGKILL 9 Kill(can't be caught or ignored) (POSIX)
SIGUSR1 10 User defined signal 1 (POSIX)
SIGSEGV 11 Invalid memory segment access (ANSI)
SIGUSR2 12 User defined signal 2 (POSIX)
SIGPIPE 13 Write on a pipe with no reader, Broken pipe (POSIX)
SIGALRM 14 Alarm clock (POSIX)
SIGTERM 15 Termination (ANSI)
SIGSTKFLT 16 Stack fault
SIGCHLD 17 Child process has stopped or exited, changed (POSIX)
SIGCONT 18 Continue executing, if stopped (POSIX)
SIGSTOP 19 Stop executing(can't be caught or ignored) (POSIX)
SIGTSTP 20 Terminal stop signal (POSIX)
SIGTTIN 21 Background process trying to read, from TTY (POSIX)
SIGTTOU 22 Background process trying to write, to TTY (POSIX)
SIGURG 23 Urgent condition on socket (4.2 BSD)
SIGXCPU 24 CPU limit exceeded (4.2 BSD)
SIGXFSZ 25 File size limit exceeded (4.2 BSD)
SIGVTALRM 26 Virtual alarm clock (4.2 BSD)
SIGPROF 27 Profiling alarm clock (4.2 BSD)
SIGWINCH 28 Window size change (4.3 BSD, Sun)
SIGPWR 30 Power failure restart (System V)

Linux Streams & Redirections

Redirection fd 0 (stdin) fd 1 (stdout) fd 2 (stderr) fd 3 Description
initial /dev/tty /dev/tty /dev/tty Let's assume this is run in a terminal, so stdin, stdout and stderr are all initially connected to the terminal (tty).
$(...) /dev/tty pipe /dev/tty First, the command substitution is set up. Command's stdout (FileDescriptor 1) gets captured (by using a pipe internally). Command's stderr (FD 2) still points to its regular place (the script's stderr).
3>&2 /dev/tty pipe /dev/tty /dev/tty Next, FD 3 should point to what FD 2 points to at this very moment, meaning FD 3 will point to the script's stderr ("save stderr in FD 3").
2>&1 /dev/tty pipe pipe /dev/tty Next, FD 2 should point to what FD 1 currently points to, meaning FD 2 will point to stdout. Right now, both FD 2 and FD 1 would be captured.
1>&3 /dev/tty /dev/tty pipe /dev/tty Next, FD 1 should point to what FD 3 currently points to, meaning FD 1 will point to the script's stderr. FD 1 is no longer captured. We have "swapped" FD 1 and FD 2.
3>&- /dev/tty /dev/tty pipe Finally, we close FD 3 as it is no longer necessary.

Linux run levels

Run Level Mode Action
0 Halt Shuts down system
1 Single-User Mode Does not configure network interfaces, start daemons, or allow non-root logins
2 Multi-User Mode Does not configure network interfaces or start daemons.
3 Multi-User Mode with Networking Starts the system normally.
4 Undefined Not used/User-definable
5 X11 As runlevel 3 + display manager(X)
6 Reboot Reboots the system

Standard run levels for Red Hat based distributions

The run level is configured in the /etc/inittab

/etc/rc.d contains a folder for each run level: rcX.d.

rcX.d contains a sym link to /etc/init.d/daemon which is the daemon.

chkconfig is the tool used for that purpose

Bashrc

Bashrc

Sources

Clone this wiki locally