2 packs: 15% off with code BUY2. 3 or more: 20% off with code BUY3.

Free LPI LPIC-1 102-500 Practice Questions

30 free LPI LPIC-1 102-500 practice questions from the CertStash pack of 120, each with the correct answer and a full explanation. The rule is the same for every exam: ten free on the product page, 30 free here, all 120 in the pack, and each step includes the one before it.

Question 1

Which of the following is a valid IPv6 address?

  1. 2001:db8:0g21::1
  2. 2001::db8:4581::1
  3. 2001:db8:3241::1
  4. 2001%db8%9990%%1
  5. 2001.db8.819f..1
Show answer and explanation

Correct answer: C. 2001:db8:3241::1

2001:db8:3241::1 is a valid IPv6 address using proper hexadecimal notation (0-9, a-f) and the :: compression for consecutive zero groups. Option A contains 'g' which is not a valid hexadecimal character. Option B uses :: twice which violates IPv6 compression rules. Option D uses % delimiters instead of colons. Option E uses dots and contains consecutive dots instead of proper IPv6 notation.

Why the other options are wrong

  • A. Contains the character 'g' which is not valid in hexadecimal notation.
  • B. Uses the :: compression twice, which is not permitted in IPv6 addresses.
  • D. Uses percent signs (%) instead of colons as separators.
  • E. Uses dots instead of colons and has malformed consecutive dots.

Question 2

Which if the following tools, used for DNS debugging, reports not only the response from the name sever but also details about the query?

  1. dnsq
  2. hostname
  3. dig
  4. dnslookup
  5. zoneinfo
Show answer and explanation

Correct answer: C. dig

dig (Domain Information Groper) is the standard DNS debugging tool that provides detailed information about both the query sent and the response received from the name server, including query flags, response codes, and authoritative answers. hostname is a simple utility for displaying the system hostname. dnslookup is an older, less detailed tool. dnsq and zoneinfo are not standard DNS debugging utilities.

Why the other options are wrong

  • A. dnsq is not a standard DNS debugging tool.
  • B. hostname only displays the system hostname, not DNS query details.
  • D. nslookup is older and less detailed than dig for DNS debugging.
  • E. zoneinfo is not a recognized DNS debugging utility.

Question 3

Which of the following statements is valid in the file /etc/nsswitch.conf?

  1. multi on
  2. 192.168.168.4 dns-server
  3. namespaces: net mount procs
  4. include /etc/nsswitch.d/
  5. hosts: files dns
Show answer and explanation

Correct answer: E. hosts: files dns

The line 'hosts: files dns' is a valid nsswitch.conf statement that specifies the order in which name resolution sources are consulted for hostname lookups (first files, then DNS). Option A uses invalid syntax. Option B mixes IP addresses with DNS configuration incorrectly. Option C uses invalid namespace declaration. Option D attempts to include a directory which is not a valid nsswitch.conf feature.

Why the other options are wrong

  • A. "multi on" is not valid syntax in nsswitch.conf.
  • B. IP addresses cannot be specified this way in nsswitch.conf for DNS servers.
  • C. The "namespaces:" statement with this syntax is not valid in nsswitch.conf.
  • D. nsswitch.conf does not support directory inclusion via the include directive.

Question 4

Which of the following connection types, as seen in nmcli connection show, may exist in NetworkManager? (Choose three.)

  1. tcp
  2. ethernet
  3. wifi
  4. ipv6
  5. bridge
Show answer and explanation

Correct answer: B, C, E. ethernet; wifi; bridge

NetworkManager supports ethernet (wired connections), wifi (wireless connections), and bridge (virtual bridge connections) as connection types. These are all recognized connection types visible in nmcli connection show output. tcp is a transport protocol rather than a connection type in NetworkManager. ipv6 is an IP protocol version, not a connection type.

Why the other options are wrong

  • A. TCP is a transport layer protocol, not a NetworkManager connection type.
  • D. IPv6 is a protocol version, not a NetworkManager connection type in the sense of connection media.

Question 5

On a Linux workstation, the route command takes a long time before printing out the routing table. Which of the following errors does that indicate?

  1. The local routing information may be corrupted and must be re-validated using a routing protocol.
  2. One of the routers in the routing table is not available which causes the automatic router failure detection mechanism (ARFD) to wait for a timeout.
  3. There may accidentally be more than one default router in which case a default router election has to be done on the network in order to choose one router as the default.
  4. The Linux Kernel Routing Daemon (LKRD) is not running and should be started using its init script or systemd unit.
  5. DNS resolution may not be working as route by default tries to resolve names of routers and destinations and may run into a timeout.
Show answer and explanation

Correct answer: E. DNS resolution may not be working as route by default tries to resolve names of routers and destinations and may run into a timeout.

The route command displays a delay when DNS resolution is not working properly because it attempts to resolve hostnames of routers and destinations by default, causing timeouts when DNS queries fail. The other options describe non-existent mechanisms or incorrect troubleshooting approaches for this symptom.

Why the other options are wrong

  • A. Automatic route re-validation is not a standard Linux feature that would cause this delay.
  • B. ARFD (Automatic Router Failure Detection) is not a standard Linux kernel mechanism.
  • C. Default router election is not an automatic workstation-level feature in this manner.
  • D. The Linux Kernel Routing Daemon (LKRD) is not a real daemon; delay is not caused by missing routing daemons.

Question 6

What is true about the Hop Limit field in the IPv6 header?

  1. The field is not changed during the transport of a package.
  2. The field is transmitted within a hop-by-hop extension header.
  3. Each router forwarding the packet increases the field's value.
  4. Each router forwarding the packet decreases the field's value.
  5. For multicast packages, the field's value is always 1.
Show answer and explanation

Correct answer: D. Each router forwarding the packet decreases the field's value.

The Hop Limit field in the IPv6 header is decremented by one at each router that forwards the packet, similar to the TTL field in IPv4. This prevents packets from circulating indefinitely in the network. The field is a regular part of the main IPv6 header, not an extension header, and is changed during transport.

Why the other options are wrong

  • A. The Hop Limit field is actively modified (decremented) during packet transport.
  • B. The Hop Limit is part of the main IPv6 header, not a hop-by-hop extension header.
  • C. Each router decreases the field, not increases it.
  • E. Multicast packets do not have special Hop Limit restrictions; the field can have various values.

Question 7

Which of the following nmcli subcommands exist? (Choose two.)

  1. nmcli ethernet
  2. nmcli device
  3. nmcli wifi
  4. nmcli address
  5. nmcli connection
Show answer and explanation

Correct answer: B, E. nmcli device; nmcli connection

nmcli device and nmcli connection are valid subcommands in NetworkManager's command-line interface. device manages network devices while connection manages connection profiles. ethernet, wifi, and address are not primary nmcli subcommands at the top level.

Why the other options are wrong

  • A. nmcli ethernet is not a valid subcommand; device is used to manage ethernet interfaces.
  • C. nmcli wifi is not a valid subcommand; device is used to manage wifi connections.
  • D. nmcli address is not a valid subcommand for managing IP addresses.

Question 8

Which of the following changes may occur as a consequence of using the command ip? (Choose three.)

  1. Network interfaces may become active or inactive.
  2. New name servers may be added to the resolver configuration.
  3. The system's host name may change.
  4. IP addresses may change.
  5. The routing table may change.
Show answer and explanation

Correct answer: A, D, E. Network interfaces may become active or inactive; IP addresses may change; The routing table may change.

The ip command can activate or deactivate network interfaces, modify IP addresses, and change the routing table. These are its primary use cases for dynamic network configuration. The ip command does not modify the resolver configuration (nameservers in resolv.conf) or change the system hostname; these require other tools.

Why the other options are wrong

  • B. The ip command does not modify resolver configuration or add nameservers to /etc/resolv.conf.
  • C. The ip command cannot change the system hostname; the hostname command or hostnamectl is used for that.

Question 9

How many IP addresses can be used for unique hosts inside the IPv4 subnet 192.168.2.128/26?

  1. 6
  2. 14
  3. 30
  4. 62
  5. 126
Show answer and explanation

Correct answer: D. 62

A /26 subnet has 26 bits for the network and 32-26=6 bits for hosts. With 6 host bits, there are 2^6=64 total addresses. Subtracting 2 addresses (network and broadcast), 64-2=62 usable host addresses remain.

Why the other options are wrong

  • A. 6 is the number of host bits, not usable addresses.
  • B. 14 would result from a /28 subnet, not /26.
  • C. 30 is the usable count for a /27 subnet.
  • E. 126 is the usable count for a /25 subnet.

Question 10

Which of the following IPv4 networks are reserved by IANA for private address assignment and private routing? (Choose three.)

  1. 10.0.0.0/8
  2. 127.0.0.0/8
  3. 169.255.0.0/16
  4. 172.16.0.0/12
  5. 192.168.0.0/16
Show answer and explanation

Correct answer: A, D, E. 10.0.0.0/8; 172.16.0.0/12; 192.168.0.0/16

IANA reserves three ranges for private use: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 as defined in RFC 1918. These are used for internal networks that do not route on the public Internet.

Why the other options are wrong

  • B. 127.0.0.0/8 is the loopback range, not a private address range for general use.
  • C. 169.255.0.0/16 is not a valid IANA-reserved private range; 169.254.0.0/16 is link-local.

What people say about the full LPIC-1 pack 4.8 from 5

Passed! Honestly the most useful single thing I bought for this exam. Better than the official book for actual exam prep.
Derek SzymanskiLPIC-1
Wish I found this sooner. Accuracy is impressive.
andrzej nakamuraLPIC-1
Great resource. Bought from this guy for three different exams now. My go to whenever I have a cert coming up. Real questions at a cheap price,
Usha ELPIC-1

Question 11

What output is produced by the following command sequence? echo '1 2 3 4 5 6' | while read a b c; do echo result $c $b $a; done

  1. result: 6 5 4
  2. result: 1 2 3 4 5 6
  3. result: 3 4 5 6 2 1
  4. result: 6 5 4 3 2 1
  5. result: 3 2 1
Show answer and explanation

Correct answer: C. result: 3 4 5 6 2 1

The read command splits '1 2 3 4 5 6' into three variables: a=1, b=2, c='3 4 5 6' (c captures the remaining input). The echo then outputs 'result 3 4 5 6 2 1' by printing $c, $b, and $a in that order.

Why the other options are wrong

  • A. This output format is incorrect and does not match what the read command produces.
  • B. The read command assigns to specific variables; it doesn't simply echo the input unchanged.
  • D. The read command does not reverse all individual digits; it assigns positional parameters and c captures the remainder.
  • E. This output is too short and doesn't account for the remaining values captured in variable c.

Question 12

What is a purpose of an SSH host key?

  1. It must be sent by any SSH client in addition to a user key in order to identify the client's host.
  2. It is root key by which all user SSH keys must be signed.
  3. It provides the server's identity information to connecting SSH clients.
  4. It authenticates any user that logs into a remote machine from the key's host.
  5. It is used by system services like cron, syslog or a backup job to automatically connect to remote hosts.
Show answer and explanation

Correct answer: C. It provides the server's identity information to connecting SSH clients.

An SSH host key provides the server's identity to connecting SSH clients. It allows clients to verify they are connecting to the correct server and is used to prevent man-in-the-middle attacks.

Why the other options are wrong

  • A. Host keys are not sent by clients; they are provided by the server to identify itself.
  • B. Host keys are not a root certificate authority for signing user keys.
  • D. Host keys do not authenticate individual users; user authentication is separate.
  • E. Host keys are not used for automatic service authentication; that requires separate mechanisms like key pairs in authorized_keys.

Question 13

Which configuration file contains the default options for SSH clients?

  1. /etc/ssh/sshd_config
  2. /etc/ssh/ssh
  3. /etc/ssh/ssh_config
  4. /etc/ssh/client
  5. /etc/ssh/ssh_client
Show answer and explanation

Correct answer: C. /etc/ssh/ssh_config

The file /etc/ssh/ssh_config contains default options and settings for SSH clients on a system. This file is read by SSH client programs to determine connection parameters, host-specific options, and authentication methods. The sshd_config file is for the server daemon, not the client.

Why the other options are wrong

  • A. sshd_config is for the SSH server daemon configuration, not SSH clients.
  • B. This is not a valid SSH configuration file path.
  • D. This is not a standard SSH configuration file.
  • E. This is not a standard SSH configuration file.

Question 14

Which of the following files assigns a user to its primary group?

  1. /etc/pgroup
  2. /etc/shadow
  3. /etc/passwd
  4. /etc/group
  5. /etc/gshadow
Show answer and explanation

Correct answer: C. /etc/passwd

/etc/passwd assigns each user to their primary group via the GID field (the 4th colon-separated field in each user entry). This file contains the definitive mapping of users to their primary group IDs.

Why the other options are wrong

  • A. /etc/pgroup does not exist as a standard Linux file.
  • B. /etc/shadow contains password information, not group assignments.
  • D. /etc/group defines groups and their secondary members, not primary group assignments.
  • E. /etc/gshadow contains group password information, not primary group assignments.

Question 15

Which of the following tasks can the date command accomplish? (Choose two.)

  1. Set the system's date and time.
  2. Set the system's date but not the time.
  3. Calculate the time span between two dates.
  4. Print a calendar for a month or a year.
  5. Display time in a specific format.
Show answer and explanation

Correct answer: A, E. Set the system's date and time; Display time in a specific format.

The date command can display the current date and time and format output using format specifiers, and with appropriate permissions it can set the system date and time using the -s option. However, it cannot calculate time spans or display calendars independently.

Why the other options are wrong

  • B. The date command sets both date and time together with -s, not date alone.
  • C. Date command does not calculate time spans between dates.
  • D. Calendar display is the function of the cal command, not date.

Question 16

Which of the following configuration files should be modified to globally set shell variables for all users?

  1. /etc/profile
  2. /etc/bashrc
  3. ~/.bash_profile
  4. /etc/.bashrc
  5. /etc/shellenv
Show answer and explanation

Correct answer: A. /etc/profile

/etc/profile is the global login shell initialization file that applies to all users on the system. It is sourced by login shells and is the appropriate place to set global shell variables for all users.

Why the other options are wrong

  • B. /etc/bashrc is for non-login interactive shells and is not the primary global configuration file.
  • C. ~/.bash_profile is user-specific, not global for all users.
  • D. /etc/.bashrc is not a standard configuration file location; the correct path would be /etc/bashrc.
  • E. /etc/shellenv is not a standard Linux configuration file.

Question 17

Which of the following features are provided by SPICE? (Choose two.)

  1. Connecting local USB devices to remote applications.
  2. Accessing graphical applications on a remote host.
  3. Replacing Xorg as local X11 server.
  4. Downloading and locally installing applications from a remote machine.
  5. Uploading and running a binary program on a remote machine.
Show answer and explanation

Correct answer: A, B. Connecting local USB devices to remote applications; Accessing graphical applications on a remote host.

SPICE (Simple Protocol for Independent Computing Environments) provides two main features: it allows connecting local USB devices to remote applications through USB redirection (A), and it enables accessing graphical applications running on a remote host over the network (B). These capabilities make SPICE useful for remote desktop and application access scenarios.

Why the other options are wrong

  • C. SPICE is a remote display protocol; it does not replace Xorg as a local X11 server.
  • D. SPICE does not handle application downloading and local installation from remote machines.
  • E. SPICE is not designed for uploading and executing binary programs on remote machines.

Question 18

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?

  1. mail.* /var/log/maillog mail,crit @logger.example.org
  2. mail.* /var/log/maillog mail.crit syslog://logger.example.org
  3. mail /var/log/maillog mail.crit @logger.example.org
  4. mail.* /var/log/maillog mail.crit @logger.example.org
  5. mail * /var/log/maillog mail crit @logger.example.org
Show answer and explanation

Correct answer: D. mail.* /var/log/maillog mail.crit @logger.example.org

The correct syntax for /etc/syslog.conf requires 'mail.*' to match all mail facility messages, the file path '/var/log/maillog' as the destination, then a separate selector 'mail.crit' for critical mail events, followed by '@logger.example.org' for remote logging (the @ symbol indicates a remote host).

Why the other options are wrong

  • A. The syntax is incorrect; facilities and priorities cannot be comma-separated in a single selector on the same line.
  • B. syslog:// is not valid syslog.conf syntax; the @ symbol is used for remote hosts.
  • C. The facility selector should be 'mail.*' not just 'mail' to capture all priority levels.
  • E. The syntax 'mail *' is incorrect; selectors use dot notation (mail.*), and multiple actions cannot be space-separated like this.

Question 19

What information is provided by the echo $$ command?

  1. The process ID of the current shell.
  2. The process ID for the following command.
  3. The process ID of the last command executed.
  4. The process ID of the last command which has been placed in the background.
  5. The process ID of the echo command.
Show answer and explanation

Correct answer: A. The process ID of the current shell.

The $$ special variable expands to the process ID (PID) of the current shell. This is useful for scripts that need to reference their own process identifier.

Why the other options are wrong

  • B. The $$ variable refers to the current shell, not the following command.
  • C. $! (not $$) holds the PID of the last background command; $$ is the current shell.
  • D. The $! variable holds the PID of the last backgrounded command, not $$.
  • E. The PID returned is that of the shell itself, not the echo command.

Question 20

Which of the following commands preloads and manages existing SSH keys that are used for automatic authentication while logging in to order machines using SSH?

  1. sshd
  2. ssh-keyring
  3. ssh-keygen
  4. ssh-pki
  5. ssh-agent
Show answer and explanation

Correct answer: E. ssh-agent

The ssh-agent command preloads and manages SSH private keys in memory, enabling automatic authentication for SSH connections without requiring password entry each time. When keys are loaded into ssh-agent, SSH can use them for authentication across multiple sessions.

Why the other options are wrong

  • A. sshd is the SSH server daemon, not a key management tool.
  • B. ssh-keyring is not a standard SSH utility.
  • C. ssh-keygen generates SSH keys but does not manage or preload them for authentication.
  • D. ssh-pki is not a standard SSH command.

Question 21

On a machine running several X servers, how do programs identify the different instances of the X11 server?

  1. By a fixed UUID that is defined in the X11 configuration file.
  2. By a display name like: 1.
  3. By the name of the user that runs the X server like x11:bob.
  4. By a device name like /dev/X11/xservers/1.
  5. By a unique IPv6 address from the fe80::/64 subnet.
Show answer and explanation

Correct answer: B. By a display name like: 1.

X11 servers are identified by display names in the format hostname:displaynumber.screennumber, such as :0 or :1 for local displays, or computername:0 for remote displays. This convention allows programs to connect to specific X server instances when multiple X servers are running on the same machine or network.

Why the other options are wrong

  • A. X11 does not use fixed UUIDs defined in configuration files for identification.
  • C. Display names are not based on usernames; multiple users can connect to the same display.
  • D. X11 servers do not use device names like /dev/X11/xservers/1 for identification.
  • E. X11 display identification does not rely on IPv6 addresses from the fe80::/64 subnet.

Question 22

Which of the following commands configure network interfaces based on the system's existing distribution-specific configuration files? (Choose two.)

  1. ifconf
  2. ifdown
  3. ifpause
  4. ifstart
  5. ifup
Show answer and explanation

Correct answer: B, E. ifdown; ifup

ifup and ifdown are standard Linux commands that configure or deconfigure network interfaces using settings from distribution-specific configuration files such as /etc/network/interfaces or /etc/sysconfig/network-scripts/.

Why the other options are wrong

  • A. ifconf is not a standard networking command.
  • C. ifpause is not a standard networking command.
  • D. ifstart is not a standard command; ifup is used to bring interfaces up.

Question 23

Which of the following statements is true regarding systemd timer units?

  1. Timer units can only be defined within a service unit's file.
  2. The command executed by the timer is specified in the timer unit's [Cmd] section.
  3. A dedicated system service, systemd-cron, handles the execution of timer units.
  4. Timer units only exist in the system scope and are not available for users.
  5. Each systemd timer unit controls a specific systemd service unit.
Show answer and explanation

Correct answer: E. Each systemd timer unit controls a specific systemd service unit.

Each systemd timer unit is paired with and controls a corresponding systemd service unit that performs the actual work. Timer units define when actions should occur, while service units define what actions to perform. The timer unit's Unit= directive specifies which service unit it activates.

Why the other options are wrong

  • A. Timer units are defined in separate .timer files, not within service unit files.
  • B. Commands are specified in the associated service unit file, not in the timer unit's [Cmd] section.
  • C. There is no systemd-cron service; systemd-run and the timer mechanism are built into systemd itself.
  • D. Timer units are available in both system and user scopes via --user flag.

Question 24

Which of the following commands can be used to limit the amount of memory a user may use?

  1. umask
  2. usermod
  3. passwd
  4. ulimit
  5. chage
Show answer and explanation

Correct answer: D. ulimit

The ulimit command sets resource limits for shell processes and child processes, including memory usage. It can restrict the amount of memory a user may use through options like -v for virtual memory.

Why the other options are wrong

  • A. umask controls file creation permissions, not memory usage.
  • B. usermod modifies user account properties but does not directly limit memory usage.
  • C. passwd manages user passwords and does not control resource limits.
  • E. chage manages password expiration settings, not memory resource limits.

Question 25

Which of the following commands shows all active systemd timers?

  1. systemctl-timer show
  2. timectl list
  3. systemctl -t
  4. systemctl list-timers
  5. timeq
Show answer and explanation

Correct answer: D. systemctl list-timers

The command systemctl list-timers displays all active and inactive systemd timer units with their next scheduled execution times and last trigger information.

Why the other options are wrong

  • A. systemctl-timer show is not a valid command syntax.
  • B. timectl list is not a standard systemd command for listing timers.
  • C. systemctl -t is incomplete; the full command requires 'timer' as an argument.
  • E. timeq is not a real command.

25 questions in. Want the rest? The first half of the pack, free by email · The full pack

Question 26

Depending on a system's configuration, which of the following files can be used to enable and disable network services running on this host?

  1. /etc/profile
  2. /etc/xinetd.conf
  3. /etc/ports
  4. /etc/services
  5. /etc/host.conf
Show answer and explanation

Correct answer: B. /etc/xinetd.conf

/etc/xinetd.conf is the configuration file for xinetd (extended internet daemon), which manages and controls which network services are enabled or disabled on the system. It allows administrators to enable or disable services that run under xinetd's control, making it the file specifically used to enable and disable services.

Why the other options are wrong

  • A. /etc/profile is used for shell environment configuration, not service management.
  • C. /etc/ports is not a standard Linux configuration file.
  • D. /etc/services maps service names to port numbers but does not enable or disable services.
  • E. /etc/host.conf is used for hostname resolution configuration, not service management.

Question 27

Which of the following comparison operators for test work on elements in the file system? (Choose two.)

  1. -z
  2. -eq
  3. -d
  4. -f
  5. -lt
Show answer and explanation

Correct answer: C, D. -d; -f

The -d operator tests if a file is a directory, and the -f operator tests if a file is a regular file. Both are filesystem-related comparison operators used in conditional statements with the test command.

Why the other options are wrong

  • A. -z tests if a string is empty (string operator, not filesystem).
  • B. -eq tests for numeric equality (arithmetic operator, not filesystem).
  • E. -lt tests for numeric less-than (arithmetic operator, not filesystem).

Question 28

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?

  1. iburst
  2. quickstart
  3. fast
  4. fsync
  5. flood
Show answer and explanation

Correct answer: A. iburst

The iburst option in the chrony configuration file speeds up the initial synchronization by sending a burst of eight packets instead of the standard single packet during the initial connection phase. This allows faster convergence to the correct time.

Why the other options are wrong

  • B. quickstart is not a standard chrony configuration option.
  • C. fast is not a standard chrony option for initial synchronization.
  • D. fsync is not a chrony configuration option.
  • E. flood is not a standard chrony option; iburst is the correct option for burst polling.

Question 29

Which of the following steps prevents a user from obtaining an interactive login session?

  1. Setting the UID for the user to 0.
  2. Running the command chsh -s /bin/false with the user name.
  3. Removing the user from the group staff.
  4. Adding the user to /etc/noaccess.
  5. Creating a .nologin file in the user's home directory.
Show answer and explanation

Correct answer: B. Running the command chsh -s /bin/false with the user name.

Running chsh -s /bin/false sets the user's login shell to /bin/false, which is a non-functional shell that prevents the user from obtaining an interactive login session. This is the standard method to disable login access while keeping the account active.

Why the other options are wrong

  • A. Setting UID to 0 makes the user a root-equivalent account, granting access rather than preventing it.
  • C. Removing a user from the staff group does not prevent login; it only affects group permissions.
  • D. /etc/noaccess is not a standard Linux file for controlling access.
  • E. .nologin in the home directory is not a standard mechanism; it is typically checked only at the system level (/etc/nologin), and user-level .nologin files are not enforced by default.

Question 30

Which of the following commands can identify the PID od a process which opened a TCP port?

  1. ptrace
  2. strace
  3. debug
  4. lsof
  5. nessus
Show answer and explanation

Correct answer: D. lsof

The lsof command (list open files) can identify which process has opened a specific TCP port by showing all open files and network connections associated with running processes. The -i flag specifically filters for network connections, allowing administrators to see which PID is listening on or using a particular port.

Why the other options are wrong

  • A. ptrace is a system call for process tracing and debugging, not for identifying port usage.
  • B. strace traces system calls and signals but is not the standard tool for identifying which process opened a port.
  • C. debug is not a standard Linux command for port identification.
  • E. nessus is a vulnerability scanner, not a tool for identifying process PIDs associated with ports.

That was 30 of 120.

The full LPI LPIC-1 102-500 pack has all 120 questions, each with the answer, the explanation and why the other options are wrong, plus a questions-only copy for timed runs. US$39, paid once, with free monthly updates and a pass-or-your-money-back guarantee.

Get the full pack

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