View Full LPI 101-500 Exam Dumps and Practice Test Dumps
Question: 321. Which command can display the absolute pathname of the current working directory after resolving symbolic links?
- whereis
2. realpath
3. basename
4. dirname
Correct Answer: 2. realpath
Explanation:
The realpath command resolves a pathname into an absolute pathname and can resolve symbolic links along the path. This is useful when a script or administrator needs to determine the actual filesystem location represented by a pathname rather than simply displaying the pathname supplied by the user. For example, symbolic links may make several different pathnames refer to the same underlying location. basename extracts the final component of a pathname, while dirname extracts the directory portion. whereis searches for related files such as binaries and documentation rather than resolving a pathname.
Question: 322. Which filesystem object provides a pathname reference to another file or directory?
- Hard link
2. Inode
3. Symbolic link
4. File descriptor
Correct Answer: 3. Symbolic link
Explanation:
A symbolic link is a filesystem object containing a pathname that refers to another file or directory. Unlike a hard link, which references the same inode as another directory entry, a symbolic link has its own inode and stores a target pathname. This allows symbolic links to reference directories and, on typical Linux systems, targets located on another filesystem. If the target is moved or removed, the symbolic link can become dangling. Symbolic links are widely used to provide convenient alternate names, compatibility paths, and configurable references to files or directories.
Question: 323. Which file commonly contains information used to define how filesystems are mounted automatically during system startup?
- /etc/fstab
2. /etc/mtab
3. /etc/mounts
4. /etc/filesystems
Correct Answer: 1. /etc/fstab
Explanation:
The /etc/fstab file contains static filesystem mount configuration. It can specify devices, filesystem types, mount points, and mount options that the operating system can use when mounting filesystems. Entries in this file can also control whether particular filesystems are mounted automatically during boot or when mount -a is executed. The exact syntax and available options depend on the system and filesystem. /etc/fstab should be edited carefully because incorrect entries can cause mounting failures. It is different from runtime information describing filesystems that are currently mounted.
Question: 324. Which option in /etc/fstab prevents a filesystem from being mounted automatically by mount -a?
- ro
2. auto
3. defaults
4. noauto
Correct Answer: 4. noauto
Explanation:
The noauto mount option tells the mount command not to mount the corresponding filesystem automatically when mount -a is used. This can be useful for filesystems that should be available only when explicitly requested, such as removable or infrequently used storage. The auto option has the opposite effect by allowing automatic mounting through mechanisms that honor the option. ro controls read-only access, while defaults represents a collection of commonly used default mount options. Understanding these options is important when configuring /etc/fstab safely.
Question: 325. What is the primary purpose of the /var/run path on systems that retain this traditional pathname?
- Store permanent application databases
2. Provide a location for runtime state information
3. Store bootloader configuration
4. Contain user home directories
Correct Answer: 2. Provide a location for runtime state information
Explanation:
/var/run is a traditional pathname associated with runtime state information created by services and processes. On many modern Linux systems, /var/run is implemented as a symbolic link to /run, which is the contemporary location for volatile runtime data. Such information can include process identifiers, sockets, and other state that is needed while the system is running but does not necessarily need to persist across reboots. This differs from /var/lib, which generally stores persistent variable application data. Understanding the relationship between /var/run and /run helps when interpreting older documentation.
Question: 326. Which command displays the inode number associated with each listed filesystem entry?
- ls -i
2. ls -n
3. ls -I
4. ls -d
Correct Answer: 1. ls -i
Explanation:
The -i option of ls displays the inode number for each filesystem object in the listing. Inode numbers identify filesystem objects within a particular filesystem and are useful when investigating hard links, link counts, and filesystem metadata. Two different filenames can have the same inode number when they are hard links to the same underlying file. The -d option controls how directory arguments are handled, while -n changes ownership display to numeric user and group IDs. Therefore, ls -i is the appropriate option when inode identification is required.
Question: 327. Which find expression searches for regular files larger than 100 megabytes?
- find . -large 100M
2. find . -type f -size +100M
3. find . -file +100M
4. find . -size 100M -regular
Correct Answer: 2. find . -type f -size +100M
Explanation:
The expression find . -type f -size +100M combines two tests: -type f restricts the results to regular files, and -size +100M searches for files above the specified size threshold. This combination is useful when investigating disk usage because it excludes directories and other filesystem objects. The exact interpretation of size thresholds can depend on the unit syntax supported by the implementation, so administrators should consult the local find documentation for precise behavior. Combining multiple find tests is a powerful way to construct targeted filesystem searches.
Question: 328. Which command is commonly used to search a prebuilt filename database rather than scanning directories directly?
- find
2. grep
3. locate
4. stat
Correct Answer: 3. locate
Explanation:
The locate command searches a prebuilt database containing filesystem pathnames. Because it searches indexed data rather than normally traversing the filesystem at the time of the query, it can return results very quickly. However, the database may not immediately reflect files that were recently created, moved, or removed. The find command generally performs a live filesystem search and therefore provides current results but may take longer. grep searches text content or command output, while stat displays metadata about specified filesystem objects. The distinction between database-based and live searching is important in Linux administration.
Question: 329. Which signal is normally associated with stopping a process so that it cannot continue until resumed?
- SIGCONT
2. SIGSTOP
3. SIGTERM
4. SIGCHLD
Correct Answer: 2. SIGSTOP
Explanation:
SIGSTOP is a signal that stops a process’s execution. Unlike signals such as SIGTERM, it is not intended to request graceful termination. A stopped process can later be resumed using SIGCONT. SIGSTOP is also notable because the process cannot catch, block, or ignore it. This makes it useful when a process must be forcibly suspended. SIGCONT resumes a stopped process, SIGTERM requests termination, and SIGCHLD is commonly delivered to a parent when a child process changes state. Understanding signal purposes is important when managing Linux processes.
Question: 330. What happens when a process becomes orphaned on a modern Linux system?
- It is automatically converted into a zombie
2. It is immediately terminated
3. It is adopted by an appropriate ancestor process such as PID 1
4. It becomes a kernel thread
Correct Answer: 3. It is adopted by an appropriate ancestor process such as PID 1
Explanation:
An orphan process is a running process whose original parent has terminated. Rather than remaining without a parent, the process is adopted by another suitable ancestor, traditionally PID 1 on many Linux systems. Modern systems using systemd commonly have systemd as PID 1. This adoption allows the process to continue operating while maintaining a valid parent relationship. An orphan is different from a zombie: a zombie has already terminated but remains in the process table until its parent collects its exit status. Understanding parent-child relationships helps explain process lifecycle behavior.
Question: 331. Which command can display the current shell’s process ID?
- echo $$
2. echo $PPID
3. echo $!
4. echo $?
Correct Answer: 1. echo $$
Explanation:
The shell parameter $$ expands to the process ID of the current shell. Therefore, echo $$ displays the PID associated with that shell process. This is useful in shell scripts when a script needs to identify its own process or construct a temporary filename involving the shell’s PID. $PPID instead represents the parent process ID, $! commonly contains the PID of the most recently started background process, and $? contains the exit status of the most recently completed foreground command. These special parameters provide different types of process and execution information.
Question: 332. Which shell parameter contains the process ID of the most recently started background command?
- $0
2. $?
3. $$
4. $!
Correct Answer: 4. $!
Explanation:
The special shell parameter $! expands to the process ID of the most recently executed background pipeline or asynchronous command. It is useful when a script needs to save or later wait for a process that was started with &. For example, a script can launch a background task, store $!, and then use that process identifier with wait. This differs from $$, which identifies the current shell, and $?, which represents the exit status of the most recently completed foreground command. Correctly distinguishing these parameters is important in shell scripting.
Question: 333. Which command can show both running processes and their CPU and memory usage interactively?
- top
2. touch
3. tee
4. tr
Correct Answer: 1. top
Explanation:
The top command provides a continuously updated interactive view of running processes and system resource usage. It commonly displays information such as process IDs, CPU utilization, memory utilization, process ownership, and process state. Administrators can use it to identify processes consuming unusually large amounts of system resources. Unlike commands that provide a static process listing, top refreshes its display while running, making it useful for observing changing workloads. Other utilities can provide process information, but top is specifically designed for interactive monitoring of processes and system activity.
Question: 334. Which command can send a specified signal to a process using its process ID?
- signal
2. kill
3. terminate
4. stop
Correct Answer: 2. kill
Explanation:
The kill command sends a signal to one or more processes identified by process ID. Despite its name, kill does not always terminate a process because the signal can be selected explicitly. For example, an administrator can send SIGTERM for a normal termination request or another appropriate signal for a different purpose. A signal can be specified by name or number depending on the command syntax. The command requires appropriate permissions when targeting processes owned by another user. Understanding signals makes kill a general process-control utility rather than merely a termination command.
Question: 335. Which shell command lists currently active jobs managed by the interactive shell?
- jobs
2. tasks
3. processes
4. activities
Correct Answer: 1. jobs
Explanation:
The jobs shell builtin displays jobs currently managed by the interactive shell’s job-control system. Its output can identify jobs running in the background, stopped jobs, and their job numbers. These job numbers can then be used with commands such as fg and bg to manipulate the jobs. The jobs command is different from process-monitoring tools such as ps, because it focuses on the shell’s own job table rather than providing a general listing of system processes. Job control is particularly useful when several commands are being run interactively from one terminal.
Question: 336. Which shell builtin can resume a stopped job in the background?
- resume
2. continue-job
3. bg
4. start
Correct Answer: 3. bg
Explanation:
The bg shell builtin resumes a stopped job and allows it to continue executing in the background. A job can commonly be stopped using terminal job-control mechanisms and then resumed with bg, allowing the user to continue using the shell prompt. The job can later be brought back to the foreground with fg. The command works with shell job specifications, such as %1, when multiple jobs are being managed. This differs from starting a completely new process because bg operates on an existing shell-managed job.
Question: 337. Which command prevents a shell script from continuing after a command fails by enabling immediate exit on a nonzero status?
- set -e
2. set -f
3. set -a
4. set -m
Correct Answer: 1. set -e
Explanation:
The set -e shell option enables an error-exit behavior in which the shell exits when a command returns a nonzero status, subject to several shell-specific exceptions and contextual rules. It is often used in scripts to prevent later commands from running after an unexpected failure. However, because the exact behavior of set -e can be affected by constructs such as conditional commands, pipelines, and command lists, scripts should not assume that every nonzero status always causes immediate termination. Understanding these exceptions is important when writing reliable shell scripts.
Question: 338. Which shell builtin can assign a variable whose value is restricted from being changed later in the same shell?
- export
2. readonly
3. declare -x
4. protect
Correct Answer: 2. readonly
Explanation:
The readonly shell builtin marks variables as read-only so that later attempts to assign a different value or unset them are normally rejected by the shell. This can be useful for protecting configuration values or constants used by a script. It is different from export, which makes a shell variable available to child processes through the environment. Filesystem permissions do not control shell-variable assignment, so chmod cannot make a shell variable read-only. The exact syntax for creating and inspecting read-only variables can vary slightly between shells, but the underlying concept is broadly supported.
Question: 339. Which shell parameter expands to the name used to invoke the shell script?
- $0
2. $1
3. $#
**4. $@
Correct Answer: 1. $0
Explanation:
In a typical shell script, $0 expands to the name or pathname used to invoke the script. It is often used when producing usage messages because it allows a script to refer to itself by the invocation name. $1 represents the first positional argument, $# contains the number of positional arguments, and $@ expands to the positional arguments themselves. The exact representation of $0 can depend on how the script was invoked, so it should not always be interpreted as a canonical absolute pathname. Nevertheless, it is the standard shell parameter for the script’s invocation name.
Question: 340. Which shell syntax allows a function to define a variable that is local to that function in shells supporting the local builtin?
- private variable=value
2. local variable=value
3. scope variable=value
4. internal variable=value
Correct Answer: 2. local variable=value
Explanation:
The local builtin is used by several common shells to create variables whose scope is limited to the current function invocation. For example, local result=value allows a function to use result without normally modifying a global variable of the same name. Local variables make larger shell scripts easier to maintain because functions can use temporary variable names without unintentionally changing surrounding shell state. The exact scope rules and availability of local can vary between shell implementations, so scripts intended for strict POSIX portability should account for those differences.