Domain 11Containers & TroubleshootingADVANCED

Containers, Troubleshooting & Extras

Rootless Podman containers, systemd integration, boot recovery into rescue/emergency targets, root password resets, and web service setup.

Domain: Domain 11: Containers, Troubleshooting & Extras•Updated: 2026-08-29
#Podman#Rootless Containers#Troubleshooting#Rescue Mode#Root Password Reset#Apache

RHCSA Commands: Extras and Practice


Boot Troubleshooting & Recovery

Command Description Example
mount -o remount,rw / Remounts the root filesystem as read/write during emergency/rescue modes mount -o remount,rw /
passwd Changes the root password in single-user/rescue modes passwd
touch /.autorelabel Forces SELinux to relabel all files on the next reboot (critical after password reset via init=/bin/bash) touch /.autorelabel
exec /usr/lib/systemd/systemd Replaces the current shell (PID 1) with systemd to resume normal boot after init=/bin/bash exec /usr/lib/systemd/systemd
chroot /mnt/sysimage Changes the root directory to the mounted rescue system to repair it chroot /mnt/sysimage
grub2-install Reinstalls the GRUB 2 bootloader to the specified disk grub2-install /dev/sda or grub2-install /dev/vda
dracut --force Rebuilds the initramfs image; --force overwrites the existing one dracut --force
journalctl -xb Views boot logs to diagnose why a filesystem or service failed to mount/start journalctl -xb
systemctl list-units Lists all currently loaded systemd unit files (useful in rescue/emergency targets) systemctl list-units
systemctl show-environment Shows current shell environment variables systemctl show-environment
systemctl reboot Reboots the machine from rescue mode systemctl reboot
reboot Restarts the system (standard mode) reboot
systemctl isolate multi-user.target Switches to multi-user target manually systemctl isolate multi-user.target
systemctl set-default Sets the default boot target systemctl set-default multi-user.target
grub2-mkconfig Regenerates the GRUB configuration file grub2-mkconfig -o /boot/grub2/grub.cfg

GRUB Boot Arguments (not commands but critical for troubleshooting)

Argument Description Example
init=/bin/bash Boots directly into a bash shell as PID 1 (no password required) Append to linux line at GRUB
init=/bin/sh Boots directly into a sh shell as PID 1 Append to linux line at GRUB
rd.break Stops boot in initramfs stage (requires root password) Append to linux line at GRUB
systemd.unit=emergency.target Enters minimal troubleshooting mode (requires root password) Append to linux line at GRUB
systemd.unit=rescue.target Starts more systemd units for a more complete rescue mode (requires root password) Append to linux line at GRUB
rhgb Red Hat Graphical Boot (hides boot messages) Remove to see verbose boot
quiet Suppresses boot messages Remove to see verbose boot

Containers / Podman

Image Management

Command Description Example
podman search Searches configured registries for images podman search mysql
podman search --no-trunc Searches without truncating output podman search --no-trunc mysql
podman search --limit <n> Limits search results to N entries podman search --limit 5 nginx
podman pull Downloads an image from a registry to local storage podman pull registry.redhat.io/ubi9
podman images Lists locally stored container images podman images
podman inspect Displays detailed JSON metadata of a local image or container podman inspect ubi9
podman rmi Removes an image from local storage podman rmi ubi9
podman rmi -a Removes all locally stored images podman rmi -a
podman tag Adds a name/tag to an image podman tag ubi9:latest myregistry/ubi9:v1
podman login Logs in to a container registry podman login registry.redhat.io
podman logout Logs out from a container registry podman logout registry.redhat.io
podman info Reveals system information, including defined registries podman info
podman build Builds a custom image from a Containerfile podman build -t myimage:1.0 .

Container Lifecycle

Command Description Example
podman run Launches a new container from an image podman run -d --name web -p 8080:80 -v /data:/data:Z nginx
podman run -d Runs a container in detached (background) mode podman run -d --name web nginx
podman run -it Runs a container interactively with a terminal podman run -it ubi8
podman run --name Assigns a name to a container podman run --name myapp ubi8
podman run --rm Auto-removes the container after it exits podman run --rm ubi7 ls
podman run -p Maps a host port to a container port podman run -p 10000:80 nginx
podman run -v Mounts a host directory into the container (bind mount) podman run -v /host_data:/container_data:Z ubi8
podman run -e Passes or sets an environment variable podman run -e SECRET=secret123 ubi8
podman ps Lists running containers podman ps
podman ps -a Lists all containers (including stopped/exited) podman ps -a
podman start Starts a stopped container podman start web1
podman stop Gracefully stops a running container (SIGTERM, then SIGKILL) podman stop web1
podman restart Restarts a container podman restart web1
podman rm Removes a stopped container podman rm web1
podman rm -a Removes all stopped containers podman rm -a
podman exec Executes a command inside a running container podman exec -it web1 /bin/sh
podman attach Attaches to a running container’s terminal podman attach web1
podman logs Fetches the logs of a container podman logs web1
podman port Shows port mappings for a container podman port web1

Rootless Containers & Systemd Integration

Command Description Example
podman generate systemd Generates a systemd unit file for an existing container podman generate systemd --name web1 --files --new
podman unshare Runs a command inside the rootless user namespace (fixes UID mappings) podman unshare chown 27:27 /data
loginctl enable-linger Enables a user’s systemd services to run at boot without an active login session loginctl enable-linger student
systemctl --user enable --now Enables/starts a user-level (rootless) systemd service systemctl --user enable --now container-web1.service
systemctl daemon-reload Reloads systemd configuration after adding new unit files systemctl daemon-reload
systemctl enable --now Enables and starts a system-level service systemctl enable --now container-root-container.service
systemctl status Checks the status of a service systemctl status container-web1.service
systemctl restart Restarts a service systemctl restart container-web1.service

Skopeo

Command Description Example
skopeo inspect Inspects a remote image in a registry without downloading it skopeo inspect docker://docker.io/nginx

Container Configuration Files

File/Directory Description
/etc/containers/registries.conf System-wide registry configuration (search, insecure, block lists)
~/.config/containers/registries.conf Per-user registry configuration (overrides system-wide)
~/.config/systemd/user/ Per-user systemd unit files for rootless containers
/etc/systemd/system/ System-level systemd unit files for root containers

Apache HTTP Server

Command Description Example
dnf install httpd Installs the Apache web server package dnf install httpd
dnf group install "Basic Web Server" Installs Apache and all related packages dnf group install "Basic Web Server"
dnf install httpd-manual Installs the Apache documentation dnf install httpd-manual
systemctl enable --now httpd Starts the Apache service and enables it to start on boot systemctl enable --now httpd
systemctl status httpd Checks the status of the Apache service systemctl status httpd
systemctl restart httpd Restarts the Apache service systemctl restart httpd
curl http://localhost Tests the web server from the command line curl http://localhost
dnf install curl Installs the curl utility for testing dnf install curl
grep -v '#' /etc/httpd/conf/httpd.conf Shows non-comment lines in the Apache config grep -v '#' /etc/httpd/conf/httpd.conf
setenforce 0 Temporarily sets SELinux to permissive mode setenforce 0
mkdir -p Creates directories recursively (for virtual host document roots) mkdir -p /www/docs/account.example.com

Apache Configuration Files

File/Directory Description
/etc/httpd/conf/httpd.conf Main Apache configuration file
/etc/httpd/conf.d/ Drop-in configuration directory (virtual hosts go here)
/etc/httpd/conf.modules.d/ Module-specific configuration files
/var/www/html Default document root
DocumentRoot Config parameter specifying where Apache serves documents from
ServerRoot Config parameter defining where Apache looks for config files (default: /etc/httpd)
<VirtualHost *:80> Virtual host directive for name-based virtual hosting on port 80

SELinux

Command Description Example
setenforce 0 Temporarily sets SELinux to permissive mode setenforce 0
setenforce 1 Sets SELinux back to enforcing mode setenforce 1
semanage port -a Adds a port to the SELinux policy database persistently semanage port -a -t http_port_t -p tcp 8300
semanage boolean Modifies SELinux booleans persistently semanage boolean -m --on nfs_export_all_rw
chcon Changes SELinux context on files/directories chcon -t shadow_t /usr/testfile1
semanage fcontext Sets persistent SELinux context rules semanage fcontext -a -t shadow_t '/usr/testfile1'
restorecon Restores SELinux contexts based on policy rules restorecon -v /usr/testfile1
semanage fcontext -l Lists all SELinux file context rules semanage fcontext -l
touch /.autorelabel Forces SELinux to relabel all files on next reboot touch /.autorelabel

Systemd & Services

Command Description Example
systemctl enable --now Enables and starts a service systemctl enable --now httpd
systemctl status Checks the status of a service systemctl status httpd
systemctl restart Restarts a service systemctl restart httpd
systemctl start Starts a service systemctl start vsftpd
systemctl stop Stops a service systemctl stop httpd
systemctl disable Disables a service from starting on boot systemctl disable httpd
systemctl set-default Sets the default boot target systemctl set-default multi-user.target
systemctl isolate Switches to a different target immediately systemctl isolate multi-user.target
systemctl daemon-reload Reloads systemd configuration systemctl daemon-reload
systemctl list-units Lists all loaded units systemctl list-units
systemctl --user Manages user-level (rootless) services systemctl --user enable --now container-web1.service

Networking

Command Description Example
nmcli NetworkManager command-line tool for network configuration nmcli connection modify eth0 ipv4.addresses 192.168.0.242/24 ipv4.gateway 192.168.0.1 ipv4.dns 192.168.0.1 ipv4.method manual
nmcli connection up Activates a network connection nmcli connection up eth0
nmcli connection show Shows network connections nmcli connection show
hostnamectl Sets the system hostname persistently hostnamectl set-hostname rhcsa2.example.com
hostnamectl set-hostname Sets the static hostname hostnamectl set-hostname rhcsa3.example.com
hostnamectl set-hostname --transient Sets a transient hostname (alias) hostnamectl set-hostname --transient rhcsa3
ping -c2 Sends 2 ICMP echo requests to test connectivity ping -c2 rhcsa4
firewall-cmd --permanent --add-service Adds a service to firewalld persistently firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --add-port Adds a port to firewalld persistently firewall-cmd --permanent --zone=public --add-port=8400/udp
firewall-cmd --permanent --zone=external --add-service Adds a service to a specific zone firewall-cmd --permanent --zone=external --add-service=http
firewall-cmd --reload Reloads firewalld configuration firewall-cmd --reload
firewall-cmd --list-all Lists all firewalld settings firewall-cmd --list-all
firewall-cmd --list-all-zones Lists all zones and their settings firewall-cmd --list-all-zones

SSH & Remote Access

Command Description Example
ssh Connects to a remote system via SSH ssh user@rhcsa4
ssh-keygen Generates SSH key pair for password-less access ssh-keygen -t rsa
ssh-copy-id Copies SSH public key to a remote server ssh-copy-id user60@rhcsa4
scp Securely copies files to/from a remote system scp /etc/sysconfig user@rhcsa6:/var/tmp/remote
rsync Synchronizes files remotely with compression rsync -avz -e ssh /etc/ user@rhcsa6:/var/tmp/etc/
rsync -avz Synchronizes with archive mode, verbose, and compression rsync -avz /etc/ user@rhcsa6:/var/tmp/etc/
logout / exit Terminates an SSH session exit

Package Management (DNF)

Command Description Example
dnf install Installs a package dnf install httpd
dnf install -y Installs a package without prompting dnf install -y curl
dnf group install Installs a package group dnf group install "Development Tools"
dnf module install Installs a module stream dnf module install postgresql:9.6
dnf module list Lists available module streams dnf module list
dnf module enable Enables a module stream dnf module enable container-tools:rhel8
dnf module reset Resets a module to default state dnf module reset container-tools
dnf module info Shows module information dnf module info container-tools
dnf list Lists installed and available packages dnf list installed
dnf search Searches for packages dnf search httpd
dnf provides Finds which package provides a file dnf provides /usr/bin/sealert
rpm -ql Lists all files in an installed package rpm -ql setup
subscription-manager register Registers the system with RHSM subscription-manager register --username <user>
subscription-manager attach Attaches a subscription subscription-manager attach
subscription-manager refresh Refreshes subscription data subscription-manager refresh

Storage & File Systems

LVM

Command Description Example
pvcreate Creates a physical volume pvcreate /dev/sdb1
vgcreate Creates a volume group vgcreate -s 8M vg1 /dev/sdb1
vgcreate -s Creates a VG with specified PE size vgcreate -s 8M myvg /dev/sdb1
lvcreate Creates a logical volume lvcreate -L 280M -n lvol1 vgtest
lvcreate -l Creates an LV with specified number of LEs lvcreate -l 10 -n lv1 vg1
lvextend Extends a logical volume lvextend -L +64M /dev/vg1/lv1
lvdisplay Displays LV information lvdisplay
vgdisplay Displays VG information vgdisplay
pvs Shows physical volumes summary pvs
vgs Shows volume groups summary vgs
lvs Shows logical volumes summary lvs

VDO

Command Description Example
vdo create Creates a VDO volume vdo create --name vdo1 --device /dev/sdb --vdoLogicalSize 16G
vdo status Shows VDO volume status vdo status --name vdo1

Stratis

Command Description Example
stratis pool create Creates a Stratis pool stratis pool create pool1 /dev/sdc
stratis pool add-data Expands a Stratis pool with additional disk stratis pool add-data pool1 /dev/sdd
stratis filesystem create Creates a Stratis filesystem stratis filesystem create pool1 str1
stratis pool list Lists Stratis pools stratis pool list
stratis filesystem list Lists Stratis filesystems stratis filesystem list

File System & Mounting

Command Description Example
mkfs.xfs Creates an XFS file system mkfs.xfs /dev/vg1/lv1
mkfs.ext4 Creates an Ext4 file system mkfs.ext4 /dev/sdb2
mkfs.vfat Creates a FAT file system mkfs.vfat -n mylabel /dev/sdb1
mkswap Initializes a swap partition mkswap /dev/sdb3
swapon Activates a swap partition swapon /dev/sdb3
swapon --show Shows active swap devices swapon --show
mount Mounts a file system mount /dev/vg1/lv1 /mnt/mnt1
mount -o loop Mounts an ISO image using loop device mount -o loop rhel.iso /repo
umount Unmounts a file system umount /mnt/mnt1
blkid Shows block device attributes (UUID, label, type) blkid /dev/sdb1
lsblk Lists block devices lsblk
df -h Shows disk usage in human-readable format df -h
xfs_growfs Grows an XFS file system online xfs_growfs /mnt/lvfs1
resize2fs Resizes an Ext4 file system resize2fs /dev/vg1/lv1
e2label Sets/gets an Ext4 file system label e2label /dev/sdb2 stdlabel
tune2fs -l Shows Ext4 file system information tune2fs -l /dev/sdb2
parted / fdisk Creates disk partitions fdisk /dev/sdb
ls -ld Shows directory/file permissions and ownership ls -ld /shared

NFS

Command Description Example
systemctl enable --now nfs-server Starts and enables the NFS server service systemctl enable --now nfs-server
exportfs -rv Reloads NFS exports exportfs -rv
showmount -e Shows NFS exports on a server showmount -e rhcsa3
systemctl enable --now autofs Starts and enables the autofs service systemctl enable --now autofs

User & Group Management

Command Description Example
useradd Creates a new user account useradd user10
useradd -u Creates a user with a specific UID useradd -u 2929 user40
useradd -c Creates a user with a comment useradd -c "I am user70" -u 7000 user70
useradd -s Creates a user with a specific shell useradd -s /sbin/nologin user50
useradd -s /usr/bin/passwd Creates a user who can only change password useradd -s /usr/bin/passwd bob
useradd -d Creates a user with a custom home directory useradd -d /home/users/linda linda
usermod Modifies an existing user account usermod -aG group10 user20
usermod -L Locks a user account usermod -L user70
usermod -U Unlocks a user account usermod -U user70
usermod -e Sets account expiration date usermod -e 2021-12-31 user10
usermod -f Sets maximum inactivity period (days) usermod -f 30 user70
groupadd Creates a new group groupadd group10
groupadd -g Creates a group with a specific GID groupadd -g 3000 group30
passwd Sets/changes a user’s password passwd user10
chage Manages password aging chage -M 90 user10
id Shows user/group IDs id user10
su - Switches to another user su - user10
sudo Executes a command as another user sudo dnf install httpd
loginctl enable-linger Enables lingering for a user loginctl enable-linger student

File Permissions & ACLs

Command Description Example
chmod Changes file/directory permissions chmod 770 /shared
chmod g+s Sets the setgid bit on a directory chmod g+s /sdata
chmod o+t Sets the sticky bit on a directory chmod o+t /var/dir1
chown Changes file/directory ownership chown root:group10 /mnt/mnt1
chgrp Changes group ownership chgrp group10 /mnt/mnt1
setfacl -m Sets an access ACL setfacl -m u:user10:rwx /var/tmp/dir1
setfacl -d -m Sets a default ACL setfacl -d -m u:user10:rwx /var/tmp/dir1
setfacl -m u:user10:rw Sets read/write ACL for a user setfacl -m u:user10:rw /var/tmp/testfile1
getfacl Shows ACLs on a file/directory getfacl /var/tmp/dir1

File Operations & Archives

Command Description Example
tar -cjf Creates a bzip2-compressed archive tar -cjf /var/tmp/usr.tar.bz2 /usr/lib
tar -czf Creates a gzip-compressed archive tar -czf /var/tmp/etc.tar.gz /etc
tar -xjf Extracts a bzip2-compressed archive tar -xjf /var/tmp/usr.tar.bz2
tar -xzf Extracts a gzip-compressed archive tar -xzf /var/tmp/etc.tar.gz
ln Creates a hard link ln /var/tmp/lnfile1 /var/tmp/lnfile2
ln -s Creates a symbolic (soft) link ln -s /var/tmp/lnfile1 /boot/file1
stat Shows file statistics (inode, size, timestamps) stat /var/tmp/lnfile1
find Searches for files by various criteria find / -name "core" -mtime -30
find -user Finds files owned by a specific user find / -user edwin
find -exec Executes a command on found files find /var -name "core" -exec cp {} /var/tmp/coredir1 \;
find -mtime Finds files modified within N days find / -mtime -30 > /var/tmp/modfiles.txt
cp Copies files/directories cp /etc/sysconfig user@rhcsa6:/var/tmp/remote
mkdir -p Creates directories recursively mkdir -p /dir1/dir2/dir3/dir4
grep -i Case-insensitive search grep -i "^essential" /usr/share/dict/linux.words
grep -v Inverts match (excludes matching lines) grep -v "^$" /var/tmp/pattern.txt
man -k Searches manual pages by keyword man -k password
updatedb Updates the locate database updatedb
locate Locates files using the locate database locate sealert

Scheduling & Automation

Command Description Example
crontab -e Edits a user’s crontab crontab -e
crontab -l Lists a user’s crontab crontab -l
cron expression Schedules recurring tasks 20 1 * * 1 find /var -name "core" -exec cp {} /var/tmp/coredir1 \;
at Schedules a one-time task echo "touch /tmp/file" | at 2:00am
atd The at daemon service systemctl enable --now atd

Logging & Journal

Command Description Example
journalctl Views systemd journal logs journalctl
journalctl -xb Views logs for the current boot journalctl -xb
logger Sends custom messages to the system log logger "This is RHCSA sample exam on $(date) by $LOGNAME"
grep Searches log output grep "RHCSA" /var/log/messages

System Tuning

Command Description Example
tuned-adm profile Applies a tuning profile tuned-adm profile powersave
tuned-adm active Shows the currently active tuning profile tuned-adm active
tuned-adm recommend Shows the recommended tuning profile tuned-adm recommend

Time Synchronization (Chrony)

Command Description Example
chronyc sources Shows NTP sources chronyc sources
chronyc tracking Shows time synchronization status chronyc tracking
systemctl enable --now chronyd Starts and enables the chronyd service systemctl enable --now chronyd

Shell & Environment

Command Description Example
export Sets an environment variable export ENV1=book1
echo Prints text or variable values echo $ENV1
echo > Writes text to a file echo "Welcome" > /var/www/html/index.html
cat Displays file contents cat /etc/redhat-release
uname -r Shows the kernel version uname -r
whoami Shows the current user whoami
hostname Shows the system hostname hostname
pwd Shows the current working directory pwd
ls Lists directory contents ls -la /var/www/html
date Shows the current date and time date
df Shows disk space usage df -h
os-release Shows OS release information cat /etc/os-release
grep Searches text using patterns grep "hosts" /etc/setup.pkg
tee Writes to a file and displays output podman generate systemd | tee /etc/systemd/system/container.service
less Views file contents page by page podman inspect ubi9 | less
vi / vim Text editor for modifying files vi /etc/fstab
:%s/old/new/g Vi command to replace all occurrences :%s/account/sales/g

Repository & ISO Mounting

Command Description Example
mount -o loop Mounts an ISO image mount -o loop rhel-9.iso /repo
dnf repolist Lists configured repositories dnf repolist
dnf config-manager Manages repository configuration dnf config-manager --add-repo=file:///repo

Kernel Management

Command Description Example
uname -r Shows the current kernel version uname -r
dnf install kernel Installs the latest kernel dnf install kernel
grub2-mkconfig -o /boot/grub2/grub.cfg Regenerates GRUB configuration grub2-mkconfig -o /boot/grub2/grub.cfg

Default User Settings

Command Description Example
useradd -D Shows or sets default useradd settings useradd -D
useradd -D -b Sets the default base directory for new users useradd -D -b /home
useradd -D -g Sets the default group for new users useradd -D -g users
useradd -D -s Sets the default shell for new users useradd -D -s /bin/bash
useradd -D -u Sets the first UID for new users useradd -D -u 2000
useradd -D -e Sets the default password validity chage -M 90
useradd -D -f Sets the default inactivity period useradd -D -f 30
useradd -D -s /sbin/nologin Sets default shell to non-interactive useradd -D -s /sbin/nologin

Default User Skeleton

File/Directory Description
/etc/default/useradd Default settings for new users
/etc/login.defs System-wide login defaults (UID range, password aging)
/etc/skel/ Skeleton directory; files here are copied to new user home directories
/etc/skel/NEWFILE A file placed here will be copied to each new user’s home directory

Practice Exam-Specific Commands

Commands from Sample Exam 1

Command Description Example
grep -i "^essential" /usr/share/dict/linux.words > /var/tmp/pattern.txt Case-insensitive search for lines starting with “essential” grep -i "^essential" /usr/share/dict/linux.words | grep -v "^$" > /var/tmp/pattern.txt
PS1 Sets the command prompt PS1='\h \u \w \$ '
~/.bashrc Per-user initialization file for prompt permanence echo "PS1='\h \u \w \$ '" >> ~/.bashrc
chage -E Sets account expiration date chage -E 2021-12-31 user10
visudo Edits the sudoers file visudo
user20 ALL=(ALL) NOPASSWD: ALL Allows user20 to use sudo without password Add to /etc/sudoers
man -k password > /var/tmp/man.out Searches manual pages and redirects output man -k password > /var/tmp/man.out
logger Logs custom messages logger "This is RHCSA sample exam on $(date) by $LOGNAME"
grep "RHCSA" /var/log/messages Confirms log entry grep "RHCSA" /var/log/messages
at.allow / at.deny Controls user access to the atd service Add/remove users from /etc/at.allow and /etc/at.deny

Commands from Sample Exam 2

Command Description Example
nmcli connection modify Configures network via nmcli nmcli connection modify eth0 ipv4.addresses 192.168.0.242/24 ipv4.gateway 192.168.0.1 ipv4.dns 192.168.0.1 ipv4.method manual
chage -I Sets maximum inactivity period chage -I 30 user70
useradd -s /sbin/nologin Creates a user with non-interactive shell useradd -s /sbin/nologin user50
mkfs.ext4 -L Creates Ext4 with a label mkfs.ext4 -L stdlabel /dev/sdb2
mount -L Mounts by label mount -L stdlabel /mnt/stdfs1
xfs_growfs Grows XFS file system online xfs_growfs /mnt/lvfs1
lvextend -L +64M Extends LV by 64MB lvextend -L +64M /dev/vg1/lv1
tuned-adm recommend Shows recommended tuning profile tuned-adm recommend
tuned-adm profile Applies a tuning profile tuned-adm profile powersave
chronyc Chrony time sync utility chronyc sources
dnf groupinfo Shows package group information dnf groupinfo "Development Tools" > /var/tmp/systemtools.out
passwd -S Shows password status (locked/unlocked) passwd -S user70
grep "L" /etc/shadow Checks if account is locked grep "user70.*L" /etc/shadow > /var/tmp/user70.lock
grubby Modifies bootloader configuration grubby --update-kernel=ALL --args="..."

Commands from Sample Exam 3

Command Description Example
semanage port -a -t http_port_t -p tcp 8300 Adds HTTP port to SELinux policy semanage port -a -t http_port_t -p tcp 8300
vdo create Creates a VDO volume vdo create --name vdo1 --device /dev/sdb --vdoLogicalSize 16G
systemctl enable --now nfs-server Starts NFS server systemctl enable --now nfs-server
systemctl enable --now autofs Starts autofs systemctl enable --now autofs
stratis pool create Creates a Stratis pool stratis pool create pool1 /dev/sdc
stratis filesystem create Creates a Stratis filesystem stratis filesystem create pool1 str1
stratis pool add-data Expands a Stratis pool stratis pool add-data pool1 /dev/sdd
chmod g+s Sets setgid bit chmod g+s /sdata
chmod 1777 Sets sticky bit with full permissions chmod 1777 /var/dir1
ln Creates a hard link ln /var/tmp/lnfile1 /var/tmp/lnfile2
ln -s Creates a soft link ln -s /var/tmp/lnfile1 /boot/file1
dnf module install postgresql:9.6 Installs a specific module stream dnf module install postgresql:9.6
firewall-cmd --permanent --zone=external --add-service=http Adds HTTP to external zone firewall-cmd --permanent --zone=external --add-service=http
firewall-cmd --reload Reloads firewall firewall-cmd --reload
chcon -t shadow_t Sets SELinux type chcon -t shadow_t /usr/testfile1
semanage fcontext -a -t shadow_t '/usr/testfile1' Sets persistent SELinux context semanage fcontext -a -t shadow_t '/usr/testfile1'
restorecon -v Restores SELinux context restorecon -v /usr/testfile1
ssh-keygen Generates SSH keys ssh-keygen -t rsa
ssh-copy-id Copies SSH key to remote host ssh-copy-id user60@rhcsa4
stat Shows file statistics stat /usr/bin/ac*
podman port Validates port mapping podman port container-name
podman exec -it Verifies environment variables podman exec -it container-name env

Commands from Sample Exam 4

Command Description Example
semanage port -a -t http_port_t -p udp 8400 Adds UDP port to SELinux policy semanage port -a -t http_port_t -p udp 8400
scp -r Securely copies a directory scp -r /etc/sysconfig user@rhcsa6:/var/tmp/remote
rsync -avz -e ssh Synchronizes with compression rsync -avz -e ssh /etc/ user@rhcsa6:/var/tmp/etc/ 2>&1 > /var/tmp/etc.transfer
semanage boolean -m --on nfs_export_all_rw Enables SELinux boolean persistently semanage boolean -m --on nfs_export_all_rw
ln Creates hard links ln /var/tmp/lnfile1 /var/tmp/hard1
stat Shows inode number stat /var/tmp/lnfile1
rpm -ql setup Lists files in a package rpm -ql setup
grep "hosts" Filters output for “hosts” rpm -ql setup | grep "hosts" > /var/tmp/setup.pkg
uname -r Checks kernel version uname -r
subscription-manager register Registers with RHSM subscription-manager register
dnf install kernel Installs latest kernel dnf install kernel
journalctl Configures journald Create /var/log/journal directory
podman run -d --name Launches named root container podman run -d --name mycontainer -p 443:443 ubi7
podman generate systemd --new --name Generates systemd unit for container podman generate systemd --new --name mycontainer --files
podman run -e KERN=$(uname -r) Passes command substitution as env var podman run -e KERN=$(uname -r) -e SHELL ubi8

Commands from Practice Exam A

Command Description Example
useradd Creates a user useradd student
passwd Sets a password passwd student
mount -o loop Mounts ISO persistently mount -o loop /path/to/iso /repo
useradd -D -u 2000 Sets first UID for new users useradd -D -u 2000
chage -M 90 Sets default password validity to 90 days chage -M 90
usermod -aG Adds user to a secondary group usermod -aG livingopensource edwin
useradd -u 1234 -s /sbin/nologin Creates user with specific UID and no shell useradd -u 1234 -s /sbin/nologin santos
chmod 2770 Sets setgid and full group access chmod 2770 /groups/livingopensource
chown root:livingopensource Sets ownership and group chown root:livingopensource /groups/livingopensource
vgcreate -s 8M Creates VG with 8MiB PE size vgcreate -s 8M myvg /dev/sdb1
lvcreate -L 500M -n mydata myvg Creates 500MiB LV lvcreate -L 500M -n mydata myvg
mkfs.ext4 Formats with Ext4 mkfs.ext4 /dev/myvg/mydata
mount Mounts persistently mount /dev/myvg/mydata /mydata
find -user -exec cp Finds and copies files find / -user edwin -exec cp {} /root/edwinfiles/ \;
crontab -e Schedules daily Mon-Fri 2am 0 2 * * 1-5 touch /etc/motd
stratis pool create Creates Stratis pool stratis pool create mypool /dev/sdc
stratis filesystem create Creates Stratis filesystem stratis filesystem create mypool myfs
useradd -s /usr/bin/passwd User can only change password useradd -s /usr/bin/passwd bob
dnf install vsftpd Installs FTP server dnf install vsftpd
systemctl enable --now vsftpd Starts and enables vsftpd systemctl enable --now vsftpd
podman run -d --name Runs HTTP container podman run -d --name httpd -v /httproot:/var/www/html:Z httpd
podman generate systemd --new --files Generates systemd unit podman generate systemd --new --files --name httpd
systemctl enable --now Enables container service systemctl enable --now container-httpd.service
mkdir -p Creates NFS export directories mkdir -p /users/linda /users/anna
systemctl enable --now nfs-server Starts NFS server systemctl enable --now nfs-server
systemctl enable --now autofs Starts autofs systemctl enable --now autofs
useradd -d Creates user with custom home useradd -d /home/users/linda linda

Commands from Practice Exam B

Command Description Example
fdisk / parted Creates a partition fdisk /dev/sdb
mkfs.vfat -n mylabel Formats with vfat and label mkfs.vfat -n mylabel /dev/sdb1
mount -L mylabel /mydata Mounts by label mount -L mylabel /mydata
cp /etc/skel/NEWFILE Copies skeleton file for new users Place NEWFILE in /etc/skel/
chmod 1770 Sets sticky bit with group access chmod 1770 /groups/livingopensource
mkswap Initializes swap mkswap /dev/sdb2
swapon Activates swap swapon /dev/sdb2
lvextend -L +1G Extends LV by 1GiB lvextend -L +1G /dev/mapper/rhel-root
xfs_growfs / Grows root XFS filesystem xfs_growfs /
find -user -exec cp Finds and copies user files find / -user linda -exec cp {} /tmp/lindafiles/ \;
useradd -u 2008 Creates user with custom UID useradd -u 2008 vicky
dnf install httpd Installs web server dnf install httpd
systemctl enable --now httpd Starts and enables web server systemctl enable --now httpd
podman run -d --name Runs rootless MySQL container podman run -d --name mysql -e MYSQL_ROOT_PASSWORD=password -v /home/student/mysql:/var/lib/mysql:Z docker.io/library/mysql:latest
podman generate systemd --new --files --name mysql Generates systemd unit for rootless container podman generate systemd --new --files --name mysql
systemctl --user enable --now Enables rootless container service systemctl --user enable --now container-mysql.service
loginctl enable-linger Enables linger for rootless autostart loginctl enable-linger linda

Configuration Files Reference

File Purpose
/etc/fstab Persistent file system mount definitions
/etc/hosts Static hostname-to-IP mappings
/etc/hostname System hostname
/etc/default/grub GRUB bootloader configuration
/boot/grub2/grub.cfg GRUB configuration (generated)
/etc/dracut.conf Dracut initramfs configuration (deprecated)
/etc/dracut.conf.d/ Dracut configuration drop-in directory
/etc/containers/registries.conf Container registry configuration
/etc/httpd/conf/httpd.conf Apache main configuration
/etc/httpd/conf.d/ Apache drop-in configuration directory
/etc/sudoers Sudo access control
/etc/at.allow Users allowed to use atd
/etc/at.deny Users denied from using atd
/etc/login.defs System-wide login defaults
/etc/default/useradd Default useradd settings
/etc/skel/ Skeleton directory for new user homes
/etc/exports NFS export definitions
/etc/auto.master Autofs master configuration
/etc/auto.direct Autofs direct map
/etc/auto.indirect Autofs indirect map
/etc/chrony.conf Chrony time synchronization configuration
/etc/journald.conf Journal configuration
/var/log/journal/ Persistent journal storage
/etc/systemd/system/ System-level systemd unit files
~/.config/systemd/user/ User-level systemd unit files
/etc/sysctl.conf Kernel parameter tuning
/root/anaconda-ks.cfg Anaconda kickstart configuration
/root/install.log Installation package log
/var/log/anaconda/ Anaconda installation logs
/etc/yum.repos.d/ Repository configuration files