Boot targets and processes
Goal
Change the default boot mode, drop into rescue, reset a lost root password — three exam classics.
Targets
systemctl get-default
systemctl set-default multi-user.target # server without GUI
systemctl set-default graphical.target
systemctl isolate rescue.target # immediate switch (root session required)
systemctl list-dependencies multi-user.target | head
Rescue at boot: add systemd.unit=rescue.target (or rd.break) to the kernel line in GRUB (press e), then Ctrl+X.
Reset root (rd.break)
# at the switch_root prompt:
mount -o remount,rw /sysroot
chroot /sysroot
passwd root
touch /.autorelabel # mandatory when SELinux is enforcing
exit; exit
Processes
ps aux --sort=-%mem | head
pgrep -a sshd
top -o %CPU
kill -TERM 1234 # clean termination
kill -9 1234 # last resort, no cleanup
pkill -f "python3 app.py"
nice -n 10 cmd # start with lower priority
renice 5 -p 1234
One-shot scheduling
systemd-run --on-active="5min" /usr/bin/touch /tmp/done
Verify
systemctl get-default
ps -eo pid,ni,comm --sort=-ni | head