Skip to content
devopsbymuh_

LFCS practice questions and answers

All 60 questions from Full Practice Test 1 for Linux Foundation Certified System Administrator (LFCS), with the correct answer and a full explanation for each — including why the other options are wrong. Free to read, no signup.

What this set covers

Questions are weighted to match the official LFCS exam guide. The real exam is 17-20 performance-based tasks questions in 120 minutes with a pass mark of 67%.

  • Operations Deployment16 q · 25%
  • Networking14 q · 25%
  • Storage12 q · 20%
  • Essential Commands12 q · 20%
  • Users and Groups6 q · 10%
Question 1Networking

Which command tests whether TCP port 443 on host example.com is reachable, without sending application data?

  • Anc -zv example.com 443
  • Bping example.com
  • Cdig example.com
  • Dtraceroute example.com

Correct answer: A nc -zv example.com 443

netcat in zero-I/O mode attempts the TCP connection and reports success or failure. ping uses ICMP and says nothing about a specific port, dig queries DNS, and traceroute maps the path rather than testing a port.

man nc
Question 2Users and GroupsSelect 2

Which two commands report the groups a user belongs to? (Select TWO.)

  • Aid username
  • Bgroups username
  • Cwho
  • Dlast
  • Ew

Correct answer: A, B id username · groups username

id prints UID, GID, and all group memberships, and groups prints the membership list. who and w show current logins and last shows login history.

man id
Question 3Operations Deployment

Which command must be run after editing a unit file on disk before the change takes effect?

  • Asystemctl daemon-reload
  • Bsystemctl reboot
  • Csystemctl isolate multi-user.target
  • Dsystemctl mask the unit

Correct answer: A systemctl daemon-reload

daemon-reload makes systemd re-read unit files from disk so the new configuration is used. Rebooting works but is disproportionate, isolate switches targets, and masking disables the unit entirely.

man systemctl
Question 4Operations Deployment

Which approach keeps a long-running command alive after the SSH session ends?

  • ARun it under a terminal multiplexer such as tmux or screen, or start it as a systemd service
  • BRun it with a higher nice value
  • CRedirect its output to /dev/null
  • DRun it inside a subshell with parentheses

Correct answer: A Run it under a terminal multiplexer such as tmux or screen, or start it as a systemd service

A multiplexer keeps the session alive independently of the SSH connection, and a systemd service is supervised by init entirely. Nice values affect scheduling, redirecting output does not detach the process, and a subshell still belongs to the same session.

man tmux
Question 5Networking

Which setting enables IPv4 packet forwarding persistently across reboots?

  • Anet.ipv4.ip_forward = 1 in a file under /etc/sysctl.d/
  • Becho 1 > /proc/sys/net/ipv4/ip_forward only
  • CAn entry in /etc/hosts
  • DAn alias in /etc/profile

Correct answer: A net.ipv4.ip_forward = 1 in a file under /etc/sysctl.d/

A sysctl configuration file is applied at boot, making the setting persistent. Writing directly to /proc changes the running kernel only, and hosts entries and shell aliases are unrelated.

man sysctl.d
Question 6Operations Deployment

Which command lists all failed systemd units on the system?

  • Asystemctl --failed
  • Bsystemctl list-timers
  • Csystemctl get-default
  • Dsystemctl show

Correct answer: A systemctl --failed

The --failed option filters units in the failed state, which is the fastest triage step after a boot problem. list-timers shows scheduled timers, get-default prints the default target, and show dumps unit properties.

man systemctl
Question 7Essential Commands

Which command searches command history for previously run commands containing 'systemctl'?

  • Ahistory | grep systemctl
  • Bgrep systemctl /etc/passwd
  • Cwhich systemctl
  • Dtype systemctl

Correct answer: A history | grep systemctl

history prints the shell's command history and grep filters it. Searching passwd is unrelated, and which and type report where the command lives rather than how it was used.

Question 8Storage

Which identifier should be used in /etc/fstab so that a filesystem mounts correctly even if device names change between boots?

  • AUUID
  • B/dev/sda1
  • CThe inode number
  • DThe mount point path

Correct answer: A UUID

A UUID is stored in the filesystem itself and is stable regardless of enumeration order, unlike kernel device names. Inode numbers identify files within a filesystem, and the mount point is where it is attached rather than what is attached.

man fstab
Question 9Operations Deployment

Which command enables a systemd service so it starts automatically at boot and also starts it immediately?

  • Asystemctl enable --now nginx
  • Bsystemctl start nginx
  • Csystemctl status nginx
  • Dsystemctl mask nginx

Correct answer: A systemctl enable --now nginx

enable creates the boot-time symlink and --now starts the unit in the same command. start alone does not persist across reboot, status only reports, and mask prevents the unit from being started at all.

man systemctl
Question 10Networking

Which command adds a default gateway of 192.168.1.1 to the routing table at runtime?

  • Aip route add default via 192.168.1.1
  • Bip addr add 192.168.1.1/24 dev eth0
  • Cip link set eth0 up
  • Dip neigh add 192.168.1.1 dev eth0

Correct answer: A ip route add default via 192.168.1.1

ip route add default via installs the default route through the given next hop. ip addr assigns an address, ip link brings an interface up, and ip neigh manipulates the ARP cache.

man ip-route
Question 11Essential Commands

Which command finds all files under /var larger than 100 MB?

  • Afind /var -type f -size +100M
  • Bgrep -r 100M /var
  • Cdu -h /var | sort
  • Dls -lR /var | head

Correct answer: A find /var -type f -size +100M

find with the size test filters by file size directly, and +100M means larger than 100 mebibytes. grep searches file contents, du summarises directory usage rather than listing individual large files, and a recursive ls is not filtered by size.

man find
Question 12Operations Deployment

Which command sends the termination signal to a process by name rather than by PID?

  • Apkill nginx
  • Bkill nginx
  • Cnice nginx
  • Drenice nginx

Correct answer: A pkill nginx

pkill matches processes by name or other attributes and signals them. kill requires a PID, while nice and renice adjust scheduling priority.

man pkill
Question 13Essential CommandsSelect 2

Which two redirections send both standard output and standard error of a command into out.log? (Select TWO.)

  • Acommand > out.log 2>&1
  • Bcommand &> out.log
  • Ccommand > out.log
  • Dcommand 2> out.log
  • Ecommand | out.log

Correct answer: A, B command > out.log 2>&1 · command &> out.log

Redirecting stdout to the file and then duplicating stderr onto it captures both, and the shorthand form does the same in bash. Redirecting only stdout or only stderr misses one stream, and piping to a filename is invalid.

Bash — Redirections
Question 14Operations Deployment

Which command shows which process is listening on TCP port 8080?

  • Ass -ltnp | grep :8080
  • Bping localhost
  • Cip addr show
  • Ddf -h

Correct answer: A ss -ltnp | grep :8080

ss with listening, TCP, numeric, and process options reports the socket and the owning process. ping tests reachability, ip addr shows interface addresses, and df reports disk usage.

man ss

Which tool reports which processes are keeping a filesystem busy so it cannot be unmounted?

  • Alsof +D /mnt or fuser -vm /mnt
  • Bdf -h /mnt
  • Cblkid
  • Dsync

Correct answer: A lsof +D /mnt or fuser -vm /mnt

lsof and fuser both identify processes holding open files or working directories under a mount point. df reports usage, blkid shows device identifiers, and sync flushes buffers without releasing anything.

man fuser
Question 16StorageSelect 2

Which two facts about a hard link are correct? (Select TWO.)

  • AIt refers to the same inode as the original file
  • BIt cannot span filesystems
  • CIt breaks when the original name is deleted
  • DIt can point to a directory by default
  • EIt stores the target path as text

Correct answer: A, B It refers to the same inode as the original file · It cannot span filesystems

Hard links are additional directory entries for the same inode, so they are confined to a single filesystem. Deleting one name leaves the data intact while another link remains, directories cannot normally be hard linked, and storing a path as text describes a symbolic link.

man ln
Question 17Operations Deployment

Which systemd mechanism replaces a cron job and provides logging, dependency handling, and randomised delays?

  • AA systemd timer unit paired with a service unit
  • BAn entry in /etc/motd
  • CA shell loop started from .bashrc
  • DAn alias in /etc/profile

Correct answer: A A systemd timer unit paired with a service unit

Timer units schedule an associated service and integrate with the journal, dependencies, and options such as RandomizedDelaySec. The message of the day, shell loops from a login file, and aliases are not scheduling mechanisms.

man systemd.timer
Question 18Operations Deployment

Which command reports the default systemd target the system boots into?

  • Asystemctl get-default
  • Brunlevel
  • Csystemctl list-sockets
  • Duname -r

Correct answer: A systemctl get-default

get-default prints the target that default.target links to, typically multi-user or graphical. runlevel reports legacy compatibility values, list-sockets shows socket units, and uname prints kernel information.

man systemctl
Question 19Essential Commands

Which command creates a compressed archive of /etc into /backup/etc.tar.gz?

  • Atar -czf /backup/etc.tar.gz /etc
  • Btar -xzf /backup/etc.tar.gz /etc
  • Cgzip /etc
  • Dzip /backup/etc.tar.gz /etc

Correct answer: A tar -czf /backup/etc.tar.gz /etc

c creates, z applies gzip compression, and f names the archive file. The x flag extracts rather than creates, gzip compresses individual files rather than directory trees, and zip produces a zip archive with a misleading name here.

man tar
Question 20Operations Deployment

A service fails to start. Which command shows its recent log output with the reason?

  • Ajournalctl -u myservice -n 50 --no-pager
  • Bdmesg | tail
  • Csystemctl list-units
  • Dps aux | grep myservice

Correct answer: A journalctl -u myservice -n 50 --no-pager

journalctl -u filters the journal to a specific unit, which is where systemd records start-up failures. dmesg shows kernel messages, list-units enumerates units without their logs, and ps only shows whether a process is running.

man journalctl
Question 21Users and Groups

Which file stores hashed user passwords and password ageing information?

  • A/etc/shadow
  • B/etc/passwd
  • C/etc/group
  • D/etc/login.defs

Correct answer: A /etc/shadow

shadow holds password hashes and ageing fields and is readable only by root. passwd holds account attributes without hashes on modern systems, group lists group membership, and login.defs holds default policy values.

man shadow
Question 22StorageSelect 2

Which two commands relate to creating an LVM setup from a raw disk? (Select TWO.)

  • Apvcreate /dev/sdb
  • Bvgcreate vg0 /dev/sdb
  • Cmkswap /dev/sdb
  • Dresize2fs /dev/sdb
  • Eblkid /dev/sdb

Correct answer: A, B pvcreate /dev/sdb · vgcreate vg0 /dev/sdb

pvcreate initialises the physical volume and vgcreate builds a volume group from it, which are the first two LVM steps. mkswap formats swap space, resize2fs resizes an existing ext filesystem, and blkid only reports identifiers.

man pvcreate
Question 23Operations Deployment

Which command inspects the resource limits currently applied to the running shell?

  • Aulimit -a
  • Bfree -m
  • Cuptime
  • Dvmstat 1

Correct answer: A ulimit -a

ulimit -a lists all soft limits such as open files and maximum processes for the current shell. free reports memory, uptime shows load averages, and vmstat samples system activity.

man bash — ulimit

Which command safely verifies that entries in /etc/fstab are valid before rebooting?

  • Amount -a followed by checking for errors
  • Breboot and see what happens
  • Cumount -a
  • Dfsck -y on the root filesystem while mounted read-write

Correct answer: A mount -a followed by checking for errors

mount -a attempts every fstab entry not already mounted and reports failures, which catches typos before they break the boot. Rebooting to find out risks an unbootable system, umount -a unmounts filesystems, and running fsck on a mounted read-write filesystem can corrupt it.

man mount
Question 25Essential Commands

Which command creates a symbolic link named current pointing to /opt/app/v2?

  • Aln -s /opt/app/v2 current
  • Bln /opt/app/v2 current
  • Ccp -r /opt/app/v2 current
  • Dmv /opt/app/v2 current

Correct answer: A ln -s /opt/app/v2 current

The -s flag creates a symbolic link, which can span filesystems and point at directories. Without -s you get a hard link, which cannot normally target a directory, while cp copies and mv relocates.

man ln
Question 26Essential Commands

Which command replaces every occurrence of 'debug' with 'info' in config.txt and writes the change to the file?

  • Ased -i 's/debug/info/g' config.txt
  • Bsed 's/debug/info/' config.txt
  • Cgrep -v debug config.txt
  • Dawk '{print $1}' config.txt

Correct answer: A sed -i 's/debug/info/g' config.txt

The -i flag edits in place and the g modifier replaces every occurrence on each line. Without -i the result only goes to standard output, without g only the first match per line changes, grep filters lines, and that awk program prints the first field.

man sed
Question 27Essential Commands

Which command changes the permissions of script.sh so that only the owner can read, write, and execute it?

  • Achmod 700 script.sh
  • Bchmod 777 script.sh
  • Cchmod 644 script.sh
  • Dchown root script.sh

Correct answer: A chmod 700 script.sh

700 grants read, write, and execute to the owner and nothing to group or others. 777 grants everything to everyone, 644 removes execute and grants read to others, and chown changes ownership rather than permissions.

man chmod
Question 28Operations Deployment

Which file should be edited to make an environment variable available to all users' login shells system wide?

  • AA file under /etc/profile.d/ ending in .sh
  • B~/.bashrc for the current user only
  • C/etc/hosts
  • D/etc/fstab

Correct answer: A A file under /etc/profile.d/ ending in .sh

Scripts in /etc/profile.d are sourced by login shells for all users, which is the maintainable way to set system-wide variables. A user's bashrc affects only that user, hosts maps names to addresses, and fstab describes filesystems.

man bash — Invocation
Question 29NetworkingSelect 2

Which two statements about SSH key-based authentication are correct? (Select TWO.)

  • AThe public key is placed in the remote user's ~/.ssh/authorized_keys
  • BThe private key stays on the client and should be protected by a passphrase
  • CThe private key must be copied to the server
  • Dauthorized_keys should be world-writable for convenience
  • EKey authentication requires PasswordAuthentication to remain enabled

Correct answer: A, B The public key is placed in the remote user's ~/.ssh/authorized_keys · The private key stays on the client and should be protected by a passphrase

Only the public key belongs on the server, and the private key stays with the client, ideally passphrase protected. Copying the private key defeats the model, permissive permissions on authorized_keys cause sshd to refuse it, and password authentication can and usually should be disabled.

man sshd
Question 30Users and Groups

Which command adds the user bob to the supplementary group docker without removing his existing groups?

  • Ausermod -aG docker bob
  • Busermod -G docker bob
  • Cgroupadd -U bob docker
  • Dchgrp docker bob

Correct answer: A usermod -aG docker bob

The -a flag appends to the supplementary group list, and omitting it replaces the entire list. groupadd creates groups rather than assigning membership, and chgrp changes file group ownership.

man usermod
Question 31Essential CommandsSelect 2

Which two commands display the current working directory and change to the previous directory respectively? (Select TWO.)

  • Apwd
  • Bcd -
  • Ccd ~
  • Dls -a
  • Edirname .

Correct answer: A, B pwd · cd -

pwd prints the working directory and cd with a hyphen returns to the previous one. cd with a tilde goes to the home directory, ls lists contents, and dirname manipulates a path string.

man pwd
Question 32Networking

Which command shows the path packets take to a remote host, listing each hop?

  • Atraceroute example.com
  • Bss -tan
  • Cip link show
  • Dhostnamectl

Correct answer: A traceroute example.com

traceroute reports each router along the path with round-trip times. ss lists sockets, ip link shows interface state, and hostnamectl displays and sets the system hostname.

man traceroute
Question 33Operations Deployment

Where should a local override of a packaged systemd unit be placed so package updates do not overwrite it?

  • AIn a drop-in file under /etc/systemd/system/<unit>.d/override.conf
  • BBy editing the file in /usr/lib/systemd/system directly
  • CIn /tmp/systemd
  • DIn the user's home directory

Correct answer: A In a drop-in file under /etc/systemd/system/<unit>.d/override.conf

Drop-in files under /etc/systemd/system take precedence over vendor units and survive package upgrades, and systemctl edit creates them. Editing the vendor unit under /usr/lib is overwritten on update, and /tmp and home directories are not unit search paths for system services.

man systemd.unit
Question 34Operations Deployment

Which command reloads a service's configuration without dropping active connections, when the unit supports it?

  • Asystemctl reload nginx
  • Bsystemctl restart nginx
  • Csystemctl kill nginx
  • Dsystemctl disable nginx

Correct answer: A systemctl reload nginx

reload signals the running process to re-read its configuration, which for a unit with ExecReload defined avoids restarting and dropping connections. restart stops and starts the process, kill sends a signal to terminate it, and disable only removes the boot-time symlink.

man systemctl

Which command reports the total disk usage of each subdirectory of /var, sorted largest first?

  • Adu -sh /var/* | sort -h -r
  • Bdf -h /var
  • Cls -lh /var
  • Dstat /var

Correct answer: A du -sh /var/* | sort -h -r

du summarises each entry and sort -h -r orders human-readable sizes descending. df reports filesystem-level usage, ls shows directory entry sizes rather than recursive totals, and stat shows metadata for one path.

man du
Question 36Users and Groups

Which command creates a user with a home directory and bash as the login shell?

  • Auseradd -m -s /bin/bash alice
  • Buseradd alice
  • Cusermod -aG alice
  • Dgroupadd alice

Correct answer: A useradd -m -s /bin/bash alice

The -m flag creates the home directory and -s sets the login shell. Plain useradd may skip the home directory depending on defaults, usermod modifies an existing account, and groupadd creates a group.

man useradd
Question 37Essential Commands

Which command shows the last 50 lines of /var/log/syslog and then continues to display new lines as they are written?

  • Atail -n 50 -f /var/log/syslog
  • Bhead -n 50 /var/log/syslog
  • Ccat /var/log/syslog
  • Dless /var/log/syslog

Correct answer: A tail -n 50 -f /var/log/syslog

tail with -n selects how many lines to show and -f follows the file for new output. head shows the beginning, cat prints once and exits, and less pages through the file without following by default.

man tail
Question 38Operations Deployment

Which command shows the boot messages from the previous boot in the systemd journal?

  • Ajournalctl -b -1
  • Bjournalctl -f
  • Cjournalctl --disk-usage
  • Djournalctl --vacuum-size=100M

Correct answer: A journalctl -b -1

The -b flag with an offset selects a specific boot, and -1 means the previous one, which requires persistent journal storage. -f follows new entries, disk-usage reports size, and vacuum-size trims the journal.

man journalctl
Question 39Networking

Which command displays the IP addresses configured on all interfaces?

  • Aip addr show
  • Bip route show
  • Css -s
  • Darp -a

Correct answer: A ip addr show

ip addr lists interfaces with their assigned addresses. ip route shows the routing table, ss -s summarises socket statistics, and arp shows the neighbour cache.

man ip
Question 40Networking

Which firewalld command permanently allows inbound HTTPS traffic in the default zone?

  • Afirewall-cmd --permanent --add-service=https then firewall-cmd --reload
  • Bfirewall-cmd --add-service=https only
  • Csystemctl stop firewalld
  • Diptables -F

Correct answer: A firewall-cmd --permanent --add-service=https then firewall-cmd --reload

The permanent flag writes the rule to the configuration and reload activates it, so it survives restarts. Without permanent the change is lost on reload, and stopping the firewall or flushing iptables removes protection entirely.

man firewall-cmd
Question 41Essential Commands

Which command displays the type of a file's contents regardless of its extension?

  • Afile report.dat
  • Bstat report.dat
  • Cls -l report.dat
  • Dwc -c report.dat

Correct answer: A file report.dat

The file command inspects magic bytes and reports the content type. stat shows inode metadata, ls shows permissions and size, and wc counts bytes.

man file
Question 42Networking

Which command sets the system hostname persistently on a systemd-based distribution?

  • Ahostnamectl set-hostname web01
  • Bhostname web01
  • Cexport HOSTNAME=web01
  • Decho web01 > /proc/sys/kernel/hostname

Correct answer: A hostnamectl set-hostname web01

hostnamectl writes /etc/hostname and updates the running value, so the change survives a reboot. The hostname command, an exported variable, and a direct /proc write all affect only the current session or boot.

man hostnamectl
Question 43Essential Commands

Which command prints the third field of each line in a colon-delimited file?

  • Aawk -F: '{print $3}' file
  • Bcut -c3 file
  • Csed -n '3p' file
  • Dhead -3 file

Correct answer: A awk -F: '{print $3}' file

awk with -F sets the field separator and $3 selects the third field. cut -c3 selects a character position, sed -n '3p' prints the third line, and head prints the first three lines.

man awk
Question 44Essential Commands

Which command counts how many lines in access.log contain the string 'ERROR'?

  • Agrep -c ERROR access.log
  • Bgrep -v ERROR access.log
  • Cwc -l access.log
  • Dsort access.log | uniq

Correct answer: A grep -c ERROR access.log

grep -c prints the number of matching lines. The -v flag inverts the match, wc -l counts every line in the file, and sort with uniq deduplicates without counting matches.

man grep
Question 45Networking

Which file controls the order and addresses of DNS resolvers on a traditional Linux system?

  • A/etc/resolv.conf
  • B/etc/hostname
  • C/etc/services
  • D/etc/protocols

Correct answer: A /etc/resolv.conf

resolv.conf lists nameservers and search domains used by the resolver library, though it is often managed by systemd-resolved or NetworkManager. hostname holds the system name, and services and protocols map names to port and protocol numbers.

man resolv.conf
Question 46Networking

Which sshd configuration change most improves security on an internet-facing host?

  • ASet PermitRootLogin no and PasswordAuthentication no, relying on keys
  • BSet PermitEmptyPasswords yes
  • CSet PermitRootLogin yes with a strong password
  • DDisable the host key checking on clients

Correct answer: A Set PermitRootLogin no and PasswordAuthentication no, relying on keys

Disabling direct root login and password authentication removes the two most commonly brute-forced paths. Empty passwords are catastrophic, root login with a password is still guessable, and disabling host key checking weakens the client against interception.

man sshd_config

A filesystem reports no space left on device, but df shows 40% used. What should be checked next?

  • AInode exhaustion, using df -i
  • BThe system's memory usage with free
  • CThe CPU load average
  • DThe number of open network sockets

Correct answer: A Inode exhaustion, using df -i

A filesystem can run out of inodes while blocks remain free, typically after creating enormous numbers of small files, and df -i reveals this. Memory, CPU load, and socket counts do not cause this error.

man df
Question 48Operations DeploymentSelect 2

Which two actions help ensure a service starts only after the network is fully configured? (Select TWO.)

  • AAdd After=network-online.target to the unit
  • BAdd Wants=network-online.target to the unit
  • CAdd a sleep 30 command to the ExecStart line
  • DDisable the unit and start it manually
  • ESet Restart=no on the unit

Correct answer: A, B Add After=network-online.target to the unit · Add Wants=network-online.target to the unit

After orders the unit and Wants pulls the target in, and both are needed for the ordering to actually be meaningful. Sleeping is a fragile guess, manual starting defeats automation, and disabling restarts does not address ordering.

systemd — Running services after the network is up
Question 49NetworkingSelect 2

Which two commands are appropriate for troubleshooting DNS resolution? (Select TWO.)

  • Adig example.com A
  • Bgetent hosts example.com
  • Cdf -h
  • Dlsblk
  • Efree -m

Correct answer: A, B dig example.com A · getent hosts example.com

dig queries DNS directly and getent exercises the system's full name service switch path, which together distinguish a DNS server problem from a local configuration problem. df, lsblk, and free report storage and memory.

Question 50NetworkingSelect 2

Which two are valid ways to persist a static IP address on a modern NetworkManager-managed system? (Select TWO.)

  • Anmcli connection modify with ipv4.method manual and ipv4.addresses set
  • BA NetworkManager keyfile under /etc/NetworkManager/system-connections/
  • CRunning ip addr add in a login shell profile
  • DWriting the address into /etc/hosts
  • ESetting the address in /etc/resolv.conf

Correct answer: A, B nmcli connection modify with ipv4.method manual and ipv4.addresses set · A NetworkManager keyfile under /etc/NetworkManager/system-connections/

nmcli edits the stored connection profile and the keyfile is where that profile lives, so both persist across reboots. A login profile only runs for interactive shells, hosts maps names to addresses, and resolv.conf configures DNS.

Which command adds a swap file of 2 GB and activates it?

  • Afallocate -l 2G /swapfile, chmod 600 /swapfile, mkswap /swapfile, swapon /swapfile
  • Bmkfs.ext4 /swapfile then mount it
  • Ctouch /swapfile then swapon /swapfile
  • Ddd if=/dev/zero of=/swapfile then mount -o swap

Correct answer: A fallocate -l 2G /swapfile, chmod 600 /swapfile, mkswap /swapfile, swapon /swapfile

The file must be allocated, permission-restricted, formatted as swap, and then enabled, in that order. Creating an ext4 filesystem is wrong for swap, an empty file has no swap signature, and swap is enabled with swapon rather than mount.

man swapon

Which mount option prevents execution of binaries from a mounted filesystem, useful for /tmp or removable media?

  • Anoexec
  • Bro
  • Csync
  • Dnoatime

Correct answer: A noexec

noexec blocks executing binaries from that mount, which is a common hardening measure alongside nosuid and nodev. ro makes the mount read-only, sync forces synchronous writes, and noatime skips access time updates for performance.

man mount
Question 53Users and Groups

Which command locks a user account so the password cannot be used to log in?

  • Apasswd -l username
  • Bpasswd -d username
  • Cchage -l username
  • Did username

Correct answer: A passwd -l username

passwd -l prefixes the hash with an exclamation mark so no password matches. The -d option deletes the password entirely, which can allow passwordless login, chage -l lists ageing information, and id shows UID and group membership.

man passwd

Which command displays the UUID and filesystem type of every block device?

  • Ablkid
  • Bmount
  • Cfdisk -l
  • Dsync

Correct answer: A blkid

blkid reports the UUID, label, and filesystem type for each device, which is what you copy into fstab. mount lists what is currently mounted, fdisk -l shows partition tables without UUIDs, and sync flushes write buffers.

man blkid

Which command lists block devices with their mount points and sizes in a tree layout?

  • Alsblk
  • Bdf -i
  • Cdu -sh /
  • Dmount -a

Correct answer: A lsblk

lsblk shows disks, partitions, and logical volumes hierarchically with sizes and mount points. df -i reports inode usage of mounted filesystems, du sums directory sizes, and mount -a mounts everything listed in fstab.

man lsblk

Which sequence extends an LVM logical volume and its ext4 filesystem by 5 GB?

  • Alvextend -L +5G /dev/vg0/lv_data then resize2fs /dev/vg0/lv_data
  • Bresize2fs +5G then lvextend
  • Cpvcreate then mkfs.ext4
  • Dvgreduce then lvremove

Correct answer: A lvextend -L +5G /dev/vg0/lv_data then resize2fs /dev/vg0/lv_data

The logical volume must grow first so the filesystem has room to expand into, then resize2fs grows the filesystem. Resizing the filesystem first would fail, pvcreate plus mkfs would destroy data, and vgreduce with lvremove removes storage.

man lvextend
Question 57Users and Groups

Which configuration allows members of the group ops to run all commands with sudo, following best practice?

  • AA file under /etc/sudoers.d containing %ops ALL=(ALL) ALL, edited with visudo
  • BAdding every ops member to the root group
  • CSetting the setuid bit on /bin/bash
  • DSharing the root password with the ops team

Correct answer: A A file under /etc/sudoers.d containing %ops ALL=(ALL) ALL, edited with visudo

A drop-in sudoers file validated by visudo grants the group sudo access with an audit trail and without touching the main file. Root group membership does not grant sudo, a setuid shell is a severe vulnerability, and sharing the root password destroys accountability.

man sudoers
Question 58Networking

Which command shows established TCP connections along with the owning process?

  • Ass -tanp state established
  • Bip route get 8.8.8.8
  • Cnmcli device status
  • Dethtool eth0

Correct answer: A ss -tanp state established

ss filters by socket state and the p option attributes each socket to a process. ip route get shows which route would be used, nmcli reports NetworkManager device state, and ethtool queries link-level driver settings.

man ss
Question 59Networking

Which command copies a directory to a remote host over SSH while preserving permissions and only transferring changes?

  • Arsync -avz /data/ user@host:/data/
  • Bscp /data user@host:/data
  • Csftp user@host
  • Dcurl -T /data user@host

Correct answer: A rsync -avz /data/ user@host:/data/

rsync in archive mode preserves attributes and transfers only differences, with compression from -z. scp copies everything each time, sftp is interactive, and curl is not appropriate for a directory tree over SSH here.

man rsync
Question 60Operations DeploymentSelect 2

Which two commands install and then verify a package on a Debian-based system? (Select TWO.)

  • Aapt-get install -y nginx
  • Bdpkg -l nginx
  • Cyum install nginx
  • Drpm -q nginx
  • Ezypper in nginx

Correct answer: A, B apt-get install -y nginx · dpkg -l nginx

apt-get installs from configured repositories and dpkg -l queries the local package database on Debian systems. yum and rpm belong to Red Hat family systems and zypper to SUSE.

Ready to try it under exam conditions?

Reading answers is not the same as recalling them with a clock running. Take the same 60 questions as a timed mock exam — 120 minutes, no feedback until you submit, then a score broken down by exam domain so you know what to study.

Start the timed LFCS test →