LOGBOOK

HELP

1 / 260
time's up — finish this card
Other keys: showSpace: good1-4: rate0: skip5: flag
Topic Logs, Processes and Services

Question

What are the severity levels in syslog and what do they mean?

Answer

8 levels, 0 (Emergency) to 7 (Debug) — the lower the number, the more severe.

A colour scale of the 8 syslog severities from 0 Emergency (top) down to 7 Debug (bottom); lower number = more severe.

* Syslog severity runs 0 (Emergency) to 7 (Debug) — lower number = more severe, so -p err means levels 0–3. *

Syslog severity ranks how urgent a message is. It runs counter-intuitively: 0 is the worst, 7 the most trivial, so filtering "this level and worse" means "this number and below".

Level Name Meaning
0 Emergency System unusable
1 Alert Action needed immediately
2 Critical Critical condition
3 Error An error occurred
4 Warning Something looks wrong
5 Notice Normal but noteworthy
6 Informational Routine info
7 Debug Developer/debug detail

This is why journalctl -p err shows levels 0–3 (err and everything more severe), not just level 3 — the priority filter is inclusive toward the dangerous end. Production systems often log at notice or info; you bump to debug only when chasing a specific problem, because debug output is voluminous.

Mnemonic: "Every Alarm Can Eventually Warn New Interns Daily" (Emergency, Alert, Critical, Error, Warning, Notice, Informational, Debug).

journalctl -p err    # errors and above (levels 0–3)
journalctl -p warning # warnings and above (0–4)

Go deeper:

  • doc Syslog (Wikipedia) — the 0–7 severity table (Emergency…Debug) plus the facility list.
or press any other key
Topic Logs, Processes and Services

Question

How does Linux create new processes (fork and exec)?

Answer

fork() clones the current process into a child; exec() then replaces the child's code with the new program — clone, then transform.

Sequence: parent fork()s a child (same code, new PID), child exec()s a new program (same PID, memory replaced), parent wait()s and reaps it.

* fork() clones the parent into a child; exec() overlays a new program in the same PID; the parent wait()s to reap it. *

Linux has no single "create a process from this file" call. Instead it splits the job in two, and understanding why is the whole point. fork() duplicates the calling process, giving you a second process that's identical except for its new PID. exec() then overwrites that copy's memory with a different program, keeping the same PID. Clone first, become-something-else second.

fork() — make an exact copy of the parent:

  • the child inherits file descriptors, environment, and permissions
  • the child gets a brand-new PID
  • it "returns twice": 0 in the child, the child's PID in the parent — that's how each side knows who it is

exec() — replace the running program:

  • same PID, but the code, data, and stack are swapped for the new program
  • there's no going back; the old program is gone

Splitting it this way is powerful: between the fork and the exec, the child can adjust its inherited state — redirect stdout to a file, change directory, drop privileges — before the new program starts. That gap is how shells implement redirection and pipes.

Typical flow:

Parent Process
    │
    ├── fork() ──→ Child Process (copy of parent)
    │                    │
    │                    └── exec() ──→ New Program
    │
    └── wait() ──→ Waits for child to finish

Example: When you type ls in bash:

  1. Bash calls fork() → creates child bash
  2. Child calls exec("ls") → becomes ls
  3. ls runs and exits
  4. Parent bash continues

Go deeper:

  • doc fork–exec (Wikipedia) — the clone-then-overlay pattern, the twice-returning fork(), and why shells fork before exec.
or press any other key