Sheet ⁨07⁩ · ⁨Flashcards⁩Surveyed ⁨2026⁩

Linux Foundation Certified System Administrator Flashcards (LFCS)

32 CardsPublished: Updated:
Flashcard Deck
Card 1 of 32
SpaceFlip Card
Navigate
All cards in this deck32 cards

Listed for reference and for searching. Use the deck above to study; recall works better than reading.

  1. 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 f
    
                            
  2. What 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/log
    
                            
  3. How 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.ini
    
                            
  4. How do you print the second column of whitespace-separated text?

    Use awk and reference the field by number.

                              awk '{print $2}' access.log
    
                            
  5. What is the difference between > and >> in the shell?

    > redirects stdout and truncates (overwrites) the file; >> appends to it. Use 2> to redirect stderr.

  6. 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.sh
    
                            
  7. What 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.

  8. 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/www
    
                            
  9. What 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).

  10. 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 alice
    
                            
  11. How 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 alice
    
                            
  12. Which 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.

  13. 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 alice
    
                            
  14. What 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.

  15. 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/data
    
                            
  16. How 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 2
    
                            
  17. How 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/data
    
                            
  18. How 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.

  19. 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.

  20. How do you see listening ports and the processes behind them?

    Use ss with -tulpn (TCP, UDP, listening, process, numeric).

                              ss -tulpn
    
                            
  21. How 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 --reload
    
                            
  22. Where 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.

  23. 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 nginx
    
                            
  24. How 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 -f
    
                            
  25. What 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.

  26. 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.sh
    
                            
  27. How 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.

  28. 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.

  29. 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.txt
    
                            
  30. What 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.

  31. 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/null
    
                            
  32. How 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.

Was this useful?