RHCSA flashcards
RHCSA · Build recall with a focused review session.
32 cards. Read the term and the definition here. The deck at the top of this page is optional.
- grep -r option
- The -r option makes grep search recursively through all files under a directory; combine with -i for case-insensitive matching and -n to print line numbers.
- find -name
- find /var -name '*.log' searches /var recursively for entries whose basename matches the pattern; quote the pattern so the shell does not expand it.
- tar -czf
- Creates a gzip-compressed tar archive: -c creates, -z filters through gzip, and -f names the archive file, which must come immediately before the filename.
- Hard link vs symlink
- A hard link is another directory entry for the same inode and cannot cross filesystems; a symbolic link stores a path to the target and can cross filesystems.
- dnf provides
- dnf provides /usr/bin/command locates the package that supplies a file; use it when a command is missing and you need to know which package to install.
- dnf history undo
- dnf history lists transactions with IDs; dnf history undo ID reverses the changes of that transaction, including package installs and removals, when the repositories still contain needed versions.
- repo file location
- DNF repository definitions are stored as .repo files in /etc/yum.repos.d/; each section needs a unique ID plus name and baseurl or metalink, and enabled=1 activates it.
- Shebang line
- The first line of a shell script, such as #!/bin/bash, names the interpreter that executes the file; it must be the very first line and the script must be executable.
- $@ vs $*
- In bash, "$@" expands to separate quoted arguments preserving spaces, while "$*" expands to one word joining all arguments with the first character of IFS.
- test -f
- The -f test succeeds when the path exists and is a regular file; related tests include -d for directory, -e for existence, -r for readable, and -x for executable.
- systemctl enable --now
- Enables a systemd unit to start at boot and starts it immediately in one step; equivalent to running systemctl enable unit followed by systemctl start unit.
- journalctl -u
- Filters the systemd journal to messages from one unit, for example journalctl -u sshd; add -f to follow new entries or -b to restrict to the current boot.
- systemctl get-default
- Prints the default systemd target, such as multi-user.target or graphical.target; change it with systemctl set-default TARGET.target, which alters the default boot mode.
- nice and renice
- nice starts a command with an adjusted CPU priority from -20 (highest) to 19 (lowest); renice changes the priority of an already running process by PID.
- pvcreate vgcreate lvcreate
- LVM creation order: pvcreate initializes a physical volume, vgcreate groups PVs into a volume group, and lvcreate allocates a logical volume from that group.
- lvextend and xfs_growfs
- After lvextend enlarges a logical volume, grow the filesystem: use xfs_growfs /mountpoint for XFS, or resize2fs /dev/vg/lv for ext4. XFS can only grow, not shrink.
- partprobe
- partprobe /dev/sdb asks the kernel to reread the partition table so newly created partitions appear as device nodes without rebooting.
- GPT vs MBR
- GPT supports up to 128 partitions by default and disks larger than 2 TiB; MBR supports four primary partitions and is limited to 2 TiB.
- mkfs.xfs
- Formats a block device with the XFS filesystem, destroying existing data; XFS cannot be shrunk, so size logical volumes carefully before creating the filesystem.
- /etc/fstab fields
- Six fields: device, mount point, filesystem type, mount options, dump backup flag, and fsck pass order; use 0 for dump and 0 for no fsck check.
- setfacl -m
- Adds or modifies a POSIX ACL entry, for example setfacl -m u:alice:rw file; getfacl displays ACLs and a plus sign in ls -l indicates one exists.
- nmcli con mod
- Changes a NetworkManager connection profile; set ipv4.method manual, ipv4.addresses, ipv4.gateway, and ipv4.dns, then run nmcli con up NAME to apply.
- firewall-cmd --permanent
- Makes a firewalld change survive reload and reboot; after adding a service or port with --permanent, run firewall-cmd --reload to activate the saved configuration.
- hostnamectl set-hostname
- Sets the static system hostname persistently; it updates /etc/hostname and the running kernel hostname. Add the name to /etc/hosts for local resolution.
- ip route
- Displays the kernel routing table; ip route add default via GATEWAY adds a default route temporarily, while NetworkManager settings make routes persistent.
- useradd -m
- Creates a user and its home directory from /etc/skel; combine with -s /bin/bash for the login shell and -G group1,group2 to add supplementary groups.
- usermod -aG
- Adds a user to supplementary groups without removing existing memberships; omitting -a replaces all current supplementary groups, so always use -aG together.
- chage -M
- Sets the maximum number of days a password remains valid, for example chage -M 90 alice; chage -l alice lists current password aging information.
- getenforce
- Prints the current SELinux mode: Enforcing, Permissive, or Disabled. setenforce 0 or 1 changes between enforcing and permissive only until reboot; the persistent setting is in /etc/selinux/config.
- restorecon -Rv
- Restores SELinux file contexts according to the policy; use restorecon -Rv /path to relabel recursively and show changes after copying files or changing contexts.
- semanage fcontext
- Adds a persistent SELinux file context mapping, for example semanage fcontext -a -t httpd_sys_content_t '/web(/.*)?' then restorecon -Rv /web applies it.
- setsebool -P
- Sets an SELinux boolean persistently with -P, for example setsebool -P httpd_can_network_connect on; getsebool -a lists available booleans.