LOGBOOK

HELP

1 / 260
time's up — finish this card
Other keys: show • Space: good • 1-4: rate • 0: skip • 5: flag
Topic Reading and Editing Files from the Command Line

Question

What is /dev/null and how is it used?

Answer

/dev/null is a special device file that discards everything written to it — redirect a stream there to silence it.

/dev/null is the system's "black hole": anything you write vanishes, and reading from it gives instant end-of-file. Because it behaves like a file, you can aim any redirect at it. The most common use is killing error noise: 2> /dev/null throws away stderr so find / doesn't bury you in "Permission denied". > /dev/null 2>&1 drops all output — useful in cron jobs where you only care whether the command succeeded, not what it printed.

Common use - suppress error messages:

find / -name "passwd" 2> /dev/null

Use cases:

Pattern Purpose
2> /dev/null Discard errors only
> /dev/null Discard stdout only
> /dev/null 2>&1 Discard all output

Example:

# Search without "Permission denied" spam:
find / -name "*.conf" 2> /dev/null

Tip: /dev/null is often called the "bit bucket" - bits go in, nothing comes out.

or press any other key
Topic SELinux Security

Question

What are the three SELinux modes and when should each be used?

Answer

Enforcing = block AND log policy violations (production); Permissive = log violations but allow them through (for testing/troubleshooting); Disabled = SELinux off entirely (not recommended).

Enforcing blocks and logs (production), Permissive logs only (testing), Disabled is off with no logging; getenforce shows the live mode.

* The three SELinux modes — enforcing (block+log), permissive (log only), disabled (off). *

The key distinction is enforcing vs permissive: both still evaluate the policy and write the same AVC denial messages to the audit log, but only enforcing actually stops the action. That makes permissive the right tool for debugging — you can see every rule a workload would hit without breaking it, fix the labels/booleans, then switch back to enforcing. Check the live mode with getenforce; flip it at runtime with setenforce 0 (permissive) / setenforce 1 (enforcing). Note you cannot reach disabled with setenforce — going fully off requires editing the config file and rebooting.

Mode Behavior Use Case
Enforcing Enforces access control rules, denies violations Production systems (default)
Permissive Logs violations but doesn't block Testing & troubleshooting
Disabled Completely off, no logging Not recommended!

Check current mode:

getenforce

Change mode temporarily:

# Permissive
setenforce 0
# Enforcing
setenforce 1

Set mode at boot (kernel parameter):

# Permissive
enforcing=0
# Enforcing
enforcing=1

Tip: Never disable SELinux in production - use Permissive mode for troubleshooting instead.

Go deeper:

  • doc getenforce(8) — the command that reports enforcing / permissive / disabled.
or press any other key