RHCSA Chapter 4 — CPU, Journal, Boot & System Management Commands
1. Boot, Reboot, and Shut Down
| Command |
Syntax / Example |
Purpose |
systemctl reboot |
systemctl reboot |
Reboot the system (preferred). |
systemctl poweroff |
systemctl poweroff |
Power off the system (preferred). |
systemctl halt |
systemctl halt |
Halt the CPU (does not necessarily power off). |
reboot |
reboot |
Legacy reboot (symbolic link to systemctl). |
poweroff |
poweroff |
Legacy poweroff (symbolic link to systemctl). |
shutdown |
shutdown -r now |
Reboot immediately. |
shutdown |
shutdown -h now |
Halt / power off immediately. |
shutdown |
shutdown -r +5 "Rebooting" |
Schedule reboot in 5 minutes with broadcast message. |
shutdown |
shutdown +10 |
Schedule shutdown in 10 minutes. |
2. Systemd Targets (Boot Modes)
| Command |
Syntax / Example |
Purpose |
systemctl get-default |
systemctl get-default |
Show the current default boot target. |
systemctl set-default |
systemctl set-default multi-user.target |
Set the default boot target persistently. |
systemctl isolate |
systemctl isolate rescue.target |
Switch the running system to a specific target immediately (only targets with AllowIsolate=yes). |
systemctl |
systemctl --type=target |
List currently active targets. |
systemctl |
systemctl -t target --all |
List all targets (active + inactive). |
systemctl start |
systemctl start rescue.target |
Start a target. |
grep |
grep Isolate *.target |
Find all targets that allow isolation. |
Key targets and legacy runlevel mapping:
| Target |
Legacy Runlevel |
Description |
poweroff.target |
0 |
Shut down and power off. |
rescue.target |
1 |
Single-user rescue mode. |
multi-user.target |
3 |
Full multi-user, no GUI (typical server default). |
graphical.target |
5 |
Full multi-user with GUI. |
reboot.target |
6 |
Reboot. |
emergency.target |
— |
Minimal emergency shell. |
3. Interrupt Boot Process (Root Password Reset)
| Step |
Command |
Purpose |
| 1 |
(GRUB: press e, append rd.break to linux line, press Ctrl+x) |
Boot into emergency shell with root FS at /sysroot (read-only). |
| 2 |
mount -o remount,rw /sysroot |
Remount /sysroot as read-write. |
| 3 |
chroot /sysroot |
Change root to /sysroot. |
| 4 |
passwd root |
Reset the root password. |
| 5 |
touch /.autorelabel |
CRITICAL — Force SELinux relabel on next boot. |
| 6 |
exit then exit (or reboot) |
Leave chroot, then reboot. |
Alternative GRUB boot targets (append to linux line):
rescue or 1 or s or single → rescue target
emergency → emergency target
3 → runlevel 3 (multi-user)
4. Process Management
4a. Viewing Processes
| Command |
Syntax / Example |
Purpose |
ps |
ps |
Show processes for the current terminal. |
ps |
ps aux |
BSD-style full process listing (all users). |
ps |
ps -ef |
System V-style full listing (shows exact command used). |
ps |
ps -eFl |
Extra full + long format (very detailed). |
ps |
ps fax |
Show parent-child hierarchy (tree view). |
ps |
ps -ef --forest |
Tree view with full format. |
ps |
ps -ef -x |
Include daemon processes (no controlling terminal). |
ps |
ps -o cmd,pid,ppid,user |
Custom column output. |
ps |
ps -C sshd |
List only processes matching the given command name. |
ps |
ps -U user1 |
List processes owned by a specific user. |
ps |
ps -G root |
List processes owned by a specific group. |
ps |
ps aux | grep dd |
Filter processes by keyword. |
ps |
ps fax | grep -B5 dd |
Show hierarchy with 5 lines of context before match. |
ps |
ps aux | grep defunct |
Find zombie processes. |
top |
top |
Interactive real-time process and resource monitor. |
top (interactive) |
Press k |
Kill a process from within top. |
top (interactive) |
Press r |
Renice a process from within top. |
top (interactive) |
Press 1 |
Show per-CPU core breakdown. |
top (interactive) |
Press q |
Quit top. |
top (interactive) |
Press o |
Re-sequence the process list. |
top (interactive) |
Press f / F |
Add/remove fields or select sort field. |
top (interactive) |
Press h |
Show help. |
uptime |
uptime |
Show system uptime and load average (1, 5, 15 min). |
lscpu |
lscpu |
Show CPU info including number of cores. |
pidof |
pidof rsyslogd |
Show PID of a specific process by name. |
pgrep |
pgrep dd |
Show PID(s) of processes matching a name pattern. |
4b. Shell Job Control
| Command / Key |
Purpose |
& (at end of command) |
Start the command in the background immediately. |
Ctrl-Z |
Suspend (pause) the current foreground job. |
Ctrl-C |
Cancel (terminate) the current foreground job. |
Ctrl-D |
Send EOF (end of input) to the current job. |
bg |
Resume the last suspended job in the background. |
bg %3 |
Resume job number 3 in the background. |
fg |
Bring the last background job to the foreground. |
fg %1 |
Bring job number 1 to the foreground. |
jobs |
List all current shell jobs (with job numbers and states). |
4c. Killing Processes (Signals)
| Command |
Syntax / Example |
Purpose |
kill |
kill <PID> |
Send SIGTERM (15) — graceful termination (default). |
kill |
kill -9 <PID> |
Send SIGKILL (9) — force kill (last resort). |
kill |
kill -1 <PID> |
Send SIGHUP (1) — reload config / hang up. |
kill |
kill -SIGCHLD <parentpid> |
Tell parent to reap zombie children. |
kill |
kill -l |
List all available signals. |
pkill |
pkill <name> |
Kill by process name. |
pkill |
pkill -u user1 |
Kill all processes owned by a user. |
killall |
killall httpd |
Kill ALL processes matching the exact name. |
Common signals:
| Signal |
Number |
Action |
| SIGHUP |
1 |
Hang up / reload config. |
| SIGINT |
2 |
Interrupt (same as Ctrl-C). |
| SIGKILL |
9 |
Force kill (cannot be ignored). |
| SIGTERM |
15 |
Graceful termination (default for kill). |
| SIGCONT |
18 |
Continue (same as bg). |
| SIGSTOP |
19 |
Stop (same as Ctrl-Z). |
| SIGTSTP |
20 |
Stop (foreground equivalent). |
4d. Process Priority (Niceness)
| Command |
Syntax / Example |
Purpose |
nice |
nice |
Show the default niceness value. |
nice |
nice -n 10 ./script.sh |
Launch a command with lowered priority (niceness +10). |
nice |
nice -n -5 top |
Launch with higher priority (requires root for negative). |
renice |
renice -n 5 -p 1234 |
Change priority of running process PID 1234. |
renice |
renice -n -5 $(pgrep top) |
Renice using command substitution for PID. |
systemctl set-property |
systemctl set-property system.slice CPUWeight=800 |
Set cgroup slice CPU weight. |
Niceness range: -20 (highest priority) to +19 (lowest priority). Default = 0. Only root can set negative values.
5. System Tuning (tuned)
| Command |
Syntax / Example |
Purpose |
systemctl enable --now |
systemctl enable --now tuned |
Start and enable the tuned daemon. |
systemctl status |
systemctl status tuned |
Check if tuned is running. |
tuned-adm |
tuned-adm active |
Show the currently active tuning profile. |
tuned-adm |
tuned-adm list |
List all available tuning profiles. |
tuned-adm |
tuned-adm recommend |
Get the system-recommended profile. |
tuned-adm |
tuned-adm profile balanced |
Apply a specific profile. |
tuned-adm |
tuned-adm profile throughput-performance |
Apply throughput-performance profile. |
tuned-adm |
tuned-adm profile virtual-guest |
Apply virtual-guest profile. |
dnf |
dnf -y install tuned |
Install tuned (if not present). |
Available profiles: balanced, desktop, latency-performance, network-latency, network-throughput, powersave, throughput-performance, virtual-guest, virtual-host.
6. Systemd Service Management
| Command |
Syntax / Example |
Purpose |
systemctl start |
systemctl start sshd |
Start a service now. |
systemctl stop |
systemctl stop sshd |
Stop a service. |
systemctl restart |
systemctl restart sshd |
Stop and restart a service. |
systemctl reload |
systemctl reload sshd |
Reload config without changing PID. |
systemctl status |
systemctl status sshd |
Show service status, PID, recent logs. |
systemctl status |
systemctl status -l sshd |
Show status with full (non-truncated) log lines. |
systemctl enable |
systemctl enable sshd |
Enable service to start at boot. |
systemctl disable |
systemctl disable sshd |
Disable service from starting at boot. |
systemctl enable --now |
systemctl enable --now vsftpd |
Enable AND start immediately. |
systemctl is-active |
systemctl is-active atd |
Check if a unit is currently running. |
systemctl is-enabled |
systemctl is-enabled atd |
Check if a unit is set to auto-start at boot. |
systemctl is-failed |
systemctl is-failed sshd |
Check if a unit is in failed state. |
systemctl mask |
systemctl mask atd |
Prohibit a unit from being started (auto or manual). |
systemctl unmask |
systemctl unmask atd |
Reverse a mask. |
systemctl daemon-reload |
systemctl daemon-reload |
Reload all unit files after editing/creating unit files. |
systemctl kill |
systemctl kill <unit> |
Terminate all processes for a unit. |
systemctl show |
systemctl show sshd |
Show all configurable properties for a unit. |
systemctl cat |
systemctl cat httpd.service |
Display the current unit file contents. |
systemctl edit |
systemctl edit httpd.service |
Edit a unit override (creates drop-in in /etc/systemd/system/). |
systemctl list-units |
systemctl list-units -t service |
List all active service units. |
systemctl list-units |
systemctl list-units -t service --all |
List all service units (active + inactive). |
systemctl list-units |
systemctl --failed -t service |
List all services that have failed. |
systemctl list-unit-files |
systemctl list-unit-files |
List all installed unit files and their state. |
systemctl list-unit-files |
systemctl list-unit-files logrotate.* |
List specific unit files by pattern. |
systemctl list-dependencies |
systemctl list-dependencies vsftpd.service |
Show dependency tree for a unit. |
systemctl list-dependencies |
systemctl list-dependencies --reverse vsftpd.service |
Show reverse dependencies (what depends on this unit). |
systemctl list-sockets |
systemctl list-sockets |
List all socket units. |
systemctl -t help |
systemctl -t help |
Show all available unit types. |
systemctl get-property |
systemctl get-property <unit> |
Get a specific property value. |
systemctl set-property |
systemctl set-property system.slice CPUWeight=800 |
Set a runtime property on a slice. |
Unit file locations (precedence, high to low):
/run/systemd/system/ — runtime-generated (highest)
/etc/systemd/system/ — admin custom (second)
/usr/lib/systemd/system/ — RPM-installed defaults (lowest)
Unit types: service, socket, target, device, mount, automount, swap, timer, path, slice, scope.
7. System Logging (rsyslog)
| Command / File |
Purpose |
/etc/rsyslog.conf |
Main rsyslog configuration file. |
/etc/rsyslog.d/ |
Drop-in configuration directory for rsyslog. |
/var/log/messages |
General system log (most commonly used). |
/var/log/secure |
Authentication-related messages. |
/var/log/boot.log |
System startup messages. |
/var/log/cron |
Scheduled job messages. |
/var/log/maillog |
Mail-related messages. |
/var/log/dmesg |
Kernel log messages. |
/var/log/audit/audit.log |
Audit / SELinux messages. |
/var/log/httpd/ |
Apache web server logs (written directly, NOT via rsyslog). |
tail |
tail -f /var/log/messages |
tail |
tail -20 /var/log/secure |
tail |
tail -10 /var/log/messages |
less |
less /var/log/messages |
logger |
logger "Custom message" |
logger |
logger -p local0.info "Message" |
logger |
logger -p daemon.debug "Daemon Debug Message" |
logger |
logger -p kern.err hello |
rsyslogd |
rsyslogd -N 1 |
systemctl restart |
systemctl restart rsyslog |
rsyslog facilities: auth/authpriv, cron, daemon, kern, lpr, mail, mark, news, syslog, user, uucp, local0–local7.
rsyslog priorities (ascending severity): debug → info → notice → warning/warn → error/err → crit → alert → emerg/panic.
8. Systemd Journal (journald)
| Command |
Syntax / Example |
Purpose |
journalctl |
journalctl |
View the full journal (paged via less). |
journalctl |
journalctl --no-pager |
View journal without pager (scrolls to terminal). |
journalctl |
journalctl -f |
Follow live journal output (like tail -f). |
journalctl |
journalctl -b |
Show the boot log (current boot only). |
journalctl |
journalctl -x |
Add explanatory notes to log entries. |
journalctl |
journalctl -u sshd.service |
Filter by systemd unit. |
journalctl |
journalctl -p err |
Show only error-level and above messages. |
journalctl |
journalctl --since yesterday |
Show messages since yesterday. |
journalctl |
journalctl --since "2023-10-10 10:00:00" |
Show messages since a specific timestamp. |
journalctl |
journalctl --since yesterday -p err |
Combine time and priority filters. |
journalctl |
journalctl -n 20 |
Show the last 20 journal entries. |
journalctl |
journalctl -o verbose |
Show verbose output with all metadata fields. |
journalctl |
journalctl --dmesg |
Show kernel messages only (same as dmesg). |
journalctl |
journalctl _UID=1000 |
Filter by user ID. |
journalctl |
journalctl _SYSTEMD_UNIT=sshd.service |
Filter by systemd unit (verbose key). |
journalctl |
journalctl --since today -u sshd -p err |
Complex combined filter. |
8a. Making the Journal Persistent
| Step |
Command |
Purpose |
| 1 |
mkdir /var/log/journal |
Create the persistent journal directory. |
| 2 |
chown root:systemd-journal /var/log/journal |
Set correct ownership. |
| 3 |
chmod 2755 /var/log/journal |
Set correct permissions (setgid). |
| 4 |
systemctl restart systemd-journald |
Restart journald to activate persistence. |
Alternative method: Edit /etc/systemd/journald.conf, set Storage=persistent, then restart the service.
Storage options in /etc/systemd/journald.conf:
auto (default): persistent if /var/log/journal exists, otherwise volatile.
volatile: in-memory only (/run/log/journal), lost on reboot.
persistent: always on disk (/var/log/journal).
none: no storage at all.
9. Log Rotation (logrotate)
| File / Command |
Purpose |
/etc/logrotate.conf |
Main logrotate configuration (global defaults). |
/etc/logrotate.d/ |
Per-service logrotate configuration directory. |
/etc/cron.daily/logrotate |
Script that triggers daily log rotation. |
logrotate |
logrotate -f /etc/logrotate.conf |
man |
man logrotate |
Default settings: Rotate weekly, keep 4 old versions, create new empty file after rotation, use date extension.
10. Task Scheduling
10a. at (One-Time Future Tasks)
| Command |
Syntax / Example |
Purpose |
at |
at 14:00 |
Schedule a job at 2:00 PM. |
at |
at noon |
Schedule a job at noon. |
at |
at midnight |
Schedule a job at midnight. |
at |
at now + 5 hours |
Schedule a job 5 hours from now. |
at |
at 3:00 10/15/20 |
Schedule a job at a specific date/time. |
at |
at -f /path/to/script 15:00 |
Execute a file at the specified time. |
atq |
atq |
List all scheduled at jobs (queue). |
at |
at -l |
Alternative to atq — list jobs. |
at |
at -c <job_id> |
Display the contents of a specific job. |
atrm |
atrm <job_id> |
Remove a scheduled at job. |
Ctrl-D |
(in at shell) |
Close the at shell and submit the job. |
batch |
batch |
Schedule a job when system load drops below threshold. |
Access control files: /etc/at.allow, /etc/at.deny.
10b. cron (Recurring Tasks)
| Command |
Syntax / Example |
Purpose |
crontab |
crontab -e |
Edit the current user’s crontab. |
crontab |
crontab -e -u username |
Edit another user’s crontab (root only). |
crontab |
crontab -l |
List the current user’s cron jobs. |
crontab |
crontab -r |
Remove the current user’s crontab. |
systemctl status |
systemctl status crond |
Check the cron daemon status. |
Cron time fields: minute (0-59) hour (0-23) day_of_month (1-31) month (1-12) day_of_week (0-7, Sun=0 or 7)
Cron configuration locations:
/etc/crontab — system-wide crontab (do NOT edit directly).
/etc/cron.d/ — drop-in cron job files.
/etc/cron.hourly/, /etc/cron.daily/, /etc/cron.weekly/, /etc/cron.monthly/ — scripts for periodic execution.
/var/spool/cron/ — per-user crontab files (managed by crontab -e, never edit directly).
Access control files: /etc/cron.allow, /etc/cron.deny.
anacron:
/etc/anacrontab — anacron configuration (handles missed hourly/daily/weekly/monthly jobs).
10c. Systemd Timers
| Command |
Syntax / Example |
Purpose |
systemctl list-units |
systemctl list-units -t timer |
List all active timers. |
systemctl status |
systemctl status logrotate.timer |
Check a specific timer’s status. |
systemctl cat |
systemctl cat logrotate.timer |
View a timer unit file. |
systemctl list-unit-files |
systemctl list-unit-files sysstat* |
List unit files matching a pattern. |
Timer options in [Timer] section:
OnCalendar= — calendar-based (e.g., daily, *:00/10 for every 10 minutes).
OnBootSec= — relative to boot time.
OnStartupSec= — relative to systemd start.
OnUnitActiveSec= — relative to last activation.
OnActiveSec= — relative to timer activation.
AccuracySec= — time window for execution.
Persistent= — catch up missed runs.
11. GRUB 2 Bootloader
| Command / File |
Purpose |
/etc/default/grub |
Edit this file to modify GRUB2 settings (GRUB_TIMEOUT, GRUB_CMDLINE_LINUX, etc.). |
/boot/grub2/grub.cfg |
Main GRUB2 config (BIOS) — DO NOT edit directly (auto-generated). |
/boot/efi/EFI/redhat/grub.cfg |
Main GRUB2 config (UEFI) — DO NOT edit directly. |
/boot/grub2/grubenv |
GRUB2 environment file (stores saved_entry, etc.). |
/etc/grub.d/ |
Helper scripts used by grub2-mkconfig. |
grub2-mkconfig |
grub2-mkconfig -o /boot/grub2/grub.cfg |
grub2-mkconfig |
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg |
grub2-mkconfig |
grub2-mkconfig > /boot/grub2/grub.cfg |
Key /etc/default/grub directives:
GRUB_TIMEOUT — seconds to wait at boot menu (default: 5).
GRUB_DEFAULT — which entry to boot by default (saved = last booted).
GRUB_CMDLINE_LINUX — kernel boot parameters (e.g., rhgb quiet crashkernel=auto).
GRUB_DISABLE_RECOVERY — show/hide recovery entries.
GRUB_ENABLE_BLSCFG — use BootLoaderSpec format.
12. Time Management
| Command |
Syntax / Example |
Purpose |
date |
date |
Show current system time. |
date |
date +%d-%m-%y |
Show date in custom format. |
date |
date -s 16:03 |
Set system time to 4:03 PM. |
date |
date -s 21:30 |
Set system time to 9:30 PM. |
date |
date --date '@1420987251' |
Convert epoch timestamp to human-readable time. |
hwclock |
hwclock |
Show hardware clock time. |
hwclock |
hwclock --systohc |
Sync system time → hardware clock. |
hwclock |
hwclock --hctosys |
Sync hardware clock → system time. |
timedatectl |
timedatectl |
Show detailed time settings (local, UTC, RTC, timezone, NTP). |
timedatectl |
timedatectl status |
Show current time settings. |
timedatectl |
timedatectl list-timezones |
List all available time zones. |
timedatectl |
timedatectl set-timezone Europe/Amsterdam |
Set the system time zone. |
timedatectl |
timedatectl set-time HH:MM:SS |
Set the current time. |
timedatectl |
timedatectl set-ntp 1 |
Enable NTP time synchronization. |
timedatectl |
timedatectl set-ntp 0 |
Disable NTP. |
timedatectl |
timedatectl set-local-rtc 0 |
Set RTC to UTC (recommended). |
timedatectl |
timedatectl show |
Show time properties in key=value format. |
tzselect |
tzselect |
Interactive time zone selection tool. |
ln |
ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime |
Set timezone via symlink (legacy method). |
chronyc |
chronyc sources |
Show NTP sources and sync status. |
chronyc |
chronyc status |
Show chronyd daemon status. |
systemctl status |
systemctl status chronyd |
Check chrony NTP service status. |
systemctl start |
systemctl start chronyd |
Start the chrony service. |
systemctl enable |
systemctl enable chronyd |
Enable chrony at boot. |
systemctl restart |
systemctl restart chronyd |
Restart chrony after config changes. |
dnf |
dnf -y install chrony |
Install chrony package. |
firewall-cmd |
firewall-cmd --add-service ntp --permanent |
Open firewall for NTP. |
firewall-cmd |
firewall-cmd --reload |
Reload firewall rules. |
Key time config files:
/etc/chrony.conf (or /etc/chrony/chronyd.conf) — NTP server configuration.
/usr/share/zoneinfo/ — Time zone data directory.
/etc/localtime — Symlink to the current time zone file.
| Command |
Syntax / Example |
Purpose |
uname |
uname -r |
Show the running kernel version. |
uname |
uname -m |
Show the system architecture. |
rpm |
rpm -qa | grep kernel |
List installed kernel packages. |
dnf |
dnf install kernel |
Install the latest kernel (adds, does NOT replace). |
cat |
cat /proc/version |
Show kernel version from proc filesystem. |
cat |
cat /proc/cmdline |
Show kernel boot command line. |
Key kernel directories:
/boot/ — Kernel images (vmlinuz, initramfs), GRUB config.
/proc/ — Virtual filesystem with live kernel/process info.
/usr/lib/modules/ — Kernel modules by version.
14. System Shutdown / State Change via systemctl isolate
| Command |
Purpose |
systemctl isolate reboot.target |
Reboot the system via target isolation. |
systemctl isolate poweroff.target |
Power off via target isolation. |
systemctl isolate multi-user.target |
Switch to text-mode (no GUI). |
systemctl isolate graphical.target |
Switch to GUI mode. |
Appendix: Key Configuration Files Summary
| File |
Purpose |
/etc/default/grub |
GRUB2 default settings (edit here, then grub2-mkconfig). |
/boot/grub2/grub.cfg |
Generated GRUB2 config (BIOS) — do NOT edit. |
/boot/efi/EFI/redhat/grub.cfg |
Generated GRUB2 config (UEFI) — do NOT edit. |
/etc/systemd/journald.conf |
Journal storage and size settings. |
/etc/rsyslog.conf |
Main rsyslog configuration. |
/etc/rsyslog.d/ |
rsyslog drop-in configs. |
/etc/logrotate.conf |
Global log rotation settings. |
/etc/logrotate.d/ |
Per-service log rotation configs. |
/etc/crontab |
System-wide crontab (reference only). |
/etc/cron.d/ |
System crontab drop-in files. |
/etc/anacrontab |
Anacron configuration. |
/etc/chrony.conf |
NTP server configuration. |
/var/log/journal/ |
Persistent journal directory. |
/run/log/journal/ |
Volatile (in-memory) journal directory. |
/etc/systemd/system/ |
Custom systemd unit files (highest admin priority). |
/usr/lib/systemd/system/ |
RPM-installed unit files (lowest priority). |
/etc/at.allow / /etc/at.deny |
at access control. |
/etc/cron.allow / /etc/cron.deny |
cron access control. |