LPI · Free Practice Questions · Last reviewed May 2026
42real 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.
A system administrator wants to mount a USB flash drive formatted with the ext4 filesystem. The device is detected as /dev/sdc1. Which command should be used to mount the device to /mnt/usb?
mount -a /dev/sdc1 /mnt/usb
mount /mnt/usb /dev/sdc1
mount /dev/sdc1 /mnt/usb
Correct: mount with device and mount point, filesystem auto-detected.
mount -t ext4 /dev/sdc1 /mnt/usb
A Linux system has two SATA disks: /dev/sda (250GB) and /dev/sdb (500GB). The administrator wants to create a logical volume group named 'vgdata' using partitions on both disks, then create a 600GB logical volume named 'lvdata' for a database. Which sequence of commands should be used?
pvcreate /dev/sdb1 /dev/sdc1; lvcreate -L 600G -n lvdata vgdata; vgcreate vgdata /dev/sdb1 /dev/sdc1
pvcreate /dev/sdb /dev/sdc; vgcreate vgdata /dev/sdb /dev/sdc; lvcreate -L 600G -n lvdata vgdata
pvcreate /dev/sdb1 /dev/sdc1; vgcreate vgdata /dev/sdb1 /dev/sdc1; lvcreate -L 600G -n lvdata vgdata
Correct order: pvcreate, vgcreate, lvcreate.
vgcreate vgdata /dev/sdb1 /dev/sdc1; pvcreate /dev/sdb1 /dev/sdc1; lvcreate -L 600G -n lvdata vgdata
During boot, a Linux system displays 'Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(0,0)'. Which of the following is the most likely cause?
The root filesystem is corrupted and needs fsck.
The kernel lacks the necessary driver for the storage controller.
Missing driver prevents accessing the root filesystem.
The root= parameter in the boot loader points to a non-existent device.
The initrd is missing or corrupted.
Which of the following commands displays the amount of free disk space on all mounted filesystems in a human-readable format?
df -i
df -h
Correct: human-readable disk free.
du -sh
df -T
An administrator needs to create a new ext4 filesystem on /dev/sdb1 and wants to reserve 2% of the blocks for the root user. Which command should be used?
mkfs.ext4 -m 2 /dev/sdb1
Correct: -m specifies reserved blocks percentage.
tune2fs -m 2 /dev/sdb1
mke2fs -r 2 /dev/sdb1
mkfs.ext4 -R 2 /dev/sdb1
A Linux system has a software RAID1 array /dev/md0 consisting of /dev/sda1 and /dev/sdb1. After replacing a failed disk, the administrator runs 'mdadm --manage /dev/md0 --add /dev/sdc1', but the array remains degraded. Which command should be used to check the status of the array?
mdadm --examine /dev/sdc1
mdadm --version
mdadm --detail /dev/md0
Correct: shows detailed array status.
mdadm --query /dev/md0
Want more Devices, Filesystems and FHS practice?
Practice this domainA system administrator needs to install the latest version of a package named 'webapp' from a third-party repository that has been added to the system. Which command should be used to update the package list and install the package in one step?
apt-get update && apt-get install webapp
Updates package list and installs the package.
apt-get upgrade webapp
dpkg -i webapp.deb
apt-cache search webapp && apt-get install webapp
A Linux administrator is troubleshooting a package dependency issue. When attempting to install package 'foo', the package manager reports a missing dependency 'libbar.so.2'. Which of the following is the most appropriate next step?
Run 'ldconfig' to update the library cache
Reinstall the 'foo' package using 'rpm -i --force foo.rpm'
Run 'rpm -q --whatrequires libbar.so.2'
Use 'apt-file search libbar.so.2' or 'dnf provides libbar.so.2' to find the package that contains the file
Identifies the package providing the missing library.
A company maintains a private Debian repository for internal packages. A new package 'internal-tool' version 2.0 has been added to the repository, but when users run 'apt-get update && apt-get install internal-tool', the old version 1.0 is still being offered. What is the most likely cause?
The package version number is not higher than the installed version
The local apt cache needs to be cleared with 'apt-get clean'
The 'apt-get update' command did not run successfully due to network issues
The repository's Release file has not been regenerated after adding the new package
apt uses the Release file to check validity; if outdated, it may ignore new Packages files.
A system administrator wants to compile and install a program from source. After running './configure --prefix=/opt/myapp', the configure script fails with an error about missing 'libssl-dev'. What should the administrator do to resolve this issue?
Install the 'libssl-dev' package using the package manager
Development packages contain headers required by configure.
Manually download and place the missing header files in /usr/include
Install the 'libssl' runtime library
Add the '--disable-ssl' flag to ./configure
A technician needs to remove a package named 'apache2' along with its configuration files from a Debian system. Which command should be used?
dpkg -r apache2
apt-get autoremove apache2
apt-get purge apache2
Removes package and config files.
apt-get remove apache2
A Linux administrator is managing a server that uses RPM-based package management. They need to find which installed package provides the '/etc/ssh/sshd_config' file. Which command should they use?
rpm -qi /etc/ssh/sshd_config
rpm -qf /etc/ssh/sshd_config
Queries the package that owns the file.
rpm -ql /etc/ssh/sshd_config
rpm -qa | grep sshd_config
Want more Linux Installation and Package Management practice?
Practice this domainA systems administrator needs to change the permissions of the file /home/user/script.sh so that the owner can read, write, and execute; the group can read and execute; and others have no access. Which command accomplishes this?
chmod 755 /home/user/script.sh
chmod 750 /home/user/script.sh
750 gives rwx for owner, r-x for group, and --- for others, matching the requirement.
chmod 770 /home/user/script.sh
chmod 741 /home/user/script.sh
Which TWO commands can be used to view the contents of a compressed file named archive.tar.gz without extracting it to disk?
gzip -d archive.tar.gz
bunzip2 -c archive.tar.gz | tar -t
tar -tzf archive.tar.gz
Correct: tar -t lists table of contents; -z handles gzip; -f specifies file.
gunzip -l archive.tar.gz
zcat archive.tar.gz | tar -t
Correct: zcat decompresses to stdout; pipe to tar -t lists contents.
Refer to the exhibit. An administrator needs to edit /etc/example.conf to change setting1 to 'production' and add a new line 'setting2=value' after the include line. The file must be edited in place without creating a backup. Which command sequence achieves this?
sed -i 's/setting1=default/setting1=production/' /etc/example.conf; sed -i '/^include /a\nsetting2=value' /etc/example.conf
Correct: -i without argument edits in place; first command changes the setting; second appends after the include line.
sed -i 's/setting1=default/setting1=production/' /etc/example.conf; sed -i '/^include /i\nsetting2=value' /etc/example.conf
sed -i.bak 's/setting1=default/setting1=production/' /etc/example.conf; sed -i.bak '/^include /a\nsetting2=value' /etc/example.conf
sed -i.bak 's/setting1=default/setting1=production/' /etc/example.conf; sed -i.bak '/^include /a\nsetting2=value' /etc/example.conf
You are a Linux administrator for a company that runs a web server on a system with limited disk space. The web server logs are stored in /var/log/httpd/access_log and grow quickly. The operations team requires that the most recent logs be available for troubleshooting, but logs older than 7 days must be compressed to save space. You decide to implement log rotation using logrotate. The logrotate configuration file for httpd currently contains:
/var/log/httpd/*.log { daily rotate 7 compress delaycompress missingok notifempty sharedscripts postrotate /bin/systemctl reload httpd 2>/dev/null || true endscript
}
After applying this configuration, you notice that log files are being compressed immediately instead of after one rotation. What is the most likely cause and the correct step to fix this?
Remove the 'sharedscripts' directive to ensure the postrotate script runs for each log file individually.
Change the rotation frequency to 'weekly' so that the most recent week's logs remain uncompressed and older logs are compressed.
With weekly rotation, the most recent rotated log (one week old) remains uncompressed due to delaycompress, while older logs are compressed, meeting the requirement of compressing logs older than 7 days.
Remove the 'delaycompress' directive to ensure compression occurs at each rotation.
Add the 'copytruncate' directive to avoid moving the log file, allowing the web server to continue writing to the same file.
Arrange the steps to configure a static IP address on a Linux system using the command line.
Order the steps to recover a forgotten root password on a Linux system.
Want more GNU and Unix Commands practice?
Practice this domainA system administrator wants to ensure that the syslog service starts automatically on boot and is running immediately without a reboot. Which command sequence should be used?
systemctl start syslog && systemctl enable syslog
systemctl start --enable syslog
systemctl enable syslog && systemctl start syslog
systemctl enable --now syslog
The --now flag enables and starts the service in one step.
A user reports that a cron job is not executing. The cron job is defined in /etc/crontab. The administrator checks the system logs and finds no errors. Which command should the administrator use to verify that the cron daemon is running?
pgrep cron
Returns PID if cron is running, gives no output if not.
systemctl status cron
crontab -l
ps aux | grep cron
A system administrator wants to schedule a script to run every Monday at 3:00 AM, but only if the system clock is set to local time (not UTC). Which crontab entry should be used?
3 0 * * 1 /path/to/script
0 3 * * 1 /path/to/script
Correct: minute 0, hour 3, any day of month, any month, Monday (1).
0 15 * * 1 /path/to/script
0 3 * * 0 /path/to/script
A server has a backup script that runs daily at midnight. The system administrator notices that the script sometimes fails because the filesystem is mounted read-only. Which approach is the best practice to ensure the script runs only when the filesystem is writable?
Add a cron job that runs before the backup to remount the filesystem read-write
Use anacron to run the job after boot
Wrap the backup command in a script that checks if the filesystem is writable before proceeding
Best practice: check condition inside script and exit gracefully if not met.
Change the cron job to run every hour until it succeeds
An administrator needs to find all files in the /var/log directory that have been modified in the last 24 hours. Which command should be used?
find /var/log -ctime 0
find /var/log -mtime 0
mtime 0 matches files modified within the last 24 hours.
find /var/log -atime 0
find /var/log -mmin 1440
A Linux system fails to boot with the error 'Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)'. Which of the following is the most likely cause?
The root filesystem has a corrupted superblock
The initrd file is missing or corrupted
The kernel lacks the necessary driver for the storage controller
Kernel cannot access the root device due to missing storage driver.
The bootloader configuration points to the wrong partition
Want more Administrative Tasks practice?
Practice this domainA system administrator writes a script that extracts data from a CSV file and inserts it into a database. The script works correctly when run manually but fails when executed by cron. Which environment variable is most likely causing the issue?
SHELL
LANG
HOME
PATH
PATH is often not set in cron, causing command not found errors.
A developer needs to ensure a bash script exits immediately if any command fails, and also prints each command before executing it. Which set of shell options should be used at the beginning of the script?
set -ex
-e exits on error, -x prints commands.
set -e
set -vx
set -ux
A script contains the following line: for i in $(cat file.txt); do echo $i; done. The file file.txt contains a single line with multiple words. How many times will the loop execute?
Equal to the number of lines in the file
Equal to the number of words in the file
The command substitution splits into words.
Once
The loop will not execute
Refer to the exhibit. Why does the cron job fail?
The cron job lacks the PATH environment variable.
The script is owned by root, but the cron job runs as a different user.
The script is not executable.
The file permissions do not include execute for the owner.
The script lacks a shebang line.
Which TWO commands can be used to sort the output of ps -ef by the resident set size (RSS) in descending order?
ps -ef | sort -k5,5 -rn
ps --sort=-rss
--sort=-rss sorts by RSS descending.
ps -ef | sort -k3 -rn
ps --sort=rss
ps -ef | sort -k5 -rn
RSS is typically the 5th field in ps -ef output.
Which THREE statements are true about the sed command?
sed 's/old/new/g' file.txt permanently changes the file.
sed -i 's/foo/bar/g' file.txt replaces all occurrences of foo with bar in the file.
-i makes in-place changes.
sed uses extended regular expressions by default.
sed '/^#/d' file.txt deletes lines that start with #.
The address /^#/ matches lines starting with #, d deletes them.
sed -n '3,5p' file.txt prints lines 3 to 5 of file.txt.
-n suppresses output, p prints specified lines.
Want more Shells, Scripting and Data Management practice?
Practice this domainA system administrator notices that the NTP service on a Linux server is not synchronizing time with external NTP servers. The administrator runs 'ntpq -p' and sees that all servers listed have a 'reach' value of 0. Which of the following is the most likely cause?
The system timezone is incorrectly set.
The NTP service is configured to use the local clock.
A firewall is blocking UDP port 123.
Reach 0 indicates no response, common when firewall blocks NTP.
The NTP server is using a different NTP version.
A web server running Apache on Linux is experiencing slow response times. The administrator runs 'netstat -tuln' and sees many connections in TIME_WAIT state. Which of the following is the best course of action to improve performance?
Increase the KeepAliveTimeout directive.
Disable the KeepAlive directive.
Enable TCP keepalive and adjust kernel parameters for faster reuse.
Adjusting tcp_tw_reuse and tcp_tw_recycle can reduce TIME_WAIT.
Increase the MaxKeepAliveRequests directive.
Which of the following commands will display the default gateway of a Linux system?
arp -a
netstat -i
ip route show
Displays routing table including default gateway.
ifconfig
A database server on a Linux system is configured to listen on TCP port 3306. The administrator wants to restrict access to the database server to only the local network (192.168.1.0/24) using iptables. Which of the following iptables rules achieves this?
iptables -A INPUT -p tcp --dport 3306 -d 192.168.1.0/24 -j DROP
iptables -A OUTPUT -p tcp --dport 3306 -d 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 3306 -s 192.168.1.0/24 -j ACCEPT
Correct rule to allow incoming MySQL from local subnet.
iptables -A OUTPUT -p tcp --sport 3306 -s 192.168.1.0/24 -j ACCEPT
A user reports that they cannot connect to a remote server using SSH. The administrator checks the SSH server status and it is running. Which of the following is the most likely cause?
A firewall is blocking port 22.
Firewall blocking SSH port is a common issue.
The client's subnet mask is incorrect.
The client cannot resolve the server's hostname.
The SSH server is using UDP instead of TCP.
A system administrator is configuring a Linux server to act as a router. The server has two network interfaces: eth0 (192.168.1.1/24) and eth1 (10.0.0.1/24). Which of the following commands enables IP forwarding on this server?
route add default gw 10.0.0.1
sysctl -w net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward
sysctl -w net.ipv4.ip_forward=1
Correctly enables IP forwarding.
Want more Essential System Services and Networking practice?
Practice this domainA system administrator notices that the server's clock is consistently off by several minutes. Which service should be used to synchronize the time with an external time source?
ntpd
ntpd is the standard NTP daemon for time synchronization.
timed
chronyd
systemd-timesyncd
During boot, the kernel must mount the root filesystem. Which of the following is responsible for providing the kernel with the location of the root filesystem?
udev
initramfs
init
boot loader
The boot loader passes root= parameter to the kernel.
A server has two disk drives: /dev/sda (SSD) and /dev/sdb (HDD). The administrator wants to place frequently accessed files on the SSD for performance. Which approach best achieves this using Linux filesystem features?
Create separate LVM logical volumes on each disk and mount them at different mount points.
LVM allows flexible allocation of storage from different physical volumes.
Configure RAID 0 across both disks to combine speed.
Use symbolic links to redirect file access to the SSD.
Use a union mount to overlay the SSD on top of the HDD.
A technician is troubleshooting a system that fails to boot with the error 'Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)'. What is the most likely cause?
The init binary is missing or corrupted.
The root filesystem is corrupted and needs fsck.
The kernel lacks the necessary driver for the storage controller.
Kernel cannot access the root device due to missing storage driver.
The boot loader is not installed correctly.
Which hardware component uses a unique address to identify itself on the network at the data link layer?
IP address
MAC address
MAC addresses are used for communication within a local network segment.
Hostname
Port number
A Linux system has two network interfaces: eth0 and eth1. The administrator wants to bond them for increased throughput. Which kernel module is required for bonding?
aggregation
bonding
The bonding kernel module provides network interface bonding.
team
bond
Want more System Architecture practice?
Practice this domainThe LPIC-1 exam has 60 questions and must be completed in 90 minutes. The passing score is 500/1000.
Scenario-based questions covering exam objectives with detailed answer explanations.
The exam covers 7 domains: Devices, Filesystems and FHS, Linux Installation and Package Management, GNU and Unix Commands, Administrative Tasks, Shells, Scripting and Data Management, Essential System Services and Networking, System Architecture. 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 LPIC-1 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.