Sign in
Home/Linux Foundation/Linux Foundation Certified System Administrator (LFCS)/Free questions

Linux Foundation Certified System Administrator (LFCS) — Free Practice Questions

10 free sample questions from a bank of 140, with the correct answers and explanations. No signup required — start practising right now.

1Which SysV init configuration file should be modified to disable the ctrl-alt-delete key combination?
  • /etc/keys
  • /proc/keys
  • /etc/inittab
  • /proc/inittab
  • /etc/reboot
Answer: C

The short version

C — /etc/inittab controls the ctrl-alt-delete action on SysV init. Disabling or commenting the ca trap line stops an immediate reboot from the keyboard sequence.

Key concepts in this question

  • SysV init and PID 1: init reads its table at boot and stays as parent of services, reacting to signals and runlevel requests.
  • /etc/inittab role: central table mapping runlevels, respawn entries, and special key sequences to actions such as shutdown or reboot.
  • ctrl-alt-delete trap: a line with action such as ctrlaltdel pointing at shutdown or similar, triggered by init on that key event.
  • /proc versus /etc: files under /proc expose live kernel state and are not edited for persistent init policy, while /etc holds persistent configuration.
  • Runlevel model: SysV uses numbered runlevels for single-user, multiuser, and graphical states, all steered by inittab on legacy systems.

Why C is correct

On SysV init systems the kernel starts init, which consults /etc/inittab for what to do on events including ctrl-alt-delete. That file typically contains a ca entry invoking shutdown, so commenting it out or pointing it to a no-op disables the reboot behaviour. No other listed path is consulted by init for this trap, which makes inittab the decisive persistent control. Vendor prose aligns with this standard behaviour.

Why the others are wrong

  • A. /etc/keys does not exist as a standard init control file on SysV systems.
  • B. /proc/keys reports kernel keyring state and is not a persistent init configuration file.
  • D. /proc/inittab does not exist, since inittab lives under /etc on SysV init.
  • E. /etc/reboot is not a standard init configuration file and does not define the key trap.

LFCS exam tip

Link ctrl-alt-delete directly to inittab ca entry on SysV, and link persistent-versus-virtual paths by remembering /etc persists while /proc reports.

2What information can the lspci command display about the system hardware? (Choose THREE correct answers.)
  • Device IRQ settings
  • PCI bus speed
  • System battery type
  • Device vendor identification
  • Ethernet MAC address
Answer: A, B, D

The short version

ABD — lspci shows PCI hardware identity, IRQ routing and bus speed. It queries the PCI subsystem and its database, so vendor IDs, IRQ assignments and bus link details are in scope while battery type and Ethernet MAC addresses belong to other tools.

Key concepts in this question

  • PCI enumeration: lspci lists devices attached to PCI, PCIe, CardBus and related buses by reading config space and the pci.ids database.
  • Vendor and device identification: each PCI device exposes vendor ID, device ID, subsystem, class and revision, displayed by lspci with numeric and textual forms.
  • IRQ and link details: verbose modes report interrupt pin, IRQ routing, latency, bus width, clock and PCIe link speed and width for each slot.
  • What lspci is not: power, battery, DMI, MAC and IP details come from sysfs, dmidecode, ip link or ethtool, not from PCI config space.
  • Choose-three logic: LFCS multi-select items require each correct choice to be independently true, so eliminate options tied to unrelated subsystems.

Why ABD is correct

lspci is the standard PCI inspection tool, so device IRQ settings, PCI bus speed and width, and vendor identification are exactly the fields it reports in normal and verbose output. Verbose flags add kernel driver, latency, capabilities and link status, confirming all three selections. Battery type is ACPI platform data and MAC address is a network link-layer address, so neither is a PCI bus attribute reported by this command.

Why the others are wrong

  • C. System battery type comes from ACPI, upower or sysfs power supply entries, not from PCI enumeration.
  • E. Ethernet MAC address is shown by ip link, ifconfig or sysfs network entries, not by lspci which shows the controller itself.

LFCS exam tip

Remember lspci equals PCI bus plus verbose equals IRQ plus vendor plus speed, while battery equals ACPI and MAC equals ip link.

3Which of the following commands can be used to locate programs and their corresponding man pages and configuration files?
  • dirname
  • which
  • basename
  • query
  • whereis
Answer: E

The short version

E — whereis finds binaries, man pages, and related source locations together. It reports all three categories from standard system paths in one call.

Key concepts in this question

  • whereis scope: searches standard binary, manual, and source locations and reports each category found for a named program.
  • which scope: resolves only the executable that the current PATH would run, without man pages or configuration files.
  • basename and dirname: pathname splitters that strip directory or trailing components, not system-wide search tools.
  • PATH and standard hierarchy: binaries live under locations such as /bin and /usr/bin, while manuals live under share/man sections.
  • LFCS command selection: exam often contrasts single-purpose locators against broader inventory tools by what artifact types they return.

Why E is correct

whereis is specifically designed to locate the binary, manual page, and source files for a program name in one invocation. That triple coverage matches the stem exactly, whereas the distractors cover only execution lookup or string manipulation. Its search over standard binary directories and manual sections is documented behaviour, so it is the only fit. Vendor prose correctly highlights this breadth of coverage.

Why the others are wrong

  • A. dirname strips directory parts from a path and never searches the filesystem for programs.
  • B. which shows only the executable resolved by PATH, not man pages or configuration files.
  • C. basename strips leading directories or suffixes and performs no lookup of installed files.
  • D. query is not a standard standalone locator for binaries, manuals, and configuration files.

LFCS exam tip

Memorize the trio as which finds run path, whereis finds binary plus manual plus source, and basename plus dirname only edit path strings.

4Which of the following commands changes the number of days before the ext3 filesystem on /dev/sda1 has to run through a full filesystem check while booting?
  • tune2fs -d 200 /dev/sda1
  • tune2fs -c 200 /dev/sda1
  • tune2fs -i 200 /dev/sda1
  • tune2fs -n 200 /dev/sda1
  • tune2fs --days 200 /dev/sda1
Answer: C

The short version

C — tune2fs dash-i sets the max interval between checks. A value of 200 means roughly 200 days before forced fsck at boot, while dash-c counts mounts and other flags do other jobs.

Key concepts in this question

  • tune2fs role: adjusts ext2, ext3 and ext4 superblock parameters including check intervals and mount counts.
  • Interval flag: dash-i takes days, weeks or time suffix and controls time-based forced filesystem checks.
  • Count flag: dash-c sets maximum mount count between checks, which is mount-based rather than time-based.
  • Other flags: dash-d, dash-n and long day options in distractors map to different tunables or do not exist.
  • Boot check trigger: init scripts compare interval and count to decide whether a full check is due.

Why C is correct

Time-based scheduling lives in the superblock interval field, and only dash-i writes that field with a day count. Setting dash-i 200 therefore postpones or advances the calendar check to 200 days from the last check. The count flag changes mount-number logic, the d and n flags touch other filesystem tunables, and the long days spelling is not a valid tune2fs option, so they cannot satisfy the days-before-check requirement.

Why the others are wrong

  • A. Dash-d handles other filesystem attributes and does not set the check interval in days.
  • B. Dash-c sets max mounts between checks, not max days between checks.
  • D. Dash-n adjusts reserved-block or unrelated numeric tunables, not the time interval.
  • E. Double-dash days is not a recognized tune2fs option for this operation.

LFCS exam tip

Remember i for interval days and c for count mounts when tuning fsck scheduling.

5Which type of filesystem is created by mkfs when it is executed with the block device name only and without any additional parameters?
  • ext2
  • ext3
  • ext4
  • XFS
  • VFAT
Answer: A

The short version

A — bare mkfs defaults to ext2. Without type or option flags the classic mkfs wrapper builds an ext2 filesystem on the given device.

Key concepts in this question

  • mkfs wrapper: mkfs dispatches to filesystem-specific builders based on type flag or compiled default.
  • Historical default: traditional Linux mkfs without dash-t defaulted to ext2 before ext3 and ext4 became common explicit choices.
  • Explicit types: ext3, ext4, XFS and VFAT each require type selection or dedicated mkfs dot-type helpers.
  • Exam settled behavior: LFCS bank treats bare invocation as ext2 creation for this trivia item.
  • Verification path: blkid or superblock inspection would reveal the resulting type after creation.

Why A is correct

The settled key reflects classic behavior where mkfs with only a device name invokes the ext2 builder. No journal, extent or FAT structures are created unless requested, so ext3, ext4, XFS and VFAT outcomes would each need extra parameters. That makes ext2 the only result consistent with doing nothing beyond naming the block device.

Why the others are wrong

  • B. Ext3 needs journaling options or explicit type and is not the bare default.
  • C. Ext4 needs explicit selection for extents and modern features, not bare invocation.
  • D. XFS uses a separate builder and type flag and is never the generic default.
  • E. VFAT is for removable media and needs explicit FAT type selection.

LFCS exam tip

Remember bare mkfs equals ext2 in classic LFCS trivia, always add dash-t for others.

6How many fields are in a syntactically correct line of /etc/fstab?
  • 3
  • 4
  • 5
  • 6
  • 7
Answer: D

The short version

D — fstab lines contain six fields. Device, mountpoint, type, options, dump and pass together form a syntactically complete entry.

Key concepts in this question

  • Filesystem field: names the device, UUID, label or remote share to be mounted.
  • Mountpoint and type: second field gives the directory target and third gives ext4, xfs, nfs and similar types.
  • Options field: fourth field holds comma-separated flags like defaults, noauto, ro and relatime.
  • Dump and pass: fifth field guides dump backups and sixth guides fsck boot order.
  • Count stability: missing or extra whitespace-separated columns make the line incomplete or invalid.

Why D is correct

Standard fstab documentation defines exactly six whitespace-separated columns in order, and parsers expect all six for full validation. The vendor table listing filesystem, mountpoint, type, options, dump and pass confirms the six-column shape. Counts of three through five omit required backup or check ordering data, while seven adds a nonexistent column, so only six is syntactically correct.

Why the others are wrong

  • A. Three fields cover only device plus mountpoint plus type and omit options and check data.
  • B. Four fields still lack dump and pass ordering needed for boot checks.
  • C. Five fields omit one of the final numeric fields and remain incomplete.
  • E. Seven fields add an extra column beyond the documented six-field layout.

LFCS exam tip

Remember six fstab fields with dump five and pass six for boot order.

7How can the existing environment variable FOOBAR be suppressed for the execution of the script./myscript only?
  • unset -v FOOBAR;./myscript
  • set -a FOOBAR="";./myscript
  • env -u FOOBAR./myscript
  • env -i FOOBAR./myscript
Answer: C

The short version

C is the right answer. Use env with the unset flag to run one command without FOOBAR while leaving the current shell unchanged.

Key concepts in this question

  • Environment inheritance: children receive a copy of exported variables, so filtering that copy hides a name from one command.
  • env for one shot: env builds a modified environment for a single child without altering the calling shell.
  • unset scope: unset -v deletes the name from the current shell itself, which persists after the script ends.
  • Empty is present: assigning an empty string still exports the name, while unsetting removes it entirely.

Why C is correct

Option C runs ./myscript with FOOBAR removed from the child environment, which matches for the execution of ./myscript only. The env tool deletes the entry, then execs the script, so the parent keeps FOOBAR for later use. This is the documented unset behavior before running the command. It preserves PATH, HOME, and all other exports. The bank text missing a space is a typo, the spaced form env -u FOOBAR ./myscript is standard and portable on Linux.

Why the others are wrong

  • A unset then run: clears FOOBAR from the interactive shell, so suppression is not limited to one invocation and later commands lose it.
  • B empty string: still passes the name on, so tests for presence versus emptiness still see FOOBAR defined.
  • D env -i misuse: starts from an empty environment and wipes every variable, far broader than hiding one name and likely to break the script.

LFCS exam tip

Remember env -u NAME CMD for single-command removal versus unset for permanent removal, and env -i means start empty.

8Which of the following commands creates an ext3 filesystem on /dev/sdb1? (Choose TWO correct answers.)
  • /sbin/mke2fs -j /dev/sdb1
  • /sbin/mkfs -t ext3 /dev/sdb1
  • /sbin/mkfs -c ext3 /dev/sdb1
  • /sbin/mke3fs -j /dev/sdb1
Answer: A, B

The short version

AB — mke2fs with journaling and mkfs with explicit ext3 type both build ext3. One enables the journal flag, the other declares the filesystem type directly.

Key concepts in this question

  • ext2 versus ext3: ext3 is functionally ext2 plus a journal, so adding a journal to an ext2 builder yields ext3.
  • mke2fs -j: the -j option creates the journal, converting the default ext2 layout into ext3 on the target device.
  • mkfs front end: mkfs dispatches to filesystem builders, with -t selecting type such as ext3 for the named partition.
  • mkfs -c behaviour: the -c option checks for bad blocks rather than selecting filesystem type for the new volume.
  • Nonexistent builders: standard e2fsprogs provides mke2fs and mkfs.ext3 helpers but no mke3fs command.

Why AB is correct

Option A works because mke2fs builds ext2 by default and -j adds the journal that defines ext3, producing the requested filesystem on the target partition. Option B works because mkfs -t ext3 explicitly selects the ext3 builder for the same device, which is the canonical modern form. Both paths converge on an ext3 layout with journal, superblock, and inode tables. Vendor prose correctly identifies this pair as the two valid spellings.

Why the others are wrong

  • C. mkfs -c requests a bad-blocks scan and does not select ext3 as the filesystem type.
  • D. mke3fs is not a standard utility, so the command fails even with -j supplied.

LFCS exam tip

Remember ext3 equals ext2 plus journal, so mke2fs -j and mkfs -t ext3 are equivalent builders, while -c always means check blocks.

9Which of the following commands will change the quota for a specific user?
  • edquota
  • repquota
  • quota -e
  • quota
Answer: A

The short version

A — edquota edits quota limits for a named user or group. It opens the stored limits in an editor so soft and hard values can change safely.

Key concepts in this question

  • Disk quota model: block and inode limits with soft grace and hard ceiling per user or group per filesystem.
  • edquota role: designated editor for quota records, taking a username or group name and updating kernel and quota files.
  • repquota role: reporting tool that summarizes usage and limits across users, without editing capability.
  • quota role: display tool showing current usage and limits for the caller or a named user.
  • Privilege and flow: quota changes normally require root, with quotacheck and quotaon state already active on the filesystem.

Why A is correct

edquota is the only listed utility that writes new soft and hard block and inode limits for a specific account, typically via sudo edquota plus username. It modifies the persistent quota database that the kernel then enforces, while the other commands only display or summarize. That edit-versus-report distinction is the standard documented division of labour. Vendor prose correctly shows the john example workflow for this task.

Why the others are wrong

  • B. repquota prints usage reports for filesystems but provides no editing path for limits.
  • C. quota -e is not a valid editing invocation, since quota lacks an edit mode for limits.
  • D. quota displays current consumption and limits but cannot alter stored quota values.

LFCS exam tip

Pair edit with edquota, report with repquota, and view with quota to answer every quota verb question instantly.

10Which utility would be used to change how often a filesystem check is performed on an ext2 filesystem without losing any data stored on that filesystem?
  • mod2fs
  • fsck
  • tune2fs
  • mke2fs
  • fixe2fs
Answer: C

The short version

C — tune2fs adjusts ext2 and ext3 parameters without reformatting. It rewrites superblock tunables such as check interval while leaving data intact.

Key concepts in this question

  • tune2fs purpose: tuner for ext2, ext3, and ext4 superblock fields without data loss or rebuild.
  • Check interval and mount count: -i sets maximum time between checks and -c sets mounts between checks, both enforced at boot.
  • fsck purpose: checker that verifies and repairs inconsistencies, but does not set future scheduling policy by itself.
  • mke2fs effect: filesystem creator that writes a fresh filesystem and therefore destroys existing data on the target.
  • Fictional names: mod2fs and fixe2fs are not standard ext tuning utilities in e2fsprogs.

Why C is correct

tune2fs is documented to modify parameters such as maximum mount count and check interval directly in the superblock, requiring no backup restore or reformat. That lets an administrator lengthen or shorten how often boot-time checks occur while user data remains untouched. The other real tool either checks or creates, and the invented names have no function. Vendor prose correctly centers on interval control for this stem.

Why the others are wrong

  • A. mod2fs is not a standard utility for tuning ext2 check behaviour.
  • B. fsck checks and repairs a filesystem but does not set its future check interval policy.
  • D. mke2fs creates a new filesystem and would destroy data rather than retune it.
  • E. fixe2fs is not a standard utility for adjusting ext2 parameters.

LFCS exam tip

Think tune for adjust, fsck for fix, and mke2fs for make new, then map interval questions straight to tune2fs with -i and -c.

Want the full bank of 140 questions for Linux Foundation Certified System Administrator (LFCS)? See all practice exams.