LPI 010-160 Linux Essentials Certificate Exam, version 1.6 Exam Dumps and Practice Test Questions Set2 Q21-40

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

Question 21

Which command can be used to display all currently running services on a Linux system?

A) ps
B) systemctl list-units –type=service
C) top
D) jobs

Answer: B) systemctl list-units –type=service

Explanation:

Linux uses services, often called daemons, to perform background tasks such as web servers, database servers, and system management tasks. Identifying which services are running is crucial for administrators to ensure system functionality, troubleshoot issues, and maintain security. The systemctl command is the primary tool for managing system services on Linux distributions that use systemd. The specific command systemctl list-units –type=service lists all active services, including their status, description, and unit file path. For example, output may include services like ssh.service or cron.service, indicating whether they are running, failed, or inactive. This allows administrators to quickly check critical system services and take appropriate actions, such as starting, stopping, or restarting a service.

A) ps – The ps command lists currently running processes, which include services, user processes, and other system programs. While you can filter service processes manually using grep, it does not provide a categorized list of services or their active status. ps outputs static snapshots of process information and is more useful for process-specific monitoring rather than service management.

B) systemctl list-units –type=service – Correct. This command provides a complete and structured view of services, their current state, and whether they are enabled or disabled on system boot. It is particularly helpful when managing system startup behavior and identifying failed services. Administrators often combine this with other systemctl commands such as systemctl status service_name to get detailed information about a specific service.

C) top – The top command shows a real-time view of running processes, CPU usage, memory usage, and other metrics. While it shows processes that may correspond to services, it does not provide a clear list of all services or their statuses. It is more suitable for performance monitoring rather than service management.

D) jobs – Lists background jobs for the current shell session, such as processes started using & or suspended with Ctrl+Z. It does not display system-wide services and is limited to the current terminal session.

Knowing how to identify running services is essential in Linux Essentials because it helps maintain system stability, troubleshoot failures, and ensure critical services are operational. The systemctl tool is central to service management on modern Linux distributions and forms the basis for understanding service behavior, dependencies, and startup configurations.

Question 22

Which command is used to display all groups a user belongs to?

A) groups
B) id
C) who
D) finger

Answer: A) groups

Explanation: 

In Linux, users can belong to multiple groups, which control access permissions to files, directories, and system resources. Understanding group membership is essential for managing permissions and ensuring secure access. The groups command outputs all groups a specified user belongs to, or if no user is specified, it displays the groups for the current user. For example, running groups alice might return alice : alice sudo developers, indicating that the user alice belongs to the alice primary group and the sudo and developers supplementary groups. This information is crucial when assigning access to shared directories or configuring permissions for applications.

A) groups – Correct. Directly displays the group memberships of a user. It is simple, efficient, and widely used for verifying access control. Administrators use it to ensure users have the appropriate permissions before modifying directories or files.

B) id – Displays detailed user information including user ID (UID), primary group ID (GID), and all group memberships. While it provides more detailed output than groups, it can be less concise for quickly checking which groups a user belongs to. Example: id alice shows UID, GID, and supplementary groups.

C) who – Displays users currently logged into the system along with login terminals and times. It does not provide information about the groups a user belongs to.

D) finger – Provides detailed user information including login name, home directory, shell, and sometimes last login time. While it gives some personal information about users, it does not list all groups a user is a member of.

Knowing group memberships helps in security auditing, file permission management, and ensuring users have appropriate access rights. Misconfigured group memberships can lead to unauthorized access or prevent users from performing necessary tasks. Using groups in combination with commands like chmod and chown allows administrators to effectively manage user permissions across the system.

Question 23

Which of the following commands is used to change a user’s password?

A) passwd
B) chpasswd
C) usermod
D) su

Answer: A) passwd

Explanation: 

In Linux, maintaining secure passwords is critical for system security and preventing unauthorized access. The passwd command allows users to change their own password or allows an administrator to change another user’s password if executed with root privileges. When invoked, it prompts for the current password (for normal users) and the new password, ensuring that users cannot set a password without verification. For example, running passwd alice as root changes the password for user alice. This command also integrates with PAM (Pluggable Authentication Modules) to enforce password policies like complexity, history, and expiration.

A) passwd – Correct. Primary command for changing passwords. It interacts with the shadow password file and enforces security policies, making it critical for system administration. Regular password updates are a security best practice to reduce the risk of account compromise.

B) chpasswd – Used in scripts to change multiple passwords at once. It reads username:password pairs from standard input. While powerful for bulk updates, it is not typically used interactively by end users.

C) usermod – Modifies user account settings such as home directories, shells, or group memberships, but does not directly change passwords.

D) su – Switches to another user account temporarily. While you can switch to root to then use passwd to change passwords, su itself does not modify passwords.

Understanding the difference between passwd, chpasswd, and usermod is essential for Linux Essentials. Password management is a core skill for both security and administration. The passwd command ensures users comply with system policies, protects accounts, and prevents unauthorized access. Administrators must understand its behavior and implications to maintain system integrity and enforce strong security practices.

Question 24 

Which command is used to search for files by name in a Linux filesystem?

A) grep
B) find
C) locate
D) which

Answer: B) find

Explanation:

Locating files is a common administrative task in Linux, whether to troubleshoot, edit configurations, or manage data. The find command allows users to search for files or directories by name, type, size, permissions, modification time, and more. It searches the filesystem recursively, starting from a specified directory. For example, find /home -name “*.txt” searches all .txt files under /home. The find command is extremely versatile and can perform actions on the matched files using -exec, such as find /tmp -type f -name “*.log” -exec rm {} \; to delete temporary log files.

A) grep – Searches for patterns inside files, not for file names themselves. For instance, grep “root” /etc/passwd searches for the text “root” inside the file. While powerful for text searching, it is not a file-finding tool.

B) find – Correct. Searches for files or directories based on a wide range of criteria, including name, type, size, owner, permissions, and modification time. It is essential for administration, scripting, and troubleshooting when file locations are unknown or dynamically created.

C) locate – Uses a pre-built database to quickly find files by name. It is faster than find but may be outdated if the database has not been updated recently. For example, locate file.txt searches for all matching filenames in the database.

D) which – Displays the full path of an executable in the user’s PATH environment variable, such as which python3. It does not search the general filesystem for arbitrary files.

Understanding the difference between find and locate is essential for Linux Essentials. While locate is faster due to its database approach, find provides more flexible and precise searches, including filtering by permissions, type, and timestamps. Mastery of find allows administrators to locate critical files, automate tasks, and troubleshoot filesystem issues effectively.

Question 25

Which command is used to display system memory usage?

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

Answer: B) free

Explanation: 

Memory management is an important aspect of Linux system administration. Understanding how much RAM is being used, how much is free, and how much swap space is available is crucial for performance monitoring and troubleshooting. The free command displays a summary of memory usage in kilobytes, megabytes, or gigabytes, depending on the options provided. For instance, free -h shows memory in human-readable format. Output includes total, used, free, shared, buffer/cache, and available memory, giving administrators a comprehensive overview of system memory.

A) df – Displays disk usage for mounted filesystems, not memory usage. It is essential for storage monitoring but unrelated to RAM.

B) free – Correct. Provides detailed memory usage, including physical memory, swap space, and buffers/cache. Understanding free helps diagnose performance issues such as high memory usage or swap exhaustion, which can slow down or destabilize the system.

C) top – Shows real-time CPU and memory usage for processes. While it provides memory usage dynamically, it does not provide a quick summary like free. It is more suitable for ongoing monitoring rather than an instant snapshot.

D) vmstat – Displays memory and process statistics in real-time, including CPU, swap, and paging. While useful for performance analysis, it is more detailed and complex than free for beginners.

Knowing how to interpret memory usage is critical for Linux Essentials. Administrators use free to verify available resources before starting applications, plan capacity, or identify potential memory leaks. It is often combined with top or vmstat for dynamic monitoring and troubleshooting. Understanding memory usage ensures efficient system performance, reliability, and resource allocation.

Question 26

Which command is used to display network interface information in Linux?

A) ifconfig
B) ip addr
C) netstat
D) ping

Answer: B) ip addr

Explanation: 

Networking is a key component of Linux administration. Understanding how to view and manage network interfaces is essential for troubleshooting connectivity issues, configuring IP addresses, and ensuring proper system communication. The ip addr command, part of the iproute2 package, displays detailed information about network interfaces, including interface names, IP addresses, MAC addresses, broadcast addresses, and current status (UP/DOWN). For example, running ip addr might show eth0 with inet 192.168.1.100/24, indicating the interface’s IPv4 address and subnet mask. This command is widely used because it replaces the older ifconfig and provides more comprehensive and structured information.

A) ifconfig – Historically used to configure and display network interfaces. While still present on many systems, it is considered deprecated in favor of ip addr. It shows similar information like IP addresses, netmask, and interface status but lacks the advanced features and consistent syntax of the ip command.

B) ip addr – Correct. Modern tool for network interface management. Provides clear and comprehensive details about IP addresses, broadcast addresses, and interface states. It is recommended for scripting, monitoring, and modern Linux administration.

C) netstat – Displays network connections, routing tables, and network statistics. While useful for monitoring active network sessions, it does not provide detailed interface configurations or IP addresses. It is often used for analyzing open ports, listening services, or TCP/UDP connections.

D) ping – Used to test connectivity to another host by sending ICMP echo requests. While critical for troubleshooting network reachability, it does not display interface information or configuration details.

Understanding how to view network interfaces with ip addr is fundamental for Linux Essentials. Administrators often combine it with commands like ip route for routing information or ping for connectivity testing. Being able to interpret the output allows troubleshooting IP conflicts, verifying configuration, and preparing the system for network services. Mastery of ip addr ensures accurate and efficient network administration, which is a core competency for Linux certification and real-world system management.

Question 27

Which of the following commands can display a list of all installed packages on a Debian-based system?

A) rpm -qa
B) dpkg -l
C) yum list installed
D) apt-get install

Answer: B) dpkg -l

Explanation: 

Package management is a critical skill in Linux, as software installation, updates, and removal are central to system administration. Debian-based distributions, such as Ubuntu, use dpkg as the low-level package manager to manage .deb packages. The dpkg -l command lists all installed packages with details such as package name, version, and description. For example, running dpkg -l | grep apache lists all installed Apache packages, helping administrators verify installed software or troubleshoot missing dependencies. This command is fundamental for both system maintenance and exam preparation, as understanding installed packages ensures proper system operation and security updates.

A) rpm -qa – Used on Red Hat-based systems to query all installed RPM packages. While it provides similar information to dpkg -l, it is not applicable to Debian-based systems like Ubuntu. Attempting to use it on Debian would result in an error unless the RPM tool is installed.

B) dpkg -l – Correct. Lists all packages installed via Debian’s package management system. It is versatile for verifying software, creating inventory reports, and troubleshooting dependencies. Combining it with grep or less allows filtering for specific software or scrolling through long lists.

C) yum list installed – Used on older Red Hat-based systems or CentOS to list installed packages. Like rpm -qa, it is not applicable for Debian systems. On newer Red Hat-based systems, dnf is commonly used instead.

D) apt-get install – Installs packages but does not list existing ones. Running this command attempts to install specified packages rather than querying installed software.

Knowing how to list installed packages is essential for system audits, compliance verification, and troubleshooting missing or outdated software. On Debian-based systems, dpkg -l provides a comprehensive overview of the software landscape, helping administrators plan updates, manage dependencies, and ensure the system meets operational requirements. It is a foundational skill for Linux Essentials certification and day-to-day Linux administration.

Question 28

Which command is used to compress files in Linux using gzip?

A) tar
B) gzip
C) zip
D) compress

Answer: B) gzip

Explanation: 

File compression is important in Linux for saving disk space, transferring files, and archiving logs. The gzip command compresses individual files using the GNU zip format, reducing storage usage. For example, running gzip file.txt creates file.txt.gz and removes the original file.txt unless the -c option is used to output to a new file. Gzip is widely used because it provides good compression ratios and integrates well with other tools, including tar for creating compressed archives like .tar.gz.

A) tar – Primarily used for archiving multiple files into a single file (tar stands for tape archive). It does not compress files by itself but is commonly combined with gzip (tar -czf archive.tar.gz files) to create compressed archives. Tar is excellent for grouping files but relies on compression tools for reducing size.

B) gzip – Correct. Compresses individual files efficiently. Often used in combination with tar to compress directories into .tar.gz files, it is one of the most widely used compression tools in Linux environments. gzip uses the DEFLATE algorithm, which balances compression ratio and speed, making it suitable for both large and small files. It supports options for compression levels, ranging from -1 (fastest, least compression) to -9 (slowest, maximum compression), allowing administrators to optimize based on storage or performance needs. The -k option preserves the original file, ensuring data safety, while the -v option provides verbose output, showing compression progress. Additionally, gzip integrates seamlessly with other Linux utilities and scripting workflows, making it ideal for automated backups, transferring files over networks, and reducing disk usage in multi-user systems. Combined with tar, it allows the creation of compressed archives while maintaining directory structures, file permissions, and timestamps. Because of its speed, reliability, and broad compatibility, gzip remains an essential tool for system administrators, developers, and anyone managing Linux systems. Its widespread support across distributions ensures that compressed files can be easily shared, extracted, and used in various environments without additional dependencies

C) zip – Creates compressed archives compatible with Windows systems. Unlike gzip, which compresses individual files, zip can compress multiple files or entire directories into a single archive while preserving the internal directory structure. This makes it particularly useful for sharing files between Linux and Windows environments, as the resulting .zip files can be easily extracted on virtually any operating system without requiring special tools. While zip is less common for traditional Linux administration—where tar combined with gzip or bzip2 is preferred for backups and system archives—it remains valuable for distributing files to users who may be on Windows or macOS. zip also supports options for compression levels, password protection, and verbose output, giving administrators flexibility when preparing archives. 

D) compress – An older compression utility, historically used in Unix systems. It produces .Z files but has been largely replaced by gzip due to its superior compression ratio, speed, and broader compatibility with modern systems. compress was once the standard for reducing file sizes on early Unix machines, making file storage and transfer more efficient in resource-constrained environments. However, it lacks the flexibility and features of newer compression tools like gzip, bzip2, and xz, which offer higher compression ratios, better error handling, and integration with modern file archiving practices. While compress is still available on some Linux distributions for backward compatibility, it is rarely used in contemporary system administration or scripting. 

Mastering gzip is critical in Linux Essentials. Administrators frequently use it to compress log files, backup data, or package scripts. Understanding when to use gzip versus tar, zip, or other tools allows efficient storage management, better file transfer speeds, and effective use of system resources. Compression is an essential skill for Linux certification exams and real-world system administration tasks.

Question 29 

Which of the following commands displays the last login information for all users?

A) last
B) who
C) w
D) finger

Answer: A) last

Explanation: 

Monitoring login activity is important for security auditing, user management, and system troubleshooting. The last command reads from /var/log/wtmp and displays a chronological list of login sessions, including usernames, terminals, IP addresses, and login/logout times. For example, running last might show that user alice logged in via pts/0 from 192.168.1.10 at a specific time. This information is critical for detecting unauthorized access, tracking user activity, and understanding system usage patterns.

A) last – Correct. Displays historical login records, including successful and terminated sessions. It allows administrators to review system usage over time and is often combined with other log monitoring tools to detect anomalies. The last command reads from /var/log/wtmp to provide detailed information about user logins, including usernames, terminal sessions, login times, durations, and originating IP addresses. This is essential for auditing, security monitoring, and troubleshooting unauthorized access attempts. By analyzing patterns in login activity, administrators can identify unusual behavior, such as repeated failed logins or unexpected session times, helping maintain system integrity.

B) who – Shows currently logged-in users and their login terminals. While useful for live session monitoring, it does not display historical login information. The who command provides details such as the username, terminal device, login date and time, and the originating IP address if connected remotely. It is valuable for administrators to quickly verify active sessions, monitor user activity in real time, and manage system resources. Unlike commands that show past logins, who focuses solely on the present state, making it ideal for immediate troubleshooting or session audits.

C) w – Displays currently logged-in users along with what commands they are executing. It is useful for real-time monitoring of system activity but does not provide historical data. The w command provides a detailed view that includes the username, terminal, login time, idle time, CPU usage, and the command each user is currently running. Administrators can use it to identify resource-intensive processes, track active sessions, and detect unusual behavior in real time. While it complements commands like who for live session monitoring, w adds the additional benefit of showing what users are actively doing, making it particularly valuable for performance troubleshooting, workload assessment, and proactive system management.

D) finger – Provides detailed user information, including login name, home directory, shell, and sometimes last login. While it may provide last login info, it is limited to individual users and does not provide a complete historical view like last. The finger command can display additional information such as full name, office location, and phone number if configured. Administrators often use it to verify user accounts, check login status for specific users, or troubleshoot environment issues. Unlike broader audit tools, finger focuses on per-user details, making it useful for quick lookups, validation of shell access, and confirming account settings without needing to parse system-wide logs. Despite being less common in modern Linux distributions, understanding finger is helpful for legacy system management and cross-platform user verification.

Understanding login records is fundamental for Linux Essentials. Administrators must review last login data for security audits, compliance, and troubleshooting unauthorized access. The last command provides a reliable way to track all user activity over time and forms a foundation for effective monitoring, accountability, and system management.

Question 30

Which command is used to change file ownership in Linux?

A) chmod
B) chown
C) chgrp
D) ls

Answer: B) chown

Explanation:

File ownership in Linux determines who can access or modify files and directories. The chown command changes the owner and optionally the group of a file or directory. For example, chown alice:developers file.txt sets alice as the owner and developers as the group. Proper file ownership is critical for security, collaboration, and correct system operation. Administrators use chown when configuring permissions for web servers, shared directories, and system services.

A) chmod – Modifies file permissions (read, write, execute) for owner, group, and others. It does not change ownership but works alongside chown to enforce access control. The chmod command allows administrators to set permissions numerically (e.g., chmod 755 file.txt) or symbolically (e.g., chmod u+rwx,g+rx,o+rx file.txt), providing flexibility for different use cases. Proper use of chmod ensures system security, prevents unauthorized access, and maintains data integrity, especially in multi-user environments. It is also commonly used in scripts to automate permission management, allowing consistent enforcement of access policies across multiple files and directories. Understanding chmod is fundamental for Linux Essentials certification, as permission management is a core skill for safe and efficient system administration.

B) chown – Correct. Used to assign ownership and group for files and directories. Essential for system security and multi-user collaboration, the chown command allows administrators to change the owner and optionally the group of a file or directory using syntax like chown user:group filename. Proper ownership ensures that files are accessible only to authorized users and groups, preventing unauthorized access or modification. It works in tandem with chmod to enforce comprehensive access control policies. Administrators often use chown when setting up shared directories, deploying applications, or preparing environments for multiple users. Additionally, chown can be applied recursively (-R) to modify ownership of entire directories and their contents, which is particularly useful for managing large file hierarchies or migrating user data. Mastery of chown is critical for Linux Essentials certification, as understanding file ownership and permissions is fundamental to maintaining system integrity, security, and proper collaborative workflows.

C) chgrp – Changes only the group ownership of a file or directory, not the user owner. Useful when managing group-based permissions, the chgrp command allows administrators to assign a new group to a file or directory using syntax like chgrp groupname filename. This is particularly helpful in collaborative environments where multiple users share access to the same files and need group-specific permissions. The command can also be applied recursively with the -R option to modify entire directories and their contents, ensuring consistent group ownership across multiple files. Combined with chmod, chgrp enables precise control over who can read, write, or execute files within a group, supporting security policies and workflow requirements. Understanding chgrp is an important part of Linux Essentials certification, as it emphasizes managing access rights efficiently without affecting the file owner, which is critical for maintaining proper multi-user system administration and preventing unauthorized access.

D) ls – Lists files and directories, optionally showing permissions and ownership with ls -l, but it does not modify ownership.

Mastery of chown ensures administrators can secure files, assign proper ownership, and maintain system integrity. Misconfigured ownership can lead to unauthorized access, application failures, or security breaches. Combining chown with chmod and chgrp forms a comprehensive approach to file permission management, a core skill in Linux Essentials certification.

Question 31

Which command is used to display the contents of a directory in long format, showing permissions, owner, and size?

A) ls
B) ls -l
C) tree
D) dir

Answer: B) ls -l

Explanation: 

The ls command lists files and directories, but adding the -l option displays detailed information in a long listing format. This includes file type, permissions, number of links, owner, group, size, and modification date. For example, ls -l /etc shows the detailed properties of files in the /etc directory, helping administrators verify ownership, permissions, and file sizes. Long listing is critical for auditing and troubleshooting file systems.

A) ls – Lists files in short format, showing only names. Useful for simple file overviews but does not provide detailed information.

B) ls -l – Correct. Provides detailed information on permissions, ownership, file size, and modification dates. Essential for system audits, permissions verification, and file management.

C) tree – Displays directory contents hierarchically but may not show detailed file attributes by default. Useful for visualizing directory structures rather than detailed file properties.

D) dir – Similar to ls in basic functionality but less commonly used in modern Linux systems. It may provide limited information depending on the distribution.

Understanding ls -l is essential for Linux Essentials. It allows administrators to inspect permissions, ownership, and file attributes, which is necessary for troubleshooting permission issues, verifying configurations, and maintaining secure and organized filesystems.

Question 32

Which of the following commands is used to display all currently mounted block devices?

A) mount
B) df
C) lsblk
D) fdisk

Answer: C) lsblk

Explanation:

Understanding storage devices is critical in Linux. The lsblk command displays all block devices, including disks, partitions, and mount points. Output shows device names, sizes, types, and associated mount points, helping administrators identify storage configurations. For example, lsblk might show sda as a disk with partitions sda1 and sda2 mounted on / and /home. This information is vital for troubleshooting storage issues, planning backups, or preparing for partitioning and formatting tasks.

A) mount – Displays mounted filesystems but does not show all block devices, particularly unmounted disks or partitions.

B) df – Reports disk usage for mounted filesystems, not all devices.

C) lsblk – Correct. Lists all block devices, their sizes, types, and mount points. Useful for storage monitoring, partition management, and system audits.

D) fdisk – Used for partitioning disks, not for displaying mounted devices. It can list partitions but not their mount points or usage.

Using lsblk allows administrators to visualize storage devices and their relationships, which is essential for managing disks, mounting, formatting, and backup planning.

Question 33 

Which command is used to display the hostname of a Linux system?

A) hostname
B) uname -n
C) cat /etc/hostname
D) all of the above

Answer: D) all of the above

Explanation: 

The hostname identifies a Linux system on a network. Multiple commands can reveal the hostname: the hostname command displays it directly, uname -n prints the network node hostname, and cat /etc/hostname reads the static hostname from the configuration file. Knowing the hostname is essential for network administration, troubleshooting, and system identification.

A) hostname – Correct. Displays the current system hostname. Can also be used to temporarily set a hostname with proper privileges.

B) uname -n – Displays the network node name, equivalent to the hostname. Useful in scripts or cross-platform scenarios.

C) cat /etc/hostname – Reads the persistent hostname stored in the configuration file. Essential for verifying system startup settings.

D) all of the above – Correct. All three methods are valid for displaying the hostname in Linux Essentials and system administration. Understanding all options allows administrators to quickly identify systems, verify configurations, and troubleshoot network identification issues.

Question 34

Which command displays system uptime, users logged in, and load averages?

A) uptime
B) w
C) who
D) top

Answer: A) uptime

Explanation: 

System uptime indicates how long the system has been running since last boot. The uptime command displays uptime, number of logged-in users, and system load averages for the past 1, 5, and 15 minutes. For example, uptime might output 15:45:30 up 2 days, 4:30, 3 users, load average: 0.12, 0.10, 0.08. This information is critical for administrators monitoring system stability, performance, or planning maintenance windows.

A) uptime – Correct. Provides a concise snapshot of system runtime, user activity, and load averages. Useful for monitoring system health and identifying high load conditions.

B) w – Displays logged-in users, their activity, and system uptime, providing more detailed user-centric information but less concise than uptime.

C) who – Lists currently logged-in users without load averages or system uptime.

D) top – Displays dynamic process information, CPU, and memory usage. While it shows uptime in its header, it is primarily for performance monitoring, not a quick summary.

Using uptime is a key skill in Linux Essentials for monitoring system health, scheduling maintenance, and evaluating performance trends.

Question 35

Which command is used to display file type information in Linux?

A) file
B) ls -l
C) stat
D) type

Answer: A) file

Explanation: 

The file command identifies file types by analyzing their content rather than relying on extensions. For example, file example.txt outputs ASCII text, while file script.sh outputs Bourne-Again shell script. This command is useful for verifying downloaded files, troubleshooting unknown file formats, and managing system scripts.

A) file – Correct. Provides type identification for any file based on content. Essential for validating files and scripts in Linux Essentials.

B) ls -l – Displays file details like permissions, ownership, size, and modification date but does not determine file type beyond directory, symlink, or regular file.

C) stat – Shows detailed file metadata, such as inode, permissions, timestamps, and size, but does not identify file content type.

D) type – Displays the location or type of a command in the shell, not file content.

Knowing how to determine file types ensures administrators can manage unknown files safely, identify scripts, and verify integrity, which is a critical Linux Essentials skill.

Question 36

Which command is used to display all symbolic links in a directory?

A) ls -l
B) find -type l
C) readlink
D) ln -s

Answer: B) find -type l

Explanation:

Symbolic links (symlinks) are pointers to files or directories. Identifying them is important for troubleshooting broken links, managing shared resources, or validating configurations. The find command with the -type l option searches recursively for all symbolic links within a directory. For example, find /etc -type l lists all links under /etc. This allows administrators to verify link targets and identify broken references.

A) ls -l – Displays files with symbolic links indicated by ->, but does not search recursively unless combined with options. Useful for inspecting a single directory.

B) find -type l – Correct. Searches all symbolic links recursively, allowing comprehensive audits.

C) readlink – Displays the target of a specific symbolic link, not a list of links.

D) ln -s – Creates a symbolic link rather than displaying existing ones.

Using find -type l helps administrators identify misconfigured links, resolve broken references, and ensure proper file organization, an important skill for Linux Essentials and system maintenance.

Question 37

Which command shows the kernel ring buffer messages?

A) dmesg
B) journalctl
C) tail /var/log/messages
D) syslog

Answer: A) dmesg

Explanation: 

Kernel messages provide critical information about hardware detection, driver initialization, and system events during boot. The dmesg command displays the kernel ring buffer, allowing administrators to diagnose hardware issues, driver problems, or boot-time errors. For example, dmesg | grep usb shows messages related to USB devices. Understanding kernel messages helps in troubleshooting system stability and hardware functionality.

A) dmesg – Correct. Displays all kernel messages stored in the ring buffer. It is invaluable for diagnosing hardware issues, checking driver loading, and verifying system startup sequences.

B) journalctl – Displays systemd journal logs, including kernel messages if filtered. While versatile, dmesg is more direct for kernel buffers.

C) tail /var/log/messages – Shows recent system log entries, including some kernel messages, but not the complete ring buffer.

D) syslog – Refers to the system logging facility, not a command. Logs may contain kernel messages but are stored persistently, unlike dmesg which shows the ring buffer.

Mastering dmesg is essential for Linux Essentials, as it enables quick diagnostics, hardware troubleshooting, and understanding system events without relying solely on log files.

Question 38

Which command displays the current shell in use?

A) echo $SHELL
B) ps -p $$
C) env | grep SHELL
D) all of the above

Answer: D) all of the above

Explanation:

Knowing the current shell is important for scripting, configuration, and understanding shell-specific behavior. There are multiple ways to determine the shell: echo $SHELL prints the default login shell from environment variables; ps -p $$ shows the process name for the current shell session; and env | grep SHELL can confirm environment settings. Understanding all these methods helps administrators verify shell environments and avoid script compatibility issues.

A) echo $SHELL – Displays the default login shell. Useful for checking which shell will run scripts by default.

B) ps -p $$ – Shows the running shell process for the current session. Useful for interactive session verification.

C) env | grep SHELL – Confirms shell environment variables, often indicating the default or active shell.

D) all of the above – Correct. All methods are valid ways to determine the current shell, ensuring administrators can troubleshoot shell issues and ensure scripts run as intended.

Question 39

Which command is used to schedule tasks at a specific time?

A) cron
B) at
C) systemd timers
D) all of the above

Answer:

D) all of the above

Explanation:

Task scheduling allows automation of repetitive tasks, system maintenance, and administrative duties. Linux provides multiple tools: cron schedules recurring tasks via crontab entries; at schedules one-time tasks at a specified time; and systemd timers provide modern, flexible scheduling integrated with systemd. For example, at 23:00 -f backup.sh schedules a one-time backup script, while crontab -e schedules recurring tasks. Understanding scheduling tools is essential for automating administration, ensuring consistent maintenance, and improving efficiency.

A) cron – Schedules repetitive tasks using crontab syntax, such as daily backups or log rotations.

B) at – Schedules one-time tasks at a specific date and time. Useful for temporary or ad-hoc job execution.

C) systemd timers – Modern replacement for cron, integrated with systemd, offering advanced scheduling and dependency management.

D) all of the above – Correct. All three methods are valid for task scheduling depending on use case, making them essential for Linux Essentials and real-world administration.

Question 40

Which command shows disk input/output statistics in real-time?

A) iostat
B) vmstat
C) sar
D) df

Answer: A) iostat

Explanation: Monitoring disk I/O is important for performance tuning, troubleshooting slow systems, and analyzing storage workloads. The iostat command displays CPU and device I/O statistics, including reads, writes, and utilization. For example, iostat -x 2 shows extended statistics every 2 seconds, allowing administrators to detect bottlenecks. Understanding disk I/O patterns helps optimize performance, identify failing disks, and ensure high system efficiency.

A) iostat – Correct. Provides real-time disk I/O statistics per device. Essential for monitoring performance, diagnosing bottlenecks, and capacity planning.

B) vmstat – Displays memory, processes, and CPU statistics. While it includes I/O information, it is less detailed per device than iostat.

C) sar – Collects and reports system activity, including I/O, but requires data collection setup. It is more comprehensive but less immediate.

D) df – Shows disk usage but does not monitor real-time I/O activity.

Using iostat enables administrators to detect high I/O wait times, monitor storage performance, and ensure system responsiveness, which is a critical skill for Linux Essentials certification and practical system administration.

img