LPI Linux Essentials Exam — Questions and Answers
Question 1: What does `ls -lh` display differently than `ls -l`?
- It shows file sizes in human-readable units (KB, MB) (Correct answer)
- It shows hidden files
- It shows the inode number
- It sorts by modification time
Correct answer: It shows file sizes in human-readable units (KB, MB)
The `-h` (human-readable) flag formats file sizes with units like K, M, G instead of raw byte counts.
Question 2: Which command removes a user and their home directory from the system?
- userdel username
- deluser username
- usermod -r username
- userdel -r username (Correct answer)
Correct answer: userdel -r username
userdel -r deletes the user account and recursively removes their home directory and mail spool.
Question 3: Which command creates a tar archive without any compression?
- tar -cf archive.tar files/ (Correct answer)
- tar -czf archive.tar.gz files/
- tar -cjf archive.tar.bz2 files/
- tar -cJf archive.tar.xz files/
Correct answer: tar -cf archive.tar files/
Using only -c and -f without -z, -j, or -J creates a plain uncompressed tar archive.
Question 4: Which symbolic chmod expression removes all permissions for others?
- o=
- o-rwx
- o=---
- Both A and B (Correct answer)
Correct answer: Both A and B
Both 'o=' (assign nothing) and 'o-rwx' (remove all) result in no permissions for others.
Question 5: Which of the following statements about the BSD 2-Clause license is correct?
- It allows use in proprietary software with minimal restrictions (Correct answer)
- It prohibits use in commercial software
- It requires derivative works to be released under the same license
- It requires patent rights to be granted to all users
Correct answer: It allows use in proprietary software with minimal restrictions
The BSD 2-Clause license is a permissive license that allows use in proprietary software, requiring only attribution and preservation of the license text.
Question 6: Which of the following lines in a script correctly executes the `whoami` command and assigns its output to a variable named `CURRENT_USER`?
- CURRENT_USER='whoami'
- let CURRENT_USER=whoami
- CURRENT_USER->whoami
- CURRENT_USER=$(whoami) (Correct answer)
Correct answer: CURRENT_USER=$(whoami)
The `$(command)` syntax is used for command substitution. It executes the command within the parentheses (`whoami`) and substitutes its standard output. This output is then assigned to the `CURRENT_USER` variable.
Question 7: What is the role of a device driver in Linux?
- A kernel module that allows the OS to communicate with hardware (Correct answer)
- A program that installs new hardware
- A script that mounts file systems
- A utility that partitions disk drives
Correct answer: A kernel module that allows the OS to communicate with hardware
A device driver is a kernel module that provides an interface between the operating system and a specific hardware device.
Question 8: Which tool creates a new filesystem (formats a partition) in Linux?
- mkfs (Correct answer)
- fdisk
- fsck
- mount
Correct answer: mkfs
mkfs (make filesystem) creates a new filesystem on a partition or disk device, e.g., mkfs.ext4 /dev/sdb1.
Question 9: What is the purpose of `tar --listed-incremental=snapshot.file`?
- Create an incremental backup using a snapshot file to track changes (Correct answer)
- List files changed since the last full backup
- Extract only files newer than snapshot.file
- Compare archive contents against snapshot.file
Correct answer: Create an incremental backup using a snapshot file to track changes
This option enables incremental backups by recording file metadata in the snapshot file and only archiving changed files on subsequent runs.
Question 10: Which command shows a tree view of processes illustrating parent-child relationships?
- pstree (Correct answer)
- ps tree
- proctree
- ptree
Correct answer: pstree
The `pstree` command displays running processes in a hierarchical tree format, clearly showing parent-child relationships between processes.
Question 11: What is the purpose of the /etc/group file?
- Maps group names to GIDs and lists group members (Correct answer)
- Defines default permissions for new groups
- Controls which groups can use sudo
- Stores encrypted group passwords only
Correct answer: Maps group names to GIDs and lists group members
/etc/group maps group names to GIDs and lists the supplementary members of each group.
Question 12: What does the `-z` test operator check in `[ -z "$var" ]`?
- Whether $var is an empty string (Correct answer)
- Whether $var is unset
- Whether $var contains only zeros
- Whether $var is a number
Correct answer: Whether $var is an empty string
`-z` returns true when the string has a length of zero.
Question 13: Which file on Debian-based systems contains the list of software repositories?
- /etc/rpm/repos.conf
- /etc/apt/sources.list (Correct answer)
- /etc/yum.repos.d/
- /etc/pacman.conf
Correct answer: /etc/apt/sources.list
/etc/apt/sources.list defines the URLs and types of repositories that APT uses to fetch packages.
Question 14: Which command lists all currently running processes for all users in a detailed format?
- ps aux (Correct answer)
- jobs -l
- ls -la
- top -a
Correct answer: ps aux
The `ps aux` command shows all processes from all users with detailed information including CPU and memory usage.
Question 15: What extension does `bzip2` add to a compressed file by default?
- .b2
- .bz2 (Correct answer)
- .bzip
- .bz
Correct answer: .bz2
By default, bzip2 appends .bz2 to the original filename, so file.txt becomes file.txt.bz2.
Question 16: What does the `tr 'a-z' 'A-Z'` command do?
- Translates lowercase letters to uppercase (Correct answer)
- Reverses the alphabet
- Counts lowercase letters
- Deletes lowercase letters
Correct answer: Translates lowercase letters to uppercase
tr translates characters; 'a-z' to 'A-Z' converts every lowercase letter to its uppercase equivalent.
Question 17: Which file stores the encrypted passwords for user accounts on a modern Linux system?
- /etc/passwd
- /etc/shadow (Correct answer)
- /etc/security
- /etc/gshadow
Correct answer: /etc/shadow
Modern Linux systems store encrypted passwords in /etc/shadow, which is readable only by root.
Question 18: Which `find` command option specifies the type of object to search for (file or directory)?
- -size
- -perm
- -name
- -type (Correct answer)
Correct answer: -type
`find -type f` finds regular files and `find -type d` finds directories, filtering results by object type.
Question 19: What signal number is used with `kill` to forcefully terminate a process that cannot be ignored?
- 1
- 9 (Correct answer)
- 2
- 15
Correct answer: 9
Signal 9 (SIGKILL) immediately and forcefully terminates a process and cannot be caught or ignored by the process.
Question 20: Which command is used to load a kernel module manually in Linux?
- insmod or modprobe (Correct answer)
- kmod --insert
- modload
- loadmod
Correct answer: insmod or modprobe
insmod loads a module directly while modprobe loads a module along with its dependencies from the module directory.
Question 21: Which file would you read to find the Linux kernel version currently running on a system?
- /boot/kernel.conf
- /proc/version (Correct answer)
- /sys/kernel/release
- /etc/kernel-version
Correct answer: /proc/version
/proc/version contains the kernel version string, build date, and compiler information for the running kernel.
Question 22: Which command would you use to sort a file's lines in reverse alphabetical order?
- sort -z file
- sort -r file (Correct answer)
- sort -d file
- sort -a file
Correct answer: sort -r file
The sort -r option reverses the default sort order, producing reverse alphabetical output.
Question 23: What arithmetic value does `$(( 3 ** 2 ))` evaluate to in bash?
- 32
- 5
- 6
- 9 (Correct answer)
Correct answer: 9
The `**` operator performs exponentiation, so 3 to the power of 2 equals 9.
Question 24: How would you add an existing user 'alice' to the 'wheel' group without removing her from other groups?
- usermod -aG wheel alice (Correct answer)
- usermod -g wheel alice
- groupadd wheel alice
- gpasswd wheel alice
Correct answer: usermod -aG wheel alice
`usermod -aG wheel alice` appends (-a) alice to the supplementary group (-G) wheel.
Question 25: Which of the following is an example of a permissive open source license?
- GNU Affero General Public License
- GNU General Public License v3
- MIT License (Correct answer)
- Mozilla Public License 2.0
Correct answer: MIT License
The MIT License is a permissive license with minimal restrictions, unlike the copyleft GPL, AGPL, and the file-level copyleft MPL.
Question 26: Which virtual filesystem in Linux provides an interface to kernel data structures and information about system processes?
- /tmp
- /proc (Correct answer)
- /dev
- /sys
Correct answer: /proc
The `/proc` filesystem is a special, pseudo-filesystem that provides an interface to kernel data structures. It doesn't contain real files but runtime system information, such as system memory, devices mounted, and hardware configuration. It contains a directory for each running process, identified by its process ID (PID).
Question 27: What does the `cut -d: -f1` command do when processing /etc/passwd?
- Prints the first field using colon as delimiter (Correct answer)
- Prints the third field using colon as delimiter
- Counts lines with colons
- Deletes lines containing colons
Correct answer: Prints the first field using colon as delimiter
cut -d: sets the delimiter to colon and -f1 selects the first field from each line.
Question 28: What does 'public domain' mean in the context of software?
- Software for which the copyright has expired or been waived, allowing unrestricted use (Correct answer)
- Software that can only be used by government agencies
- Software owned collectively by a group of contributors
- Software that is freely available on the internet
Correct answer: Software for which the copyright has expired or been waived, allowing unrestricted use
Public domain software has no copyright restrictions, either because the copyright expired or the author explicitly waived all rights.
Question 29: Which shell built-in command is used to read a line of input from the user and store it in a variable?
- read (Correct answer)
- get
- input
- scan
Correct answer: read
The `read` built-in reads a line from standard input and assigns it to the named variable.
Question 30: Which option makes `zip` compress files recursively including subdirectories?
- -d
- -s
- -R
- -r (Correct answer)
Correct answer: -r
The -r option tells zip to recurse into directories and include all files and subdirectories in the archive.
Question 31: Which command creates a new group called 'devops' on a Linux system?
- mkgroup devops
- groupadd devops (Correct answer)
- addgroup devops
- newgroup devops
Correct answer: groupadd devops
groupadd devops is the standard command to create a new group entry in /etc/group.
Question 32: What is the purpose of the `which` command?
- Lists all available shell commands
- Displays which partitions are mounted
- Shows which users are logged in
- Locates the executable file for a given command (Correct answer)
Correct answer: Locates the executable file for a given command
`which <command>` searches the directories in $PATH and prints the full path of the executable that would be run.
Question 33: What does pressing Tab once do in the bash shell when typing a command?
- Inserts a literal tab character
- Clears the current line
- Attempts to auto-complete the command or filename (Correct answer)
- Moves to the next command in history
Correct answer: Attempts to auto-complete the command or filename
Tab completion in bash automatically completes the command name, filename, or path if there is an unambiguous match.
Question 34: A company uses open source software licensed under the GNU Lesser General Public License (LGPL) in a proprietary product. Which statement is most accurate?
- The entire proprietary product must be released as open source
- The company cannot use LGPL software in any commercial product
- The company can link to the LGPL library without open-sourcing its proprietary code (Correct answer)
- The company must pay a fee to the Free Software Foundation
Correct answer: The company can link to the LGPL library without open-sourcing its proprietary code
The LGPL is designed to allow proprietary software to link to LGPL-licensed libraries without requiring the proprietary code to be open-sourced.
Question 35: A script has permissions -rwxr-xr-x. A user in the file's group runs it. What can they do?
- Only read the script
- Nothing — group has no execute permission
- Execute the script (Correct answer)
- Execute and modify the script
Correct answer: Execute the script
The group permissions are r-x, which includes execute, so group members can run the script.
Question 36: How is the SUID bit represented in ls -l output for a file with execute permission?
- S in the owner execute position
- s in the owner execute position (Correct answer)
- x in the group execute position
- t in the owner execute position
Correct answer: s in the owner execute position
A lowercase 's' in the owner execute position means SUID is set and execute is also set.
Question 37: What is the file extension for packages managed by the RPM package manager?
- .tar
- .rpm (Correct answer)
- .deb
- .pkg
Correct answer: .rpm
RPM packages use the .rpm extension and are used on distributions like Red Hat, CentOS, and Fedora.
Question 38: A system administrator needs to find all files in the `/var/log` directory that have been modified in the last 7 days. Which of the following commands will accomplish this task?
- find /var/log --modified 7
- find /var/log -mtime -7 (Correct answer)
- grep -r -mtime 7 /var/log
- search /var/log -time 7
Correct answer: find /var/log -mtime -7
The `find` command is used to search for files and directories. The `/var/log` argument specifies the starting directory for the search. The `-mtime` option filters files based on their last modification time in days, and `-7` specifically looks for files modified within the last 7 days.
Question 39: How would you add an existing user 'alice' to an existing group 'developers'?
- addgroup alice developers
- usermod -G developers alice
- usermod -aG developers alice (Correct answer)
- groupadd developers alice
Correct answer: usermod -aG developers alice
usermod -aG appends the group to alice's supplementary groups without removing existing ones; omitting -a would replace all groups.
Question 40: What command can be used to run a process that continues running even after the user logs out?
- bg
- nohup (Correct answer)
- disown
- daemon
Correct answer: nohup
The `nohup` command runs a program immune to hangup signals, allowing it to continue running after the user's terminal session ends.
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