LPI Linux Essentials Exam — Questions and Answers
Question 1: Which grep option prints the line number before each matching line?
- -n (Correct answer)
- -v
- -c
- -l
Correct answer: -n
grep -n prefixes each matching line with its line number in the file.
Question 2: A user wants to search for the case-insensitive string "error" within the `system.log` file. Which of the following commands is the correct way to perform this search?
- search --ignore-case "error" system.log
- grep -i "error" system.log (Correct answer)
- cat system.log | filter -i "error"
- find "error" system.log
Correct answer: grep -i "error" system.log
The `grep` command is the standard tool for searching text using patterns. The `-i` option makes the search case-insensitive, so it will match "error", "Error", "ERROR", etc.
Question 3: If you are in /home/user/docs and type 'cd ../..', where will you end up?
- /home/user
- /home (Correct answer)
- /
- /home/user/docs/..
Correct answer: /home
Each `..` moves one level up: from docs to user, then from user to home, landing at /home.
Question 4: A file has the permissions `-rw-r--r--`. The owner wants to add write permission for the group members without affecting any other permissions. Which of the following commands will achieve this?
- chmod o+w file.txt
- chmod g=w file.txt
- chmod 664 file.txt
- chmod g+w file.txt (Correct answer)
Correct answer: chmod g+w file.txt
The symbolic notation `g+w` specifically targets the 'group' (`g`) and 'adds' (`+`) the 'write' (`w`) permission. Using octal `664` would work in this specific case, but it resets all permissions rather than just adding one. The `g+w` syntax is the most precise way to add a permission without altering others.
Question 5: Which file defines default settings (like UMASK and EXPIRE) applied when creating new users?
- /etc/useradd.conf
- /etc/passwd
- /etc/skel/profile
- /etc/default/useradd (Correct answer)
Correct answer: /etc/default/useradd
/etc/default/useradd stores default values used by the useradd command, such as the default shell and home base directory.
Question 6: What is the result of running: echo {a,b,c}.txt?
- Prints: {a,b,c}.txt literally
- Produces a syntax error
- Creates three files named a.txt b.txt c.txt
- Prints: a.txt b.txt c.txt (Correct answer)
Correct answer: Prints: a.txt b.txt c.txt
Brace expansion generates the strings a.txt, b.txt, and c.txt, which echo then prints.
Question 7: Which directory in a Linux system typically contains device files for hardware devices?
- /sys
- /dev (Correct answer)
- /proc/devices
- /hardware
Correct answer: /dev
/dev contains device files (special files) that represent hardware devices such as disks, terminals, and printers.
Question 8: Which command sends a process to the background after it has already been started in the foreground?
- fg
- nohup
- jobs
- bg (Correct answer)
Correct answer: bg
After pressing Ctrl+Z to suspend a foreground process, the `bg` command resumes it running in the background.
Question 9: Which command lists all background and suspended jobs in the current shell session?
- bg
- jobs (Correct answer)
- tasks
- ps
Correct answer: jobs
The `jobs` command displays all jobs (background and suspended processes) started in the current shell, along with their job IDs and status.
Question 10: Which file stores the encrypted passwords for user accounts on a modern Linux system?
- /etc/gshadow
- /etc/security
- /etc/shadow (Correct answer)
- /etc/passwd
Correct answer: /etc/shadow
Modern Linux systems store encrypted passwords in /etc/shadow, which is readable only by root.
Question 11: Which command would you use inside a script to terminate with exit code 2?
- quit 2
- return 2
- stop 2
- exit 2 (Correct answer)
Correct answer: exit 2
The `exit` command ends the script and passes its numeric argument as the exit status.
Question 12: A file has permissions -rw-rw-r--. Which class has write access?
- Owner only
- Group and others
- All classes
- Owner and group (Correct answer)
Correct answer: Owner and group
rw- for owner and rw- for group means both owner and group have write access; others have read-only.
Question 13: Which utility can both compress files and create archives (unlike gzip which only compresses)?
- xz
- zip (Correct answer)
- compress
- bzip2
Correct answer: zip
The zip utility creates archive files containing multiple files with compression, while gzip/bzip2/xz only compress single files.
Question 14: Which field in /etc/passwd specifies the user's default shell?
- Field 7 (Correct answer)
- Field 4
- Field 6
- Field 5
Correct answer: Field 7
The seventh (last) field in /etc/passwd specifies the user's login shell, e.g., /bin/bash.
Question 15: What is the purpose of running 'apt-get update'?
- Refreshes the local package index from repositories (Correct answer)
- Removes outdated packages from the system
- Installs system updates automatically
- Upgrades all installed packages to the latest version
Correct answer: Refreshes the local package index from repositories
'apt-get update' downloads the latest package lists from configured repositories, refreshing the local index.
Question 16: Which command displays the full path of the current working directory?
- pwd (Correct answer)
- cwd
- dir
- path
Correct answer: pwd
The `pwd` (print working directory) command outputs the absolute path of the current directory.
Question 17: What is the primary function of the execute (`x`) permission when it is set on a directory?
- It allows a user to create, delete, or rename files within the directory.
- It allows a user to enter the directory with the `cd` command. (Correct answer)
- It allows a user to read the contents of files within the directory.
- It allows a user to list the contents of the directory using the `ls` command.
Correct answer: It allows a user to enter the directory with the `cd` command.
For a directory, the execute (`x`) permission grants the ability to traverse it or enter it, for example, by using the `cd` command. Listing contents requires read (`r`) permission, and modifying the directory's contents (creating/deleting files) requires write (`w`) permission.
Question 18: Which tar option extracts files to a specific directory instead of the current one?
- -O /path/to/dir
- -X /path/to/dir
- -C /path/to/dir (Correct answer)
- -D /path/to/dir
Correct answer: -C /path/to/dir
The -C option changes the working directory before performing any operations, so files are extracted there.
Question 19: What does the `continue` statement do inside a bash loop?
- Exits the entire loop
- Restarts the loop from the beginning
- Exits the script
- Skips the rest of the current iteration and starts the next one (Correct answer)
Correct answer: Skips the rest of the current iteration and starts the next one
`continue` jumps back to the loop condition check, skipping the remaining commands in the current iteration.
Question 20: What does the sticky bit do when set on a directory?
- Prevents new files from being created
- Makes the directory immutable
- Prevents users from deleting files they do not own (Correct answer)
- Runs files as the directory owner
Correct answer: Prevents users from deleting files they do not own
The sticky bit on a directory restricts file deletion so only the file owner, directory owner, or root can remove files.
Question 21: What does `tail -f /var/log/syslog` do?
- Shows the first 10 lines and exits
- Follows the file and prints new lines as they are written (Correct answer)
- Filters lines matching 'syslog'
- Shows lines in reverse order
Correct answer: Follows the file and prints new lines as they are written
tail -f follows a file in real time, printing new content as it is appended.
Question 22: A graphic designer creates an icon set and wants to allow others to use it for free, even in commercial projects. However, they want to ensure that any modified versions of the icons are also shared freely under the same terms. Which Creative Commons license should they use?
- CC BY-ND (Attribution-NoDerivs)
- CC BY (Attribution)
- CC BY-SA (Attribution-ShareAlike) (Correct answer)
- CC BY-NC (Attribution-NonCommercial)
Correct answer: CC BY-SA (Attribution-ShareAlike)
The Creative Commons Attribution-ShareAlike (CC BY-SA) license allows others to remix, adapt, and build upon the work even for commercial purposes, as long as they give credit and license their new creations under the identical terms. This 'ShareAlike' component is a form of copyleft for creative works.
Question 23: What is the primary role of the BIOS or UEFI in the Linux boot process?
- To load the graphical user interface.
- To start system services and daemons.
- To initialize hardware and load the bootloader. (Correct answer)
- To mount the root filesystem.
Correct answer: To initialize hardware and load the bootloader.
The BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface) is the first software that runs when a computer is powered on. Its primary responsibilities are to perform a Power-On Self-Test (POST) to initialize and check system hardware, and then to locate and hand over control to the bootloader (like GRUB) from a storage device.
Question 24: What is a primary difference between the Apache 2.0 license and the MIT license?
- The MIT license is a copyleft license, while Apache 2.0 is not.
- The Apache 2.0 license includes an express grant of patent rights, while the MIT license does not. (Correct answer)
- The Apache 2.0 license prohibits commercial use.
- The MIT license requires you to publish all modifications.
Correct answer: The Apache 2.0 license includes an express grant of patent rights, while the MIT license does not.
A key feature of the Apache 2.0 license is that it includes an explicit grant of patent rights from contributors to users. The MIT license is much simpler and does not explicitly address patent rights, which is a key reason some projects and corporations prefer the Apache license.
Question 25: Which command is used to check disk usage in Linux?
- df (Correct answer)
- lsblk
- fdisk
- du
Correct answer: df
The `df` command, short for 'disk free', is used in Linux to report file system disk space usage. It displays information such as the total capacity, used space, available space, and percentage used for each mounted file system. This command is essential for monitoring disk capacity and managing storage resources effectively.
Question 26: To count the number of lines containing the word "warning" in the file `application.log`, which command should be used?
- wc "warning" application.log
- grep -n "warning" application.log
- grep -c "warning" application.log (Correct answer)
- count "warning" < application.log
Correct answer: grep -c "warning" application.log
While `grep` is used for searching, the `-c` option modifies its behavior to output a count of matching lines instead of the lines themselves. `wc -l` would count all lines, and `grep -n` would show line numbers with the matches.
Question 27: What is the key difference between an absolute path and a relative path?
- An absolute path is valid from anywhere in the filesystem, while a relative path depends on the current directory. (Correct answer)
- Relative paths can only be used to navigate to subdirectories.
- An absolute path is shorter than a relative path.
- A relative path always starts from the user's home directory.
Correct answer: An absolute path is valid from anywhere in the filesystem, while a relative path depends on the current directory.
An absolute path specifies a location from the root directory (`/`) and is unambiguous. A relative path specifies a location starting from the current directory, so its meaning changes depending on where you are.
Question 28: Which command on Linux is used to securely copy files between a local machine and a remote host over SSH?
- cp
- ftp
- rsync
- scp (Correct answer)
Correct answer: scp
The `scp` (secure copy) command uses the SSH protocol to encrypt and transfer files between local and remote systems.
Question 29: What does a `#!` (shebang) line at the top of a script specify?
- The script author's name
- The shell variables to export
- The interpreter used to execute the script (Correct answer)
- A comment describing the script's purpose
Correct answer: The interpreter used to execute the script
The shebang (`#!`) followed by a path tells the kernel which interpreter to use to run the script.
Question 30: Which file contains the user's encrypted password and password aging information?
- /etc/group
- /etc/passwd
- /etc/shadow (Correct answer)
- /etc/login.defs
Correct answer: /etc/shadow
The `/etc/shadow` file securely stores user password information. It contains the encrypted password hash and other details like password expiration policies. This file is readable only by the root user to enhance security.
Question 31: What is the purpose of the `break` statement inside a loop?
- Resets the loop counter to zero
- Exits the innermost loop (Correct answer)
- Skips the current iteration and continues with the next
- Exits the script immediately
Correct answer: Exits the innermost loop
`break` terminates execution of the innermost enclosing loop and resumes after it.
Question 32: Which environment variable stores the path to the current user's home directory?
- $USER
- $PWD
- $HOME (Correct answer)
- $PATH
Correct answer: $HOME
The `$HOME` environment variable contains the absolute path to the current user's home directory.
Question 33: What does the `nice` command control when starting a process?
- Memory limit
- Scheduling priority (Correct answer)
- File permissions
- CPU affinity
Correct answer: Scheduling priority
The `nice` command launches a process with a specified scheduling priority (niceness value) to influence how much CPU time it receives.
Question 34: What is the typical role of the /sys filesystem (sysfs) in Linux?
- Log kernel error messages to disk
- Store system-wide configuration files
- Provide a virtual filesystem exposing kernel objects and device attributes (Correct answer)
- Mount external file systems automatically
Correct answer: Provide a virtual filesystem exposing kernel objects and device attributes
sysfs is a virtual filesystem mounted at /sys that exports kernel objects, their attributes, and their relationships to user space.
Question 35: The Free Software Foundation (FSF) defines four essential freedoms for free software. Which of the following is NOT one of those freedoms?
- The freedom to run the program for any purpose.
- The freedom to redistribute copies to help others.
- The freedom from any cost associated with the software. (Correct answer)
- The freedom to study how the program works and change it.
Correct answer: The freedom from any cost associated with the software.
The FSF's definition of free software focuses on liberty, not price. It defines free software by four essential freedoms: the freedom to run the program, to study and change it, to redistribute copies, and to distribute copies of your modified versions. Free software can be sold.
Question 36: Which command shows a tree view of processes illustrating parent-child relationships?
- ps tree
- ptree
- proctree
- pstree (Correct answer)
Correct answer: pstree
The `pstree` command displays running processes in a hierarchical tree format, clearly showing parent-child relationships between processes.
Question 37: Which command decompresses a .xz file while keeping the original compressed file?
- xz -f file.xz
- xz -t file.xz
- xz -c file.xz
- xz -dk file.xz (Correct answer)
Correct answer: xz -dk file.xz
The -d decompresses and -k keeps the original, so both the compressed and decompressed files remain.
Question 38: After a system reboot, a technician wants to review the messages generated by the kernel during the startup sequence to troubleshoot a potential hardware detection issue. Which command is most suitable for viewing these kernel ring buffer messages?
- cat /var/log/syslog
- history
- dmesg (Correct answer)
- journalctl -u kernel
Correct answer: dmesg
`dmesg` (display message or driver message) is used to examine or control the kernel ring buffer. It prints the messages generated by the kernel, including those from the boot process related to hardware detection and driver initialization. While logs might be in `/var/log/syslog` or accessible via `journalctl`, `dmesg` is the most direct and traditional tool for this specific purpose.
Question 39: When you use software licensed under the GNU GPLv2, what is a key obligation if you distribute a modified version of that software?
- You can re-license your modified version under any license you choose.
- You must make the source code of your modifications available under the GPLv2. (Correct answer)
- You must get written permission before distributing the software.
- You must pay a licensing fee to the original author.
Correct answer: You must make the source code of your modifications available under the GPLv2.
The GNU GPL is a 'copyleft' license, which means that if you create a derivative work (e.g., by modifying the source code) and distribute it, you must also license your derivative work under the GPL. A core part of this is making the corresponding source code available to the recipients.
Question 40: What does `unzip -l archive.zip` do?
- Extracts archive.zip to a list of directories
- Deletes listed files from archive.zip
- Lists zip archives in the current directory
- Lists the contents of archive.zip without extracting (Correct answer)
Correct answer: Lists the contents of archive.zip without extracting
The -l option displays the file listing inside the zip archive including sizes and dates, without extracting anything.
LPI Linux Essentials Exam
The LPI Linux Essentials Exam (010-160) validates foundational Linux knowledge including open-source concepts, command-line navigation, data extraction, archiving, user management, file permissions, basic scripting, hardware awareness, process monitoring, and networking basics.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds
Practice questions written with AI assistance and published by Nathan Beja, founder of Practice Test Geeks. They are not real exam questions. Exam facts are checked against the official sources linked below. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- lpi.org — Test delivery, eligibility, exam format, score validity, passing score, score release, fees · verified Dec 2026
- pearsonvue.com — Time limit · verified Nov 2026