View Full LPI 101-500 Exam Dumps and Practice Test Dumps
Question 161. Which command is commonly used to display the current working directory in Linux?
- ls
- pwd
- cd
- dir
Correct Answer: 2. pwd
Explanation:
The pwd command stands for “print working directory” and displays the absolute path of the directory in which the user is currently located. This is especially useful when working with multiple directories or navigating through a complex filesystem structure. For example, running pwd might return /home/user/documents, showing exactly where the shell is currently positioned. The cd command changes the current directory, while ls lists files and directories. Although dir may be available on some systems, it is not the standard command expected for this purpose in Linux administration. Therefore, pwd is the correct command for displaying the current working directory.
Question 162. Which command can be used to search for a specific pattern within text files?
- grep
- mkdir
- chmod
- uname
Correct Answer: 1. grep
Explanation:
The grep command is used to search text for lines that match a specified pattern. It is one of the most frequently used Linux utilities for working with configuration files, logs, scripts, and command output. For example, grep error logfile.txt searches for lines containing the word “error.” Options can modify its behavior, such as -i for case-insensitive matching and -r for recursive searches. mkdir creates directories, chmod modifies file permissions, and uname displays system information. Because grep is designed specifically for pattern matching and text searching, it is the appropriate command when an administrator needs to locate particular information within text.
Question 163. Which file traditionally contains local user account information in Linux?
- /etc/hosts
- /etc/group
- /etc/passwd
- /etc/fstab
Correct Answer: 3. /etc/passwd
Explanation:
The /etc/passwd file traditionally contains information about local user accounts. Each entry generally includes the username, a placeholder for password information on systems using shadow passwords, user ID, group ID, comment or descriptive field, home directory, and login shell. Modern Linux systems normally store password hashes separately in /etc/shadow to provide better security. /etc/group contains group definitions, /etc/hosts provides local hostname-to-address mappings, and /etc/fstab defines filesystems that can be mounted. Understanding these files is important for Linux administration because user identity, groups, authentication, and filesystem configuration are common administrative tasks covered by the LPI 101-500 objectives.
Question 164. Which command changes the permissions associated with a file?
- chown
- chmod
- passwd
- umask
Correct Answer: 2. chmod
Explanation:
The chmod command changes the permission bits associated with files and directories. Linux permissions determine whether the owner, group, and other users can read, write, or execute an object. Permissions can be specified symbolically, such as chmod u+x script.sh, or numerically, such as chmod 755 script.sh. The chown command changes ownership, while passwd changes a user’s password. umask controls the default permissions removed when new files and directories are created; it does not directly change the permissions of an existing file. Therefore, chmod is the appropriate command for modifying existing file or directory permissions.
Question 165. Which command displays currently running processes in a dynamic, continuously updating view?
- ps
- jobs
- top
- kill
Correct Answer: 3. top
Explanation:
The top command provides a dynamic real-time view of running processes and system resource usage. It commonly displays process IDs, users, CPU utilization, memory utilization, process states, and other information. The display is periodically refreshed, allowing administrators to observe processes consuming significant resources. The ps command provides a snapshot of processes at the time it is executed, while jobs primarily shows jobs associated with the current shell. The kill command sends signals to processes rather than displaying them. Consequently, top is particularly useful when troubleshooting performance problems or identifying processes that are consuming excessive CPU or memory.
Question 166. Which command is commonly used to terminate a process by sending it a signal?
- kill
- sleep
- wait
- nice
Correct Answer: 1. kill
Explanation:
The kill command sends a signal to a process identified by its process ID. Despite its name, it is not limited to terminating processes; different signals can request various actions. For example, kill -TERM PID sends a termination request, while kill -KILL PID sends a signal that cannot normally be caught or ignored. Administrators should generally use a graceful termination signal before resorting to SIGKILL. The sleep command pauses execution, wait waits for background processes, and nice starts a process with a specified scheduling priority. Understanding signals and process control is an important part of Linux system administration.
Question 167. Which command displays the amount of free and used memory in a human-readable format?
- df -h
- free -h
- du -h
- meminfo
Correct Answer: 2. free -h
Explanation:
The free command displays information about physical memory and swap usage. Using the -h option makes the values human-readable, typically presenting sizes using units such as MiB or GiB. This can help administrators quickly determine how much memory is available and how much is being used. df -h instead reports filesystem disk-space usage, while du -h estimates the disk space used by files and directories. meminfo is not the standard command for this task; detailed memory information can instead be examined through /proc/meminfo. Therefore, free -h is the most appropriate command for viewing memory usage in a readable format.
Question 168. Which command is commonly used to create a compressed gzip archive from a tar archive?
- tar -czf
- tar -xzf
- gzip -d
- zip -r
Correct Answer: 1. tar -czf
Explanation:
The tar -czf command creates a tar archive and compresses it using gzip. The c option creates a new archive, z enables gzip compression, and f specifies the archive filename. For example, tar -czf backup.tar.gz directory/ creates a compressed archive containing the specified directory. In contrast, tar -xzf is commonly used to extract a gzip-compressed tar archive. gzip -d decompresses gzip data, while zip -r creates a ZIP archive rather than a tar.gz archive. Understanding archive creation and extraction is important because Linux administrators frequently use these operations for backups, software distribution, and transferring groups of files.
Question 169. Which command is used to create a new directory?
- touch
- mkdir
- rmdir
- mkfile
Correct Answer: 2. mkdir
Explanation:
The mkdir command creates new directories in Linux. For example, mkdir projects creates a directory named projects in the current working directory. The -p option can create parent directories when they do not already exist, such as mkdir -p /home/user/projects/linux. The touch command is commonly used to create an empty file or update timestamps, while rmdir removes empty directories. mkfile is not a standard Linux command for creating directories. Administrators frequently use mkdir when organizing files, creating application directories, preparing mount points, or establishing directory structures for users and services.
Question 170. Which filesystem is commonly associated with modern Linux installations and supports journaling?
- FAT16
- ext4
- ISO9660
- swap
Correct Answer: 2. ext4
Explanation:
ext4 is a widely used Linux filesystem that supports journaling and provides features such as large filesystem support, extents, delayed allocation, and improved reliability compared with earlier ext filesystems. Journaling helps reduce filesystem recovery time after certain unexpected shutdowns by recording filesystem metadata changes in a journal. FAT16 is an older filesystem with significant limitations, ISO9660 is primarily associated with optical media, and swap is used as virtual memory space rather than a general-purpose filesystem for storing ordinary files. Linux distributions can support many filesystem types, but ext4 remains an important filesystem that administrators should understand for LPI-related tasks involving storage and filesystem management.
Question 171. Which command displays the amount of available and used disk space on mounted filesystems?
- du
- lsblk
- df
- mount
Correct Answer: 3. df
Explanation:
The df command reports filesystem disk-space usage for mounted filesystems. It commonly displays total space, used space, available space, usage percentage, and the filesystem or mount point. The -h option makes the output easier to read by using human-readable units. The du command instead estimates the space consumed by specific files and directories. lsblk displays information about block devices, while mount can display or manage mounted filesystems. Administrators often use df -h when investigating disk-space problems because it quickly identifies filesystems that are approaching capacity.
Question 172. Which command changes the owner of a file or directory?
- chmod
- chgrp
- chown
- usermod
Correct Answer: 3. chown
Explanation:
The chown command changes the ownership of a file or directory. It can be used to change the user owner and, when specified appropriately, the group owner as well. For example, chown alice file.txt changes the file’s user ownership to Alice, while chown alice:developers file.txt changes both the user and group ownership. chmod changes permission bits, and chgrp specifically changes group ownership. usermod modifies attributes of a user account rather than directly changing file ownership. Proper ownership configuration is important because Linux access control relies on the relationship between users, groups, and permission settings.
Question 173. Which command can be used to display the path of an executable found through the user’s PATH?
- which
- where
- locate
- findpath
Correct Answer: 1. which
Explanation:
The which command can identify the executable that would be invoked when a command is entered, based on the directories listed in the user’s PATH environment variable. For example, which bash may return a path such as /usr/bin/bash. This can be useful when multiple versions of a program exist or when troubleshooting command-resolution problems. locate searches an indexed database of filesystem names, while find can perform more flexible filesystem searches. where and findpath are not standard replacements for which in typical Linux environments. Therefore, which is the appropriate command for checking the executable resolved through PATH.
Question 174. Which environment variable determines the directories searched for executable commands?
- HOME
- SHELL
- PATH
- USER
Correct Answer: 3. PATH
Explanation:
The PATH environment variable contains a colon-separated list of directories that the shell searches when the user enters a command without specifying its full path. For example, a PATH might contain /usr/local/bin:/usr/bin:/bin. When a command such as ls is entered, the shell searches these directories according to their order. HOME identifies the user’s home directory, SHELL commonly identifies the user’s default shell, and USER commonly identifies the current username. Understanding PATH is important because incorrectly configured PATH values can cause commands to fail or can result in an unexpected executable being selected.
Question 175. Which command is commonly used to display the current kernel and system information?
- uname
- hostnamectl
- sysinfo
- kernel
Correct Answer: 1. uname
Explanation:
The uname command displays information about the running system and kernel. Common options include -s for the kernel name, -r for the kernel release, -m for the machine hardware name, and -a for a broader collection of system information. For example, uname -r can be useful when determining the currently running kernel version. hostnamectl can also provide system and hostname information on systems using systemd, but it serves a broader system-management purpose. sysinfo and kernel are not standard commands for this task. Therefore, uname is the expected command for basic kernel and system identification.
Question 176. Which command is commonly used to create a symbolic link?
- ln -s
- link -p
- cp -l
- symlink
Correct Answer: 1. ln -s
Explanation:
The ln -s command creates a symbolic link, which is a filesystem object that points to another file or directory. For example, ln -s /opt/application/current app creates a symbolic link named app that points to the specified target. Symbolic links are useful for providing alternate paths, managing application versions, and simplifying access to frequently used locations. Without the -s option, ln normally creates a hard link instead. cp -l is not the standard method for creating symbolic links, and symlink is not a normal shell command. Understanding symbolic and hard links is an important Linux filesystem concept.
Question 177. Which command can be used to identify the type of data contained in a file?
- type
- file
- identify
- kind
Correct Answer: 2. file
Explanation:
The file command examines the contents of a file and attempts to determine its type. It can identify many types of data, including text files, executable binaries, scripts, archives, images, and other formats. This is useful when a filename does not have a meaningful extension or when an administrator needs to determine whether a file is binary or textual. The shell type command serves a different purpose: it identifies how a command name is interpreted by the shell. identify is commonly associated with image-processing utilities rather than general file-type detection, and kind is not a standard Linux command. Therefore, file is correct.
Question 178. Which command is commonly used to display the first lines of a text file?
- tail
- head
- top
- begin
Correct Answer: 2. head
Explanation:
The head command displays the beginning portion of a file or input stream. By default, it commonly displays the first ten lines, although the number can be changed using options such as -n. For example, head -n 20 logfile.txt displays the first twenty lines. The tail command performs the opposite operation by displaying the end of a file and is frequently used with the -f option to monitor growing log files. top displays running processes, while begin is not a standard Linux command. Therefore, head is the appropriate utility when an administrator needs to inspect the beginning of a text file.
Question 179. Which command is commonly used to display the last lines of a text file?
- tail
- head
- end
- lastlines
Correct Answer: 1. tail
Explanation:
The tail command displays the end of a file or input stream. By default, it commonly shows the last ten lines, but administrators can specify another number with options such as -n. One particularly useful feature is tail -f, which continuously displays newly appended data and is frequently used to monitor log files while a service is running. The head command instead displays the beginning of a file. end and lastlines are not standard Linux commands for this purpose. Consequently, tail is the appropriate utility for examining the final portion of a text file or following changes to an active log.
Question 180. Which command can be used to display the manual page for a Linux command?
- help
- info
- man
- docs
Correct Answer: 3. man
Explanation:
The man command provides access to Linux manual pages, which document commands, system calls, library functions, configuration files, and other system interfaces. For example, man chmod opens the manual page describing the chmod command. Manual pages are organized into numbered sections, allowing users to distinguish between similarly named topics. The help command is primarily associated with shell built-ins, while info provides GNU Info documentation where available. docs is not a standard command for accessing Linux manual pages. Learning to use man effectively is important for Linux administrators because it provides detailed information about command syntax, options, behavior, and related references.