All LPI exams

Free 101-500 practice test: 30 questions with answers

30 original questions for LPIC-1 Exam 101, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.

Free questions
30
Full bank
112 questions
Real exam
60 questions, 90 min

101-500 exam guide: topics, cost and format

All 30 101-500 questions with answers

The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.

103 GNU and Unix Commands (8 questions)

  1. Question 1

    A user wants to rerun the most recent bash command that begins with ssh without retyping it. Which input does this?

    1. ATyping %ssh at the prompt
    2. BTyping !! at the prompt
    3. CTyping $ssh at the prompt
    4. DTyping !ssh at the prompt
    Show answer and explanation
    Correct answer: D

    !ssh is history expansion that reruns the latest command starting with ssh. !! reruns the previous command in full, $ssh expands a shell variable named ssh, and %ssh refers to a job in job control rather than the history.

  2. Question 2

    A script must show only the first ten lines of a large text file on standard output. Which filter does this by default?

    1. Atail
    2. Btac
    3. Cwc
    4. Dhead
    Show answer and explanation
    Correct answer: D

    head prints the first ten lines of its input by default. tail prints the last lines, tac prints lines in reverse order, and wc counts lines, words and bytes instead of showing the text.

  3. Question 3

    An administrator has a file named ips.txt with one client IP address per line and wants a count of each address, most frequent first. Which pipeline produces this?

    1. Auniq ips.txt | sort -rn
    2. Bgrep -c . ips.txt | sort -rn
    3. Cwc -l ips.txt | uniq -c
    4. Dsort ips.txt | uniq -c | sort -rn
    Show answer and explanation
    Correct answer: D

    uniq only collapses adjacent duplicate lines, so the input must be sorted first; uniq -c then prefixes each line with its count, and sort -rn orders the results from highest to lowest. Running uniq without sorting misses repeats that are not adjacent, grep -c . only counts non-empty lines, and wc -l gives a single total.

  4. Question 4

    A script prints its normal results to the terminal but sends its error messages to standard error. Which redirection saves only the error messages in errors.log?

    1. AAppend 2> errors.log to the command
    2. BAppend &> errors.log to the command
    3. CAppend < errors.log to the command
    4. DAppend > errors.log to the command
    Show answer and explanation
    Correct answer: A

    2> redirects file descriptor 2, standard error, to the file while standard output stays on the terminal. > sends only standard output to the file, &> sends both streams to the file, and < feeds the file's contents to standard input instead.

  5. Question 5

    Which two statements about pipes and redirection in a Unix shell are correct? (Choose two.)

    1. AA pipe carries only standard error from the first command to the second
    2. BA pipe connects the standard output of one command to the standard input of the next command
    3. CA pipe stores intermediate data in a temporary file on disk between the two commands
    4. DThe tee command copies its input to a file and also writes it to standard output
    Show answer and explanation
    Correct answer: B, D

    A pipe feeds standard output into the next command's standard input, and tee writes its input to a named file and to standard output at the same time. A pipe carries standard output by default rather than standard error, and its data passes through a kernel buffer rather than a temporary file on disk.

  6. Question 6

    Which signal sent to a process cannot be caught, blocked or ignored by that process?

    1. ASIGHUP
    2. BSIGTERM
    3. CSIGKILL
    4. DSIGINT
    Show answer and explanation
    Correct answer: C

    SIGKILL is enforced by the kernel and cannot be caught, blocked or ignored, so the process gets no chance to clean up. SIGTERM, SIGHUP and SIGINT can all be handled by a program, which is why they are often used to request a clean shutdown or a configuration reload.

  7. Question 7

    An administrator needs the process ID of the running sshd daemon so it can be used in a later kill command. Which command prints the matching PIDs directly?

    1. Apgrep sshd
    2. Buname -a
    3. Cdf -h
    4. Dwhich sshd
    Show answer and explanation
    Correct answer: A

    pgrep searches the running process table by name and prints the PIDs of matching processes. uname -a shows kernel details, the which command only shows the path of an executable, and df -h reports disk space usage.

  8. Question 8

    A nightly backup job competes with interactive users for CPU time. Which command starts the job with the lowest scheduling priority?

    1. Anice -n 19 ./backup.sh
    2. Bnice -n -19 ./backup.sh
    3. Ctime ./backup.sh
    4. Dnohup ./backup.sh &
    Show answer and explanation
    Correct answer: A

    Niceness ranges from -20 (highest priority) to 19 (lowest), so nice -n 19 gives the backup the smallest CPU share. A negative value raises priority and requires root, time only reports how long a command took, and nohup only protects the job from hangup signals.

104 Devices, Linux Filesystems, Filesystem Hierarchy Standard (8 questions)

  1. Question 9

    A newly created partition /dev/sdb1 must be formatted with the ext4 filesystem. Which command creates the filesystem on it?

    1. Afsck.ext4 /dev/sdb1
    2. Bfdisk /dev/sdb1
    3. Cmkfs.ext4 /dev/sdb1
    4. Dmount /dev/sdb1 /mnt
    Show answer and explanation
    Correct answer: C

    mkfs.ext4 writes a new ext4 filesystem onto the partition. fsck.ext4 checks an existing filesystem, fdisk edits partition tables rather than creating filesystems, and mount attaches a filesystem to the directory tree.

  2. Question 10

    Why should a read-write filesystem that is still mounted not be checked with fsck?

    1. AIt deletes every user file on any mounted filesystem it checks
    2. BIt can alter metadata while the kernel is using the filesystem
    3. CIt can only read the superblock and cannot repair any errors
    4. DIt forces the system into single-user mode before it can run
    Show answer and explanation
    Correct answer: B

    fsck writes repairs to on-disk structures, and if the kernel is writing to the same filesystem at the same time the metadata can be corrupted, which is why the filesystem should be unmounted or checked read-only. The other options describe behaviour that is wrong for fsck: it does not wipe user files, it is not limited to reading the superblock, and it does not change the runlevel.

  3. Question 11

    An administrator wants a data partition to be mounted automatically at every boot with the same options. Which file defines these persistent mount entries?

    1. A/etc/fstab
    2. B/etc/exports
    3. C/etc/hosts
    4. D/etc/mtab
    Show answer and explanation
    Correct answer: A

    /etc/fstab lists the devices, mount points and options that the system mounts at boot. /etc/mtab reflects what is currently mounted rather than configuring mounts, /etc/exports defines NFS shares for a server, and /etc/hosts maps host names to addresses.

  4. Question 12

    A project directory must let its owner read, write and enter it, let group members read and enter it, and give other users no access at all. Which octal mode sets this?

    1. A640
    2. B750
    3. C755
    4. D700
    Show answer and explanation
    Correct answer: B

    750 gives the owner rwx (7), the group r-x (5) and others nothing (0). 640 removes execute for the owner and group so the directory cannot be entered, 755 gives other users read and enter access, and 700 removes all group access.

  5. Question 13

    Which statement about a hard link is correct?

    1. AIt shares the inode of the original file, so the data remains until every link is removed
    2. BIt stores only the path of the target, so it breaks if that path is later moved
    3. CIt is deleted automatically whenever the original file is removed from the disk
    4. DIt can point to a file located on a different filesystem than the link itself
    Show answer and explanation
    Correct answer: A

    A hard link is another directory entry for the same inode, so the data is freed only after the last link is removed. The path-storing description fits a symbolic link instead, a hard link cannot span filesystems, and removing the original file does not remove its hard links.

  6. Question 14

    An administrator compiles a utility from source and wants it kept apart from files owned by the distribution's package manager. Which default install prefix is conventional for this?

    1. A/usr/local
    2. B/bin
    3. C/etc
    4. D/usr/bin
    Show answer and explanation
    Correct answer: A

    /usr/local is the FHS location for software installed by the administrator outside package-managed trees. /usr/bin holds executables owned by the package manager, /bin holds essential system binaries, and /etc holds configuration rather than programs.

  7. Question 15

    A server has one SATA disk that appears as /dev/sda. Which device file names its second partition?

    1. A/dev/sda2
    2. B/dev/sd2a
    3. C/dev/sda02
    4. D/dev/hda2
    Show answer and explanation
    Correct answer: A

    Partitions append their number to the whole-disk name, so the second partition of /dev/sda is /dev/sda2. /dev/sd2a and /dev/sda02 do not follow the naming scheme, and /dev/hda2 refers to a legacy IDE disk rather than a SATA disk.

  8. Question 16

    Writes to a filesystem fail with 'No space left on device', yet df -h shows free blocks. Which command shows whether the filesystem has run out of inodes?

    1. Adf -h
    2. Bdu -sh /var
    3. Clsblk -f
    4. Ddf -i
    Show answer and explanation
    Correct answer: D

    df -i reports inode usage per filesystem, and a filesystem can refuse new files when its inodes are exhausted even with free blocks. df -h reports only block space, du -sh measures the size of a directory tree, and lsblk -f lists block devices with their filesystem details.

102 Linux Installation and Package Management (7 questions)

  1. Question 17

    Which two statements about Debian package tools are accurate? (Choose two.)

    1. Adpkg installs or removes a single .deb file without fetching its missing dependencies from repositories
    2. Bapt cannot install a .deb file that is stored on the local disk
    3. Capt uses the configured repository lists to resolve and download the dependencies of a package
    4. Ddpkg reads the repository list in /etc/apt/sources.list to resolve dependencies
    Show answer and explanation
    Correct answer: A, C

    dpkg works only on the package file it is given and does not download missing dependencies, while apt consults the configured repositories to resolve and fetch them. apt can install a local .deb by path, and dpkg does not use the apt repository list at all.

  2. Question 18

    A sysadmin on a RHEL-family system has downloaded a single .rpm file and wants any missing dependencies pulled from the enabled repositories. Which command is the best choice?

    1. Arpm -ivh package.rpm
    2. Brpm -ivh --nodeps package.rpm
    3. Cdnf install ./package.rpm
    4. Drpm -e package
    Show answer and explanation
    Correct answer: C

    dnf (or yum on older systems) installs a local .rpm path and resolves its dependencies from the enabled repositories. rpm -ivh installs the file without looking up missing dependencies, --nodeps skips the dependency check entirely, and rpm -e removes a package instead of installing one.

  3. Question 19

    Which command displays the shared libraries that a dynamically linked executable needs at runtime?

    1. Aldconfig -v
    2. Bfile /usr/bin/myprog
    3. Cstrip /usr/bin/myprog
    4. Dldd /usr/bin/myprog
    Show answer and explanation
    Correct answer: D

    ldd prints each shared library a dynamic executable depends on and the path where the dynamic linker resolves it. ldconfig -v rebuilds the linker cache and does not inspect one executable, strip removes symbol information, and file only reports the file type.

  4. Question 20

    After a vendor library is copied into /opt/vendor/lib, a program fails with an error saying the shared library cannot be opened. What is the standard fix?

    1. ACopy the library into /usr/bin so it is on the default search path
    2. BAdd the path to a file in /etc/ld.so.conf.d and run ldconfig
    3. CSet the execute bit on the library file with chmod +x
    4. DAdd /opt/vendor/lib to the PATH variable in the shell profile
    Show answer and explanation
    Correct answer: B

    The dynamic linker searches only the directories listed in /etc/ld.so.conf, including the files in /etc/ld.so.conf.d, and ldconfig rebuilds its cache, so adding the path there and running ldconfig makes the library visible. Copying to /usr/bin does not place it where the linker searches, chmod does not affect library loading, and PATH only controls where executables are found.

  5. Question 21

    A Linux virtual machine running on a KVM host needs fast paravirtualized disk and network I/O instead of emulated hardware. Which driver family should the guest kernel use?

    1. AEmulated e1000 network drivers
    2. Bvirtio paravirtualized drivers
    3. CACPI power management drivers
    4. DiSCSI initiator modules
    Show answer and explanation
    Correct answer: B

    virtio provides paravirtualized block and network drivers that KVM guests use for efficient I/O. Emulated e1000 presents an emulated NIC with more overhead, ACPI handles power and platform events, and iSCSI is a storage protocol rather than a driver family for virtual hardware.

  6. Question 22

    A server's log directory keeps growing and has repeatedly filled the root filesystem. Which mount point is the best candidate for its own partition so that log growth cannot starve the rest of the system?

    1. A/home
    2. B/var
    3. C/opt
    4. D/srv
    Show answer and explanation
    Correct answer: B

    /var holds variable data such as logs and spool files, so a separate partition keeps its growth from filling /. /home holds user data, /opt holds add-on packages, and /srv holds data served by the system, and none of these is the usual home of growing logs.

  7. Question 23

    On a Debian system, an administrator wants to refresh the local list of available package versions from the configured repositories without installing any upgrades yet. Which command does this?

    1. Aapt-get upgrade
    2. Bapt-get clean
    3. Cdpkg --configure -a
    4. Dapt-get update
    Show answer and explanation
    Correct answer: D

    apt-get update downloads fresh package indexes from the configured repositories and leaves installed software unchanged. apt-get upgrade installs newer versions of installed packages, dpkg --configure -a finishes configuring partly installed packages, and apt-get clean empties the local package cache.

101 System Architecture (7 questions)

  1. Question 24

    An administrator is installing Linux on a new server that uses UEFI firmware. Which partition must the firmware be able to read so it can locate and start the bootloader?

    1. AThe BIOS boot partition
    2. BThe swap partition
    3. CThe EFI System Partition
    4. DThe root partition formatted as XFS
    Show answer and explanation
    Correct answer: C

    UEFI firmware loads boot files from the EFI System Partition, a FAT-formatted partition that holds the bootloader binaries. The BIOS boot partition serves GRUB on GPT disks under legacy BIOS, swap is used for paging, and firmware does not read the root filesystem directly.

  2. Question 25

    On a systemd-based system, which target is the closest equivalent of SysV runlevel 3, a multi-user text mode without a graphical desktop?

    1. Arescue.target
    2. Bgraphical.target
    3. Cmulti-user.target
    4. Dpoweroff.target
    Show answer and explanation
    Correct answer: C

    multi-user.target corresponds to runlevel 3, with networking and services running on a text console and no display manager. graphical.target maps to runlevel 5, rescue.target to single-user runlevel 1, and poweroff.target to halting the system, which is runlevel 0.

  3. Question 26

    A technician must confirm that a network card and a graphics adapter installed in a Linux server are detected on the PCI bus. Which command lists the PCI devices known to the kernel?

    1. Alsusb
    2. Blsmod
    3. Clsblk
    4. Dlspci
    Show answer and explanation
    Correct answer: D

    lspci lists devices attached to the PCI bus, where network and graphics adapters are normally connected. lsusb lists USB devices, lsmod lists loaded kernel modules, and lsblk lists block devices such as disks and partitions.

  4. Question 27

    Which two statements describe the early boot sequence of a typical Linux system? (Choose two.)

    1. AThe init process mounts filesystems from /etc/fstab before the kernel is loaded from disk
    2. BFirmware runs a power-on self-test and then loads the bootloader from a configured boot device
    3. CThe kernel reads its boot menu entries from the user account database in /etc/passwd
    4. DThe bootloader loads the kernel and an initial RAM filesystem into memory before the kernel starts
    Show answer and explanation
    Correct answer: B, D

    Firmware performs POST and hands control to a bootloader such as GRUB, which loads the kernel and initramfs, so B and D are correct. A is wrong because init runs only after the kernel has started, and C is wrong because boot menu entries are read by the bootloader while /etc/passwd holds user accounts.

  5. Question 28

    What is the main purpose of the initial RAM filesystem that the bootloader loads alongside the Linux kernel?

    1. AIt stores the home directories of users during the early boot process
    2. BIt provides drivers and tools to mount the real root filesystem
    3. CIt replaces the kernel's scheduler until the first user logs in
    4. DIt records every log message that is written during the boot sequence
    Show answer and explanation
    Correct answer: B

    The initramfs is a temporary root filesystem in memory that holds the drivers and tools needed to find and mount the real root filesystem. It does not hold user home directories, replace the kernel scheduler, or store the boot log, which are not its job.

  6. Question 29

    A headless server should boot to a text console from now on, and the change must survive reboots. Which systemd command achieves this?

    1. Asystemctl set-default multi-user.target
    2. Bsystemctl isolate multi-user.target
    3. Csystemctl set-default graphical.target
    4. Dsystemctl start graphical.target
    Show answer and explanation
    Correct answer: A

    set-default changes the target that systemd starts at boot, so the change persists across reboots. isolate multi-user.target switches to text mode immediately but leaves the boot default unchanged, set-default graphical.target would boot to the desktop, and start graphical.target launches the desktop for the current session only.

  7. Question 30

    A Linux administrator needs the CPU model name and the list of processor feature flags without installing any tools. Which file under /proc provides this?

    1. A/proc/meminfo
    2. B/proc/cpuinfo
    3. C/proc/partitions
    4. D/proc/version
    Show answer and explanation
    Correct answer: B

    /proc/cpuinfo is a kernel-generated file that lists each processor's model name and feature flags. /proc/meminfo reports memory usage, /proc/partitions lists known block devices and their sizes, and /proc/version shows the kernel version string.