LPI 101-500 Practice Test Questions and Exam Dumps Part 18 Q341-360

View Full LPI 101-500 Exam Dumps and Practice Test Dumps

 

Question: 341. Which directory commonly contains architecture-independent shared data used by applications?

  1. /usr/share
    2. /usr/sbin
    3. /var/run
    4. /boot

Correct Answer: 1. /usr/share

Explanation:

The /usr/share directory commonly contains architecture-independent data used by applications and system utilities. Examples can include documentation, localization files, icons, and other data that does not depend directly on the processor architecture. Executable programs are generally placed in directories such as /usr/bin, while system-administration executables may be found under /usr/sbin. /boot contains files needed during the boot process, and /var/run or /run is associated with volatile runtime state. Understanding the distinction between executable directories and shared application data is useful when navigating a Linux filesystem.

Question: 342. Which directory is traditionally associated with optional third-party software packages installed by the system administrator?

  1. /opt
    2. /tmp
    3. /proc
    4. /etc

Correct Answer: 1. /opt

Explanation:

The /opt directory is traditionally used for optional software packages and add-on application software. Programs installed under /opt may keep their application files together in a dedicated subdirectory rather than distributing them across the standard system hierarchy. This can make third-party or self-contained software easier to manage. /etc is primarily for configuration files, /tmp is used for temporary data, and /proc provides a virtual filesystem exposing process and kernel information. The exact layout of installed applications varies across Linux distributions, but /opt has a well-established conventional purpose.

Question: 343. Which command displays the filesystem type along with mounted filesystem information when used with df?

  1. df -T
    2. df -i
    3. df -P
    4. df -h

Correct Answer: 1. df -T

Explanation:

The -T option of df adds the filesystem type to the displayed information. This is useful when an administrator needs to determine whether a mounted filesystem uses a type such as ext4, XFS, tmpfs, or another supported filesystem. The -h option instead makes size values easier for humans to read, while -i displays inode usage information. df -T therefore provides both filesystem space information and the filesystem type, making it helpful during storage troubleshooting and system inventory tasks.

Question: 344. Which ls option appends indicators such as / to directory names?

  1. -F
    2. -L
    3. -I
    4. -G

Correct Answer: 1. -F

Explanation:

The -F option of ls appends a character to filenames to indicate certain file types. For example, directories are commonly shown with a trailing /, executable files may receive *, and symbolic links may receive @, depending on the implementation. These indicators make directory listings easier to interpret at a glance. The option does not change the underlying files or permissions. It simply adds visual information to the names in the listing. This is particularly useful during interactive shell work when users want to distinguish directories, executables, and links quickly.

Question: 345. Which command can display the target of a symbolic link without following it to display the target’s metadata?

  1. readlink
    2. linktarget
    3. ls-target
    4. targetof

Correct Answer: 1. readlink

Explanation:

The readlink command can display the pathname stored as the target of a symbolic link. This is useful when an administrator needs to determine what a symbolic link actually references. For example, readlink linkname returns the link’s stored target path. Options such as -f can additionally resolve the target through filesystem path components and symbolic links, subject to the command’s semantics. This differs from commands that inspect the target object itself. Understanding readlink is particularly useful when troubleshooting configuration links, alternate paths, and dangling symbolic links.

Question: 346. Which command displays detailed metadata about a specified file, including timestamps and inode information?

  1. inspect
    2. stat
    3. metadata
    4. fileinfo

Correct Answer: 2. stat

Explanation:

The stat command displays detailed filesystem metadata about a specified file or directory. Depending on the filesystem and implementation, its output can include the inode number, file type, permissions, ownership, size, link count, and several timestamps. This makes stat more detailed than a basic directory listing. It is particularly useful when investigating hard links, timestamps, ownership, and filesystem metadata. The file command, by contrast, primarily attempts to identify the type or contents of a file. stat is therefore the appropriate tool when detailed metadata is required.

Question: 347. Which mount option requests that a filesystem be mounted using a specified filesystem type?

  1. -t
    2. -f
    3. -s
    4. -p

Correct Answer: 1. -t

Explanation:

The -t option of mount specifies the filesystem type to use when mounting a filesystem. For example, an administrator can specify a type such as ext4, xfs, or another supported filesystem. This can be useful when the type cannot be determined automatically or when explicit configuration is required. The exact filesystem type must be supported by the kernel and available system components. Other mount options control behavior such as read-only access, mount flags, or configuration handling. Correctly identifying the filesystem type helps prevent failed or incorrect mount operations.

Question: 348. What does the mount option -o bind generally allow?

  1. It formats a filesystem before mounting
    2. It mounts an existing directory at another location
    3. It converts a symbolic link into a hard link
    4. It mounts only removable media

Correct Answer: 2. It mounts an existing directory at another location

Explanation:

A bind mount makes an existing directory tree accessible at another mount point without creating a separate filesystem. Using mount –bind source target exposes the same underlying directory contents through the target path. This can be useful for containers, system administration, chroot environments, and reorganizing access to existing directory trees. It does not format the filesystem or create a new filesystem. A bind mount is also different from a symbolic link because it operates at the filesystem mount layer and can affect how the directory is presented to processes.

Question: 349. Which ls option reverses the current sorting order?

  1. -R
    2. -r
    3. -v
    4. -c

Correct Answer: 2. -r

Explanation:

The -r option reverses the sorting order used by ls. It can be combined with other sorting options to produce the opposite ordering. For example, ls -lt normally lists entries with newer modification times first, while ls -ltr reverses that order and places older entries first. The -R option instead performs a recursive listing of subdirectories. The lowercase -r should therefore not be confused with uppercase -R. Combining options is common in Linux commands, so understanding the individual meaning of each option is important.

Question: 350. Which command can display the number of hard links associated with a file?

  1. ls -l
    2. ls -h
    3. ls -p
    4. ls -A

Correct Answer: 1. ls -l

Explanation:

The long-format ls -l listing includes a field representing the number of hard links associated with the file’s inode. For an ordinary file, this value indicates how many directory entries currently reference the same inode. Creating another hard link normally increases the link count, while removing one decreases it. This is useful when investigating relationships between filenames and shared file data. The other options listed do not specifically expose the link-count field. The link count should be distinguished from the number of symbolic links pointing to a file, which is a different concept.

Question: 351. Which process identifier is normally assigned to the initial user-space process on a Linux system?

  1. PID 0
    2. PID 1
    3. PID 2
    **4. PID 100

Correct Answer: 2. PID 1

Explanation:

PID 1 is normally assigned to the initial user-space process started by the Linux kernel. On many modern distributions, this process is systemd, although other initialization systems can occupy PID 1. PID 1 has special responsibilities, including adopting orphaned processes and participating in system initialization and service management. PID 0 has a special kernel-related role rather than representing an ordinary user-space init process. Understanding PID 1 is important when studying process relationships, system startup, service management, and what happens to processes whose original parent terminates.

Question: 352. Which command displays the parent process ID of a process in a detailed process listing?

  1. ps -ef
    2. ps -q
    3. ps -x
    4. ps -c

Correct Answer: 1. ps -ef

Explanation:

The ps -ef format includes a PPID column showing the parent process ID for each listed process. The parent process ID is useful for understanding process relationships and tracing how a process was started. For example, an administrator can use the PPID to identify which process created or launched a particular child process. ps supports many different option combinations and output formats, but -ef is a widely used form for obtaining a broad full-format process listing. Process relationships are particularly important when diagnosing service hierarchies, orphaned processes, and shell-launched programs.

Question: 353. Which shell operator redirects standard output to a file while discarding the previous contents of that file?

  1. >>
    2. 2>
    3. >
    4. &>

Correct Answer: 3. >

Explanation:

The > redirection operator sends standard output to a specified file and normally truncates that file before writing the new output. If the file does not already exist, the shell generally creates it. This differs from >>, which appends standard output to the existing contents. The 2> operator specifically redirects standard error, while combined redirection syntax such as &> is shell-dependent and redirects multiple output streams. Understanding the distinction between truncating and appending redirection is essential because accidental use of > can overwrite existing data.

Question: 354. Which file descriptor represents standard input?

  1. 2
    2. 0
    3. 1
    4. 3

Correct Answer: 2. 0

Explanation:

File descriptor 0 represents standard input, commonly abbreviated as stdin. It is the default input stream from which a command reads data. File descriptor 1 represents standard output, while file descriptor 2 represents standard error. These descriptors allow shell commands to redirect input and output between files, terminals, and other processes. For example, < input.txt redirects standard input from a file. Understanding the standard file descriptors is fundamental to Linux shell usage because pipelines and redirections rely heavily on these predefined streams.

Question: 355. Which shell redirection sends standard error to the same destination currently used by standard output in a POSIX-style shell?

  1. 2>&1
    2. 1>&2
    3. 2>1
    4. &2>1

Correct Answer: 1. 2>&1

Explanation:

The redirection 2>&1 duplicates file descriptor 1 onto file descriptor 2, causing standard error to use the same destination currently assigned to standard output. This is commonly used when both normal output and error messages need to be captured together. The order of redirections matters because the shell processes them from left to right. For example, command >output.txt 2>&1 sends both standard output and standard error to output.txt. Understanding descriptor duplication is important when writing scripts that collect command output or logs reliably.

Question: 356. Which command can display only the last 20 lines of a file?

  1. tail -20
    2. head -20
    3. last -20
    4. end -20

Correct Answer: 1. tail -20

Explanation:

The tail command displays the end of a file, and tail -20 requests the last 20 lines on commonly used implementations. This is useful for quickly examining recent entries in log files without displaying the entire file. The head command performs the opposite task by displaying content from the beginning of a file. tail can also follow a growing file using options such as -f, which is especially useful for monitoring logs while applications are running. The exact numeric syntax can vary slightly across implementations, but tail -20 is widely recognized.

Question: 357. Which command can display only the first 15 lines of a file?

  1. first -15
    2. top -15
    3. head -15
    4. start -15

Correct Answer: 3. head -15

Explanation:

The head command displays the beginning portion of a file, and head -15 requests the first 15 lines on commonly used Linux implementations. This is useful when quickly inspecting the structure or opening records of a large file without reading its entire contents. The command can also operate on multiple files and can be combined with pipelines. tail is used for the end of a file instead. Administrators frequently use head during troubleshooting, data inspection, and shell scripting when only the initial portion of command output is needed.

Question: 358. Which command can display a file’s contents one screen at a time while allowing interactive navigation?

  1. cat
    2. less
    3. echo
    4. touch

Correct Answer: 2. less

Explanation:

The less command is a pager that allows users to view text interactively one screen at a time. It is particularly useful for large files or long command output because it avoids flooding the terminal with the entire content at once. Users can scroll forward and backward, search for text, and navigate through the displayed data. cat normally writes the complete file directly to standard output, while echo is primarily used to display supplied text. touch creates or updates file timestamps rather than displaying content. less is therefore well suited to interactive text inspection.

Question: 359. Which command changes the group ownership of a file?

  1. chgrp
    2. chmod
    3. chuser
    4. groupmod

Correct Answer: 1. chgrp

Explanation:

The chgrp command changes the group ownership associated with a file or directory. For example, an administrator can use chgrp developers project.txt to assign the file to the developers group, provided the user has the required permissions. chmod changes permission bits rather than ownership, while groupmod modifies group account information rather than assigning a group to a filesystem object. chown can also change ownership and group ownership, making it another option for broader ownership administration. Understanding ownership and permission management is essential for controlling collaborative access to Linux files.

Question: 360. Which shell construct executes the right-hand command only when the left-hand command fails?

  1. &&
    2. |
    3. ||
    4. ;

Correct Answer: 3. ||

Explanation:

The || shell operator provides conditional execution based on failure. The command on the right is executed when the command on the left returns a nonzero exit status. This is useful for fallback actions, error handling, and alternative commands. For example, test -f config && echo found || echo missing can select an output based on whether the test succeeds, although more complex scripts may use explicit conditional statements for clarity. The && operator instead runs the right-hand command when the left-hand command succeeds, while ; simply separates commands without making execution conditional.