LPI 702-100 BSD Specialist Practice Questions with Explanations

Free LPI 702-100 BSD Specialist practice questions. 20 of them, each with the correct answer, a full explanation, and the reason every other option is wrong.

702-100 practice questions

Question 1

How often does ? match the preceding expression in a regular expression?

  • A. Two or more times
  • B. Exactly one time
  • C. Any number of times
  • D. Zero or one times
  • E. One or more times
Show answer and explanation ▾

Correct answer: D

In a regular expression the question mark makes the preceding item optional, so it matches zero or one time.

Why the other options are wrong:

  • A. Two or more is not what ? does.
  • B. Exactly one time describes a plain character with no quantifier.
  • C. Any number of times is the asterisk.
  • E. One or more times is the plus sign.

Question 2

Consider the following file legalfile:

disclosure non-disclosure non disclosure

Which line or lines in the file does the following command match? Note the space after the dash within the brackets.

grep "non[- ]disclosure" legalfile

  • A. disclosure only
  • B. non-disclosure only
  • C. non disclosure only
  • D. disclosure and non-disclosure only
  • E. non-disclosure and non disclosure only
Show answer and explanation ▾

Correct answer: E

The pattern non[- ]disclosure matches 'non' followed by either a hyphen or a space and then 'disclosure', so it matches non-disclosure and non disclosure but not plain disclosure.

Why the other options are wrong:

  • A. Plain disclosure has no 'non' in front, so it does not match.
  • B. The bracket also allows a space, so non disclosure matches too.
  • C. The bracket also allows a hyphen, so non-disclosure matches too.
  • D. Plain disclosure does not match because the pattern requires 'non' first.

Question 3

Which command shows all processes owned by the user bob?

  • A. who -l bob
  • B. pgrep -u bob
  • C. ps -o -a bob
  • D. top bob
  • E. last -p bob
Show answer and explanation ▾

Correct answer: B

pgrep -u bob lists the process IDs of processes owned by the user bob.

Why the other options are wrong:

  • A. who shows logged-in users, not processes.
  • C. That is not a valid ps option set for selecting a user's processes.
  • D. top does not take a user name as a plain argument this way.
  • E. last shows login history, not running processes.

Question 4

Which command finds all directories within the current user’s home directory?

  • A. find ~ -type d
  • B. find . -dir
  • C. find / -d | home
  • D. find -uid myname
  • E. find -d home
Show answer and explanation ▾

Correct answer: A

find ~ -type d starts at the home directory and lists only directories.

Why the other options are wrong:

  • B. find . starts in the current directory, and -dir is not a find test.
  • C. find / searches the whole filesystem and the pipe to home is not valid usage.
  • D. -uid tests file ownership by number and does not select directories.
  • E. -d home is not valid find syntax for finding directories.

Question 5

A file called mybackup is found while investigating a USB pen drive.

Which utility can be used to determine the kind of data that is contained in that file?

  • A. file mybackup
  • B. ls -l mybackup
  • C. tar -t mybackup
  • D. whatis mybackup
  • E. touch mybackup
Show answer and explanation ▾

Correct answer: A

The file utility examines the contents of a file and reports what kind of data it holds, such as a tar archive, compressed data or plain text, regardless of the file name.

Why the other options are wrong:

  • B. ls -l shows permissions, owner, size and date, not the kind of data inside the file.
  • C. tar -t lists an archive and only helps if the file is already known to be a tar archive.
  • D. whatis shows one-line manual page descriptions, not file contents.
  • E. touch updates timestamps or creates an empty file.

Question 6

Which device stands for the first BSD disk slice in the disk label on the first partition on the second SATA disk on OpenBSD?

  • A. /dev/sd1a
  • B. /dev/d2s1
  • C. /dev/sl1d2
  • D. /dev/sd1p2d
  • E. /dev/sata2a
Show answer and explanation ▾

Correct answer: A

OpenBSD numbers its sd disks from zero, so the second disk is sd1. Partitions in the disklabel are lettered, and the first one is a, which gives /dev/sd1a.

Why the other options are wrong:

  • B. /dev/d2s1 is not an OpenBSD disk device name.
  • C. /dev/sl1d2 is not an OpenBSD disk device name.
  • D. /dev/sd1p2d is not an OpenBSD disk device name.
  • E. OpenBSD has no sata device prefix for disks.

Question 7

Which of the following tar options handle compression? (Choose two.)

  • A. -x
  • B. -c
  • C. -z
  • D. -J
  • E. -v
Show answer and explanation ▾

Correct answer: C, D

The -z option makes tar compress or decompress the archive with gzip, and -J does the same with xz. The other options select the operation or the verbosity.

Why the other options are wrong:

  • A. -x extracts files from an archive.
  • B. -c creates a new archive.
  • E. -v prints verbose output.

Question 8

When creating a symbolic link, an error message indicating that the target already exists is displayed.

Which statement is true?

  • A. ln can not override an existing target so the target must be manually removed.
  • B. ln can override the target, but only if it is a file.
  • C. ln can override the target, but only if it is a directory.
  • D. ln can override the target, whether it is a file or a directory.
  • E. ln can not override an existing symbolic link.
Show answer and explanation ▾

Correct answer: B

With the -f option, ln unlinks an existing target file and then creates the link in its place. An existing directory is not replaced: ln creates the link inside that directory instead.

Why the other options are wrong:

  • A. ln -f removes an existing target file itself, so manual removal is not required.
  • C. ln does not replace an existing directory.
  • D. ln does not replace an existing directory.
  • E. An existing symbolic link is replaced when the -f option is used.

Question 9

What is the purpose of the nice command?

  • A. Run a command with the permissions of another user.
  • B. Run a command with limited access to a specified directory.
  • C. Run a command with additional filesystem permissions.
  • D. Run a command with additional secondary groups.
  • E. Run a command with a non-standard priority.
Show answer and explanation ▾

Correct answer: E

nice starts a command with an adjusted scheduling priority. A higher nice value lowers the priority so the command competes less for CPU time, and only the superuser may raise priority.

Why the other options are wrong:

  • A. Running a command as another user is done with su or a similar tool, not nice.
  • B. Restricting a command to a directory is done with chroot, not nice.
  • C. nice does not change filesystem permissions.
  • D. nice does not change group memberships.

Question 10

Which command sends the contents of the file myconfigfile by email to me@mycompany.com?

  • A. cat myconfigfile | mail me@mycompany.com
  • B. cat myconfigfile > me@mycompany.com
  • C. mail me@mycompany.com | cat myconfigfile
  • D. mail me@mycompany.com > cat myconfigfile
  • E. mail myconfigfile -r me@mycompany.com
Show answer and explanation ▾

Correct answer: A

The mail command reads the message body from standard input and sends it to the address given as its argument. Piping the output of cat into mail therefore sends the file contents to the recipient.

Why the other options are wrong:

  • B. This redirects the file contents into a local file named me@mycompany.com.
  • C. This pipes the output of mail into cat, so the file is never used as the message body.
  • D. This redirects the output of mail into a file named cat.
  • E. This does not pass the file contents to mail as the message body.

Question 11

Which command can be used to display the local filesystems that are currently mounted?

  • A. cat /etc/fstab
  • B. df -h
  • C. du -s
  • D. mount -a
  • E. rpcinfo
Show answer and explanation ▾

Correct answer: B

df lists the filesystems that are currently mounted together with their size, used space, free space and mount point. The -h option prints the sizes in human-readable units.

Why the other options are wrong:

  • A. /etc/fstab lists configured filesystems, whether or not they are mounted now.
  • C. du -s summarizes the disk usage of files and directories.
  • D. mount -a mounts the filesystems listed in /etc/fstab instead of displaying them.
  • E. rpcinfo reports registered RPC services.

Question 12

While in the csh or tcsh shell, which command changes the timezone environment variable to GMT?

  • A. export TZ=GMT
  • B. setenv TZ GMT
  • C. env TZ=GMT
  • D. TZ=GMT; export TZ
  • E. environ TZ GMT
Show answer and explanation ▾

Correct answer: B

csh and tcsh set environment variables with setenv, followed by the variable name and the value separated by a space, so setenv TZ GMT sets the timezone variable for the current shell.

Why the other options are wrong:

  • A. export with NAME=value is Bourne shell family syntax and does not work in csh.
  • C. env TZ=GMT does not change the environment of the current shell.
  • D. This is Bourne shell syntax and does not work in csh.
  • E. environ is not a csh command for setting variables.

Question 13

While using vi as superuser, the attempt to save a file while quitting the editor leads to an error indicating that the file is read-only.

How can the file permissions be overridden to save the edits to the file and quit the editor?

  • A. :fw!
  • B. :fwq
  • C. :q!
  • D. :wq
  • E. :wq!
Show answer and explanation ▾

Correct answer: E

In vi, :wq writes the file and quits, and adding an exclamation mark forces the write. As superuser, :wq! overrides the read-only permission, saves the edits and exits.

Why the other options are wrong:

  • A. :fw! is not a vi command for saving a file.
  • B. :fwq is not a vi command for saving a file.
  • C. :q! quits and discards the edits.
  • D. :wq fails with the same read-only error because the write is not forced.

Question 14

What does $1 represent in the following lines from a Bourne shell script:

  • #!/bin/sh
  • cp $1 $2
  • A. A control operator.
  • B. An environmental variable.
  • C. A function.
  • D. A positional parameter.
  • E. The shebang.
Show answer and explanation ▾

Correct answer: D

$1 is a positional parameter: it holds the first argument given to the script on the command line, and $2 holds the second. The script copies the file named by the first argument to the name given by the second.

Why the other options are wrong:

  • A. Control operators are tokens such as ;, & and |, not $1.
  • B. Environment variables are named variables inherited by processes, not numbered arguments.
  • C. $1 is not a function.
  • E. The shebang is the #!/bin/sh line at the top of the script.

Question 15

On BSD systems that provide an interactive adduser script, which configuration file stores the default adduser settings?

  • A. adduser.conf
  • B. login.conf
  • C. pw.conf
  • D. user.conf
  • E. usermgmt.conf
Show answer and explanation ▾

Correct answer: A

The interactive adduser script reads its default settings, such as the default shell, home directory location and login class, from adduser.conf in /etc.

Why the other options are wrong:

  • B. login.conf defines login classes and their resource limits.
  • C. pw.conf holds the defaults for the pw utility.
  • D. user.conf is not the file that stores the adduser defaults.
  • E. usermgmt.conf holds the defaults for the useradd family of commands.

Question 16

Which command locks the user account bob on a FreeBSD system?

  • A. audit_user -l bob
  • B. lockuser bob
  • C. pw lock bob
  • D. usermod lock bob
  • E. vipw lock bob
Show answer and explanation ▾

Correct answer: C

On FreeBSD the pw utility manages users and groups. pw lock followed by the user name disables the account so that the user cannot log in, and pw unlock reverses it.

Why the other options are wrong:

  • A. audit_user is not a command for locking accounts.
  • B. lockuser is not a FreeBSD command.
  • D. usermod lock bob is not how an account is locked on FreeBSD.
  • E. vipw opens the password file in an editor and takes no lock subcommand.

Question 17

Which line in a cron job runs myscript once per hour?

  • A. * * * * * /pathto/myscript
  • B. 0 * * * * /pathto/myscript
  • C. * 0 * * * /pathto/myscript
  • D. * * 0 * * /pathto/myscript
  • E. * * * 0 * /pathto/myscript
Show answer and explanation ▾

Correct answer: B

The five cron time fields are minute, hour, day of month, month and day of week, and an asterisk matches every value. A 0 in the minute field with asterisks elsewhere runs the job at minute 0 of every hour, which is once per hour.

Why the other options are wrong:

  • A. Asterisks in all five fields run the script every minute.
  • C. This runs the script every minute during hour 0 only.
  • D. This puts 0 in the day of month field, which accepts 1 to 31, and leaves the minute field matching every minute.
  • E. This puts 0 in the month field, which accepts 1 to 12, and leaves the minute field matching every minute.

Question 18

When replacing the system MTA with another mail server program, which configuration file needs to be updated with the path to the new MTA?

  • A. mail.conf
  • B. mailer.conf
  • C. mta.conf
  • D. postfix.conf
  • E. sendmail.conf
Show answer and explanation ▾

Correct answer: B

BSD systems route calls to sendmail, mailq and newaliases through the mailwrapper program, which reads mailer.conf to find the real binaries. Pointing those entries at the new MTA switches the system mail server.

Why the other options are wrong:

  • A. mail.conf is not the file read by mailwrapper.
  • C. mta.conf is not the file read by mailwrapper.
  • D. postfix.conf is not the file that maps the system mail commands to an MTA.
  • E. sendmail.conf is not the file that maps the system mail commands to an MTA.

Question 19

Which command shows the current user’s group memberships?

  • A. group
  • B. groups
  • C. ident
  • D. showuser
  • E. who
Show answer and explanation ▾

Correct answer: B

The groups command prints the names of all groups the current user belongs to. Given a user name as an argument, it prints that user's groups instead.

Why the other options are wrong:

  • A. group is the name of the /etc/group file, not a command that lists memberships.
  • C. ident does not show group memberships.
  • D. showuser is not a standard BSD command.
  • E. who lists the users currently logged in.

Question 20

Which of the following programs can be used to enumerate all responsive hosts on a subnet?

  • A. traceroute
  • B. netstat
  • C. nmap
  • D. rtsol
  • E. route
Show answer and explanation ▾

Correct answer: C

nmap is a network scanner that can probe every address in a subnet and report which hosts respond, for example with a ping scan of the whole address range.

Why the other options are wrong:

  • A. traceroute shows the path of routers to a single destination.
  • B. netstat shows local network connections, routing tables and interface statistics.
  • D. rtsol sends IPv6 router solicitation messages.
  • E. route displays and changes the local routing table.

That was 20 of 53.

The full LPI 702-100 BSD Specialist pack has all 53 questions, each with the answer, the explanation and why the other options are wrong, plus a questions-only copy for timed runs. $39.00 USD, paid once, with free monthly updates and a pass-or-your-money-back guarantee.

Get the full pack

Not ready yet? Get the first 20 free as one PDF by email. Get the Half Pack →

About the 702-100 exam

These 20 LPI 702-100 BSD Specialist questions are free here, and as a free PDF by email.

They are drawn from the same bank as the full 702-100 pack, which has 53 questions in total.

Back to blog