XK0-005  CompTIA Linux+ Exam Dumps and Practice Test Questions Set 3 Q 41- 60

Visit here for our full CompTIA XK0-005 exam dumps and practice test questions.

Question 41

Which command is used to display the last login information for all users on a Linux system?

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

Answer A) last

Explanation

A) last: The last command reads from the /var/log/wtmp file and displays a list of the most recent logins on the system. It shows the username, terminal, IP or hostname, login time, and session duration. For example, last will display a historical record of user logins, including reboots, providing insight into user activity and system access patterns. It is essential for security auditing, tracking user sessions, and troubleshooting unauthorized access. last provides a chronological view, is easy to use, and works on most Linux distributions.

B) who: The who command shows users currently logged in, along with their terminal, login time, and originating IP. While useful for active sessions, it does not provide historical login data, limiting its utility for auditing past activity.

C) w: The w command displays currently logged-in users along with their activity, CPU usage, and idle times. It is excellent for real-time monitoring of user activity but does not provide historical login information, so it cannot track previous sessions.

D) finger: finger displays information about users, such as login name, full name, home directory, shell, and last login time. While it provides some login history, it is not as detailed or comprehensive as last, and it is not always installed by default on modern Linux systems.

last is correct because it provides a detailed, historical account of all login sessions, including duration and source. who and w only display current users, and finger provides limited information. Using last is essential for auditing, security monitoring, and tracking user activity on Linux systems.

Question 42

Which command is used to check and repair filesystem errors on a Linux partition?

A) fsck
B) mount
C) blkid
D) tune2fs

Answer A) fsck

Explanation

A) fsck: fsck (filesystem check) is a utility used to check and repair inconsistencies or errors in a filesystem. For example, fsck /dev/sda1 will scan the specified partition and attempt to fix any detected issues, such as orphaned inodes, bad blocks, or metadata corruption. fsck supports multiple filesystem types, including ext2, ext3, ext4, and others. It is typically run when a filesystem is unmounted to avoid conflicts. Administrators rely on fsck to maintain filesystem integrity, prevent data loss, and troubleshoot boot failures caused by corrupted partitions. fsck can also run in automatic repair mode with the -y flag, making it convenient for automated maintenance scripts.

B) mount: mount is used to attach a filesystem to the directory tree at a specified mount point. While required for accessing filesystems, mount does not perform integrity checks or repairs, so it cannot correct filesystem errors.

C) blkid: blkid lists block devices along with their UUIDs and filesystem types. While useful for identifying partitions, it does not perform error checking or repairs.

D) tune2fs: tune2fs adjusts parameters of ext2/ext3/ext4 filesystems, such as setting mount counts or enabling journaling. While it can affect filesystem behavior, it is not intended for checking or repairing filesystem errors.

fsck is correct because it specifically targets filesystem integrity, identifies errors, and can repair them. mount and blkid are primarily informational or operational commands, and tune2fs modifies filesystem parameters without repairing errors. fsck is a critical tool for maintaining data integrity and system reliability in Linux environments.

Question 43

Which command is used to show the current CPU and memory usage in real-time on Linux?

A) top
B) ps aux
C) vmstat
D) free -h

Answer A) top

Explanation

A) top: top provides a dynamic, real-time view of system resource usage, including CPU, memory, load averages, and running processes. It updates continuously and displays a list of processes sorted by resource consumption. Administrators use top to identify high-resource processes, monitor system performance, and make informed decisions about process management. For example, top shows per-process CPU and memory usage, swap utilization, and uptime, giving a comprehensive snapshot of system activity. top also allows interactive commands such as killing processes or changing display settings, making it a versatile real-time monitoring tool.

B) ps aux: ps aux lists all processes with their CPU and memory usage at the moment of execution. While informative, it is static and does not update in real-time, making it less suitable for ongoing performance monitoring.

C) vmstat: vmstat provides statistical information about processes, memory, swap, I/O, and CPU activity over intervals. While it is useful for trend analysis, it is not interactive and does not provide a detailed per-process view like top.

D) free -h: free -h shows total, used, free, and cached memory along with swap usage. While useful for checking memory status, it does not provide real-time updates or CPU usage information.

top is correct because it gives a comprehensive, real-time, and interactive view of both CPU and memory usage, along with process-level details. ps aux is static, vmstat is more statistical and less interactive, and free -h only focuses on memory. top is essential for performance monitoring and resource management in Linux systems.

Question 44

Which command is used to display open network ports and listening services on a Linux system?

A) netstat -tuln
B) ss -tuln
C) lsof -i
D) ip addr

Answer B) ss -tuln

Explanation

A) netstat -tuln: netstat -tuln displays TCP and UDP listening ports along with associated addresses and ports in numeric form. While it provides useful information about open ports, netstat is considered deprecated in modern Linux distributions in favor of ss, and its output may not include additional metadata like socket statistics or advanced filtering options.

B) ss -tuln: ss (socket statistics) is a modern replacement for netstat and provides detailed information about network sockets, listening ports, and established connections. The flags -tuln display TCP and UDP listening sockets in numeric format without resolving hostnames. ss is faster, more flexible, and capable of handling large numbers of connections efficiently. It also supports additional filtering, such as filtering by state, port, or process. Administrators use ss to monitor network services, troubleshoot connectivity, and secure open ports.

C) lsof -i: lsof -i lists open network files and the processes using them. While it shows the mapping between processes and network sockets, it is more process-focused and less convenient for quickly identifying listening ports compared to ss.

D) ip addr: ip addr displays network interfaces and IP addresses. It does not show open ports or listening services, making it unrelated to this task.

ss -tuln is correct because it provides a fast, detailed, and reliable view of open network ports and listening services. netstat is deprecated, lsof -i is process-focused, and ip addr only shows network interfaces. ss is the preferred tool for network monitoring and security auditing in modern Linux environments.

Question 45

Which command is used to display system uptime, load averages, and current users in Linux?

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

Answer C) uptime

Explanation

A) w: The w command displays currently logged-in users, their idle time, and the commands they are executing. It also shows load averages and system uptime, but its primary focus is user activity. While informative, it is more detailed for monitoring user sessions rather than providing a quick summary of system performance.

B) who: who lists logged-in users along with their terminals and login times. It does not display load averages or uptime, so it provides only partial information.

C) uptime: uptime displays a concise summary of how long the system has been running, the number of logged-in users, and the load averages for 1, 5, and 15 minutes. For example, uptime outputs: “12:30:01 up 5 days, 4:12, 3 users, load average: 0.25, 0.30, 0.35”. It is a lightweight, quick command for administrators to assess system load, activity, and availability. Its simplicity and direct focus make it ideal for routine monitoring and scripting.

D) top: top shows detailed real-time process information, CPU, and memory usage, but it is interactive and not intended for a concise one-line summary of uptime and load averages.

uptime is correct because it provides a clear, quick, and focused summary of system uptime, logged-in users, and load averages. w is more detailed for user activity, who only shows users, and top is interactive with extensive process details. uptime is essential for monitoring system availability and performance trends in Linux.

Question 46

Which command is used to display or configure network interfaces in Linux?

A) ip addr
B) ifconfig
C) nmcli
D) route

Answer A) ip addr

Explanation

A) ip addr: The ip addr command displays detailed information about all network interfaces, including IP addresses, subnet masks, interface state, and MAC addresses. It is part of the iproute2 suite and is the modern replacement for older network tools. For example, ip addr show lists all interfaces with their assigned addresses and current operational state. ip addr can also be used to assign or remove addresses with the ip addr add or ip addr del subcommands. Administrators rely on ip addr for configuration, troubleshooting, and monitoring of interfaces in contemporary Linux distributions. Its integration with other ip commands like ip link and ip route makes it a versatile tool for network management.

B) ifconfig: ifconfig is the legacy tool for displaying and configuring network interfaces. While it provides similar information, it is deprecated in most modern Linux distributions in favor of iproute2 commands. Its syntax is less flexible, and it does not support many of the advanced networking features offered by ip addr.

C) nmcli: nmcli is the NetworkManager command-line interface, used to manage network connections, devices, and profiles. While it can display interface information and configure connections, it is dependent on NetworkManager and is not always installed by default. It is more suitable for managed network environments rather than low-level interface inspection.

D) route: route shows the kernel routing table, including destination networks, gateways, and interfaces. While useful for understanding traffic paths, it does not provide comprehensive information about interface IP addresses or operational state.

ip addr is correct because it provides complete, detailed, and modern interface information with the ability to configure IP addresses. ifconfig is outdated, nmcli is dependent on NetworkManager, and route focuses on routing rather than interface details. Mastery of ip addr is essential for network configuration, troubleshooting, and monitoring in Linux.

Question 47

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

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

Answer A) gzip

Explanation

A) gzip: The gzip command compresses individual files using the GNU zip algorithm, reducing file size for storage and transfer efficiency. For example, gzip file.txt replaces the original file with a compressed file.txt.gz version. gzip is widely supported, fast, and suitable for compressing log files, text files, and archives when combined with tar. Its options include -d to decompress files and -c to output compressed data to stdout. Administrators use gzip extensively for data archiving, backups, and transfer optimization.

B) tar: tar is primarily an archiving tool that combines multiple files into a single archive (tarball). While it can be combined with gzip using tar -czf archive.tar.gz for compression, tar alone does not perform compression. Its primary function is file consolidation rather than reducing size.

C) zip: zip compresses and archives files together into a single .zip file. While similar to gzip in function, zip is more common in cross-platform scenarios, particularly for Windows compatibility. It is not the standard Linux tool for single-file compression.

D) bzip2: bzip2 compresses files using the Burrows-Wheeler algorithm, offering higher compression ratios than gzip but slower performance. For example, bzip2 file.txt creates file.txt.bz2. While effective, it is less commonly used for quick compression tasks.

gzip is correct because it is the standard Linux utility for fast, efficient compression of single files. tar is for archiving, zip is cross-platform oriented, and bzip2 trades speed for higher compression. gzip is essential for storage efficiency, backup, and log management in Linux administration.

Question 48

Which command is used to modify the system date and time on a Linux system?

A) timedatectl
B) date
C) hwclock
D) ntpdate

Answer A) timedatectl

Explanation

A) timedatectl: The timedatectl command, part of systemd, allows administrators to view and set the system date and time, adjust the timezone, and enable or disable NTP (network time synchronization). For example, timedatectl set-time “2025-11-21 12:00:00” sets the system time, and timedatectl set-timezone America/New_York changes the timezone. timedatectl integrates with systemd’s time management services, making it the preferred tool in modern Linux distributions for consistent and accurate time configuration.

B) date: date displays the current system date and time and can set it temporarily using date -s “YYYY-MM-DD HH:MM:SS”. However, changes made with date are not persistent across reboots unless synchronized with hardware or NTP, making it less reliable for long-term configuration.

C) hwclock: hwclock interacts with the hardware clock (RTC) to read or set its value. While important for low-level time management, it does not directly modify the system clock used by applications unless synchronized with hwclock –hctosys.

D) ntpdate: ntpdate sets the system time by querying NTP servers for synchronization. While effective for aligning time with network sources, it is typically a one-time adjustment and requires proper configuration of NTP services for ongoing maintenance.

timedatectl is correct because it provides persistent system time configuration, timezone management, and NTP control in a modern Linux system. date provides temporary changes, hwclock modifies hardware clock, and ntpdate is for network synchronization. Using timedatectl ensures accurate, consistent system time for applications and services.

Question 49

Which command is used to display all current processes in a tree structure on Linux?

A) pstree
B) ps aux
C) top
D) htop

Answer A) pstree

Explanation

A) pstree: pstree displays all running processes in a hierarchical tree format, showing parent-child relationships and process names. For example, pstree -p includes process IDs along with the tree. It is useful for visualizing process dependencies, identifying which processes spawned others, and understanding system resource organization. pstree provides clarity in situations where process relationships are critical, such as debugging daemons or services.

B) ps aux: ps aux lists all processes with detailed information, including CPU, memory usage, UID, and command. While informative, it displays processes in a flat list rather than showing the hierarchical relationships between parent and child processes.

C) top: top provides a real-time view of processes and their resource usage, updating continuously. While it shows active processes and allows sorting by CPU or memory, it does not display parent-child relationships in a tree structure.

D) htop: htop is an interactive process viewer that enhances top with color coding and navigation. While it allows tree view display with a toggle, pstree is simpler for directly visualizing process hierarchy without interactive navigation.

pstree is correct because it provides a clear, concise, hierarchical view of processes, highlighting relationships that are not immediately apparent in ps aux or top. htop can replicate this with interaction, but pstree remains the standard tool for static process tree inspection and analysis in Linux.

Question 50

Which command is used to display the kernel version and system architecture in Linux?

A) uname -a
B) uname -r
C) cat /proc/version
D) dmesg | grep Linux

Answer A) uname -a

Explanation

A) uname -a: The uname command with the -a flag displays all system information, including kernel name, node hostname, kernel release, kernel version, machine hardware name, processor type, hardware platform, and operating system. For example, uname -a outputs: “Linux hostname 5.15.0-70-generic #77-Ubuntu SMP x86_64 GNU/Linux”. This comprehensive view is essential for system diagnostics, compatibility checks, and troubleshooting kernel-related issues.

B) uname -r: uname -r only displays the kernel release version, such as 5.15.0-70-generic. While useful for quickly checking kernel version, it does not provide full system architecture or other metadata.

C) cat /proc/version: This displays detailed kernel version information, including compiler and build date. While informative, it does not provide architecture or hardware details in a concise manner.

D) dmesg | grep Linux: This filters kernel boot messages for Linux-related entries. While it may show kernel version information, it is not designed for concise or comprehensive system identification and requires parsing output.

uname -a is correct because it provides a complete snapshot of kernel version, system architecture, and operating system in one command. uname -r is limited to version, /proc/version is verbose and less structured, and dmesg is boot-log dependent. Mastery of uname -a is essential for system auditing, diagnostics, and administration in Linux.

Question 51

Which command is used to display the memory usage of processes in a tree format on Linux?

A) pmap
B) top
C) htop
D) smem

Answer C) htop

Explanation

A) pmap: The pmap command shows the memory map of a specific process. For example, pmap PID lists all memory segments allocated to that process, including size, permissions, and addresses. While extremely detailed, it is limited to individual processes and does not provide a tree view of multiple processes, making it less suitable for system-wide memory monitoring.

B) top: top displays real-time CPU and memory usage for all processes. While it provides a dynamic overview of resource consumption, it does not inherently present processes in a hierarchical tree format, so parent-child relationships and aggregated memory usage are not visually represented.

C) htop: htop is an interactive system-monitoring tool that enhances top by displaying processes with color-coded metrics and a tree view option that shows hierarchical relationships between parent and child processes. It provides real-time CPU, memory, and swap usage, allowing administrators to quickly identify high-memory consumers in context. For example, pressing F5 toggles the tree view, displaying processes in a structure that reflects system process hierarchy. htop is highly versatile and interactive, supporting scrolling, filtering, and process management directly from the interface, making it the preferred choice for detailed system memory inspection.

D) smem: smem reports memory usage for processes and supports proportional set size (PSS) calculation, which is useful for analyzing shared memory. While it provides accurate metrics for memory usage, it does not present processes in a hierarchical tree format by default, and it is more focused on statistics than interactive real-time monitoring.

htop is correct because it combines real-time monitoring with a hierarchical process tree and memory visualization, allowing administrators to quickly analyze memory usage in context. pmap is process-specific, top lacks tree structure, and smem provides statistical memory insights without hierarchy. htop is an essential tool for Linux system administrators to monitor memory efficiently and manage processes interactively.

Question 52

Which command is used to add a new user account on a Linux system?

A) useradd
B) adduser
C) passwd
D) groupadd

Answer A) useradd

Explanation

A) useradd: The useradd command creates a new user account on Linux. It allows specification of username, home directory, shell, user ID, and group assignments. For example, useradd -m -s /bin/bash username creates a user with a home directory and Bash as the default shell. useradd is low-level and widely available on all Linux distributions, making it reliable for scripting and automation. It directly updates /etc/passwd, /etc/shadow, and /etc/group files as needed, ensuring that the new account is recognized system-wide.

B) adduser: adduser is a higher-level script that wraps around useradd and provides interactive prompts for creating a new user, setting the password, and configuring directories. While convenient for manual account creation, it is distribution-specific and not guaranteed to be present on all Linux systems.

C) passwd: passwd changes or sets the password for a user account. While essential for securing accounts, it does not create new user accounts.

D) groupadd: groupadd creates a new group on the system, allowing users to be associated with it. It does not create user accounts by itself, though groups are often specified during account creation.

useradd is correct because it is the standard command for creating new users, specifying essential parameters, and scripting account creation. adduser is an interactive alternative, passwd only sets passwords, and groupadd only creates groups. Mastery of useradd is critical for user management and system administration in Linux.

Question 53

Which command is used to display the inode number of a file in Linux?

A) ls -i
B) stat
C) find
D) inode

Answer A) ls -i

Explanation

A) ls -i: The ls command with the -i flag displays the inode number of a file or directory. Inodes store metadata about files, including permissions, ownership, timestamps, and disk block locations. For example, ls -i file.txt shows the numeric inode value for file.txt. This is useful for low-level file operations, troubleshooting hard links, and understanding filesystem structure. It provides a direct, simple way to access inode information without additional tools or parsing.

B) stat: stat provides detailed information about a file, including size, ownership, permissions, and inode number. While comprehensive, it is more verbose than ls -i and includes additional metadata that may not be necessary when the goal is to quickly identify the inode number.

C) find: find searches for files based on conditions such as name, type, or inode. For example, find / -inum 12345 searches for files with a specific inode. While useful for locating files, it is not primarily intended to display inode numbers directly for a given file.

D) inode: There is no standard Linux command called inode. Any reference to inode must be interpreted through commands like ls -i or stat.

ls -i is correct because it provides a quick, simple, and direct method to display the inode number of a file. stat is more detailed but verbose, find searches by inode rather than displaying it directly, and inode is not a valid command. Understanding inode numbers is essential for filesystem management, linking files, and low-level troubleshooting.

Question 54

Which command is used to display the system boot messages in Linux?

A) dmesg
B) journalctl -b
C) tail -f /var/log/boot.log
D) cat /var/log/messages

Answer A) dmesg

Explanation

A) dmesg: The dmesg command reads the kernel ring buffer and displays messages related to system boot, hardware initialization, and driver loading. For example, dmesg | less shows all boot-time logs, which is crucial for diagnosing hardware issues, driver failures, or kernel-related problems. dmesg provides real-time and historical boot messages directly from the kernel, allowing administrators to troubleshoot startup issues without relying on external log files.

B) journalctl -b: journalctl -b displays all logs from the current boot, including kernel, service, and application messages. While comprehensive, it requires systemd and is not limited to kernel boot messages, providing a broader scope that may include unnecessary information.

C) tail -f /var/log/boot.log: tail -f continuously monitors the boot log file. While useful for tracking boot progress, it depends on the logging system to write boot messages and may not capture early kernel initialization messages.

D) cat /var/log/messages: cat displays the entire system log, which contains messages from multiple sources. While some boot messages may appear here, it is not specifically designed to focus on boot-time kernel logs.

dmesg is correct because it directly accesses the kernel ring buffer to display boot messages and hardware initialization logs. journalctl -b is broader and systemd-dependent, tail -f /var/log/boot.log monitors logged messages, and cat /var/log/messages is general-purpose. dmesg is essential for diagnosing hardware and boot-related issues in Linux.

Question 55

Which command is used to terminate a process by its PID in Linux?

A) kill
B) pkill
C) killall
D) xkill

Answer A) kill

Explanation

A) kill: The kill command sends a signal to a process by its PID, typically to terminate it. For example, kill 1234 sends the default SIGTERM signal to the process with PID 1234. kill can also send other signals, such as SIGKILL or SIGHUP, allowing controlled process management. It is widely used for terminating unresponsive processes or signaling daemons for configuration reloads. kill interacts directly with the process identified by its PID, making it precise and reliable.

B) pkill: pkill sends signals to processes by name or other attributes rather than PID. For example, pkill firefox terminates all processes matching the name firefox. While convenient for process groups, it is less precise when only a specific PID needs termination.

C) killall: killall sends a signal to all processes matching a specific name. For example, killall httpd terminates all Apache processes. It is useful for managing multiple processes of the same type but does not target a single PID specifically.

D) xkill: xkill provides a graphical way to terminate X Window applications by clicking on their window. It is not suitable for command-line process management or scripts.

kill is correct because it directly targets a specific PID and allows precise signal delivery to control or terminate the process. pkill and killall operate by process name rather than PID, and xkill is graphical. kill is essential for process management, scripting, and troubleshooting in Linux systems.

Question 56

Which command is used to display mounted filesystems along with their mount points and options in Linux?

A) mount
B) df -h
C) lsblk
D) blkid

Answer A) mount

Explanation

A) mount: The mount command, when used without arguments, lists all currently mounted filesystems along with their device names, mount points, filesystem types, and mount options. For example, mount outputs entries like /dev/sda1 on / type ext4 (rw,relatime,data=ordered). This is crucial for system administrators to verify mount configurations, troubleshoot mounting issues, and understand filesystem options such as read-only, noexec, or user-specific settings. mount provides a detailed view of what devices are actively used in the system, how they are accessed, and under what conditions. It is both informative and foundational for managing storage in Linux.

B) df -h: df -h shows disk usage of mounted filesystems in a human-readable format. While it lists filesystem sizes, usage, and available space, it does not display detailed mount options, which are often critical for security and performance troubleshooting.

C) lsblk: lsblk displays block devices and their hierarchy with size, type, and mount points. While it provides a structural view of storage, it does not include filesystem options or detailed mount information.

D) blkid: blkid shows block devices along with their UUIDs and filesystem types. It is useful for identifying devices in fstab or scripts, but it does not provide active mount points or options.

mount is correct because it provides both the device, the mount point, and the associated options, offering a complete picture of mounted filesystems. df -h focuses on usage, lsblk on device hierarchy, and blkid on identifiers. Understanding mount output is essential for storage management, security auditing, and troubleshooting in Linux systems.

Question 57

Which command is used to change file permissions in Linux?

A) chmod
B) chown
C) umask
D) ls -l

Answer A) chmod

Explanation

A) chmod: chmod (change mode) modifies the access permissions of a file or directory for the owner, group, and others. For example, chmod 755 file.txt sets read, write, and execute for the owner, and read and execute for group and others. chmod can use both numeric (octal) and symbolic representations to set permissions and is fundamental for controlling access in a multi-user environment. Proper use of chmod ensures security and compliance by granting or restricting access as needed.

B) chown: chown changes the ownership of files and directories, allowing administrators to assign the file to a specific user or group. While related to access control, it does not modify permission bits.

C) umask: umask sets the default permission mask for newly created files and directories. While it indirectly influences permissions, it does not change existing permissions of a file.

D) ls -l: ls -l displays file permissions, ownership, size, and timestamps. It is purely informational and cannot modify permissions.

chmod is correct because it directly modifies the permissions of files and directories. chown modifies ownership, umask sets defaults for new files, and ls -l only shows permissions. Mastery of chmod is essential for maintaining security, access control, and proper system administration in Linux environments.

Question 58

Which command is used to create a symbolic link to a file in Linux?

A) ln -s
B) cp
C) mv
D) touch

Answer A) ln -s

Explanation

A) ln -s: ln with the -s flag creates a symbolic (soft) link, which is a reference pointing to another file or directory. For example, ln -s /path/to/file linkname creates a link called linkname pointing to the original file. Symbolic links allow flexible file organization, reference files across directories, and facilitate system administration tasks without duplicating data. Unlike hard links, symbolic links can point to directories and files across different filesystems. Administrators use ln -s to create shortcuts, manage shared resources, and simplify complex directory structures.

B) cp: cp copies files or directories to a new location. While it duplicates content, it does not create a reference or link to the original file.

C) mv: mv moves or renames files and directories. While useful for organizing files, it does not create links or references.

D) touch: touch updates the access and modification timestamps of a file or creates an empty file if it does not exist. It does not link or reference existing files.

ln -s is correct because it creates a symbolic link pointing to another file or directory, allowing efficient referencing and flexible file management. cp duplicates, mv moves or renames, and touch only creates or updates timestamps. Symbolic links are essential for system organization, configuration management, and simplifying file access paths in Linux administration.

Question 59

Which command is used to schedule a one-time task in Linux?

A) at
B) cron
C) systemd-timer
D) batch

Answer A) at

Explanation

A) at: The at command schedules a command or script to run once at a specified time. For example, echo “backup.sh” | at 23:00 schedules the backup script to run at 11 PM. at reads from stdin or a file to determine the command to execute and is ideal for one-off tasks that do not repeat. The at daemon processes the job and executes it at the defined time, sending notifications if needed. It is widely used for temporary maintenance tasks, deferred scripts, or any situation where a single execution is required.

B) cron: cron schedules recurring tasks at defined intervals using crontab files. While powerful for repeated tasks, it is not suited for one-time executions unless manually removed after the job runs.

C) systemd-timer: systemd timers allow scheduling tasks similarly to cron but integrate tightly with systemd services. While capable of one-time execution, configuring a timer is more complex, and at is simpler for immediate or ad hoc scheduling.

D) batch: batch schedules commands to run when system load is low. It is similar to at but focuses on executing commands during idle periods rather than at a specified time.

at is correct because it provides a simple, direct method to schedule one-time tasks. cron handles recurring tasks, systemd-timer is more complex, and batch depends on system load. at is essential for scheduling temporary, single-run maintenance or administrative tasks in Linux systems.

Question 60

Which command is used to check the current kernel version in Linux?

A) uname -r
B) uname -a
C) cat /proc/version
D) dmesg | grep Linux

Answer A) uname -r

Explanation

A) uname -r: uname -r displays the kernel release version, such as 5.15.0-70-generic. It provides a concise view of the kernel currently running on the system, which is essential for troubleshooting, compatibility checks, and system auditing. Administrators often use uname -r to verify kernel updates, identify kernel-specific issues, and ensure software compatibility.

B) uname -a: uname -a provides comprehensive system information, including kernel name, version, hostname, architecture, and operating system. While informative, it includes additional data beyond the kernel version, making uname -r more focused when only the kernel version is needed.

C) cat /proc/version: This displays the kernel version along with compiler and build information. While detailed, it is verbose and not as concise as uname -r for quickly checking the version.

D) dmesg | grep Linux: This extracts Linux-related entries from the kernel ring buffer. While it may include the kernel version, it requires parsing and is not a direct method to determine the current version.

uname -r is correct because it provides a concise, direct, and reliable way to display the currently running kernel version. uname -a provides additional system information, /proc/version is verbose, and dmesg requires filtering. Using uname -r is standard practice for kernel verification and system maintenance in Linux.

img