LPI 010-160 Linux Essentials Certificate Exam, version 1.6 Exam Dumps and Practice Test Questions Set 10 Q136-150

LPI 010-160 Linux Essentials Certificate Exam, version 1.6 Exam Dumps and Practice Test Questions Set 10 Q136-150

Visit here for our full LPI 010-160 exam dumps and practice test questions.

Question 135

Which of the following commands is used to check the current runlevel of a Linux system?

A) uptime
B) who
C) runlevel
D) systemctl

Answer: C) runlevel

Explanation

The runlevel command in Linux is a traditional and widely recognized tool used to identify the current runlevel of a system. A runlevel represents a specific mode of operation for the machine and determines which services, daemons, and processes are active at any given time. In older Linux distributions that relied on the System V init system, runlevels were central to how the operating system behaved during startup, shutdown, and normal operation. Although many modern Linux distributions now use systemd instead of SysV init, the concept of runlevels remains important for understanding legacy systems and for interpreting certain compatibility commands.

When the runlevel command is executed, it displays two values. The first value indicates the previous runlevel, meaning the runlevel the system was in before the most recent transition such as a reboot, shutdown, or mode change. The second value represents the current runlevel the system is operating in at that moment. If the system has just been started and there is no previous runlevel to reference, the runlevel command often displays the letter N in place of a previous value. For example, an output such as:

N 5

indicates that the system has freshly booted and is now running in runlevel 5. Runlevel 5 is traditionally associated with multi-user mode with full networking capabilities and a graphical interface such as X11 or a desktop environment. Different distributions may assign slightly different meanings to runlevels, but the standard mapping of runlevels has been widely adopted across most Unix-like systems.

In classic SysV init systems, the runlevels generally range from 0 to 6. Each number corresponds to a specific state of the system. Runlevel 0 is used to halt the system, meaning the computer shuts down completely. Runlevel 1 starts the system in single-user mode, normally used for maintenance tasks or troubleshooting. In this mode, networking is disabled, and only the root user is allowed to log in, making it a safe environment to perform repairs or configuration changes without interference.

Runlevel 2 typically represents multi-user mode without networking. It allows multiple users to log in simultaneously through local terminals but does not activate network-related services. Runlevel 3 enhances this by enabling full networking while maintaining a non-graphical environment. It is useful for servers or systems that do not require a graphical interface. Runlevel 4 is seldom used in most distributions and is often left empty or customizable by system administrators for special purposes. Runlevel 5, as mentioned earlier, is multi-user mode with networking and a graphical interface. Finally, runlevel 6 instructs the system to reboot, causing the machine to shut down all processes and then restart automatically.

The runlevel command provides a simple but effective way to determine which of these states the system is currently using. This information is helpful for administrators who need to diagnose issues, confirm system behavior, or ensure that particular services are running as expected. For example, if a system is unexpectedly in runlevel 3 instead of runlevel 5, a graphical interface may not start, prompting further investigation.

In the context of multiple-choice questions, it is important to distinguish the runlevel command from other Linux commands that may seem similar but serve different functions. Option A, uptime, displays how long the system has been running since the last boot. It also provides additional details such as system load averages and the number of active users. However, uptime does not reveal anything about the system’s current runlevel or service state.

Option B, who, displays information about users who are currently logged into the system. It shows each active user session, including which terminal they are connected from and their login time. Although who is useful for monitoring user activity or identifying remote sessions, it offers no insight into the system’s operational mode or runlevel.

Option D, systemctl, is a command used in systemd-based Linux distributions to manage services, system units, and overall boot behavior. While systemctl can perform tasks like rebooting the system, switching targets, or checking service statuses, it does not directly display the traditional SysV runlevel. In systemd environments, the equivalent concept is known as targets, such as graphical.target or multi-user.target. Although there are compatibility mappings between runlevels and systemd targets, systemctl itself does not provide runlevel information in the way the runlevel command does.

Therefore, among the choices provided, the runlevel command is the correct and most appropriate tool for determining the current runlevel of a Linux system. It provides a clear and direct view of the system’s present mode of operation, as well as the previous runlevel, making it invaluable in diagnostics, system monitoring, and administration across traditional Linux environments.

Question 136

Which directory in Linux contains system-wide configuration files for programs?

A) /etc
B) /bin
C) /usr
D) /var

Answer: A) /etc

Explanation

The /etc directory in Linux contains system-wide configuration files for programs and services. These configuration files are used by the operating system and applications to store settings that determine how the system and its services behave.

Some key files and directories you may find in /etc include:

/etc/passwd: Contains user account information, such as usernames, UIDs, and GIDs.

/etc/fstab: Defines the file systems that should be mounted at boot time.

/etc/network/interfaces: Configures network interfaces.

/etc/hostname: Stores the hostname of the system.

/etc/sudoers: Contains rules for granting superuser (root) privileges to specific users or groups.

/etc/apt/sources.list: Lists the package repositories for Debian-based systems like Ubuntu.

These configuration files control various system and application settings, such as user preferences, network settings, package manager configurations, and more. Modifying these files typically requires administrative (root) permissions.

Option B, /bin, contains essential binary executables required to boot the system and troubleshoot or repair it. These are critical programs necessary for system startup and single-user mode, such as ls, cp, and mkdir. However, it does not contain configuration files.

Option C, /usr, contains user-related programs and data. It holds non-essential system files, libraries, and user binaries that are not critical for the basic operation of the system. For example, /usr/bin contains most of the user command binaries, but /usr is not used for system-wide configuration files.

Option D, /var, contains variable data files, such as logs, databases, and application cache files. It holds data that changes over time, including system logs in /var/log and mail spools in /var/spool. While it plays an essential role in system operation, it does not contain configuration files.

Thus, the correct directory for system-wide configuration files is /etc.

Question 137

What is the purpose of the chmod command in Linux?

A) To change file ownership
B) To change file permissions
C) To create a file

D) To move files

Answer: B) To change file permissions

Explanation

The chmod command in Linux is used to change file permissions. File permissions control who can read, write, or execute a file, and the chmod command allows you to modify these permissions for the file’s owner, group, and others.

File permissions are represented using three categories:

Owner: The user who owns the file.

Group: The group associated with the file.

Others: Everyone else who has access to the file.

Each category has three types of permissions:

Read (r): Allows viewing the contents of the file.

Write (w): Allows modifying the contents of the file.

Execute (x): Allows executing the file if it is a program or script.

Permissions can be set using symbolic or numeric modes:

Symbolic mode: Uses letters to represent permissions. For example, chmod u+x myfile.txt adds execute permission to the owner (u stands for user/owner).

Numeric mode: Uses numbers to represent permissions. Each permission type is assigned a number: read = 4, write = 2, and execute = 1. The sum of these numbers determines the permissions for each category. For example, chmod 755 myfile.txt gives the owner read, write, and execute permissions (7), while the group and others get read and execute permissions (5).

Option A, chown, is used to change file ownership, including the owner and the group associated with a file. While chown is related to managing file ownership, it does not modify the file’s permissions.

Option C, touch, is used to create a new empty file or update the timestamp of an existing file. It does not affect file permissions.

Option D, mv, is used to move or rename files. It does not modify file permissions.

Thus, the correct answer is chmod, as it is specifically used to change the file permissions in Linux.

Question 138

Which of the following commands is used to display the disk usage of files and directories in Linux?

A) ls
B) du
C) df
D) mount

Answer: B) du

Explanation

The du command in Linux, which stands for disk usage, is one of the most commonly used utilities for analyzing how much disk space is consumed by files and directories on a system. System administrators, developers, and even regular users rely on du when they need to understand storage consumption, identify large files or folders, or monitor how disk space is being used over time. The command works by reading directory structures and calculating the total amount of space taken up on disk by the files they contain. This includes not only the files directly inside the directory, but also those in subdirectories unless specific options are used to alter the behavior.

By default, when the du command is executed without any additional options, it displays the disk usage for the current directory as well as its subdirectories, with the output typically shown in 1K block units. This gives a detailed, hierarchical view of disk usage. For example, running du inside a directory might produce lines such as:

4 ./subdir1
8 ./subdir2
12 .

In this simple output, du shows that subdir1 consumes 4 kilobytes of disk space, subdir2 consumes 8 kilobytes, and the current directory as a whole uses a total of 12 kilobytes, including everything inside it. While this type of output can be informative, it may appear overwhelming or less readable when dealing with large directory structures containing many files and nested folders.

To address this, the du command provides a number of options that allow users to customize the output depending on their needs. One of the most frequently used options is -h, which stands for human-readable. When du is used with the -h flag, it displays file and directory sizes in units that are easier for humans to interpret, such as kilobytes (K), megabytes (M), or gigabytes (G), instead of raw block counts. This helps users quickly identify which locations are consuming significant disk space. For example, running du -h in a directory might produce output such as:

4.0K ./subdir1
8.0K ./subdir2
12K .

Another commonly used option is -s, which stands for summarize. When du is executed with -s, it provides only a single-line summary of the total disk usage of the specified directory, rather than listing the usage of every subdirectory. This is particularly useful when the user only cares about the total size of a directory and does not need detailed information about each part of it. For example, running du -s /home/user gives a concise summary of how much disk space the entire directory occupies.

The -a option expands the scope of the command even further. By default, du reports disk usage for directories, not individual files. However, when the -a option is included, du displays disk usage for every file and directory within the specified path. This is useful when a user wants to locate specific files that are taking up large amounts of disk space. It can serve as an alternative to running find commands or other utilities for file-level analysis.

For example, a user might run:

du -ah

This would show all files and directories in human-readable format, allowing them to quickly scan for large files in the system.

While du is the correct command for analyzing disk usage at the file and directory level, it is sometimes confused with other Linux commands, especially by beginners. For instance, option A in the multiple-choice context, ls, is used primarily for listing directory contents. Although ls can show file sizes when used with long listing options such as -l or -lh, it does not calculate or summarize the total disk usage of directories or recursive structures. It simply displays the size attribute of each file without assessing how storage is truly consumed on the disk.

Similarly, option C, the df command, serves a different purpose entirely. df stands for disk free, and it reports the overall disk space available and used on mounted file systems. While df gives a broad overview at the filesystem level, it does not break down usage per file or directory. This means df is useful for monitoring how much free space remains on the disk as a whole, but it does not help identify where that space is being consumed within directory structures.

Option D, mount, is another command unrelated to determining disk usage. The mount command is used to attach file systems to specific locations in the filesystem hierarchy, making them accessible to the system and users. Although mount can display information about currently mounted file systems, it provides no insight into the disk usage of individual files or directories within those mounted points.

Given these comparisons, du is clearly the correct command for analyzing disk usage in Linux. It offers flexibility, detail, and user-friendly options that make it a powerful tool for managing storage. Whether someone needs a quick summary, a complete breakdown, or a human-readable view of disk consumption, the du command is specifically designed to handle these tasks efficiently and reliably.

Question 139

Which directory in Linux typically contains user data, such as documents, images, and other personal files?

A) /etc
B) /usr
C) /home
D) /var

Answer: C) /home

Explanation

The /home directory in Linux typically contains user data, including documents, images, and other personal files. It is the default location for user home directories, where each user has their own subdirectory (e.g., /home/alice for the user alice). These subdirectories are where users store their personal files, settings, and configurations.

The /home directory is essential for multi-user systems because it ensures that each user has their own space for data and configurations, separate from system files. For example:

/home/alice: The home directory for the user alice, which contains files such as Documents, Downloads, Pictures, etc.

/home/bob: The home directory for the user bob, containing their personal files.

By organizing user data in /home, Linux ensures that user files are kept separate from system files, which are typically stored in other directories like /etc or /usr.

Option A, /etc, contains system configuration files, such as user account information, system settings, and service configurations. It does not contain user data like documents or images.

Option B, /usr, contains user-related programs and non-essential system files. This directory holds software that is not required for the system to boot but is essential for regular operation, such as applications, libraries, and system-wide executables. It does not contain personal user data.

Option D, /var, contains variable data, such as log files, email spools, and temporary files. It is used for data that changes frequently, like system logs in /var/log. While important for system operations, it does not store personal user data like /home does.

Thus, the correct answer is /home, as it is where user data is typically stored in Linux systems.

Question 140

Which of the following commands is used to display the amount of free and used memory on a Linux system?

A) top
B) free
C) ps
D) vmstat

Answer: B) free

Explanation

The free command in Linux is one of the most widely used tools for displaying memory usage information on a system. It is particularly useful for system administrators, developers, and anyone who needs to monitor system performance or diagnose issues related to insufficient memory. The command provides an overview of how much memory is currently in use, how much is available, and how much is being utilized for system buffers and caches. This allows users to quickly assess the memory status of the system without having to dig into more complex tools or manual examination of system logs.

When you run the free command without any options, the output typically appears in a table format that shows memory statistics for both physical RAM and swap space. An example of the output might look like this:

total        used        free      shared  buff/cache   available  

Mem: 16384 1024 15120 48 1240 15104
Swap: 8192 0 8192

This output is divided into clear columns, each representing specific aspects of memory usage. The total column displays the total amount of physical memory or swap space available on the system. This value does not change during operation unless the system undergoes hardware modifications, such as adding or removing memory modules.

The used column shows the amount of memory that is currently being used. However, it is important to understand that in Linux, memory management is designed to make efficient use of available resources. This means that memory classified as used may include data that is cached or buffered by the kernel to speed up system performance. These buffers and caches can usually be freed quickly if applications require the memory, so the used value alone does not always indicate that the system is low on memory.

The free column displays the amount of memory that is completely unused at the moment. However, this number is often misleading because Linux tries to minimize the amount of completely unused memory by using it for caching whenever possible. A more accurate measure of available memory is shown in the available column.

The shared column refers to memory that is being used by tmpfs, which is a temporary filesystem stored in memory. This includes files created in directories like /dev/shm. Although this value is usually small, it can grow depending on the applications running on the system.

The buff/cache column represents memory used by buffers and caches. Buffers are used by the kernel to store data temporarily when writing to or reading from disk, while caches store recently used data to improve system performance. The memory in buff/cache can be reclaimed quickly if the system needs additional RAM, so this value is not considered truly used in a restrictive sense.

The available column is one of the most important indicators for understanding real memory availability. It estimates how much memory is available for new applications without causing the system to start swapping. This value takes into account the memory used for cache and buffers that can be freed if needed. Thus, even if the used memory appears high, the available memory often reveals that the system still has enough resources to run new applications without performance degradation.

The free command also supports several useful options. One of the most commonly used options is -h, which stands for human-readable output. When you run free -h, the results are displayed in KB, MB, or GB depending on the size of the memory, making it much easier to understand compared to raw numbers in bytes.

While free is the most direct and simple command for displaying memory information, there are other commands that provide additional performance insights but are not primarily focused on memory. Option A, top, shows real-time system statistics including memory usage, CPU activity, and running processes. Although top does display memory information, its primary purpose is to give a dynamic overview of system activity.

Option C, ps, provides detailed information about active processes. It can show how much memory each individual process is using, but it does not summarize overall system memory usage.

Option D, vmstat, offers a broad view of system performance including memory, processes, and I/O statistics. It is helpful for performance tuning but is more complex than free.

Because free is specifically designed to provide a clear and concise summary of memory usage, it is the correct answer when asked which command displays the amount of free and used memory on a Linux system.

Question 141

Which of the following commands is used to show detailed information about a specific user account in Linux?

A) useradd
B) userdel
C) whois
D) finger

Answer: D) finger

Explanation

The finger command in Linux is a classic utility that provides detailed information about user accounts on a system. It is one of the older Unix tools that still exists on many Linux distributions, although it is not installed by default on all systems today. Despite its age, finger remains a convenient way to quickly gather information about a system user, especially when working in a multi-user environment where administrators need to know who is logged in, when they logged in, and what their basic profile details are. This makes finger particularly valuable for system administrators, help-desk technicians, and anyone who manages user activity on shared servers or remote machines.

When you run the finger command followed by a username, it produces a structured output that summarizes important information about that user. For example, running finger alice will show details such as:

Login: alice Name: Alice User
Directory: /home/alice Shell: /bin/bash
On since Thu Jun 9 14:30 (UTC) on pts/1 from 192.168.1.10
1 minute 13 seconds idle
No mail.
No Plan.

This type of output shows several key pieces of information. The login line displays the username associated with the account. Some systems also store the real name of the user in the system’s user database, typically found in the /etc/passwd file, and finger extracts and displays this information. The directory line shows the absolute path of the user’s home directory. This is the location where personal files, configuration files, and user-specific data are stored. The shell field tells you which command-line shell the user uses by default. This could be /bin/bash, /bin/sh, /bin/zsh, or another shell depending on the system and user preferences.

The output section that begins with “On since” provides valuable session data. It shows the last login time, the terminal used, and the originating IP address. This information is extremely useful when tracking user activity, diagnosing unauthorized logins, or simply understanding who is currently active on the system. Idle time is also displayed, indicating how long it has been since the user last interacted with the system. This can help administrators determine if a session is abandoned or still in use.

Another feature of finger is its ability to display information about a user’s email status. The line that says “No mail” means that the user does not have unread mail on the local system. This is more common on older Unix systems but still appears in output today. The line that says “No Plan” refers to the user’s .plan file, which is an optional file a user can create in their home directory to share notes, instructions, or announcements with others. While this feature is rarely used today, finger still checks for the existence of this file and displays its contents if present.

Option A, useradd, is not used for retrieving user information. Instead, it is specifically designed for creating new user accounts. Running useradd adds an entry to the system user database and optionally creates a home directory and configures related files. Because its purpose is account creation rather than information retrieval, it is not suitable for viewing detailed user data.

Option B, userdel, performs the opposite function of useradd. It removes a user account from the system. Depending on the options used, userdel can also remove the user’s home directory and mail files. This command requires caution, as improper use may result in accidental deletion of important user data. Like useradd, it does not display user information.

Option C, whois, serves an entirely different purpose. It is a command used to obtain registration information about internet domain names. For example, running whois example.com will show details such as the domain owner, administrative contacts, registrar information, registration dates, and name server listings. While extremely useful for internet research and network-related investigations, whois is not related to Linux user accounts and cannot provide any information about users on the local system.

Because finger is the only command among the options that retrieves detailed information about a system user, it is the correct answer. It remains a convenient and straightforward way to obtain insight into user account details, login activity, and basic profile information. Even though newer tools exist, finger continues to be helpful in many environments, especially where quick access to user information is needed without navigating multiple files or running complex commands.

Question 142

Which directory in Linux contains most of the system binaries (programs) that are essential for the system to boot?

A) /bin
B) /lib
C) /usr
D) /home

Answer: A) /bin

Explanation

The /bin directory in Linux contains essential system binaries (programs) that are necessary for the system to boot and run in single-user mode. These binaries are critical for basic system operation and include programs that are used to troubleshoot and repair the system, especially if the system is in a non-booting state.

The /bin directory typically includes essential command-line tools like:

ls: Used to list files and directories.

cp: Used to copy files.

mv: Used to move or rename files.

rm: Used to remove files.

bash: The default shell for many Linux systems.

These binaries are available to both system administrators and users, but the main difference is that the binaries in /bin are available during the early boot process (before mounting other file systems like /usr).

Option B, /lib, contains shared libraries that are needed by the binaries in /bin and /sbin to function. While /lib contains important system files, it is not directly responsible for holding the essential system programs needed to boot the system.

Option C, /usr, contains non-essential user binaries, libraries, and documentation. These programs are important for system functionality, but they are not critical for the initial boot process. Programs in /usr are typically installed after the system is up and running.

Option D, /home, is where user data and personal files are stored. It does not contain system binaries or programs that are needed for the system to boot.

Therefore, the correct answer is /bin, as it contains the essential system binaries that are necessary for the system to boot.

Question 143

Which command in Linux is used to display information about the system’s hardware and configuration?

A) uname
B) lshw
C) lsusb
D) top

Answer: B) lshw

Explanation

The lshw command, short for list hardware, is an important tool in Linux that is used to display extensive and detailed information about a system’s hardware components. It digs deep into the hardware layer and extracts highly specific details that can be extremely useful for system administrators, support engineers, hardware troubleshooters, and anyone who needs a full understanding of the physical configuration of a computer. Unlike basic commands that show only surface-level system information, lshw provides a complete snapshot of what hardware is present, how it is connected, and how the system identifies it internally.

When executed, the lshw command scans the hardware and returns data such as the CPU’s brand, speed, capabilities, and architecture. It can also display information about the installed memory, including total capacity, bank distribution, and memory type. For storage devices, the command lists details like disk models, sizes, partitions, logical volumes, and controllers. For network interfaces, it identifies each available network adapter, including its MAC address, supported link speeds, and driver information. Beyond these major components, lshw also provides information about the motherboard, BIOS version, PCI devices, USB controllers, and many other internal system details.

One of the powerful aspects of lshw is its flexibility. It allows output in multiple formats such as plain text for terminal display, HTML for graphical viewing in a web browser, and XML for automated processing and integration with scripts or system inventory tools. This makes lshw an adaptable tool that can be used in a range of scenarios, such as asset management, auditing hardware changes, diagnosing hardware-related issues, or documenting system configurations. A sample output section from lshw might look like this:

*-cpu  

   description: CPU  

   product: Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz  

   vendor: Intel Corp.  

   physical id: 4  

   bus info: cpu@0  

   version: Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz  

   slot: U3E1  

   size: 2700MHz  

   capacity: 2900MHz  

This output reveals a wealth of information about the CPU, including the processor model, vendor details, physical placement on the motherboard, clock speed, and maximum capacity. This level of detail is invaluable when diagnosing performance problems, verifying hardware compatibility, or preparing for upgrades. For instance, knowing a CPU’s maximum supported frequency can help determine whether the system is running efficiently or whether a specific workload is exceeding hardware capabilities.

It is important to differentiate lshw from other commonly used Linux commands that might appear similar but serve different purposes. One such command is uname, which provides basic information such as the kernel version, operating system name, system architecture (such as x86_64), and sometimes the hostname. While uname is useful for quickly identifying system-level characteristics, it does not report detailed hardware information. For example, uname cannot show the number of CPU cores, the exact memory size, or the specifications of storage components.

Another command often used for hardware-related checks is lsusb. As the name suggests, lsusb lists USB devices connected to the system. It provides information such as vendor IDs, device IDs, and basic descriptions of USB peripherals. Although lsusb is helpful for identifying external storage drives, printers, USB hubs, or input devices, it focuses exclusively on USB hardware. If someone needs an overview of internal system hardware beyond USB connections, lsusb is insufficient.

The top command is also widely used but serves an entirely different purpose. top shows real-time performance metrics, including CPU usage, memory usage, running processes, and system load averages. System administrators use top to diagnose performance bottlenecks or monitor resource consumption over time. However, top does not provide hardware descriptions or technical specifications of the system’s components. It deals with process and resource monitoring rather than hardware identification.

Considering all these tools, lshw stands out because it is explicitly designed for detailed hardware inspection. It is thorough, versatile, and capable of providing insights that cannot be obtained from commands focused on general system information, USB enumeration, or process monitoring. Because of its depth and level of detail, lshw is indispensable for tasks such as preparing hardware documentation, verifying component compatibility before installing new software, troubleshooting hardware failures, or managing multiple servers where an accurate inventory is required.

The lshw command is the correct tool when the goal is to obtain detailed hardware information about a Linux system. It offers a complete, organized, and highly informative view of CPUs, memory, storage devices, buses, network interfaces, and other hardware components. While commands like uname, lsusb, and top have their own valuable uses, none of them provide the level of hardware detail that lshw delivers. For administrators and users who require a deep understanding of their system’s physical configuration, lshw is the most suitable and comprehensive command available.

Question 144

Which of the following files is used by Linux to store information about disk partitions and their mount points?

A) /etc/fstab
B) /etc/passwd
C) /etc/hostname
D) /etc/group

Answer: A) /etc/fstab

Explanation

The /etc/fstab file in Linux is used to store information about disk partitions and their mount points. It is a configuration file that tells the system which filesystems to mount during boot and how to mount them. The fstab file contains a list of all the file systems, devices, and their mount options that the system should automatically mount during startup.

A typical entry in the /etc/fstab file looks like this:

/dev/sda1   /    ext4    defaults    1   1

/dev/sdb1   /home ext4    defaults    1   2

Each line describes a file system and contains six fields:

Device: The device or partition (e.g., /dev/sda1).

Mount Point: The location where the device should be mounted (e.g., /home).

File System Type: The type of file system (e.g., ext4).

Mount Options: Options for mounting the file system (e.g., defaults).

Dump: Used by the dump utility for backup purposes. Usually set to 1 or 0.

Pass: Used by the fsck utility to determine the order in which file systems should be checked during boot.

The /etc/fstab file is critical for setting up persistent storage in Linux, ensuring that your partitions are mounted automatically at boot time.

Option B, /etc/passwd, is a file that stores user account information, such as usernames, UIDs, and home directories. It does not deal with disk partitions or mount points.

Option C, /etc/hostname, contains the hostname of the system. This file does not provide any information about disk partitions or mount points.

Option D, /etc/group, contains information about user groups. It defines the groups to which users belong, but it does not include details about disk partitions or filesystems.

Thus, the correct answer is /etc/fstab, as it is the file specifically used to store information about disk partitions and mount points.

Question 145

Which command in Linux is used to display the current date and time?

A) time
B) date
C) clock
D) timer

Answer: B) date

Explanation

The date command in Linux is used to display the current date and time on the system. By default, date shows the current date and time in a format like this:

Tue Oct 26 14:12:45 UTC 2021

The date command can also be used to customize the output format using various format specifiers. For example:

date «+%Y-%m-%d %H:%M:%S» will output the date and time in the format 2021-10-26 14:12:45.

date «+%A, %B %d, %Y» will output the date in a more human-readable format like Tuesday, October 26, 2021.

You can also use the date command to set the system date and time if you’re logged in as the root user. For example, sudo date -s «2021-10-26 14:15:00» will set the system time to October 26, 2021, at 2:15 PM.

Option A, time, is used to measure the execution time of a command or program. It reports how long a program takes to execute, but it does not show the current system date or time.

Option C, clock, is an older command used on some systems to manage hardware clocks (the system’s real-time clock, RTC). It is not typically used to display the current date and time, although some systems might have a clock command for this purpose.

Option D, timer, is not a standard Linux command. While there are many tools for working with timers in Linux (e.g., using the sleep command to delay execution), timer itself is not a recognized command to display the current date or time.

Therefore, the correct answer is date, as it is the command specifically used to display the current date and time on a Linux system.

Question 146

What is the primary purpose of the chmod command in Linux?

A) To change the owner of a file
B) To change the permissions of a file
C) To delete a file
D) To move a file

Answer: B) To change the permissions of a file

Explanation

The primary purpose of the chmod (change mode) command in Linux is to change the permissions of a file or directory. Permissions determine who can read, write, or execute a file. The chmod command allows you to modify these permissions for the file’s owner, group, and others.

File permissions are represented as a combination of read (r), write (w), and execute (x) permissions. The chmod command modifies these permissions either through symbolic representation (e.g., u+x to add execute permission for the user) or numeric representation (e.g., chmod 755).

There are two primary ways to use chmod:

Symbolic mode: This method uses letters to represent the user category and the permission type. For example:

chmod u+x file.txt: Adds execute permission for the user.

chmod g-w file.txt: Removes write permission for the group.

Numeric mode: This method uses numbers to represent permissions. Each permission has a corresponding value:

Read = 4

Write = 2

Execute = 1
The sum of these numbers determines the permission for each category. For example:

chmod 755 file.txt: Grants the owner read, write, and execute permissions (7), and the group and others read and execute permissions (5).

Option A, changing the owner of a file, is done using the chown command, not chmod. chown is used to change the owner and/or group of a file.

Option C, deleting a file, is done using the rm command. The rm command is used to remove files or directories, but it does not affect the file permissions.

Option D, moving a file, is done using the mv command. The mv command is used to move or rename files but does not alter the file permissions.

Thus, the correct answer is chmod, as it is specifically used to change the permissions of a file or directory in Linux.