To prevent a specific user from scheduling tasks with at, what should the administrator do?
Add the specific user to /etc/at.allow file.
Add the specific user to [deny] section in the /etc/atd.conf file.
Add the specific user to /etc/at.deny file.
Add the specific user to nojobs group.
Run the following: atd --deny [user].
The /etc/at.deny file is a file that contains a list of users who are not allowed to use the at command to schedule jobs. If the file exists, any user who is not in the /etc/at.allow file and is in the /etc/at.deny file will be denied access to the at command. To prevent a specific user from scheduling tasks with at, the administrator can simply add the user’s name to the /etc/at.deny file. For example, to prevent the user bob from using the at command, the administrator can use the following command:
echo “bob†| sudo tee -a /etc/at.deny
The other options are not correct. The /etc/at.allow file is a file that contains a list of users who are allowed to use the at command. Adding a user to this file will not prevent them from scheduling tasks with at. The /etc/atd.conf file is a configuration file for the at daemon, which does not have a [deny] section. Adding a user to this file will not affect their access to the at command. The nojobs group is not a predefined group in Linux, and adding a user to this group will not prevent them from scheduling tasks with at. The atd command does not have a --deny option, and running this command will not prevent a user from scheduling tasks with at. References:
at Command in Linux with Examples - GeeksforGeeks
How to Use the Linux at Command {9 Examples} - phoenixNAP
at(1) - Linux man page
Which of the following steps prevents a user from obtaining an interactive login session?
Run the command chsh -s /bin/false with the user name.
Set the UID for the user to 0.
Remove the user from the group staff.
Add the user to /etc/noaccess.
Create a .nologin file in the user's home directory.
Running the command chsh -s /bin/false with the user name will change the user’s login shell to /bin/false, which is a program that does nothing and returns a non-zero exit code. This means that the user will not be able to execute any commands or start an interactive shell session. This is a common way to disable a user’s login without disabling the account completely, which can be useful for users who only need to access the system via scp, sftp, or other non-interactive services. However, this method does not prevent the user from authenticating with the system, and it may not work with some services that do not rely on the login shell, such as ssh with a forced command. Therefore, it is not a foolproof way to secure the system from unauthorized access. References: 1234
Which of the following can the chage command NOT change?
The number of days since January 1, 1970 after which the user's account will no longer be accessible.
The number of days since January 1, 1970 after which the password can change.
The number of days since January 1, 1970 since the password was last changed.
The maximum number of days during which a password is valid.
The number of days of inactivity after a password has expired before the account is locked.
The chage command can change the following parameters related to user password expiry and aging:
The last password change date (-d or --lastday option)
The password expiry date (-E or --expiredate option)
The minimum number of days between password changes (-m or --mindays option)
The maximum number of days during which a password is valid (-M or --maxdays option)
The number of days of warning before password expires (-W or --warndays option)
The chage command cannot change the number of days of inactivity after a password has expired before the account is locked. This parameter is controlled by the -I or --inactive option of the usermod command, which modifies the user account information. The chage command only displays the current value of this parameter, but does not allow changing it. References:
chage command in Linux with examples - GeeksforGeeks
10 chage command examples in Linux [Cheat Sheet] - GoLinuxCloud
How to Use the Chage Command in Linux – TecAdmin
How to Manage User Password Expiration and Aging in Linux - Tecmint
Why is /etc/shadow not world readable if the passwords are stored in an encrypted fashion?
The encrypted passwords are still subject to brute force attacks.
This is just for historical reasons.
There is other information in the file that needs to be kept secret.
The passwords can be decrypted by anyone with root access.
 The /etc/shadow file is not world readable because the encrypted passwords stored in it are still vulnerable to offline brute force attacks. A brute force attack is a method of trying every possible password until finding the correct one. With modern hardware and software, millions of passwords can be tried per second. If the /etc/shadow file was world readable, anyone who logged in to the system, even as a guest, could copy the file and attempt to crack the passwords without leaving any trace. By making the file readable only by the root user, the system prevents unauthorized access to the password hashes and reduces the risk of password compromise. The other options are incorrect because they do not explain the reason for the file permissions. Option B is false, as the /etc/shadow file was created to address the security issues of the /etc/passwd file, which used to store the passwords in a world readable file. Option C is partially true, as the /etc/shadow file does contain other information related to password expiration and account locking, but this is not the main reason for making the file not world readable. Option D is irrelevant, as the passwords cannot be decrypted by anyone, even with root access, as the encryption is one-way and irreversible. References: https://www.computernetworkingnotes.com/linux-tutorials/etc-shadow-file-in-linux-explained-with-examples.html
https://kerneltalks.com/user-management/understanding-etc-shadow-file/
In which file, if present, must all users be listed that are allowed to use the cron scheduling system? (Specify the full name of the file, including path.)
/etc/cron.allow
The /etc/cron.allow file is a file that contains a list of users who are allowed to use the cron scheduling system. The cron scheduling system is a way of running commands or scripts at specified times or intervals. Users can create their own cron jobs by using the crontab command, which edits a file called crontab that stores the user’s scheduled tasks. However, not all users may have access to the crontab command or the cron system. The access is controlled by two files: /etc/cron.allow and /etc/cron.deny. If the /etc/cron.allow file exists, then only the users listed in this file can use the crontab command and the cron system. The file should have one user name per line. If the /etc/cron.allow file does not exist, then the /etc/cron.deny file is checked. If this file exists, then the users listed in this file are denied access to the crontab command and the cron system. If neither file exists, then the access depends on the configuration of the cron daemon, which is the program that runs the cron jobs. By default, only the root user can use the cron system if no files exist. The root user can always use the cron system regardless of the existence or content of these files. To create or edit the /etc/cron.allow file, the root user needs to use a text editor such as vi, nano, or emacs. For example, to allow the users alice and bob to use the cron system, the root user can use the following command:
sudo vi /etc/cron.allow
And then add the following lines to the file:
alice bob
And then save and exit the file. References:
How cron.allow and cron.deny can be used to limit access to crontab for …
/etc/cron.allow - Linux Bash Shell Scripting Tutorial Wiki
Linux / UNIX Restrict at / cron Usage To Authorized Users
To exclude all log messages of a given logging facility, you should use a logging priority of _____ .
none
 To exclude all log messages of a given logging facility, you should use a logging priority of none. This means that no messages from that facility will be logged, regardless of their severity level. For example, if you want to exclude all messages from the local0 facility, you can use local0.none in your syslog configuration file. This will prevent any messages from local0 from being written to any log file or destination that matches that selector12. The logging priority of none is part of the LPI’s multi-level Linux professional certification program, and it is covered in the topic 106.1 System logging of the exam 102 objectives3. References: 1: logging - exclude syslog facility from all others - Server Fault 2: rsyslog.conf(5) - Linux manual page - man7.org 3: Exam 102 Objectives
Which file, when using Sendmail or a similar MTA system, will allow a user to redirect all their mail to another address and is configurable by the user themselves?
/etc/alias
~/.alias
/etc/mail/forwarders
~/.forward
~/.vacation
The ~/.forward file is a file that users can create in their home directories to redirect mail or send mail using sendmail or a similar MTA system. The file contains a list of recipient addresses, which can be email addresses, file names, program names, or :include: files. The file must be owned by the user and have the read permission bit set for the owner. The file cannot be a symbolic link or have more than one hard link. The file is processed by sendmail when a recipient address selects a delivery agent with the F=w flag set. If the file contains a backslash, further processing is disabled and the message is delivered to the user’s mail-spooling directory. If the file does not exist or cannot be read, it is silently ignored. The ~/.forward file is different from the /etc/aliases file, which is a system-wide file that maps aliases to one or more recipient addresses. The /etc/aliases file is maintained by the system administrator and requires running the newaliases command after any changes. The ~/.alias file is not a valid file for sendmail or similar MTA systems. The /etc/mail/forwarders file is not a standard file for sendmail or similar MTA systems. The ~/.vacation file is a file that contains a vacation message that is sent to the sender when the user is away. The ~/.vacation file is used in conjunction with the vacation program, which can be invoked from the ~/.forward file. References:
What is true regarding the command sendmail?
With any MTA, the sendmail command must be run periodically by the cron daemon.
All MTAs, including Postfix and Exim, provide a sendmail command.
The sendmail command prints the MTAs queue history of which mails have been sent successfully.
It is only available when the sendmail MTA is installed.
The sendmail command is a generic interface to various mail transfer agents (MTAs), such as Sendmail, Postfix, Exim, Qmail, etc. The sendmail command is used to send emails from the command line or from other programs that need to deliver emails. The sendmail command accepts various flags and parameters to specify the sender, recipient, subject, body, and attachments of the email. The sendmail command also reads the standard input for the email content if no file is specified. The sendmail command is part of the sendmail package, which is the original and most widely used MTA for Unix-like systems. However, other MTAs, such as Postfix and Exim, also provide a sendmail command for compatibility reasons. The sendmail command provided by these MTAs may have slightly different syntax and options, but they all support the basic functionality of sending emails. Therefore, the statement that all MTAs, including Postfix and Exim, provide a sendmail command is true123.
The other statements are false. The sendmail command does not need to be run periodically by the cron daemon, as it is not a daemon itself, but a command-line tool. The sendmail command does not print the MTA’s queue history, but rather sends the email to the MTA for delivery. The sendmail command is not only available when the sendmail MTA is installed, but also when other MTAs that provide a sendmail command are installed. References: 1: Linux Sendmail Command Help and Examples - Computer Hope 2: Send Email in Linux from Command Line | DigitalOcean 3: 5 Ways To Send Email from Linux Command Line - TecAdmin
What entry can be added to the syslog.conf file to have all syslog messages generated by a system displayed on console 12?
*.* /dev/tty12
/var/log/messages | /dev/tty12
| /dev/tty12
syslog tty12
mail.* /dev/tty12
The entry that can be added to the syslog.conf file to have all syslog messages generated by a system displayed on console 12 is A. . /dev/tty12. This entry consists of a selector field and an action field, separated by a space or a tab. The selector field specifies the pattern of facilities and priorities that match the action. The action field specifies the destination where the matching messages are sent. In this case, the selector field is ., which means all facilities and all priorities. The action field is /dev/tty12, which is the device file for the console 12. This means that any syslog message generated by the system will be displayed on the console 12, regardless of its facility or priority. This can be useful for debugging or monitoring purposes, but it can also be very noisy and distracting, as it will show all kinds of messages, including debug, info, notice, warning, err, crit, alert, and emerg12.
The other options are not correct. Option B. /var/log/messages | /dev/tty12 is invalid, as it uses a pipe (|) character in the selector field, which is not allowed. The pipe character can only be used in the action field to indicate that the matching messages are piped to an external program1. Option C. | /dev/tty12 is also invalid, as it has an empty selector field, which is not allowed. The selector field must specify at least one facility and one priority1. Option D. syslog tty12 is also invalid, as it has a missing period (.) between the facility and the priority in the selector field, and a missing slash (/) before the device file in the action field. The correct syntax for this option would be syslog.* /dev/tty12, which would display only the messages with the syslog facility and any priority on the console 121. Option E. mail.* /dev/tty12 is valid, but it would not display all syslog messages generated by a system, but only the messages with the mail facility and any priority on the console 12. This would exclude the messages from other facilities, such as auth, cron, daemon, kern, user, etc1. References: 1: syslog.conf (5) - Linux man page 2: Beginner’s Guide to Syslogs in Linux [Real World Examples]
What command should be used to print a listing of email in the system's mail queue?
lpq
mailq
mlq
sendmail –l
 The mailq command prints the list of messages that are in the mail queue. The mail queue is where outgoing mail is stored until a receiving server connection is available. The mailq command is the same as the sendmail -bp command, which also prints the mail queue. The mailq command is part of the topic 108.3: Mail transfer agent (MTA) basics, which is one of the objectives of the LPI Linux Administrator - 102 exam12. References: 1: https://learning.lpi.org/en/learning-materials/102-500/ 2: https://www.lpi.org/our-certifications/exam-102-objectives/
What is true regarding the file ~/.forward?
As it is owned by the MTA and not writable by the user, it must be edited using the editaliases command.
After editing ~/.forward the user must run newaliases to make the mail server aware of the changes.
Using ~/.forward, root may configure any email address whereas all other users may configure only their own addresses.
When configured correctly, ~/.forward can be used to forward each incoming mail to more than one other recipient.
The file ~/.forward is a text file that contains one or more email addresses to which the incoming mail for the user will be forwarded123. The file is owned by the user and can be edited with any text editor123. The file does not require any special syntax or commands, just a list of email addresses separated by commas or newlines123. For example, if the user wants to forward their mail to alice@example.com and bob@example.com, they can create a ~/.forward file with the following content:
alice@example.com, bob@example.com
The MTA will read the ~/.forward file and send a copy of each incoming mail to the specified addresses123. Therefore, the correct answer is D. When configured correctly, ~/.forward can be used to forward each incoming mail to more than one other recipient.
The other options are false regarding the file ~/.forward. The file is not owned by the MTA and does not need to be edited with the editaliases command, which is used to edit the system-wide aliases file, not the user-specific ~/.forward file4. The user does not need to run newaliases to make the MTA aware of the changes, as the MTA will check the ~/.forward file every time a mail is delivered to the user123. The newaliases command is used to rebuild the system-wide aliases database, not the user-specific ~/.forward file4. The file ~/.forward does not have any restrictions on the email addresses that can be used for forwarding, as long as they are valid and reachable123. The root user can also use the ~/.forward file to forward their mail, but it is not recommended for security reasons.
References: 1: LPIC 102 – Configure e-mail aliases and forwarding on Linux using MTA - TechViewLeo 2: topic 108.3: Mail transfer agent (MTA) basics - IBM Developer 3: 108.3 Mail Transfer Agent (MTA) basics - Linux Professional Institute … 4: Linux At, Batch, Atq, Atrm Command Help and Examples - Computer Hope : [How to forward root’s email to another email address - nixCraft]
What command can be used to generate syslog entries of any facility and priority? (supply just the command name without a path)
logger
The logger command can be used to generate syslog entries of any facility and priority. It is a shell command interface to the syslog system log module. It allows users to write messages to the system log from the command line or from a script. The logger command supports several options to specify the facility, priority, tag, message, and other attributes of the log entry. For example, the following command generates a log entry with the facility user and the priority info:
logger -p user.info “This is a test messageâ€
The facility and priority can be any of the values defined in the syslog protocol, such as kern, mail, auth, local0, etc. for the facility, and emerg, alert, crit, err, warn, notice, info, debug, etc. for the priority. The default facility is user and the default priority is notice. The logger command can also read messages from standard input or from a file. For more information, see the logger man page or the logger - Linux man page online. References:
Syslogs in Linux: Understanding Facilities and Levels
What are Syslog Facilities and Levels? - Trend Micro
syslog-ng Open Source Edition 3.30 - Administration Guide
Syslog Logging Guide: Advanced Concepts - CrowdStrike
Please specify the top directory containing the configuration files for the CUPS printing system. (Specify the full path to the directory.)
/etc/cups, /etc/cups/
The top directory containing the configuration files for the CUPS printing system is /etc/cups. This directory stores various files that control the behavior and functionality of the CUPS scheduler, cupsd (8), such as cups-files.conf (5), cupsd.conf (5), mime.convs (5), mime.types (5), printers.conf (5), and subscriptions.conf (5). The /etc/cups directory also contains subdirectories for classes, interfaces, ppd, and ssl, which store information about printer classes, device interfaces, printer drivers, and encryption certificates, respectively12. The /etc/cups directory is part of the LPI’s multi-level Linux professional certification program, and it is covered in the topic 105.5 Print service of the exam 102 objectives3. References: 1: cups-files (5) - Linux Manuals 2: cupsd.conf - server configuration file for cups 3: Exam 102 Objectives
Which of the following parameters are used for journalctl to limit the time frame of the output? (Choose TWO correct answers.)
--from=
--since=
--until=
--upto=
--date=
The journalctl command is a tool for viewing and filtering the systemd journal logs. It accepts various parameters to control the output format, the source of the logs, and the filtering criteria. Two of the parameters that are used to limit the time frame of the output are --since= and --until=. These parameters take a date and time value in the format of “YYYY-MM-DD hh:mm:ss†or a relative value such as “-1h†for one hour ago. For example, the command journalctl --since="2023-11-22 23:00:00" --until="2023-11-23 00:00:00" will show the logs from 11:00 PM to 12:00 AM on November 22, 2023. The --since= and --until= parameters are part of the LPI’s multi-level Linux professional certification program, and they are covered in the topic 106.1 System logging of the exam 102 objectives1. References: 1: https://www.lpi.org/our-certifications/exam-102-objectives/
Which of the following are commonly used Mail Transfer Agent (MTA) applications? (Choose THREE correct answers.)
Postfix
Procmail
Sendmail
Exim
SMTPd
 Postfix, Sendmail, and Exim are three of the most commonly used Mail Transfer Agent (MTA) applications on Linux systems. An MTA is a software that transfers and routes electronic mail messages from one computer to another using the Simple Mail Transfer Protocol (SMTP). An MTA receives messages from another MTA or from a Mail User Agent (MUA), which is a computer application that end users use to access or send emails. An MTA can also query the MX records of the recipient’s domain to find the destination mail server and forward the message accordingly. An MTA can also perform other functions such as filtering, encryption, authentication, and bounce handling.
Postfix is a cross-platform, popular MTA that was designed and developed by Wietse Zweitze Venema for his mail server while working at the IBM research department. It was primarily developed as an alternative to well-known and popular Sendmail MTA. Postfix runs on Linux, Mac OSX, Solaris, and several other Unix-like operating systems. It borrows a lot of Sendmail properties on the outside, but it has a totally and comprehensively distinct internal operation. Additionally, it bids to be fast in performance with easy configurations and secure operation mechanism1.
Sendmail, now known as Proofpoint (after Proofpoint, Inc acquired Sendmail, Inc), is by far the most popular and one of the oldest MTA on the Linux server platform. Sendmail has a lot of limitations though, in comparison to modern MTAs. Because of its complicated configuration steps and demands, and weak security mechanisms, many new MTAs have come up as alternatives to Sendmail, but importantly, it offers everything to do with mail on a network1.
Exim is a free MTA developed for Unix-like operating systems such as Linux, Mac OSX, Solaris, and many more. Exim offers a great level of flexibility in routing mail on a network, with outstanding mechanisms and facilities for incoming mail monitoring. Its notable features include among others: no support for POP and IMAP protocols, supports protocols such as RFC 2821 SMTP and RFC 2033 LMTP email message transport, configurations include access control lists, content scanning, encryption, routing controls among others1.
Procmail is not an MTA, but a mail processing utility that can be used to filter, sort, and deliver incoming mail. It can be invoked by an MTA or run as a standalone program. Procmail can process mail based on various criteria such as sender, subject, header, body, size, date, and more. It can also execute external programs, forward mail to another address, or write mail to a file.
SMTPd is not an MTA, but a generic name for a daemon (a background process) that implements the SMTP protocol. A daemon is a program that runs continuously and performs certain tasks at predefined times or in response to certain events. An SMTP daemon listens for incoming SMTP connections from other MTAs or MUAs and handles the mail transfer accordingly. SMTPd can also refer to a specific SMTP daemon that is part of the OpenSMTPD project, which is a free implementation of the SMTP protocol for Unix systems. References:
7 Best Mail Transfer Agents (MTA’s) for Linux
Mail Transfer Agent (MTA) Explained | Mailtrap Blog
What is a Message Transfer Agent (MTA)? - Definition from Techopedia
Mail Transfer Agent (MTA) – Glossary of Email Terms | Mailgun
[Procmail - Wikipedia]
[SMTP daemon - Wikipedia]
Which command is used to sync the hardware clock to the system clock? (Specify ONLY the command without any path or parameters.)
hwclock, /sbin/hwclock, /usr/sbin/hwclock
The command that is used to sync the hardware clock to the system clock is:
hwclock --systohc
This command copies the current system time to the hardware clock, which runs even when the system is shut down. It is equivalent to the command hwclock -w12. The hardware clock is also called the BIOS clock or the RTC (Real Time Clock)3.
On a system using shadowed passwords, the most correct permissions for /etc/passwd are ___ and the most correct permissions for /etc/shadow are _________.
-rw-r-----, -r--------
-rw-r--r--, -r--r--r--
-rw-r--r--, -r--------
-rw-r--rw-, -r-----r--
-rw-------, -r--------
The /etc/passwd file stores local accounts of the system. It is a readable text file and uses colons (:) to separate the fields. This file helps with converting user IDs to names (and back). It is fine that all users can read this file, but they should not be able to change fields. Therefore, the most correct permissions for /etc/passwd are -rw-r–r–, which means that only the owner (root) can write to the file, and everyone can read it. The /etc/shadow file contains information about the system’s users’ passwords. It is owned by user root and group shadow, and has 640 permissions. The password is stored as a long string of characters, which is a combination of the hashing algorithm, optional salt applied, and the hashed password itself. Other users are not allowed to read the file directly, to prevent them from gathering hashed passwords of others. Therefore, the most correct permissions for /etc/shadow are -r--------, which means that only the owner (root) can read the file, and no one else can read or write to it. References:
What is true about the file .profile in a user's home directory?
It must be executable.
It must call the binary of the login shell.
It must use a valid shell script syntax.
It must start with a shebang.
It must be readable for its owner only.
Which of the following comparison operators for test work on elements in the file system? (Choose two.)
–z
–eq
–d
–f
–lt
 The comparison operators for test that work on elements in the file system are -d and -f. The -d operator tests if a given file name refers to a directory, and returns true if it does. The -f operator tests if a given file name refers to a regular file, and returns true if it does. These operators are part of the topic 105.3: Perform basic file management, which is one of the objectives of the LPI Linux Administrator - 102 exam12. References: 1: LPI Linux Administrator - 102 (LPIC-1) 2: Exam 102 Objectives
What entry can you add to syslog.conf file to have all syslog messages generated by your system go to virtual console 12?
*.* /dev/tty12
/var/log/messages | /dev/tty12
| /dev/tty12
syslog tty12
mail.* /dev/tty12
The syslog.conf file is the main configuration file for the syslogd daemon, which logs system messages on Linux systems. This file specifies rules for logging, using a selector field and an action field. The selector field consists of a facility and a priority, separated by a period. The facility indicates the subsystem that produced the message, such as mail, auth, or kern. The priority indicates the severity of the message, such as debug, info, or emerg. An asterisk (*) stands for all facilities or all priorities, depending on where it is used. The action field specifies where the message should be logged, such as a file, a user, or a device.
To have all syslog messages generated by the system go to virtual console 12, which is represented by the device file /dev/tty12, the following entry can be added to the syslog.conf file:
 /dev/tty12
This means that any facility and any priority (.) should be logged to the device /dev/tty12. This will redirect all the messages that would normally go to /var/log/messages to the console 12. To see the messages, the user can press Ctrl-Alt-F12 to switch to that console.
References:
syslog.conf (5) - Linux man page
Beginner’s Guide to Syslogs in Linux [Real World Examples]
Configuration Formats — rsyslog 8.33-20180109-54df0f2 documentation
After editing the TCP wrapper configuration to grant specific hosts access to a service. When do these changes become effective?
The new configuration becomes effective after restarting the respective service.
The new configuration becomes effective at the next system reboot.
The new configuration becomes effective when the last established connection to the service is closed.
The new configuration becomes effective after restarting the tcpd service.
The new configuration becomes effective immediately for all new connections.
Where is the system journal stored?
/var/ jlog/ and /var/jlogd/
/proc/log and /proc/klog
/run/Iog/journal/or/var/log/journal/
/var/log/syslog.bin or /var/log/syslog-jrn
/etc/system/journal / or /usr/1ib/sysLend/journal/
Which parameter of the ssh command specifies the location of the private key used for login attempts? (Specify ONLY the option name without any values or parameters.)
ssh-keygen
Which of the following commands should be executed when starting a login shell in order to change the language of messages for an internationalized program to Portuguese (pt)?
export LANGUAGE=“ptâ€
export LC_MESSAGES=“ptâ€
export UI_MESSAGES=“ptâ€
export MESSAGE=“ptâ€
export ALL_MESSAGES=“ptâ€
The LC_MESSAGES environment variable is used to specify the language of messages for an internationalized program. Internationalization is the process of designing and developing a program that can adapt to different languages, cultures, and regions without requiring modifications. Localization is the process of translating and customizing a program for a specific language, culture, or region.
The LC_MESSAGES environment variable is one of the several locale categories that can affect the behavior of a program. A locale is a set of parameters that defines the user’s language, country, and any special variant preferences that the user wants to see in their user interface. The locale categories are:
LC_CTYPE: Character classification and case conversion.
LC_NUMERIC: Numeric, monetary, and time formats.
LC_TIME: Date and time formats.
LC_COLLATE: Collation order.
LC_MONETARY: Monetary formats.
LC_MESSAGES: Formats of informative and diagnostic messages and interactive responses.
LC_PAPER: Paper size.
LC_NAME: Name formats.
LC_ADDRESS: Address formats and location information.
LC_TELEPHONE: Telephone number formats.
LC_MEASUREMENT: Measurement units (metric or other).
LC_IDENTIFICATION: Metadata about the locale information.
The locale categories can be set individually by using the export command, such as:
export LC_MESSAGES=“ptâ€
This will set the language of messages for an internationalized program to Portuguese (pt) for the current login shell and any child processes. Alternatively, the locale categories can be set collectively by using the LANG or LC_ALL environment variables, such as:
export LANG=“ptâ€
This will set the default locale for all the categories to Portuguese (pt) for the current login shell and any child processes, unless overridden by another LC_* variable.
The other options in the question are not correct for this task. The LANGUAGE environment variable is used to specify a priority list of languages for programs using the GNU gettext library. The UI_MESSAGES, MESSAGE, and ALL_MESSAGES environment variables are not valid locale categories.
References:
LPI 102-500 Exam Objectives, Topic 105.3: Localization and internationalization
LPI 102-500 Study Guide, Chapter 5: Customizing Shell Environments, Section 5.3: Localization and Internationalization
Locale man page
Which of the following are valid host addresses for the subnet 203.0.113.64/28? (Choose TWO correct answers.)
2030.113.64
2030.113.78
203.0.113.65
203.0.113.80
203.0.113.81
Which directory holds configuration files for xinetd services? (Specify the full path to the directory
/etc/xinetd,d/
Which of the following files is not read directly by a Bash login shell?
-/.bashrc
-/.bash_profile
-/.bash_login
-/.profile
/etc/profile
Which option in the chrony configuration file changes the initial interval of polls to a NTP server in order to speed up the initial synchronization?
iburst
quickstart
fast
D. fsync
flood
The option in the chrony configuration file that changes the initial interval of polls to a NTP server in order to speed up the initial synchronization is iburst. The iburst option allows chronyd to send four requests to the server at intervals of 2 seconds or less, instead of the interval specified by the minpoll option, which is usually 64 seconds. This way, chronyd can make the first update of the clock shortly after start1. The iburst option is recommended for all servers, especially if the network connectivity is not reliable1.
The other options are not valid or do not have the same effect as iburst. The quickstart option does not exist in the chrony configuration file. The fast option is used to specify a fast initial correction of the system clock, but it does not change the polling interval1. The fsync option is used to enable or disable synchronization of the system clock to the real-time clock (RTC) every 11 minutes1. The flood option is used to enable a mode of operation where chronyd sends a burst of requests to the server at a high rate, which can be useful for testing or initial synchronization of a very inaccurate clock1.
References:
LPI Linux Essentials: 1.4. Using sudo
LPI Linux Administrator: 102.5. Use Debian package management
LPI Linux Engineer: 201.1. Measure and Troubleshoot Resource Usage
LPI Linux Professional Certification Program
1
Which of the following environment variables can be defined in locale. conf ? (Choose TWO correct answers.)
LC_ALL
LC_USERNAME
LC_U?F8
LC_GEOGRAPHY
LC_TIME
Which of the following commands connects to the remote host example.com which has OpenSSH listening on TCP port 2222? (Choose TWO correct answers.)
ssh --port 2222 example.com
ssh -p 2222 example.com
ssh -o Port=2222 example.com
ssh -o GatewayPort=2222 example.com
ssh example.com:2222
T The ssh command is used to connect to a remote host using the Secure Shell (SSH) protocol, which provides encrypted and authenticated communication. The ssh command has the following syntax:
ssh [options] [user@]hostname [command]
The options can modify the behavior of the ssh command, such as specifying the port number, the identity file, the cipher, the compression, and the timeout. The user@hostname specifies the username and the hostname of the remote host to connect to. The command is an optional argument that specifies the command to execute on the remote host.
To connect to the remote host example.com which has OpenSSH listening on TCP port 2222, two possible options are:
B. ssh -p 2222 example.com: This option uses the -p flag to specify the port number of the remote host. The -p flag is a shortcut for the Port option, which can also be used with the -o flag.
C. ssh -o Port=2222 example.com: This option uses the -o flag to specify a configuration option for the ssh command. The -o flag can be followed by any option that is valid in the ssh_config file, such as Port, IdentityFile, Cipher, Compression, and ConnectTimeout. The Port option sets the port number of the remote host.
The other options in the question are not correct for this task. The --port option is not a valid option for the ssh command. The GatewayPort option is used to specify whether remote hosts are allowed to connect to local forwarded ports. The example.com:2222 syntax is not valid for the ssh command.
References:
LPI 102-500 Exam Objectives, Topic 110.1: Perform security administration tasks
LPI 102-500 Study Guide, Chapter 10: Securing Your System, Section 10.1: Configuring SSH
ssh man page
opic 7, Misc Questions New
Why is the xhost program considered dangerous to use?
It makes it difficult to uniquely identify a computer on the network.
It allows easy access to your X server by other users.
It logs sensitive information to syslog.
It makes your computer share network resources without any authentication.
It is a graphical DNS tool with known exploits.
The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server1. In the case of hosts, this provides a rudimentary form of privacy control and security. It is only sufficient for a workstation (single user) environment, although it does limit the worst abuses1. However, if xhost is used to grant access to everyone, even if they aren’t on the list (i.e., access control is turned off), then any user on the network can connect to your X server and monitor your keystrokes, capture your screen, or run malicious programs2. This is why xhost is considered dangerous to use and should be avoided in favor of more secure methods, such as xauth or ssh23. References:
xhost linux command man page - commandlinux.com
Linux Xhost Command Help and Examples - Computer Hope
xhost(1) — Arch manual pages
For accessibility assistance, which of the following programs is an on-screen keyboard?
xkb
atkb
GOK
xOSK
GOK stands for GNOME On-screen Keyboard, and it is a program that provides a virtual keyboard for users who have difficulty using a physical keyboard. GOK is designed to be accessible and customizable, and it supports different keyboard layouts, input methods, and modes. GOK can also generate mouse and gesture events, and it can be controlled by various input devices, such as switches, joysticks, or head trackers. GOK is part of the GNOME desktop environment, and it can be enabled from the Universal Access settings panel123.
The other options are not correct because:
A. xkb is not a program, but a component of the X Window System that handles keyboard configuration and mapping. XKB stands for X Keyboard Extension, and it allows users to define the behavior and appearance of their keyboards, such as the layout, the modifiers, the symbols, and the actions. XKB does not provide an on-screen keyboard, but it can be used by other programs that do45.
B. atkb is not a valid name for any known program or component related to on-screen keyboards. There is no such program or component in the LPI Linux certification program or in the common Linux distributions. The closest match is ATK, which stands for Accessibility Toolkit, and it is a library that provides a set of interfaces for accessibility support in GNOME applications. ATK does not provide an on-screen keyboard, but it can be used by GOK and other programs that do6 .
D. xOSKÂ is a program that provides an on-screen keyboard, but it is not the one that is mentioned in the LPI Linux certification program or in the common Linux distributions. xOSK stands for X On-Screen Keyboard, and it is a simple and lightweight virtual keyboard that can be used with any X11 application. xOSK is not part of any desktop environment, and it has to be installed and launched manually. xOSK is not as accessible and customizable as GOK, and it does not support different input methods or modes .
References: 1: GOK - GNOME Wiki! 2: How to Set Up a Virtual On-Screen Keyboard in Linux 3: Working With On-Screen Keyboards - Oracle Help Center 4: X keyboard extension - Wikipedia 5: XKB Configuration Guide 6: Accessibility Toolkit - GNOME Developer : Accessibility - ArchWiki : xosk - X On-Screen Keyboard : How to use on-screen virtual keyboard on Linux - Xmodulo
What is the default name of the configuration file for the Xorg X11 server? (Specify the file name only without any path.)
xorg.conf
The default name of the configuration file for the Xorg X11 server is xorg.conf. This file is used to store initial setup for X, such as settings for video cards, monitors, input devices, and other options. The Xorg X11 server is a display server that uses a configuration file called xorg.conf and files ending in the suffix .conf for its initial setup1. The xorg.conf file is typically located in /etc/X11/xorg.conf, but its location may vary across operating system distributions2. The xorg.conf file is not mandatory, as the Xorg X11 server can automatically configure most hardware and settings. However, it can be created and edited manually if needed3. References:
Xorg - ArchWiki
xorg.conf - Wikipedia
How to Configure X11 in Linux: 10 Steps (with Pictures) - wikiHow
Which of the following are tasks handled by a display manager like XDM or KDM? (Choose TWO correct answers.)
Start and prepare the desktop environment for the user.
Configure additional devices like new monitors or projectors when they are attached.
Handle the login of a user.
Lock the screen when the user was inactive for a configurable amount of time.
Create an X11 configuration file for the current graphic devices and monitors.
The tasks that are handled by a display manager like XDM or KDM are to start and prepare the desktop environment for the user and to handle the login of a user. A display manager is a software component that manages the graphical user interface of an operating system. It provides a login screen where the user can enter their credentials and choose their preferred desktop environment or window manager. After the user is authenticated, the display manager launches the selected desktop environment or window manager and sets up the graphical session. The display manager also handles the logout, shutdown, and reboot of the system.
The other options are incorrect because they are not tasks handled by a display manager:
B. Configure additional devices like new monitors or projectors when they are attached. This task is handled by the X server, which is the core component of the X Window System. The X server is responsible for communicating with the hardware devices, such as the keyboard, mouse, monitor, and graphics card. The X server can detect and configure new devices dynamically using tools like xrandr or xorg.conf.
D. Lock the screen when the user was inactive for a configurable amount of time. This task is handled by the screensaver program, which is a utility that runs in the background and activates when the user is idle for a certain period of time. The screensaver can display various animations or images on the screen, or it can blank the screen entirely. The screensaver can also lock the screen and require the user to enter their password to resume the session. The screensaver can be configured by the user using tools like xscreensaver or gnome-screensaver.
E. Create an X11 configuration file for the current graphic devices and monitors. This task is handled by the X server, which is the core component of the X Window System. The X server can create an X11 configuration file, which is a text file that contains the settings for the X server and the devices it communicates with. The X11 configuration file is usually located at /etc/X11/xorg.conf or /etc/X11/xorg.conf.d/. The X server can generate a default configuration file using the command Xorg -configure, or it can be edited manually by the user or the system administrator. References https://www.baeldung.com/linux/display-managers-explained
https://quizlet.com/185979426/lx0-104-flash-cards/
On a system running the KDE Display Manager, when is the /etc/kde4/kdm/Xreset script automatically executed?
When KDM starts
When a user's X session exits
When KDM crashes
When X is restarted
When X crashes
The /etc/kde4/kdm/Xreset script is a script that runs as root after a user’s X session exits. It can be used to perform some cleanup tasks or other actions that need to be done when the user logs out of the graphical environment. For example, it can reassign the ownership of the console to root, or shut down the system if desired. The /etc/kde4/kdm/Xreset script is part of the KDE Display Manager (kdm), which is a graphical login manager for X. KDM can be configured to run this script by setting the Reset key in the [X-*-Core] section of the /etc/kde4/kdm/kdmrc configuration file. References:
kdm.options - configuration options for X display manager
kdm(1) — kdm — Debian jessie — Debian Manpages
debian - How to get system to shutdown when Xorg is quit? - Unix …
Which of the following lines is an example of a correct setting for the DISPLAY environment variable?
hostname:displayname
hostname:displaynumber
hostname/displayname
hostname/displaynumber
hostname
 The correct format for the DISPLAY environment variable is hostname:displaynumber.screennumber, where hostname is the name of the computer where the X server runs, displaynumber is a sequence number (usually 0) that identifies a display, and screennumber is the number of the screen within that display (usually 0). The screennumber can be omitted if it is 0. For example, localhost:0 or myhost:1.0 are valid values for the DISPLAY variable. The other options are either missing the colon, using the wrong separator, or not specifying the display number. References:
X11 - DISPLAY (environment variable) - Datacadamia
x11 - How can I specify a display? - Stack Overflow
What is the $DISPLAY environment variable? - Ask Ubuntu
What is the purpose of the Sticky Keys feature in X?
To assist users who have difficulty holding down multiple keys at once
To prevent repeated input of a single character if the key is held down
To ignore brief keystrokes according to a specified time limit
To repeat the input of a single character
 The Sticky Keys feature in X is an accessibility option that allows users to press modifier keys (such as Ctrl, Alt, Shift, or the Windows key) one at a time, instead of holding them down simultaneously, to perform keyboard shortcuts. For example, to copy something, a user can press Ctrl, release it, and then press C, instead of pressing Ctrl+C together. This can be helpful for users who have difficulty pressing multiple keys at once, or who prefer not to do so. References: https://www.howtogeek.com/739764/how-to-turn-off-sticky-keys-on-windows-10/
https://geekflare.com/using-sticky-keys-in-windows/
Which file used by XDM specifies the default wallpaper?
/etc/X11/xdm/Xsetup
/etc/X11/xdm.conf
/etc/X11/xdm/Defaults
/etc/X11/defaults.conf
 The file that specifies the default wallpaper for XDM is /etc/X11/xdm/Xsetup. XDM is a display manager for the X Window System that provides a graphical login screen and manages user sessions. The /etc/X11/xdm/Xsetup file is executed when XDM starts the X server and before any user login or session starts. This file can be used to configure the X server, set X resources, and perform any other system-wide setup tasks, such as setting the wallpaper. To set the wallpaper, one can use a command like qiv -z /usr/local/share/backgrounds/wallpaper.jpg in the /etc/X11/xdm/Xsetup file, where qiv is an image viewer and /usr/local/share/backgrounds/wallpaper.jpg is the path to the desired wallpaper image1.
The other options are not correct/etc/X11/xdm.conf is the configuration file for XDM, which specifies how XDM should behave, such as the access control, the login window, and the session types2/etc/X11/xdm/Defaults is the directory where the default XDM configuration files are stored, such as Xresources, Xsession, and Xwilling2. /etc/X11/defaults.conf is not a valid file or directory related to XDM or X Window System. References:
XDM - ArchWiki
Configuring XDM - Linux Documentation Project
The X11 configuration file xorg.conf is grouped into sections. How is the content of the section SectionName associated with that section?
It is placed in curly brackets as in Section SectionName { ... }.
It is placed between a line containing Section "SectionName" and a line containing EndSection.
It is placed between the tags
It is placed after the row [SectionName].
It is placed after an initial unindented Section "SectionName" and must be indented by exactly one tab character.
The X11 configuration file xorg.conf is grouped into sections, and the content of the section SectionName is associated with that section by placing it between a line containing Section “SectionName†and a line containing EndSection. For example, the following is a section named ServerLayout that defines the layout of the X server:
Section “ServerLayout†Identifier “X.org Configured†Screen 0 “Screen0†0 0 InputDevice “Mouse0†“CorePointer†InputDevice “Keyboard0†“CoreKeyboard†EndSection
The other options are incorrect for the following reasons:
A: Curly brackets are not used to delimit sections in xorg.conf. They are used to enclose values that are lists, such as Option “XkbLayout†“{us,fr}â€.
C: Tags are not used to delimit sections in xorg.conf. They are used in XML files, which have a different syntax and structure than xorg.conf.
D: Rows are not used to delimit sections in xorg.conf. They are used to define key-value pairs within a section, such as Identifier “Screen0â€.
E: Indentation is not required to delimit sections in xorg.conf. It is used to improve readability and clarity, but it does not affect the functionality of the file.
References:
xorg.conf - X Window System
Editing basics for the xorg.conf file - Linux.com
106.1 Lesson 1 - Linux Professional Institute Certification Programs
How is a display manager started?
It is started by a user using the command startx.
It is started like any other system service by the init system.
It is started by inetd when a remote hosts connects to the X11 port.
It is started automatically when a X11 user logs in to the system console.
A display manager is a program that provides a graphical login screen for users to access a graphical desktop environment. A display manager is usually started by the init system, which is the first process that runs when the system boots up. The init system is responsible for starting and stopping various system services, including the display manager. The init system can be configured to start a specific display manager by setting the default runlevel or target, or by editing the /etc/X11/default-display-manager file123.
The other options are not correct because:
A. It is started by a user using the command startx. This option is false because the startx command is used to start an X session without a display manager. The startx command launches an X server and runs the user’s .xinitrc or .xsession file, which contains the commands to start the desired desktop environment or window manager. The startx command does not invoke a display manager or a graphical login screen .
C. It is started by inetd when a remote hosts connects to the X11 port. This option is false because inetd is a daemon that listens for incoming network connections and launches the appropriate service for each connection. Inetd does not start a display manager, but it can be used to enable remote access to an X session using the XDMCP protocol. XDMCP stands for X Display Manager Control Protocol, and it allows a remote host to request a graphical login screen from a display manager running on another host. However, this is not the same as starting a display manager, and it requires the display manager to be already running on the host that provides the XDMCP service .
D. It is started automatically when a X11 user logs in to the system console. This option is false because a display manager is not started by a user login, but by the init system. A user login can trigger the start of an X session, but not a display manager. A display manager is independent of the user login, and it can run on multiple virtual consoles or display devices. A display manager can also allow multiple users to log in to different X sessions simultaneously123.
References: 1: LPI Linux Certification/Setup A Display Manager - Wikibooks 2: Working with Display Managers - LPIC-1 102 Linux certification - Linux … 3: How to Change the Default Display Manager in Ubuntu 20.04 : startx - ArchWiki : How to start GUI from command line? - Ask Ubuntu : inetd - Wikipedia : XDMCP - ArchWiki
What is the purpose of a screen reader?
It reads text displayed on the screen to blind or visually impaired people.
It reads the parameters of the attached monitors and creates an appropriate X11 configuration.
It displays lines and markers to help people use speed reading techniques.
It manages and displays files that contain e-books.
A screen reader is a form of assistive technology that renders text and image content as speech or braille output. Screen readers are essential to people who are blind, and are useful to people who are visually impaired, illiterate, or have a learning disability. Linux has several screen readers available, such as Orca, Speakup, and Emacspeak. These screen readers can help users interact with the graphical or console interface, read documents and web pages, and perform various tasks on the system. References:
Screen reader - Wikipedia
Orca Screen Reader - GNOME
Accessibility in Linux is good (but could be much better)
Which command can be used to investigate the properties for a particular window in X by clicking that window? (Specify ONLY the command without any path or parameters.)
/usr/bin/xwininfo, xwininfo
The command that can be used to investigate the properties for a particular window in X by clicking that window is xwininfo. xwininfo is a command-line tool that provides information about X windows. When executed, it opens a small window and waits for the user to select a window by clicking on it. Then, it displays various characteristics about the window in question, such as its geometry, position, size, depth, class, name, id, and more. xwininfo is part of the X Window System, which is a graphical user interface system for Unix-like operating systems. xwininfo can be useful for debugging, testing, or scripting purposes. References: https://bing.com/search?q=command+to+investigate+properties+of+a+window+in+X
https://www.exam-answer.com/linux-foundation-certified-system-administrator-lfcs-simulation-investigate-window-properties
Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)
~/.bashconf
~/.bashrc
~/.bashdefaults
~/.bash_etc
~/.bash_profile
 The Bash shell can be configured by various files that affect its behavior, such as setting environment variables, aliases, functions, options, and prompts. Some of these files are global, meaning they apply to all users of the system, and some are local, meaning they apply to individual users. The global files are usually located in the /etc directory, while the local files are usually located in the user’s home directory, which is denoted by the tilde (~) symbol1.
The local files that affect the Bash shell are:
~/.bash_profile: This file is executed when a user logs in to the system. It is used to set up the user’s environment, such as the PATH, the default editor, the umask, and other variables. It can also run commands that are needed only once per login session, such as ssh-agent or fortune. This file can also source other files, such as ~/.bashrc, to inherit their settings12.
~/.bashrc: This file is executed when a user starts a new interactive shell, such as opening a terminal window or running a script with the shebang #!/bin/bash. It is used to set up the user’s shell preferences, such as aliases, functions, options, and prompts. It can also source other files, such as /etc/bashrc, to inherit their settings12.
~/.bash_logout: This file is executed when a user logs out of the system. It is used to perform any cleanup tasks, such as clearing the screen, deleting temporary files, or printing a farewell message1.
The other files listed in the question are not valid Bash configuration files and do not affect the behavior of the shell. Therefore, the correct answer is B. ~/.bashrc and E. ~/.bash_profile.
References: 1: Bash Shell Configuration Files - Land of Linux 2: Bash Startup Files - GNU Project
Which of the following are requirements in order to run a shell script like a regular command from anywhere in the filesystem? (Choose THREE correct answers.)
The user issuing the command must be in the group script.
The script file must be found in the $PATH.
The script file must have the executable permission bit set.
The script must begin with a shebang-line (#!) that points to the correct interpreter.
The file system on which the script resides must be mounted with the option scripts.
In order to run a shell script like a regular command from anywhere in the filesystem, the following requirements must be met:
The script file must be found in the $PATH. The $PATH is a variable that contains a list of directories where the shell looks for executable files when a command is issued. If the script file is not in one of these directories, the shell will not be able to find it unless the full path is specified.
The script file must have the executable permission bit set. This is a file attribute that determines whether the file can be executed by the user, the group, or others. The executable permission bit can be set using the chmod command, for example:Â chmod +x script.sh.
The script must begin with a shebang-line (#!) that points to the correct interpreter. This is a special line at the beginning of the script that tells the shell which program to use to run the script, such as #!/bin/bash for bash scripts, or #!/usr/bin/perl for perl scripts. The shebang-line must match the exact path of the interpreter, otherwise the script will not run.
The other options are not requirements for running a shell script like a regular command. There is no such group as script, and the file system mount option scripts does not exist. References:
[LPI Linux Essentials - Topic 105: Shells, Scripting and Data Management]
[LPI Linux Professional - Exam 102 Objectives - Topic 105: Shells and Shell Scripting]
Which of the following commands puts the output of the command date into the shell variable mydate?
mydate="$(date)"
mydate="exec date"
mydate="$((date))"
mydate="date"
mydate="${date}"
(date)"∗∗ComprehensiveExplanation:∗∗Thecorrectwaytoputtheoutputofthecommanddateintotheshellvariablemydateistousecommandsubstitutionwiththesyntax(command). This will execute the command in a subshell and replace the expression with its standard output. The double quotes around the expression will prevent word splitting and globbing of the output. The other options are incorrect because they will either assign a literal string to the variable, use an invalid syntax, or try to execute the command as an arithmetic expression. References:
[LPI Linux Essentials - Topic 105: Shells, Scripting and Data Management]
[LPI Linux Administrator - Exam 102 Objectives - Topic 105: Shells and Shell Scripting]
You are looking into a new script you received from your senior administrator. In the very first line you notice a #! followed by a file path. This indicates that:
The file at that location was used to make the script.
This script provides identical functionality as the file at that location.
This script will self-extract into a file at that location.
The program at that location will be used to process the script.
The #! followed by a file path is called a shebang or a hashbang. It is a special notation that tells the operating system which interpreter to use to execute the script. For example, if the first line of a script is #!/bin/bash, it means that the script will be run by the Bash shell, which is located at /bin/bash. Similarly, if the first line of a script is #!/usr/bin/python3, it means that the script will be run by the Python 3 interpreter, which is located at /usr/bin/python3. The shebang must be the very first line of the script, and it must start with #! without any spaces. The file path after the #! must be an absolute path, not a relative path or a symbolic link. The shebang allows the script to be executed as a standalone program, without specifying the interpreter explicitly. For example, if a script named hello.sh has a shebang of #!/bin/bash, and it has the executable permission, it can be run as ./hello.sh instead of bash hello.sh. The shebang also allows the script to be associated with a specific interpreter, regardless of the default interpreter of the system or the user. For example, if a script named hello.py has a shebang of #!/usr/bin/python3, it will always be run by Python 3, even if the system or the user has Python 2 as the default Python interpreter. The shebang is not a comment, although it looks like one. It is a special instruction that is only recognized by the operating system when the script is executed. It is ignored by the interpreter when the script is read. Therefore, the shebang does not indicate that the file at that location was used to make the script, or that the script provides identical functionality as the file at that location, or that the script will self-extract into a file at that location. The correct answer is that the program at that location will be used to process the script. You can learn more about the shebang here1 and here2. References:
1 2
Which of the following SQL queries counts the number of occurrences for each value of the field order_type in the table orders?
SELECT order_type,COUNT(*) FROM orders WHERE order_type=order_type;
SELECT order_type,COUNT(*) FROM orders GROUP BY order_type;
COUNT(SELECT order_type FROM orders);
SELECT COUNT(*) FROM orders ORDER BY order_type;
SELECT AUTO_COUNT FROM orders COUNT order_type;
The correct SQL query to count the number of occurrences for each value of the field order_type in the table orders is:
SELECT order_type,COUNT(*) FROM orders GROUP BY order_type;
This query uses the SELECT statement to retrieve the values of the order_type field and the COUNT(*) function to count the number of rows for each order_type. The GROUP BY clause groups the rows by the order_type field, so that the count is calculated for each distinct value of order_type. The result of this query is a table with two columns: order_type and count, where each row shows the number of orders for a specific order_type.
The other options are incorrect for the following reasons:
A: This query uses a WHERE clause that is always true, since order_type=order_type for every row. Therefore, this query returns the same result as SELECT order_type,COUNT(*) FROM orders;, which is a table with one row that shows the total number of orders, regardless of the order_type.
C: This query is syntactically invalid, since the COUNT function cannot take a subquery as an argument. The correct way to use a subquery with COUNT is COUNT((SELECT order_type FROM orders));, which returns the total number of orders, regardless of the order_type.
D: This query uses the ORDER BY clause to sort the rows by the order_type field, but it does not group them by order_type. Therefore, this query returns the same result as SELECT COUNT(*) FROM orders;, which is a table with one row that shows the total number of orders, regardless of the order_type.
E: This query is syntactically invalid, since there is no such function as AUTO_COUNT in SQL, and the COUNT function cannot take a field name as an argument. The correct way to use COUNT with a field name is COUNT(order_type);, which returns the number of non-null values in the order_type field.
References:
[SQL COUNT Function]
[SQL GROUP BY Statement]
[SQL SELECT Statement]
What output will the following command sequence produce?
echo '1 2 3 4 5 6' | while read a b c; do
echo result: $c $b $a;
done
result: 3 4 5 6 2 1
result: 1 2 3 4 5 6
result: 6 5 4
result: 6 5 4 3 2 1
result: 3 2 1
The while loop reads a line from the standard input and splits it into words using the IFS variable, which by default contains spaces, tabs, and newlines. The read command assigns the first word to the variable a, the second word to the variable b, and the rest of the line to the variable c. Therefore, in this case, a=1, b=2, and c=3 4 5 6. The echo command prints the values of c, b, and a in reverse order, separated by spaces. The output is result: 3 2 1. The loop terminates after reading the first line, since there is no more input to read. References: Bash while Loop | Linuxize, Bash Scripting - While Loop - GeeksforGeeks
What output will the following command produce?
seq 1 5 20
1
6
1
1
1
6
1
5
10
15
1
2
3
4
2
3
4
5
5
10
15
20
The seq command in Linux is used to generate a sequence of numbers from FIRST to LAST in steps of INCREMENT1. The syntax for the seq command is:
seq [OPTION]… LAST or seq [OPTION]… FIRST LAST or seq [OPTION]… FIRST INCREMENT LAST
In this case, the command seq 1 5 20 has three arguments: FIRST = 1, INCREMENT = 5, and LAST = 20. This means that the command will produce numbers from 1 to 20 in steps of 5. The output will be:
1 5 10 15
The output will not include 20 because it is not a multiple of 5. The output will be printed on separate lines by default, unless a different separator is specified with the -s option2. References:
Seq Command in Linux [Explained With Examples]
seq Man Page - Linux - SS64.com - SS64 Command line reference
What output will the command seq 10 produce?
A continuous stream of numbers increasing in increments of 10 until stopped.
The numbers 1 through 10 with one number per line.
The numbers 0 through 9 with one number per line.
The number 10 to standard output.
The seq command in Linux is used to print a sequence of numbers, which can be piped to other commands or used in for loops and bash scripts1. The command can generate a list of integers or real numbers, with options to control the start, end, and increment of the sequence. The general syntax of the command is seq [options] specification1.
If you launch seq with a single number as a command-line parameter, it counts from one to that number. It then prints the numbers in the terminal window, one number per line2. For example, seq 10 will produce the following output:
1
2
3
4
5
6
7
8
9
10
Therefore, the correct answer is B. The numbers 1 through 10 with one number per line.
References: 1: 10+ Seq Commands with Examples in Linux – LinuxWizardry 2: How to Use the seq Command on Linux - How-To Geek
When the command echo $$ outputs 12942, what is the meaning of 12942?
It is the process ID of the echo command.
It is the process ID of the current shell.
It is the process ID of the last command executed.
It is the process ID of the last command which has been placed in the background.
In bash, the PID of a shell script’s subshell process is stored in a special variable called $$. This variable is read-only, and you cannot modify it in a shell script1. You can use echo $$ to get the PID of the current bash shell you are using2. Therefore, when the command echo $$ outputs 12942, it means that the PID of the current shell is 12942. References:
[LPI Linux Essentials - Topic 103: Command Line Basics]
[Bash Special Parameters]
How to get the process ID (PID) of a shell script
How to know the process id of current bash session?
After issuing:
function myfunction { echo $1 $2 ; }
in Bash, which output does:
myfunction A B C
Produce?
A B
A B C
A C
B C
C B A
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 $1 variable refers to the first argument, $2 to 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 function myfunction simply echoes the first and second arguments to the standard output. Therefore, when the command myfunction A B C is executed, the output is A B, since the third argument C is ignored by the function. References:
[LPI Linux Essentials - Topic 103: Command Line Basics]
[Bash Functions]
What benefit does an alias in bash provide?
It provides faster lookups for commands in the system directory.
It creates a local copy of a file from another directory.
It hides what command you are running from others.
It allows a string to be substituted for the first word of a simple command.
An alias in bash provides the benefit of allowing a string to be substituted for the first word of a simple command. This means that you can create a shortcut or alternative name for a command that is already installed on your system, and use the new name to run the command instead of the original name. For example, you can create an alias for the ls -la command, which lists all files and directories in the current directory with detailed information, by running the following command:
alias ll='ls -la'
After defining the alias, you can use the ll command to execute the ls -la command. The alias will be active for the duration of the current shell session, unless you make it persistent by adding it to your shell startup file (such as ~/.bashrc for the Bash shell).
The other options are incorrect for the following reasons:
A: An alias does not provide faster lookups for commands in the system directory. The system directory is where the executable files for the commands are stored, and the shell uses the PATH variable to search for them. An alias does not affect the PATH variable or the system directory.
B: An alias does not create a local copy of a file from another directory. An alias is a way to rename a command, not a file. To create a local copy of a file, you can use the cp command.
C: An alias does not hide what command you are running from others. An alias is a way to simplify the use of a command, not to conceal it. Anyone can see what command an alias represents by using the type command or the alias command without any arguments.
References:
LPI E - alias
105.1 Lesson 1 - Linux Professional Institute Certification Programs
How to Create Bash Aliases | Linuxize
How to create a permanent Bash alias on Linux/Unix - nixCraft
bash - How do create an alias in shell scripts? - Stack Overflow
What is the command to delete the default gateway from the system IP routing table? (Choose TWO correct answers.)
route del default
ifconfig unset default
netstat -r default
ip route del default
sysctl ipv4.default_gw=0
 The command to delete the default gateway from the system IP routing table is either route del default or ip route del default. Both commands will remove the default route that matches the specified parameters. The route command is the older and more widely supported tool, while the ip command is the newer and more powerful tool that can manipulate various aspects of the network configuration. The other options are either invalid or do not affect the default gateway. References:
1: How to Remove Default Gateways via ip | Baeldung on Linux
2: How to remove all default gateways - Unix & Linux Stack Exchange
4: How to Add or Change the Default Gateway in Linux: 9 Steps - wikiHow
Which of the following configuration files should be modified to set default shell variables for all users?
/etc/bashrc
/etc/profile
~/.bash_profile
/etc/.bashrc
 The /etc/profile file is a configuration file that is read by the Bash shell when a user logs in. It contains commands and settings that apply to all users of the system, such as environment variables, PATH information, terminal settings, and security commands. Environment variables are variables that affect the behavior of programs and processes. For example, the PATH variable defines the directories where the shell looks for executable files, and the JAVA_HOME variable defines the location of the Java installation. The /etc/profile file can also source other files from the /etc/profile.d/ directory, which can contain additional scripts for setting environment variables or other system-wide settings. The /etc/profile file is the best option for setting default shell variables for all users, as it is executed before any user-specific files. The other options are not suitable for this purpose, because:
/etc/bashrc is a configuration file that is read by the Bash shell when it is started as an interactive non-login shell. It contains commands and settings that apply to all interactive shells of the system, such as aliases, functions, and prompt settings. It is not executed when the shell is started as a login shell, which is the case when a user logs in. Therefore, it is not a good place to set default shell variables for all users.
~/.bash_profile is a configuration file that is read by the Bash shell when it is started as a login shell for a specific user. It contains commands and settings that apply only to that user, such as environment variables, PATH information, and startup programs. It can also source other files, such as ~/.bashrc, which is read by the shell when it is started as an interactive non-login shell for that user. It is not a good place to set default shell variables for all users, as it only affects the user who owns the file.
/etc/.bashrc is not a valid configuration file for the Bash shell. The dot (.) at the beginning of the file name indicates that it is a hidden file, which means that it is not visible by default in the file system. The Bash shell does not look for this file when it is started, and it does not execute any commands or settings from it. Therefore, it is not a good place to set default shell variables for all users.
References:
1 2
Which of the following commands can be used to display the local routing table? (Choose TWO correct answers.)
ifconfig
dig
netstat
route
trackroute
The commands that can be used to display the local routing table are netstat and route. Both commands can show the kernel routing tables, which contain information about the network destinations and the gateways to reach them. The netstat command can be used with the -r option to display the routing table, and the -n option to show numeric addresses only. The route command can also be used with the -n option to display the routing table without resolving names. However, both netstat and route are considered obsolete and have been replaced by the ip route command, which is the current recommended way of printing the routing table in Linux12. References:
1: Understanding Routing Table - nixCraft
2: How To Display Routing Table In Linux - RootUsers
3: linux networking - What is the local routing table used for? - Server Fault
Which of the following is true about IPv6?
With IPv6, the TCP port numbers of most services have changed.
IPv6 no longer supports broadcast addresses.
IPv4 addresses can be used without any change with IPv6.
IPv6 no longer supports multicast addresses.
For IPv6, UDP and TCP have been replaced by the Rapid Transmission Protocol RTP.
Broadcast addresses are used to send a message to all devices on a network segment. IPv4 supports broadcast addresses, but IPv6 does not. Instead, IPv6 uses multicast addresses, which are used to send a message to a group of devices that have joined a multicast group. Multicast addresses are more efficient and flexible than broadcast addresses, as they allow the sender to specify the recipients more precisely and avoid unnecessary network traffic. IPv6 also supports anycast addresses, which are used to send a message to the nearest device that provides a specific service. Anycast addresses are useful for load balancing and redundancy. References:
[LPI Linux Administrator - Exam 102 Objectives - Topic 109: Networking Fundamentals]
IPv6 - Features - Online Tutorials Library
IPv6 - Wikipedia
Which of the following programs can be used to determine the routing path to a given destination?
dig
netstat
ping
route
traceroute
The traceroute program can be used to determine the routing path to a given destination by sending packets with incrementing TTL values and recording the source of the ICMP time exceeded messages. This way, it can show the intermediate hops and the round-trip times for each packet. The other programs have different purposes: dig is used to query DNS servers, netstat is used to display network connections and statistics, ping is used to test the reachability of a host by sending ICMP echo requests and measuring the response time, and route is used to manipulate the routing table. References:
LPI 102-500 Exam Objectives, Topic 110: Network Fundamentals, Weight: 4, 110.3 Basic network troubleshooting
LPI 102-500 Study Guide, Chapter 10: Network Fundamentals, Section 10.3: Basic Network Troubleshooting, Page 125-126
What of the following can be done by the command ifconfig? (Choose TWO correct answers.)
Set a network interface active or inactive.
Specify the kernel module to be used with a network interface.
Allow regular users to change the network configuration of a network interface.
Change the netmask used on a network interface.
Specify which network services are available on a network interface.
 The command ifconfig can be used to set a network interface active or inactive by using the up or down options. For example, the following command will activate the eth0 interface:
sudo ifconfig eth0 up
The command ifconfig can also be used to change the netmask used on a network interface by specifying the netmask option followed by the desired netmask value. For example, the following command will change the netmask of the eth0 interface to 255.255.255.0:
sudo ifconfig eth0 netmask 255.255.255.0
The other options in the question are not possible with the ifconfig command. The command ifconfig cannot specify the kernel module to be used with a network interface. This is done by the modprobe command or the /etc/modules file. The command ifconfig cannot allow regular users to change the network configuration of a network interface. This is controlled by the sudoers file or the polkit framework. The command ifconfig cannot specify which network services are available on a network interface. This is done by the firewall rules or the /etc/services file. References:
[LPI Linux Administrator - Exam 102 Objectives - Topic 109: Networking Fundamentals]
Linux ifconfig Command | Linuxize
15 Useful “ifconfig†Commands to Configure Network in Linux - Tecmint
ifconfig command in Linux with Examples - GeeksforGeeks
Which of the following details is NOT provided in any output from the netstat utility?
broadcast services
interface statistics
masquerading connections
network connections
routing tables
The netstat utility is a command-line tool that displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. It can be used with various options to filter and customize the output. However, it does not provide any information about broadcast services, which are a type of network communication that sends data to all devices on a network segment. Broadcast services are usually handled by other tools, such as ping, traceroute, or arp.
References:
netstat | Microsoft Learn
28 Netstat Commands {A Comprehensive List With Examples} - phoenixNAP
What is true regarding a default route?
The default route is always used first. When the default route is not available more specific routes are tried.
When a default route is set, all other routes are disabled until the default route is deleted.
The default route is only used if there is not a more specific route to a destination host or network.
Without a default route, no network communication even in directly attached networks is possible.
A default route is a special type of route that specifies where to send packets when there is no explicit route for the destination in the routing table. A default route is usually configured on a router or a gateway that connects to another network, such as the internet. A default route is often represented by the destination 0.0.0.0/0, which means any IP address.
A default route is not always used first. It is only used as a last resort, when there is no more specific route for the destination. For example, if a host wants to send a packet to 192.168.1.10, and the routing table contains the following entries:
Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
The host will use the first entry, which is more specific, and send the packet directly to 192.168.1.10 via eth0 interface. The second entry, which is the default route, will not be used in this case. However, if the host wants to send a packet to 8.8.8.8, which is not in the same network, the host will use the default route and send the packet to 192.168.1.1, which is the gateway to the internet.
Setting a default route does not disable other routes. It only adds an entry to the routing table that can be used when no other route matches the destination. Other routes are still valid and can be used if they are more specific.
Without a default route, network communication in directly attached networks is still possible, as long as there are routes for those networks in the routing table. However, network communication to other networks that are not directly connected will not be possible, unless there are specific routes for those networks in the routing table.
References:
How to Set the Default Gateway in Linux - How-To Geek
Linux setup default gateway with route command - nixCraft
How to set a default route permanently in Linux - Xmodulo
What is the lowest numbered unprivileged TCP port? (Specify the number in digits only.)
1024
The lowest numbered unprivileged TCP port is 1024. A port number is a 16-bit unsigned integer, thus ranging from 0 to 65535. The port numbers in the range from 0 to 1023 are the well-known ports or system ports. They are used by system processes that provide widely used types of network services. On Unix-like operating systems, a process must execute with superuser privileges to be able to bind a network socket to an IP address using one of the well-known ports. Therefore, the lowest numbered port that can be used by a normal user without root access is 1024, which is the first unprivileged port123 References:
1: How to bind to port number less than 1024 with non root access?
2: lowest numbered unprivileged TCP port - Bing
3: List of TCP and UDP port numbers - Wikipedia
4: Privileged Ports - World Wide Web Consortium (W3C)
5: What is the lowest TCP port number? – TeachersCollegesj
With IPv6, how many bits have been used for the interface identifier of an unicast address? (Specify the number using digits only.)
64
With IPv6, the interface identifier of an unicast address is typically a 64-bit value that is used to identify a host’s network interface. The interface identifier can be derived from the MAC address of the network card, or it can be randomly generated or manually configured. The interface identifier is the rightmost 64 bits of the most commonly encountered address types, such as global unicast (2000::/3) and link-local (fe80::/10). The interface identifier is different from the network prefix, which is the leftmost bits of the address that indicate the network or subnet to which the host belongs. The network prefix can vary in length, depending on the address type and the subnetting scheme. The network prefix and the interface identifier are separated by a double colon (::) in the IPv6 address notation. For example, in the address 2001:db8:1234:5678:abcd:ef12:3456:7890, the network prefix is 2001:db8:1234:5678 and the interface identifier is abcd:ef12:3456:7890. References: https://study-ccna.com/ipv6-interface-identifier/
https://networklessons.com/ipv6/ipv6-eui-64-explained
Which of the following is a valid IPv6 address?
2001:db8:3241::1
2001::db8:4581::1
2001:db8:0g41::1
2001%db8%9990%%1
2001.db8.819f..1
A valid IPv6 address is represented as a set of 16-bit hexadecimals separated by colons. The address is divided into eight groups, and each 16-bit group is represented by four hexadecimal numbers. A valid IPv6 address is in the form “x1:x2:x3:x4:x5:x6:x7:x8†where each xi is a hexadecimal string which may contain digits, lower-case English letter (‘a’ to ‘f’) and upper-case English letters (‘A’ to ‘F’). Leading zeros are allowed in xi. The longest sequence of consecutive all-zero fields is replaced with two colons (::).1
Option A is the only one that follows these rules. Option B has two consecutive colons twice, which is not allowed. Option C has an invalid hexadecimal character ‘g’. Option D uses percentage signs instead of colons, which is not a valid separator. Option E uses dots instead of colons, and has two consecutive dots, which are both invalid.
References:Â 1: IPv4 and IPv6 address formats - IBM
Which keyword must be listed in the hosts option of the Name Service Switch configuration file in order to make host lookups consult the /etc/hosts file?
files
The keyword files must be listed in the hosts option of the Name Service Switch configuration file in order to make host lookups consult the /etc/hosts file. The files service specifies that the local files, such as /etc/hosts, should be used as a source of information. The order of the services on the line determines the order in which those services will be queried, in turn, until a result is found. For example, if the hosts option is set to:
hosts: files dns
then the /etc/hosts file will be searched first, and if no match is found, the DNS server will be queried next. If the hosts option is set to:
hosts: dns files
then the DNS server will be queried first, and if no match is found, the /etc/hosts file will be searched next. References:
LPI 102-500 Exam Objectives, Topic 110: Network Fundamentals, Weight: 4, 110.3 Basic network troubleshooting
LPI 102-500 Study Guide, Chapter 10: Network Fundamentals, Section 10.3: Basic Network Troubleshooting, Page 125-126
nsswitch.conf: Name Service Switch configuration file
Which of the following lines are valid in the file /etc/hosts? (Choose TWO correct answers.)
2001:db8::15 www.example.com www
www.example.com www 203.0.13.15
203.0.113.15 www.example.com www
www.example.com,www 203.0.13.15,2001:db8::15
2003.0.113.15,2001:db8::15 www.example.com www
 The valid lines in the file /etc/hosts are A and C. The format of the /etc/hosts file is as follows12:
IP_address canonical_hostname [aliases...]
where IP_address is the IPv4 or IPv6 address of the host, canonical_hostname is the official name of the host, and aliases are optional alternative names for the host. Each field is separated by whitespace (spaces or tabs). The # character indicates the beginning of a comment, and the rest of the line is ignored.
The lines B, D, and E are invalid because they do not follow the format of the /etc/hosts file. Line B has the hostname and aliases before the IP address, which is incorrect. Line D has multiple IP addresses and hostnames separated by commas, which is also incorrect. Line E has two IP addresses for the same host, which is not supported by the /etc/hosts file. If a host has more than one IP address, it should have a separate line for each address3.
References:
1: hosts(5) - Linux manual page - man7.org
2: Format of /etc/hosts on Linux (different from Windows?)
3: hosts File Format for TCP/IP - IBM
Which crontab entry could be used to set the system time at regular intervals?
1 0 * * * date $d $t $24
1 0 * * * ntpdate ntp1.digex.net
1 0 * * * date ntp1.digex.net
1 0 * * * runcron date ntp1.digex.net
1 0 * * * settime $d $t $24
 The crontab entry that could be used to set the system time at regular intervals is the one that uses the ntpdate command to synchronize the system clock with a Network Time Protocol (NTP) server. The ntpdate command takes one or more NTP server names or IP addresses as arguments and adjusts the system clock accordingly12. The crontab entry B specifies that the ntpdate command should be executed at the first minute of the zeroth hour (i.e., 00:01) of every day of every month of every weekday, using the NTP server ntp1.digex.net34. This will ensure that the system time is updated daily with a reliable source.
The other crontab entries are either invalid or ineffective for setting the system time at regular intervals. The date command can be used to display or set the system date and time, but it requires a specific format for the argument, not an NTP server name5. The runcron and settime commands are not standard Linux commands and their functionality is unknown. The $d, $t, and $24 variables are also undefined and meaningless in this context.
References: 1: Linux At, Batch, Atq, Atrm Command Help and Examples - Computer Hope 2: How to set a cron job to run at a exact time? - Stack Overflow 3: 107.2 Lesson 1 - Linux Professional Institute Certification Programs 4: How to setup a crontab to execute at specific time - Stack Overflow 5: Writing a specific format of time in a text file every minute using … - Ask Ubuntu
TESTED 15 Jan 2025