LPIC-1 sample questions with answers

10 free LPIC-1 sample questions across the exam's domains, each with its answer and an explanation. No account needed.

LPIC-1 sample questions

LPIC-1: Linux Administrator, Linux Professional Institute (LPI).

  1. Question 1

    Domain: Topic 101: System Architecture

    A USB serial adapter needs a stable symlink /dev/gps0, and the distribution ships a rule file with the same name that you want to override.

    Where should a local udev rule go so that it is kept across package updates and takes precedence over a vendor rule with the same file name?

    1. /usr/lib/udev/rules.d/
    2. /dev/udev/rules.d/
    3. /sys/class/udev/
    4. /etc/udev/rules.d/
    Show the answer

    Answer: D. /etc/udev/rules.d/

    udev reads rules from /usr/lib/udev/rules.d (vendor), /run/udev/rules.d and /etc/udev/rules.d, and a file in /etc overrides a same-named file from the system directories. Editing /usr/lib/udev/rules.d is the tempting wrong answer: that directory belongs to packages and changes there can be overwritten on upgrade.

    Checked against: https://man7.org/linux/man-pages/man7/udev.7.html

  2. Question 2

    Domain: Topic 102: Linux Installation and Package Management

    You added a vendor repository line to a file under /etc/apt/sources.list.d/, but apt-get install reports that the package cannot be located.

    What must you run before apt-get install can find packages from the new repository?

    1. apt-get upgrade
    2. apt-get update
    3. dpkg --configure -a
    4. apt-cache policy --refresh
    Show the answer

    Answer: B. apt-get update

    apt-get update downloads the package indexes from every configured source, so new repositories become visible only after it runs. apt-get upgrade is tempting, but it installs newer versions of already installed packages using the indexes you already have.

    Checked against: https://learning.lpi.org/en/learning-materials/101-500/102/102.4/

  3. Question 3

    Domain: Topic 103: GNU and Unix Commands

    Which command creates the directory /srv/app/releases/v2 including any missing parent directories?

    1. mkdir -p /srv/app/releases/v2
    2. mkdir -r /srv/app/releases/v2
    3. mkdir -m /srv/app/releases/v2
    4. touch -d /srv/app/releases/v2
    Show the answer

    Answer: A. mkdir -p /srv/app/releases/v2

    mkdir -p creates each missing parent in the path and does not complain if the directory already exists. -m is tempting because it is a real mkdir option, but it sets the permission mode of the new directory and takes a mode argument.

    Checked against: https://man7.org/linux/man-pages/man1/mkdir.1.html

  4. Question 4

    Domain: Topic 104: Devices, Linux Filesystems, Filesystem Hierarchy Standard

    umount /mnt/backup fails with 'target is busy', and you need to find out why before trying again.

    Which command shows the processes that keep the mount point busy?

    1. df -h /mnt/backup
    2. lsblk -f /mnt/backup
    3. umount -f /mnt/backup
    4. fuser -vm /mnt/backup
    Show the answer

    Answer: D. fuser -vm /mnt/backup

    fuser -m reports the processes using any file on the filesystem mounted at that path, and -v adds user and access details (lsof /mnt/backup is an alternative). umount -f is tempting, but it forces the unmount, mainly for unreachable NFS servers, instead of telling you what is using the filesystem.

    Checked against: https://man7.org/linux/man-pages/man1/fuser.1.html

  5. Question 5

    Domain: Topic 105: Shells and Shell Scripting

    When does the line mkdir /backup && cp data.db /backup || echo failed print 'failed'?

    1. Only when mkdir fails
    2. Only when cp fails
    3. Never, because && and || cannot be combined
    4. When either mkdir or cp returns a non-zero status
    Show the answer

    Answer: D. When either mkdir or cp returns a non-zero status

    && and || have equal precedence and are evaluated left to right, so the echo runs whenever the preceding list (mkdir && cp) ends with a non-zero status, whether mkdir failed and cp was skipped or cp itself failed. 'Only when cp fails' is tempting, but a failed mkdir also makes the list fail, for example when /backup already exists.

    Checked against: https://www.gnu.org/software/bash/manual/html_node/Lists.html

  6. Question 6

    Domain: Topic 106: User Interfaces and Desktops

    You manage several KVM guests and want a remote console protocol that supports features like clipboard sharing and USB redirection for the guests.

    Which remote display protocol was designed specifically for accessing the graphical console of virtual machines, for example under KVM/QEMU?

    1. XDMCP
    2. RDP
    3. SPICE
    4. SMTP
    Show the answer

    Answer: C. SPICE

    SPICE was designed for virtualised environments and is used by QEMU/KVM and tools such as virt-viewer. RDP is tempting because it is a remote desktop protocol too, but it comes from Microsoft Windows and is not a VM console protocol.

    Checked against: https://learning.lpi.org/en/learning-materials/102-500/106/106.2/

  7. Question 7

    Domain: Topic 107: Administrative Tasks

    You have reset bob's password to a temporary value and given it to him over the phone.

    Which command forces bob to choose a new password the next time he logs in, without locking the account?

    1. chage -E 0 bob
    2. usermod -L bob
    3. chage -d 0 bob
    4. passwd -d bob
    Show the answer

    Answer: C. chage -d 0 bob

    Setting the last password change date to 0 with chage -d 0 marks the password as expired, so the user must change it at the next login. chage -E 0 is the tempting look-alike, but -E sets the account expiry date, which disables the account instead of prompting for a new password.

    Checked against: https://man7.org/linux/man-pages/man1/chage.1.html

  8. Question 8

    Domain: Topic 108: Essential System Services

    Which of these programs is a Mail Transfer Agent (MTA)?

    1. Dovecot
    2. Postfix
    3. Thunderbird
    4. procmail
    Show the answer

    Answer: B. Postfix

    Postfix, like Sendmail and Exim, is an MTA that accepts and relays mail over SMTP. Dovecot is tempting because it runs on mail servers too, but it is an IMAP/POP3 server that lets clients read mailboxes.

    Checked against: https://learning.lpi.org/en/learning-materials/102-500/108/108.3/

  9. Question 9

    Domain: Topic 109: Networking Fundamentals

    You want to test name resolution for app.internal exactly as a web application on the server would see it.

    Which command resolves a name the same way applications do, honouring /etc/nsswitch.conf and /etc/hosts?

    1. host app.internal
    2. dig app.internal
    3. getent hosts app.internal
    4. nslookup app.internal
    Show the answer

    Answer: C. getent hosts app.internal

    getent queries the NSS databases in the order configured in /etc/nsswitch.conf, so it shows exactly what programs using the system resolver will get. host is tempting as a simple lookup tool, but like dig and nslookup it queries DNS servers directly and ignores /etc/hosts.

    Checked against: https://man7.org/linux/man-pages/man1/getent.1.html

  10. Question 10

    Domain: Topic 110: Security

    ssh server1 fails with 'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!' after the server was reinstalled.

    What is the correct step once you have confirmed with the administrator that the server was rebuilt?

    1. Remove the old key with ssh-keygen -R server1 and connect again to accept the new key
    2. Delete ~/.ssh/id_rsa and create a new user key pair with ssh-keygen, then copy it to server1
    3. Set StrictHostKeyChecking no permanently in ~/.ssh/config so the warning is never shown again
    4. Copy /etc/ssh/ssh_host_rsa_key from the server into your ~/.ssh directory and connect again
    Show the answer

    Answer: A. Remove the old key with ssh-keygen -R server1 and connect again to accept the new key

    The warning comes from your known_hosts entry for server1, and ssh-keygen -R removes that entry so that the new host key can be verified and stored. Regenerating your own key pair is tempting but irrelevant: the mismatch concerns the server's host key, not your user key.

    Checked against: https://man.openbsd.org/ssh-keygen

More practice

A 20-question practice sampler is free with an account; Pro adds the full question bank and timed mock exams.

LPIC-1 course and practice exam: Linux Administrator (101-500 and 102-500): the exam guide, with the format, cost, pass mark and domains from the vendor.