All LPI exams
Free 010-200 practice test: 30 questions with answers
30 original questions for Linux Essentials, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.
- Free questions
- 30
- Full bank
- 112 questions
- Real exam
- 40 questions, 60 min
All 30 010-200 questions with answers
The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.
012 Command Line Basics (6 questions)
Question 1
The current working directory is /srv/www/site/assets. Which command changes to the parent directory /srv/www/site?
- Acd ..
- Bcd /srv
- Ccd ~
- Dcd ../..
Show answer and explanationHide answer
Correct answer: AThe two dots refer to the parent directory, so cd .. moves one level up from assets to site. cd /srv jumps to an unrelated absolute path, cd ~ returns to the home directory, and cd ../.. goes two levels up to /srv/www.
Question 2
A user wants to read the description of the layout of the /etc/passwd file rather than the passwd command. Which command should they run?
- Aman 1 passwd
- Bman -k passwd
- Cman 5 passwd
- Dman 8 useradd
Show answer and explanationHide answer
Correct answer: CSection 5 of the manual describes file formats and conventions, and passwd(5) documents the fields of /etc/passwd. Section 1 covers the passwd command, section 8 covers system administration commands such as useradd, and man -k searches page descriptions rather than showing a page.
Question 3
A user remembers that a tool's purpose involves compressing files but does not know its name. Which command searches the one-line descriptions of man pages for a keyword?
- Awhereis compress
- Bapropos compress
- Cwhich compress
- Dtype compress
Show answer and explanationHide answer
Correct answer: Bapropos searches the names and short descriptions in the manual index for a keyword, the same as man -k. whereis locates binaries, sources and man pages by file name, which requires knowing the name, and type shows how the shell interprets a name.
Question 4
A developer wants to delete the directory /tmp/build-cache, including all of its nested subdirectories and files, in one command. Which command accomplishes this?
- Armdir /tmp/build-cache
- Brm -r /tmp/build-cache
- Cmv /tmp/build-cache /tmp/old-cache
- Drm /tmp/build-cache
Show answer and explanationHide answer
Correct answer: Brm -r removes a directory together with everything beneath it. rmdir only removes empty directories, plain rm refuses to remove a directory without -r, and mv only relocates the tree without deleting it.
Question 5
An administrator needs to rename /home/tom/report.txt to /home/tom/report-2024.txt without making a second copy of the file data. Which command does this?
- Amv /home/tom/report.txt /home/tom/report-2024.txt
- Bcp /home/tom/report.txt /home/tom/report-2024.txt
- Cln /home/tom/report.txt /home/tom/report-2024.txt
- Dtouch /home/tom/report-2024.txt
Show answer and explanationHide answer
Correct answer: Amv changes a file's name without copying its data, so the old name disappears. cp duplicates the data, ln adds a second name to the same file while the original name remains, and touch creates an empty file or updates timestamps.
Question 6
Which two statements about Tab completion in a typical bash shell are correct? (Choose two.)
- AIt runs the most recent command from the shell history.
- BIt completes a partially typed command or file name when the match is unique.
- CIt moves the cursor to the start of the current command line.
- DIt closes the terminal session when pressed on an empty prompt.
- EIt lists possible matches when the typed prefix matches several names.
Show answer and explanationHide answer
Correct answer: B, ETab completion fills in a unique match and lists candidates when several names share the typed prefix. Rerunning history is done with the Up arrow or !!, Ctrl+A moves to the start of the line, and Ctrl+D ends input at an empty prompt, so those statements describe other keys.
013 Data Processing (6 questions)
Question 7
A user wants to create a gzip-compressed tar archive named backup.tar.gz from the directory /home/sam/photos. Which command does this?
- Atar -xzf backup.tar.gz /home/sam/photos
- Bgzip -d backup.tar.gz /home/sam/photos
- Ctar -czf backup.tar.gz /home/sam/photos
- Dtar -tzf backup.tar.gz /home/sam/photos
Show answer and explanationHide answer
Correct answer: C-c creates an archive, -z compresses it with gzip and -f names the archive file. The other options extract (-x), decompress with gzip -d, or list (-t) the contents instead of creating an archive.
Question 8
Which redirection operator appends command output to the end of an existing file without erasing its current contents?
- AThe single greater-than sign (>)
- BThe less-than sign (<)
- CThe double greater-than sign (>>)
- DThe number 2 followed by greater-than (2>)
Show answer and explanationHide answer
Correct answer: C>> appends standard output to the end of the file and creates the file if it is missing. > replaces existing contents, < feeds input from a file, and 2> redirects standard error rather than standard output.
Question 9
An administrator wants to know how many lines in /var/log/app.log contain the word error. Which command gives this count?
- Agrep -v error /var/log/app.log
- Bgrep -c error /var/log/app.log
- Cwc -c error /var/log/app.log
- Dsort -u error /var/log/app.log
Show answer and explanationHide answer
Correct answer: Bgrep -c prints the number of lines that match the pattern. grep -v prints the lines that do not match, wc -c counts bytes rather than matching lines, and sort -u sorts unique lines without counting matches.
Question 10
A Bash script must start with the Bash interpreter when it is executed directly. Which line must appear first in the file?
- A#bash
- B!/bin/bash
- C#!/bin/bash
- D//bin/bash
Show answer and explanationHide answer
Correct answer: CThe shebang is the two characters #! followed by the absolute path to the interpreter, and the kernel uses it to launch the script. The other lines lack the #! characters or a valid absolute interpreter path, so the kernel will not start Bash.
Question 11
A user wrote a script named backup.sh in the current directory, and running ./backup.sh gives 'Permission denied'. Which command lets the file owner run it?
- Achmod 600 backup.sh
- Bchown root backup.sh
- Cchmod u+x backup.sh
- Dchmod u-w backup.sh
Show answer and explanationHide answer
Correct answer: Cu+x adds the execute permission for the owner, which lets the shell run the script by path. Mode 600 gives only read and write, chown changes ownership, and u-w removes write permission, so none of them add execute permission.
Question 12
Which three statements about the tar command are correct? (Choose three.)
- AThe -c option creates a new archive.
- BThe -x option extracts the contents of an archive.
- CIt compresses files with gzip unless a compression option is given.
- DThe -t option lists the contents of an archive without extracting it.
- EIt deletes the source files after they have been added to the archive.
Show answer and explanationHide answer
Correct answer: A, B, D-c creates, -x extracts and -t lists the archive contents without extracting them. tar does not compress unless a compression option is given, and it does not remove the source files after archiving them.
014 Linux System Administration Basics (6 questions)
Question 13
A process has stopped responding and ignores normal termination requests. Which signal, sent with kill, forces the kernel to end it, and the process cannot catch or ignore it?
- ASIGTERM (15)
- BSIGINT (2)
- CSIGHUP (1)
- DSIGKILL (9)
Show answer and explanationHide answer
Correct answer: DSIGKILL (9) cannot be caught, blocked or ignored, so the kernel ends the process directly. SIGTERM, SIGHUP and SIGINT can be caught or ignored by a program, which is why they are tried before SIGKILL.
Question 14
A nightly data-export job should yield CPU time to interactive users. Which approach achieves this?
- AStart the job with nice and a negative adjustment such as -10
- BStart the job with nice and a positive adjustment such as 10
- CSend the job a SIGKILL so the scheduler restarts it later
- DBring the job to the foreground with fg so it gets more CPU
Show answer and explanationHide answer
Correct answer: BNice values range from -20 (highest priority) to 19 (lowest), so a positive adjustment makes the scheduler give the job less CPU. A negative value raises priority, SIGKILL ends the job, and fg only moves a job to the foreground without changing its priority.
Question 15
On a systemd-based distribution, which command displays messages from the systemd journal, optionally filtered by service unit?
- Alsblk -f
- Bjournalctl
- Chostnamectl
- Dcrontab -l
Show answer and explanationHide answer
Correct answer: Bjournalctl reads the journal that systemd collects, and options such as -u filter it by unit. lsblk lists block devices, crontab -l lists scheduled cron jobs, and hostnamectl shows or sets the host name settings.
Question 16
A technician plugs in a new USB drive and needs the device name the kernel assigned, along with its partitions and mount points. Which command provides this view?
- Alsblk
- Blsmod
- Clspci
- Dlsattr
Show answer and explanationHide answer
Correct answer: Alsblk lists block devices such as disks and their partitions, with names and mount points. lsmod lists loaded kernel modules, lspci lists PCI hardware, and lsattr shows file attributes on filesystems that support them.
Question 17
A small network needs one server name to resolve to a fixed IP address before any DNS query is made. Which file holds such static name-to-address mappings on Linux?
- A/etc/hosts
- B/etc/fstab
- C/etc/resolv.conf
- D/etc/passwd
Show answer and explanationHide answer
Correct answer: A/etc/hosts maps host names to IP addresses locally, so those names resolve without a DNS query. /etc/resolv.conf names DNS servers, /etc/fstab lists filesystems to mount, and /etc/passwd stores user account records.
Question 18
A server has a 4 TB disk that must be partitioned so the whole disk is usable. Which partitioning scheme should be chosen, and why is the older alternative unsuitable?
- AMBR, because it supports more partitions than GPT and has no capacity limit
- BGPT, because MBR cannot address the full capacity of very large disks
- CMBR, because GPT can only be used on systems that do not have a BIOS
- DGPT, because it removes the need for any boot loader on the system
Show answer and explanationHide answer
Correct answer: BMBR's 32-bit sector addressing cannot reach the end of very large disks, while GPT uses 64-bit addresses. MBR does not have unlimited capacity, GPT still needs a boot loader, and GPT is not restricted to systems without a BIOS.
011 The Linux Operating System and Open Source Software (6 questions)
Question 19
A developer copies a GPL-licensed library into a commercial product and then distributes the product to customers. What does the GPL require in this situation?
- AIt forbids the developer from ever charging money for copies of the product.
- BIt requires the library to be removed and replaced with an equivalent proprietary component.
- CIt bars the product from being distributed at all, so it may only run in-house.
- DIt requires the source code of the modified product to be offered under GPL terms.
Show answer and explanationHide answer
Correct answer: DThe GPL is a copyleft license, so a distributed modified work must make its source available under GPL terms. Charging a fee and distributing the program are both allowed under the GPL, and the license does not require replacing the library with proprietary code.
Question 20
An administrator on a Debian-based server wants to install software from the configured repositories using the native package tools. Which tool family does this?
- Aapt and dpkg, the package tools of Debian-based systems
- Bpacman and makepkg, the package tools of Arch-based systems
- Crpm and dnf, the package tools of Red Hat-based systems
- Dzypper and YaST, the package tools of SUSE-based systems
Show answer and explanationHide answer
Correct answer: ADebian and Ubuntu use apt, a front end to the dpkg package system. Red Hat-based systems use rpm and dnf, Arch uses pacman, and SUSE uses zypper, so those options name the wrong distribution family.
Question 21
Ubuntu is described as a derivative distribution. Which distribution is the upstream base from which Ubuntu is derived?
- AArch Linux, whose rolling packages Ubuntu repackages
- BRed Hat Enterprise Linux, whose rpm packages Ubuntu repackages
- CSlackware, whose tarball packages Ubuntu repackages
- DDebian, whose package format and apt tools Ubuntu builds on
Show answer and explanationHide answer
Correct answer: DUbuntu is built on Debian and uses the deb package format with apt and dpkg. Red Hat Enterprise Linux uses rpm, Slackware uses tarball packages, and Arch Linux uses pacman, so none of them is the base of Ubuntu.
Question 22
A company modifies a GPL-licensed program and uses it only on its own internal servers, never giving copies to anyone outside the company. What does the GPL require in this case?
- AThe company must switch to a permissive license such as MIT before using it
- BThe company must publish the modified source on a public website within 30 days
- CThe company must send the modified source to the original author for approval
- DNothing needs to be published, because the GPL source obligations apply when the program is distributed
Show answer and explanationHide answer
Correct answer: DThe GPL source-offer obligation is triggered by distributing copies to others. Private internal use of a modified version does not require publishing it. The GPL sets no 30-day publication rule, needs no author approval, and does not require relicensing.
Question 23
Which two of the following are open source server applications commonly run on Linux? (Choose two.)
- AApache HTTP Server, a widely deployed open source web server
- BSamba, an open source file and print sharing server for Windows clients
- CAdobe InDesign, a proprietary desktop publishing application
- DGIMP, an open source desktop image editing program
- EMicrosoft Exchange Server, a proprietary mail and collaboration server
Show answer and explanationHide answer
Correct answer: A, BApache HTTP Server and Samba are open source server programs commonly deployed on Linux. InDesign and GIMP are desktop applications, and Exchange is a proprietary Microsoft server product.
Question 24
A startup wants to build a proprietary product on top of a small open source library and keep its own source code closed. Which license allows this with minimal conditions?
- AGNU General Public License version 2, a strong copyleft license
- BGNU Affero General Public License version 3, a network copyleft license
- CMIT License, a short permissive license with minimal conditions
- DGNU General Public License version 3, a strong copyleft license
Show answer and explanationHide answer
Correct answer: CThe MIT License is permissive: it allows proprietary derivative works and mainly requires the copyright notice and license text to be kept. The GPL versions and the Affero license are copyleft licenses that require derivative works distributed to others to remain open under compatible terms.
015 Security and File System Permissions (6 questions)
Question 25
A configuration file must be readable and writable by its owner, and readable but not writable by its group and by all other users. Which numeric permission mode should be set?
- A644
- B664
- C600
- D755
Show answer and explanationHide answer
Correct answer: AMode 644 gives the owner read and write (6), and the group and others read (4). Mode 600 denies the group and others any access, 664 gives the group write permission, and 755 gives execute permission to everyone.
Question 26
A developer needs to run one administrative command as root, authenticating with their own password, with the action logged against their account. Which tool should be used?
- Asu with the root password
- Bpasswd
- Cvisudo
- Dsudo
Show answer and explanationHide answer
Correct answer: Dsudo runs one command as root after the user authenticates with their own password, and the action is logged. su switches accounts using the target account's password, passwd changes passwords, and visudo edits the sudoers configuration.
Question 27
An administrator needs to copy a local backup file to a remote server in a single command, with the transfer encrypted. Which command should be used?
- Atar
- Bftp
- Ccp
- Dscp
Show answer and explanationHide answer
Correct answer: Dscp copies files over an SSH connection, so the data is encrypted in transit. cp only works on the local system, ftp sends data without encryption by default, and tar builds archives without transferring them.
Question 28
On a Linux system, which file stores the hashed passwords of user accounts and is normally readable only by root?
- A/etc/passwd
- B/etc/group
- C/etc/shadow
- D/etc/hosts
Show answer and explanationHide answer
Correct answer: C/etc/shadow holds password hashes and password aging data, and it is normally readable only by root. /etc/passwd holds account fields that ordinary users can read, /etc/group lists groups and members, and /etc/hosts maps names to addresses.
Question 29
Several users share a writable directory for temporary files. Which special permission on that directory stops users from deleting each other's files?
- AThe setuid bit on the directory
- BThe sticky bit on the directory
- CMode 777 with no special bit
- DThe setgid bit on the directory
Show answer and explanationHide answer
Correct answer: BThe sticky bit on a directory, as used on /tmp, lets only the file owner, the directory owner or root delete or rename entries there. The setuid bit is meant for executables, setgid controls group inheritance, and mode 777 without a special bit lets any user delete any file.
Question 30
The web server runs as user www-data, but the directory /var/www/uploads and its contents are owned by root. The administrator wants www-data to own everything under that directory in one step. Which command does this?
- Achown -R www-data /var/www/uploads
- Bchmod -R 777 /var/www/uploads
- Cchown www-data /var/www/uploads/*
- Dchmod u+s /var/www/uploads
Show answer and explanationHide answer
Correct answer: Achown -R changes the owner of the directory and of every file and subdirectory beneath it. chmod -R 777 opens permissions to everyone without changing ownership, a glob-based chown misses nested contents, and the setuid bit on a directory does not change its owner.