Practice for the LPI Linux Essentials exam with 13 exam-style practice questions, instant answer reveals, and concise explanations of every correct answer. Topics include: What is the ls command used for in Linux?. Follow @CertPunch and visit certpunch.com for more certification practice exams and study content.
Prefer hands-on? Take this round as an interactive practice test — answer every question, get instant feedback, and see your score: Start the LPI Linux Essentials practice test →
What you will practice
- What is the ls command used for in Linux?
- Which command closes the terminal window?
- What does the term GPL stand for?
- The output of the program date should be saved in the variable datenow. What is the correct statement to ente…
- After running a command to delete all of the files beginning with the letter "a", the file Access.txt remaine…
- Which directory contains the files and directories automatically copied over to a new user's home directory w…
Answers and explanations
Tap a question to expand the answer and the exam reasoning. Try to commit to your own pick first.
Q1. What is the ls command used for in Linux?
Answer: A. Lists the files within a directory
The ls command is used to list the files and directories within a specified path. It does not inherently display active network shares or track which local users are actively utilizing a specific file at that moment.
Q2. Which command closes the terminal window?
Answer: D. exit
Typing the exit command terminates the current shell session and effectively closes the active terminal window. The other listed options are not recognized Linux commands, making exit the only logical choice on the exam.
Q3. What does the term GPL stand for?
Answer: B. General Public License
GPL stands for General Public License, which is a widely used free software license. It guarantees end users the freedom to run, study, share, and modify the software.
Q4. The output of the program date should be saved in the variable datenow. What is the correct statement to enter into the shell to set this variable?
Answer: C. datenow=$(date)
The datenow=$(date) syntax uses command substitution to execute the date command and store its output in the variable. Remember to avoid pipes for variable assignment, as they pass output between commands.
Q5. After running a command to delete all of the files beginning with the letter "a", the file Access.txt remained. Assuming that the user had the correct ownership and permissions, why was Access.txt not deleted when the command was run?
Answer: D. Linux file names are case sensitive
Linux file names are case sensitive, so a pattern matching a lowercase a will ignore an uppercase A. To target both, you would need to use a bracket expansion like rm [aA] star on the command line.
Q6. Which directory contains the files and directories automatically copied over to a new user's home directory when the account is first created?
Answer: C. /etc/skel
The slash etc slash skel directory acts as a template, automatically copying its default files into a new user home directory during account creation. This ensures standard configuration files are readily available for every new user.
Q7. Which file is used to define all of the users on a Linux system?
Answer: D. /etc/passwd
The slash etc slash passwd file defines all user accounts on a Linux system by storing essential account information. It is a universally recognized plain text file that maps usernames to their corresponding user identifiers.
Q8. Which of the following provides the correct syntax to search for lines ending with the given pattern using the grep command?
Answer: D. pattern$
In regular expressions, the dollar sign represents the end of a line, so grep matches the pattern immediately preceding it at the line's conclusion. The caret symbol is used to match the beginning of a line instead, which is a common distractor on the exam.
Q9. Why is the file data.txt empty after executing sort data.txt > data.txt?
Answer: C. Because the file gets truncated before sort is executed
The file ends up empty because the shell processes the redirection first, truncating the destination file before the sort command executes. To avoid this data loss on the exam, remember to pipe the output into a temporary file instead.
Q10. What symbol can be used to represent a single character within search criteria?
Answer: B. ?
The question mark is used to represent exactly one character in shell globbing patterns. Remember that the asterisk matches zero or more characters, while a period represents a single character only within regular expressions, not standard shell expansion.
Q11. What command can be used to find the executable and man pages that exist for a given command?
Answer: B. whereis
The whereis command is specifically designed to locate the binary, source, and manual page files for a command. Do not confuse this with the which command, which only searches directories in your path to locate executable files.
Q12. How do you perform a recursive directory listing from the command prompt?
Answer: B. ls -R
The ls command combined with the dash capital R flag performs a recursive directory listing, displaying all subdirectories and their contents. Watch out for Windows-style commands like dir or incorrect slash parameters that might appear as distractors.
Q13. Which character represents the root directory?
Answer: D. /
The forward slash character represents the root directory, serving as the absolute top level of the Linux filesystem hierarchy. Every absolute path begins with this single slash, distinguishing it clearly from relative file paths.
More LPI Linux Essentials drills and other practice exams are on @CertPunch. New rounds drop every few days at certpunch.com.