Linux Foundation Certified System Administrator Flashcards (LFCS)
All cards in this deck32 cards
Listed for reference and for searching. Use the deck above to study; recall works better than reading.
How do you find files by name under a directory tree?
Use find with a path and -name pattern.
find /var/log -name "*.log" -type fWhat does grep -r do, and how do you show line numbers?
grep -r searches recursively through a directory; add -n for line numbers and -i for case-insensitive.
grep -rin "error" /var/logHow do you replace text in a stream or file with sed?
Use sed with the s/old/new/g substitution. Add -i to edit the file in place.
sed -i 's/localhost/127.0.0.1/g' config.iniHow do you print the second column of whitespace-separated text?
Use awk and reference the field by number.
awk '{print $2}' access.logWhat is the difference between > and >> in the shell?
> redirects stdout and truncates (overwrites) the file; >> appends to it. Use 2> to redirect stderr.
How do you make a script executable and run it?
Add the execute bit with chmod +x, then run it by path.
chmod +x deploy.sh ./deploy.shWhat do the digits in chmod 640 mean?
Owner read+write (6), group read (4), others none (0). The three digits are owner, group, others; 4=read, 2=write, 1=execute summed.
How do you change a file's owner and group?
Use chown with user:group. Add -R to recurse into a directory.
chown -R www-data:www-data /var/wwwWhat does the setuid bit do, and how do you spot it?
A setuid binary runs with the file owner's privileges rather than the caller's. It shows as an s in the owner execute position (e.g. -rwsr-xr-x).
How do you create a user with a home directory and a login shell?
useradd -m creates the home directory; -s sets the shell.
useradd -m -s /bin/bash aliceHow do you add an existing user to a group without removing other groups?
Use usermod -aG (append). Forgetting -a replaces all supplementary groups.
usermod -aG docker aliceWhich file should you edit to grant sudo access, and how?
Edit the sudoers config with visudo (never a plain editor), or drop a file in /etc/sudoers.d/. visudo validates syntax before saving.
How do you set password aging for a user?
Use chage: -M sets max days, -m min days, -W the warning window.
chage -M 90 -W 7 aliceWhat are the three layers of LVM?
Physical Volumes (PVs) on disks/partitions, grouped into a Volume Group (VG), carved into Logical Volumes (LVs) you format and mount.
How do you create and mount an ext4 filesystem?
Format with mkfs.ext4, then mount it at a mount point.
mkfs.ext4 /dev/vg0/data mount /dev/vg0/data /mnt/dataHow do you make a mount persist across reboots?
Add an entry to /etc/fstab (ideally by UUID from blkid), then test with mount -a before rebooting.
UUID=xxxx /mnt/data ext4 defaults 0 2How do you extend a logical volume and grow its filesystem?
Extend the LV with lvextend, then grow the filesystem (resize2fs for ext4, xfs_growfs for XFS).
lvextend -L +5G /dev/vg0/data resize2fs /dev/vg0/dataHow do you check disk usage vs free space?
df -h shows free space per mounted filesystem; du -sh shows the size of a directory tree.
What replaced ifconfig and route on modern Linux?
The ip command from iproute2: ip addr for interfaces/addresses, ip route for the routing table, ip link for link state.
How do you see listening ports and the processes behind them?
Use ss with -tulpn (TCP, UDP, listening, process, numeric).
ss -tulpnHow do you open a port with firewalld permanently?
Add the port to a zone with --permanent, then reload.
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reloadWhere is static hostname-to-IP resolution configured?
In /etc/hosts. The order of resolution sources is set in /etc/nsswitch.conf, and DNS servers in /etc/resolv.conf.
How do you start a service now and enable it at boot?
systemctl start runs it now; systemctl enable sets it to start on boot. --now does both.
systemctl enable --now nginxHow do you view logs for a specific unit?
Use journalctl -u <unit>. Add -f to follow, -b to limit to the current boot.
journalctl -u nginx -fWhat is a systemd target, and what replaced runlevels?
A target groups units into a system state (e.g. multi-user.target, graphical.target). Targets replaced the old numeric runlevels.
How do you schedule a recurring job with cron?
Edit the crontab with crontab -e; each line is `min hour day month weekday command`.
0 2 * * * /usr/local/bin/backup.shHow do you see why a service failed to start?
Check systemctl status <unit> for the exit code and recent log lines, then journalctl -u <unit> -b for the full boot log.
How do you harden SSH against password brute-forcing?
In /etc/ssh/sshd_config set PasswordAuthentication no and PermitRootLogin no, use key-based auth, then reload sshd.
What are POSIX ACLs and how do you set one?
ACLs grant permissions beyond the owner/group/other model. Set with setfacl and view with getfacl.
setfacl -m u:alice:rw report.txt getfacl report.txtWhat does SELinux enforcing vs permissive mean?
Enforcing blocks actions that violate policy and logs them; permissive only logs violations without blocking. Check and set with getenforce / setenforce.
How do you find files with the setuid bit set (a security audit)?
Use find with -perm to match the setuid bit across the filesystem.
find / -perm -4000 -type f 2>/dev/nullHow do you check and rotate logs to avoid filling the disk?
logrotate (configured in /etc/logrotate.d/) rotates, compresses, and prunes logs on a schedule. Test a config with logrotate -d.








