LPI 101-500 Practice Test Questions and Exam Dumps Part 8 Q141-160

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

 

Question: 141. Which command displays the current working directory?

  1. pwd
    2. where
    3. currentdir
    4. cwd

Correct Answer: 1. pwd

Explanation:
The pwd command prints the pathname of the current working directory. It is useful when a user needs to determine exactly where they are within the filesystem hierarchy, particularly when working with relative paths. The output normally represents the directory from which subsequent relative path operations are interpreted. Although some shells provide other mechanisms for accessing the current directory, pwd is the standard command used for this purpose. The commands where, currentdir, and cwd are not standard Linux commands that provide the same function. Knowing the current directory helps prevent mistakes when manipulating files.

Question: 142. Which command changes the current working directory?

  1. move
    2. cd
    3. chdirfile
    4. directory

Correct Answer: 2. cd

Explanation:
The cd command changes the current working directory of the shell. For example, cd /var/log moves the shell into the /var/log directory, while cd .. moves to the parent directory. Because cd changes the state of the current shell, it is normally implemented as a shell builtin rather than as an ordinary external program. This distinction matters because an external program could not directly change the parent shell’s working directory. Understanding cd, absolute paths, and relative paths is fundamental to navigating the Linux filesystem from the command line.

Question: 143. Which symbol represents the root directory in a Linux filesystem?

  1. ~
    2. .
    3. /
    4. #

Correct Answer: 3. /

Explanation:
The forward slash / represents the root directory of a Linux filesystem hierarchy. It is the starting point from which absolute paths are constructed. For example, /etc/hosts identifies a specific location beginning at the root directory. This should not be confused with ~, which commonly represents the current user’s home directory, or ., which represents the current directory in a relative path. The root directory is also distinct from the root user account. Understanding these path symbols is essential for correctly navigating and referencing files in Linux.

Question: 144. Which notation refers to the current directory in a relative pathname?

  1. ..
    2. /
    3. ~
    4. .

Correct Answer: 4. .

Explanation:
The single dot . represents the current directory in Linux pathname notation. It is commonly used when specifying a relative path or when explicitly referring to the directory in which a command is being executed. For example, ./script.sh attempts to execute a script located in the current directory. The double dot .. refers to the parent directory, / represents the root directory, and ~ commonly expands to the current user’s home directory. Understanding these special path components allows users to construct accurate relative and absolute paths.

Question: 145. Which command creates a new directory?

  1. newdir
    2. mkdir
    3. makedir
    4. createdir

Correct Answer: 2. mkdir

Explanation:
The mkdir command creates one or more directories. For example, mkdir projects creates a directory named projects in the current working directory. The command can also accept options such as -p, which allows intermediate parent directories to be created when necessary. Appropriate permissions are required for the location where the directory is being created. The commands newdir, makedir, and createdir are not standard Linux utilities for this operation. Directory creation is a basic filesystem-management task and is frequently used when organizing files and application data.

Question: 146. Which command removes an empty directory?

  1. rmdir
    2. removedir
    3. deldir
    4. erase

Correct Answer: 1. rmdir

Explanation:
The rmdir command removes directories that are empty. It is useful when cleaning up directory structures after their contents have already been removed or moved elsewhere. If a directory contains files or subdirectories, rmdir normally refuses to remove it. The rm command, with appropriate options, can remove directories and their contents, but it should be used carefully because recursive removal can permanently delete substantial amounts of data. Commands such as removedir, deldir, and erase are not standard Linux commands for removing an empty directory.

Question: 147. Which command copies files or directories from one location to another?

  1. move
    2. duplicate
    3. cp
    4. copyfile

Correct Answer: 3. cp

Explanation:
The cp command copies files and, with appropriate options, directories. For example, cp source.txt backup.txt creates a copy of source.txt under the new name backup.txt. Recursive options such as -r or -R can be used when copying directory trees, depending on the required behavior and implementation. Unlike mv, copying leaves the original object in place. This distinction is important when creating backups or duplicating files. The commands move, duplicate, and copyfile are not standard replacements for the Linux cp utility.

Question: 148. Which command moves a file or directory to another location or renames it?

  1. mv
    2. renamefile
    3. shift
    4. transfer

Correct Answer: 1. mv

Explanation:
The mv command moves files and directories and can also be used to rename them. For example, mv old.txt new.txt changes the name of a file, while mv report.txt /tmp/ moves it into another directory. When the source and destination are on the same filesystem, a move can often be accomplished by changing directory-entry information rather than copying the entire file contents. Unlike cp, mv normally does not leave the original pathname pointing to the same file after a successful move. Care is needed when the destination already exists.

Question: 149. Which command removes a file from the filesystem?

  1. deletefile
    2. rm
    3. erasefile
    4. remove-file

Correct Answer: 2. rm

Explanation:
The rm command removes files and, with suitable options, can remove directories and their contents. For example, rm example.txt removes the specified file if the user has the required permissions. Unlike desktop environments with a recycle bin, standard rm does not normally provide an automatic recovery mechanism, so users should verify paths carefully before executing destructive commands. Recursive removal should be used with particular caution. The commands deletefile, erasefile, and remove-file are not standard Linux commands. Safe use of rm is an important basic administration skill.

Question: 150. Which command displays the contents of a text file directly in the terminal?

  1. show
    2. readfile
    3. cat
    4. viewfile

Correct Answer: 3. cat

Explanation:
The cat command reads files and writes their contents to standard output. It is commonly used for displaying short text files, combining multiple files, or feeding file contents into another command through a pipeline or redirection. For example, cat notes.txt prints the contents of notes.txt to the terminal. For large files, an interactive pager such as less is usually more convenient because it allows navigation without flooding the terminal. The commands show, readfile, and viewfile are not standard Linux replacements for cat.

Question: 151. Which command changes the permissions of a file using symbolic or numeric notation?

  1. chmod
    2. access
    3. perm
    4. setaccess

Correct Answer: 1. chmod

Explanation:
The chmod command changes the permission bits associated with files and directories. It supports symbolic notation such as u+x and numeric notation such as 644 or 755. These permissions control read, write, and execute access for the owner, group, and other users. For example, chmod 755 script.sh commonly gives the owner full permissions while allowing group and other users to read and execute the file. chmod does not change the file’s owner or group; those tasks are handled by ownership-related commands such as chown and chgrp.

Question: 152. Which permission allows the owner of a regular file to read its contents?

  1. Execute permission
    2. Write permission
    3. Read permission
    4. Search permission

Correct Answer: 3. Read permission

Explanation:
Read permission allows a user to read the contents of a regular file. In symbolic permissions, read is represented by r. For example, a permission string containing r– in the owner’s permission position indicates that the owner has read access but does not have write or execute permission. Write permission controls modification of file contents, while execute permission controls whether a regular file can be executed as a program or script when other requirements are satisfied. Directory permissions have somewhat different practical meanings, so file and directory access should not be treated as identical.

Question: 153. What does the numeric permission value 7 represent for a file owner?

  1. Read and write only
    2. Read, write, and execute
    3. Execute only
    4. Write and execute only

Correct Answer: 2. Read, write, and execute

Explanation:
In numeric Unix permissions, the value 7 represents the combination of read, write, and execute permissions. The values are calculated using bit values: read is 4, write is 2, and execute is 1. Therefore, 4 + 2 + 1 = 7. A permission such as 700 gives the owner read, write, and execute permissions while giving no permissions to the group or other users. Understanding these numeric values makes it easier to interpret and modify traditional Unix permission settings using chmod.

Question: 154. Which command changes the owner of a file?

  1. chown
    2. ownerchange
    3. setowner
    4. own

Correct Answer: 1. chown

Explanation:
The chown command changes the user ownership of files and directories and can also specify group ownership. For example, an administrator can use chown alice document.txt to change the owner to alice, subject to the system’s permission rules. It can also be used in forms such as chown alice:developers document.txt to specify both owner and group. This command should be distinguished from chmod, which changes permission bits, and chgrp, which focuses specifically on group ownership. Ownership and permissions work together to determine access to filesystem objects.

Question: 155. Which command displays a manual page containing documentation for a Linux command?

  1. helpdoc
    2. manual
    3. man
    4. docs

Correct Answer: 3. man

Explanation:
The man command displays manual pages containing documentation for commands, system calls, configuration files, and other system components. For example, man ls opens the manual page for ls. Manual pages are organized into numbered sections, and the man system provides a standardized source of local documentation on many Linux systems. Users can search within a manual page using the pager’s search functionality and can exit with the appropriate pager command. Although individual commands may also provide –help output, man provides more structured and detailed documentation.

Question: 156. Which command displays the username associated with the current effective user identity?

  1. user
    2. whoami
    3. currentuser
    4. loginname

Correct Answer: 2. whoami

Explanation:
The whoami command prints the username associated with the current effective user ID. It is useful when working in environments where a user may have changed identities or when verifying which account is currently being used for command execution. This differs from commands such as who, which displays information about logged-in sessions, and id, which provides broader user and group identity information. whoami is especially useful in scripts and administrative sessions when the effective identity needs to be confirmed before performing operations that depend on permissions.

Question: 157. Which command displays information about currently running processes?

  1. procshow
    2. processes
    3. ps
    4. running

Correct Answer: 3. ps

Explanation:
The ps command displays information about processes running on the system. Depending on the options used, it can show process IDs, terminal associations, CPU or memory information, parent processes, command names, and other details. For example, different ps option combinations can provide information about processes belonging to the current shell or processes running across the system. Unlike top, which provides a continuously updating interactive view, ps normally produces a snapshot of process information. This makes it useful in scripts and one-time process investigations.

Question: 158. Which command sends a signal to a process identified by its process ID?

  1. kill
    2. stopprocess
    3. terminate
    4. signalpid

Correct Answer: 1. kill

Explanation:
The kill command sends a specified signal to one or more processes identified by process ID. Despite its name, it is not limited to terminating processes. For example, kill -TERM 1234 sends the SIGTERM signal to process 1234, while other signals can be specified when appropriate. The default signal behavior depends on the implementation and command usage. Users need appropriate permissions to signal processes belonging to other users. The command should be used carefully because certain signals can immediately terminate processes without giving applications an opportunity to perform normal cleanup.

Question: 159. Which command changes a process’s scheduling priority after the process is already running?

  1. nice
    2. renice
    3. priority
    4. setnice

Correct Answer: 2. renice

Explanation:
The renice command changes the nice value of an already running process. The nice value influences CPU scheduling priority, allowing administrators to adjust how aggressively a process competes for processor time. This differs from nice, which is normally used when starting a new command with an adjusted nice value. Permissions affect which priority changes a user is allowed to make, especially when attempting to give a process greater CPU priority. renice can operate on process IDs and, depending on the implementation, may also support other selection methods such as process groups or users.

Question: 160. Which environment variable commonly identifies the shell or command interpreter being used for the user’s login environment?

  1. $TERM
    2. $PATH
    3. $SHELL
    4. $LOGIN

Correct Answer: 3. $SHELL

Explanation:
The SHELL environment variable commonly contains the pathname of the user’s preferred or configured command shell, such as /bin/bash or another shell. It is useful when scripts or users need to identify the shell associated with the environment. $PATH instead specifies directories searched for executable commands, $TERM identifies the terminal type, and $LOGIN is not the standard environment variable used for this purpose. The value of $SHELL should not always be interpreted as proof of the exact shell currently executing every command, because processes can invoke other interpreters independently.