102-500 Exam Questions & Answers
LPIC-1 System Administrator Exam 102, Part 2 of 2, (version 5.0) • LPI
100% money-back guarantee
Sample 102-500 Questions
Practice with real exam-style questions, each with the verified correct answer and explanation.
After issuing:
function myfunction { echo $1 $2 ; }
in Bash, which output does:
myfunction A B C
Produce?
In Bash, a function is a block of code that can be invoked by its name. A function can take arguments, which are passed to the function as positional parameters. The$1variable refers to the first argument,$2to the second argument, and so on. The function can access the number of arguments passed to it by using the$#variable. In this case, the functionmyfunctionsimply echoes the first and second arguments to the standard output. Therefore, when the commandmyfunction A B Cis executed, the output isA B, since the third argumentCis ignored by the function.Reference:
[LPI Linux Essentials - Topic 103: Command Line Basics]
[Bash Functions]
Which of the following commands lists all queued print jobs?
The lpq command, meaning list print queue, is a command-line utility in the Linux system to display the status of the print queue for a specified printer or class1. The lpq command can take various options and arguments to filter and format the output. By default, the lpq command shows the print queue for the default printer or class, which is determined by the PRINTER or LPDEST environment variables, or the /etc/printcap file. For example, to display the print queue for the default printer, one can run:
lpq
The output shows the printer name, status, rank, owner, job number, file size, and file name for each print job. For example, the output may look like:
Printer: lp@localhost 'HP LaserJet 1020' Queue: no printable jobs in queue Server: no server active Status: printer idle. enabled since Tue 09 Nov 2021 10:00:00 AM EST Rank Owner Job File(s) Total Size 1st alice 123 report.pdf 1024 bytes 2nd bob 124 memo.docx 2048 bytes 3rd charlie 125 presentation.pptx 4096 bytes
This shows that there are three print jobs in the queue for the printer lp@localhost, which is an HP LaserJet 1020. The first job belongs to alice, the second to bob, and the third to charlie. The lpq command can also display the print queue for a specific printer or class by using the -P option, followed by the printer or class name. For example, to display the print queue for the printer lp1, one can run:
lpq -P lp1
The output shows the print queue for the printer lp1, which may be different from the default printer. The lpq command can also display the print queue for all printers or classes by using the -a option. For example, to display the print queue for all printers or classes, one can run:
lpq -a
The output shows the print queue for each printer or class, separated by a blank line. The lpq command is different from the following commands:
lpd: This is not a command, but a daemon that provides print spooling and network printing services for the Linux system2. The lpd daemon is started by the system initialization scripts and runs in the background. It does not display the print queue for any printer or class.
lpr: This is a command that submits print jobs to the print queue for a specified printer or class3. The lpr command can take various options and arguments to specify the print options and the files to be printed. For example, to print the file report.pdf to the default printer, one can run:
lpr report.pdf
The lpr command does not display the print queue for any printer or class.
lp: This is a command that submits print jobs to the print queue for a specified printer or class, similar to the lpr command4. The lp command can take various options and arguments to specify the print options and the files to be printed. For example, to print the file report.pdf to the printer lp1, one can run:
lp -d lp1 report.pdf
The lp command does not display the print queue for any printer or class.
lsq: This is not a valid command in the Linux system. It may be a typo or a misspelling of the lpq command. It does not display the print queue for any printer or class.Reference:
1
Which parameter must be passed to ifconfig to activate a previously inactive network interface? (Specify the parameter only without any command, path or additional options)
The parameter that must be passed to ifconfig to activate a previously inactive network interface is up. The up parameter tells the kernel to activate the network interface and allow it to send and receive packets. The opposite of up is down, which deactivates the network interface.The up parameter is part of the topic 109.2: Basic network configuration, which is one of the objectives of the LPI Linux Administrator - 102 exam12.Reference:1: https://learning.lpi.org/en/learning-materials/102-500/2: https://www.lpi.org/our-certifications/exam-102-objectives/
Which of the following nmcli subcommands exist? (Choose two.)
The nmcli command is a command-line interface for NetworkManager, which is a tool for configuring and managing network settings on Linux systems. The nmcli command consists of different subcommands that correspond to different aspects of network configuration and management. The subcommands are:
nmcli general: shows status and permissions of NetworkManager, as well as system hostname and logging level and domains.
nmcli connection: enables you to create, modify, activate, deactivate, delete, and show network connections.
nmcli device: enables you to show, modify, and control network devices, such as interfaces, bonds, teams, bridges, etc.
nmcli monitor: monitors activity of NetworkManager and watches for changes in the state of connectivity and devices.
nmcli networking: enables or disables overall networking.
nmcli radio: enables or disables radio transmitters for Wi-Fi, Bluetooth, and WWAN devices.
nmcli agent: registers as a secret agent that provides and caches network credentials.
The other options listed are not valid nmcli subcommands. There is no nmcli ethernet, nmcli wifi, or nmcli address subcommand. However, nmcli device and nmcli connection can be used to configure and manage Ethernet and Wi-Fi connections and addresses.Reference:
NetworkManager configuration and usage | SLE Micro 5.3
nmcli: NetworkManager Reference Manual - GNOME
nmcli: command not found -- The Geek Diary
Which of the following entries in /etc/syslog.conf writes all mail related events to the file /var/log/maillog and sends all critical events to the remote server logger.example.com?
The /etc/syslog.conf file is used to configure the syslog daemon, which handles the logging of system messages. The file consists of lines that have the following format:
selector action
The selector specifies the type and priority of the messages to be logged, and the action specifies what to do with the messages. The selector has two parts, separated by a dot: the facility and the priority. The facility indicates the source of the message, such as mail, auth, kern, etc. The priority indicates the severity of the message, such as emerg, alert, crit, err, etc. A priority can also be preceded by an equal sign (=) to match only that priority, or a minus sign (-) to match all priorities except that one.
The action can be one of the following:
A filename, starting with a slash (/), indicating the file to write the messages to.
A hostname, preceded by an at sign (@), indicating the remote host to send the messages to via UDP.
A username, indicating the user to send the messages to via wall.
An asterisk (*), indicating all logged-in users.
A pipe symbol (|), followed by a command, indicating the program to pipe the messages to.
In this question, the correct entry is D. mail.*/var/log/maillogmail.crit@logger.example.org. This entry means:
Log all mail related messages (mail.*) to the file /var/log/maillog.
Log all critical mail messages (mail.crit) to the remote host logger.example.org.
The other options are incorrect because:
Option A is missing a dot between mail and crit, and uses the wrong domain name (example.org instead of example.com).
Option B uses an invalid action (syslog://logger.example.org) that is not supported by syslog.conf.
Option C is missing a dot between mail and *.
Option E is missing dots between mail and * and between mail and crit.
Get access to all 234 verified questions with detailed answers.
Unlock All 102-500 Questions