LPI · Free Practice Questions · Last reviewed May 2026
30 real exam-style questions organised by domain, each with the correct answer highlighted and a plain-English explanation of why it's right — and why the others are wrong.
You are managing a directory shared by a project team. You want all files created in this directory to automatically belong to the 'developers' group, regardless of the user's primary group. Which command achieves this?
usermod -aG developers
chgrp developers /data
chmod g+s /data
chmod g+s sets the setgid bit on the directory, so newly created files inherit the directory's group (developers) rather than the creator's primary group. This satisfies the stem's requirement that all files automatically belong to the developers group regardless of the user's primary group.
chmod 1777 /data
You want to change the primary group of an existing user named 'bob' to 'staff'. Which command should you use?
groupmod -n staff bob
chgrp staff bob
usermod -g staff bob
`usermod -g staff bob` sets bob's primary group, satisfying the requirement to change an existing user's primary group. The lowercase `-g` flag specifically assigns the primary group, whereas uppercase `-G` would only add supplementary groups, leaving the primary group unchanged.
usermod -G staff bob
A system administrator needs to identify the numerical ID (UID) of the user 'jdoe'. Which file should be checked?
/etc/shadow
/etc/profile
/etc/passwd
The /etc/passwd file stores one colon-separated record per account, and its third field holds the numeric UID. Reading it directly reveals jdoe's UID, satisfying the requirement to identify the numerical identifier rather than a username or group ID.
/etc/group
A user's account has been compromised. Which command is the most effective way to lock the user account immediately while preserving their files?
usermod -L jdoe
usermod -L prefixes the password hash with an exclamation mark in /etc/shadow, immediately disabling password logins while leaving the account's home directory and files untouched. This locks access without deleting data, unlike userdel, which would remove the account and its files.
userdel jdoe
killall -u jdoe
chsh -s /bin/false jdoe
Which permission bit must be set on a directory to allow a user to enter the directory and access files within it?
Write (w)
Execute (x)
Execute (x) permission on a directory grants traverse rights, letting a user pass through it and reach files inside. Without it, path resolution fails even if the files themselves are readable, so x satisfies the stem's requirement to enter the directory and access its contents.
Sticky bit
Read (r)
You are configuring a temporary directory where multiple users save files. To ensure that users can only delete their own files and not files created by others, what must you set?
chown root /tmp/shared
chmod 777 /tmp/shared
umask 077
chmod +t /tmp/shared
The sticky bit on a directory restricts deletion and renaming to each file's owner, the directory owner, or root. Setting chmod +t on the shared directory enforces exactly the constraint that users cannot delete others' files.
Want more Security And File Permissions practice?
Practice this domainYou want to delete a directory named 'temp_backup' that contains several files. Which command will successfully remove it and its contents?
rm -r temp_backup
The `-r` flag makes `rm` recurse into the directory, deleting its files and subdirectories before removing `temp_backup` itself. Without it, `rm` refuses to act on directories. This satisfies the stem's requirement to remove a non-empty directory and all its contents in one command.
rm temp_backup
rmdir temp_backup
rm -f temp_backup
To navigate from your current directory to your home directory regardless of your current location, which command is most efficient?
cd ..
cd ~
The tilde expands to the value of $HOME, so `cd ~` resolves to your home directory from any working directory in a single step. This satisfies the stem's "regardless of your current location" constraint without needing an absolute path or multiple commands.
cd /
cd /home
Which of the following commands is used to create an empty file or update the timestamp of an existing file?
cp
touch
The `touch` command creates a zero-byte file when the target does not exist, and updates the access and modification timestamps to the current time when it does. This dual behaviour directly satisfies the stem's requirement to either create an empty file or refresh an existing file's timestamp.
mkdir
mv
You are copying a directory named 'source' to 'destination' and want to ensure all subdirectories and file attributes are preserved. Which flag is essential?
cp -a
The `-a` flag combines `-R`, `-p` and `-d`, recursively copying while preserving permissions, ownership, timestamps and symbolic links. This directly satisfies the stem's requirement that all subdirectories and file attributes survive the copy, which a plain `cp -R` would not guarantee.
cp -p
cp -v
cp -r
You are using the 'less' command to view a large log file. Which key do you press to search forward for a specific string?
?
/
Within the pager, pressing / opens a forward search prompt, letting you type a string and jump to its next occurrence in the log. This satisfies the requirement to search forward through the file's contents without leaving less.
q
n
You need to search for a specific command description within the manual pages using a keyword. Which command should you use?
man -s
man -f
man -k
`man -k` searches the manual page's short descriptions (the whatis database) for a keyword, returning every matching entry. This directly satisfies the stem's requirement to locate a command by keyword rather than browsing a single page, which plain `man` cannot do.
help
Want more Finding Your Way ON A Linux System practice?
Practice this domainYou want to find all occurrences of the string 'ERROR' within the 'syslog' file. Which command is most appropriate?
cat 'ERROR' syslog
find 'ERROR' syslog
grep 'ERROR' syslog
grep searches file contents line by line for a pattern, printing matching lines. Given the constraint of locating every 'ERROR' occurrence inside the syslog file, grep 'ERROR' syslog is the direct tool; alternatives like find or locate operate on filenames, not file contents.
sed 'ERROR' syslog
Which command is used to display the current working directory in the terminal?
pwd
pwd prints the absolute path of the directory the shell is currently in, reading it from the shell's tracked location rather than the filesystem. It directly answers the question of where you are, requiring no arguments.
dir
cd
ls
You need to display the contents of a file named 'config.txt' directly to your terminal screen. Which command should you use?
head config.txt
cat config.txt
cat reads the file sequentially and writes its contents to standard output, which is the terminal, satisfying the requirement to display config.txt directly on screen. It requires no pager or editor and outputs the raw file contents.
echo config.txt
grep config.txt
You wish to send the output of the 'ls -l' command directly into a file named 'dirlist.txt', overwriting any existing content. Which operator should you use?
ls -l > dirlist.txt
The > redirection operator sends stdout to dirlist.txt, truncating and overwriting any existing content, exactly as the scenario requires. The shell opens the file for writing before executing ls, so prior contents are discarded rather than appended.
ls -l | dirlist.txt
ls -l >> dirlist.txt
ls -l < dirlist.txt
You want to replace every occurrence of 'old' with 'new' in the file 'data.txt' and view the result in the terminal. Which command achieves this?
sed 's/old/new/g' data.txt
The sed substitute command with the g flag replaces every match on each line, and without -i it writes to standard output, so results appear in the terminal while data.txt stays untouched. This satisfies both the replace-all and view-in-terminal constraints.
sed 's/old/new/' data.txt
grep 's/old/new/g' data.txt
sed 'r/old/new/g' data.txt
You need to set an environment variable named 'MYVAR' to 'hello' so that it is available to child processes. Which command is correct?
set MYVAR=hello
MYVAR=hello
env MYVAR=hello
export MYVAR=hello
The export builtin marks MYVAR for inclusion in the environment of subsequently executed commands, so child processes inherit it. Assigning without export would create only a shell variable, invisible to children, failing the stem's inheritance requirement.
Want more The Power OF The Command Line practice?
Practice this domainAn administrator wants to view the current system load and active processes. Which utility is the most appropriate for a real-time monitor?
df -T
ps aux
cat /proc/cpuinfo
top
top provides a continuously refreshing real-time view of system load, CPU and memory usage, and active processes, satisfying the stem's real-time monitor constraint. Alternatives like ps or uptime give only static snapshots, so top is the appropriate utility here.
You are managing a Linux server and need to confirm the IP address assigned to the eth0 interface. Which command is most appropriate on modern distributions?
ifconfig
ip addr
`ip addr` queries the kernel's netlink interface directly, reading current interface state from the running system rather than a legacy configuration file. It reports eth0's assigned IPv4 and IPv6 addresses, satisfying the need to confirm the actual address on modern distributions where `ifconfig` is deprecated and often absent by default.
route -n
netstat -rn
A technician needs to identify the amount of RAM installed in a server without opening the chassis. Which command provides this information from the command line?
uptime
lsblk
free -m
free -m reads /proc/meminfo and reports total, used and available RAM in mebibytes, giving installed memory without physical access. It satisfies the stem's constraint of identifying RAM from the command line without opening the chassis.
df -h
You have added a new hard drive to your Linux server, but the system does not automatically recognize the device. What is the first step you should take to verify if the kernel detects the hardware?
Reinstall the operating system.
Examine the output of dmesg.
Examining `dmesg` reveals kernel ring-buffer messages, including hardware detection events logged when the kernel probes the new drive. This directly satisfies the stem's requirement to verify kernel recognition, since `dmesg` records device discovery, driver binding and any SCSI or ATA attachment errors at boot or hotplug time.
Run the top command.
Edit the /etc/fstab file.
A small business owner wants to implement a server that allows for long-term support and stability for critical financial applications. Which distribution strategy should they prioritize?
Choosing a distribution that offers an LTS version with a long support lifecycle.
An LTS release freezes package versions and backports only security fixes, so the financial applications run against a stable, unchanging ABI for years. This directly satisfies the stem's demand for long-term support and stability, unlike rolling distributions whose continuous updates risk breaking critical software.
Using a desktop-focused distribution for ease of installation.
Compiling the kernel from source to match the specific hardware.
Selecting a rolling release distribution for frequent kernel updates.
Which command is used to display the current directory path in the terminal?
ls
dir
pwd
pwd prints the absolute path of the current working directory to standard output, directly answering the requirement to display the current directory path. Commands such as ls list directory contents instead, and cd changes directory rather than reporting it.
cd
Want more The Linux Operating System practice?
Practice this domainWhich of the following describes the core philosophy of 'Open Source' as defined by the Open Source Initiative?
The source code must be available for modification and redistribution.
Open Source Initiative criteria require freely redistributable source code, permitting modification and derived works under the same terms. This option captures that core licence requirement, satisfying the definition's demand that source be available for modification and redistribution rather than merely free of cost.
The software must be provided for free without any charge.
The code must be written in C or C++.
The software must only be used for non-profit purposes.
A Linux administrator needs to determine if their distribution is based on Debian or RHEL. Which command or path is most indicative of this family?
Checking for the presence of the 'systemd' binary.
Checking for the existence of /etc/debian_version.
The presence of /etc/debian_version confirms a Debian-derived distribution, since Debian and its descendants write this file during installation. RHEL-family systems instead ship /etc/redhat-release, so checking this path directly distinguishes the two families without relying on package manager commands that may be absent.
Running the 'uname -a' command.
Checking for the existence of /etc/sysconfig.
An open source developer wants to choose a license that allows their code to be included in proprietary software without requiring the proprietary software to open its source. Which license should they choose?
AGPL
GPLv3
MIT
MIT permits relicensing within proprietary products because it imposes no copyleft obligation, requiring only attribution and retention of the licence notice. This satisfies the stem's constraint that derivative proprietary software need not disclose its source, unlike GPL-family licences whose reciprocal terms would force source release.
Creative Commons Attribution-ShareAlike
When considering a career in Linux system administration, which certification path demonstrates proficiency in managing system-level services and security across diverse distributions?
LPIC-1: Linux Administrator
LPIC-1 from the Linux Professional Institute is distribution-neutral: its two exams cover system architecture, package management with both Debian and Red Hat tools, the command line, filesystems, scripting, user administration, essential services, networking and security basics. Passing shows you can administer Linux whichever distribution an employer uses, which is the key phrase in the question. Linux Essentials, this exam, is the natural step before it.
AWS Certified SysOps Administrator
Red Hat Certified System Administrator (RHCSA)
Cisco Certified Network Associate (CCNA)
Your company is considering moving from proprietary software to open source solutions. Which aspect of the GPL license is most restrictive regarding the distribution of modified code?
You must contribute all modifications back to the original project maintainer.
You must release the source code of any derivative works if you distribute the binaries.
The GPL's copyleft clause requires that anyone distributing binaries of derivative works must also make the corresponding source code available under the same licence. This satisfies the stem's constraint by identifying the most restrictive distribution obligation.
You are not allowed to modify the source code for internal business use.
You are forbidden from selling any software that uses GPL code.
An administrator is comparing package management systems. Which tool is primarily used on RHEL-based distributions for resolving dependencies and downloading packages?
DNF
DNF resolves dependencies and downloads packages on RHEL-based distributions, satisfying the stem's platform constraint. As the successor to YUM, it uses libsolv for dependency solving and reads repository metadata to fetch RPM packages, making it the native package manager for RHEL, Fedora and CentOS Stream.
Pacman
Portage
APT
Want more The Linux Community And A Career IN Open Source practice?
Practice this domainThe 010-160 exam has 40 questions and must be completed in 60 minutes. Always confirm current details on the vendor's official exam page.
Scenario-based questions covering exam objectives with detailed answer explanations.
The exam covers 5 domains: Security And File Permissions, Finding Your Way ON A Linux System, The Power OF The Command Line, The Linux Operating System, The Linux Community And A Career IN Open Source. Questions are weighted by domain — higher-weight domains appear more on your actual exam.
No. These are original exam-style practice questions written against the official LPI 010-160 exam objectives. They are not copied from the real exam. Courseiva focuses on genuine understanding, not memorisation of braindumps.
Courseiva tracks your accuracy per domain and routes you toward weak areas automatically. Free, no account required.