XK0-005 CompTIA Linux+ Exam Dumps and Practice Test Questions Set 5 Q 81- 100
Visit here for our full CompTIA XK0-005 exam dumps and practice test questions.
Question 81
Which command is used to compress files using the gzip algorithm in Linux?
A) gzip
B) bzip2
C) tar
D) zip
Answer A) gzip
Explanation
A) gzip: The gzip command compresses files using the GNU zip algorithm. For example, gzip file.txt creates a compressed file named file.txt.gz and reduces storage space. gzip is widely used in Linux for its balance of compression efficiency and speed. Administrators use gzip for log rotation, archival storage, and transferring files over networks to reduce bandwidth usage. gzip supports multiple options such as -d for decompression, -k to keep the original file, and -c to write output to stdout. It handles individual files effectively but does not compress directories directly, often combined with tar for packaging multiple files into a single archive. Mastery of gzip is critical for managing storage, backups, and optimizing file transfer efficiency.
B) bzip2: bzip2 is an alternative compression tool that typically achieves higher compression ratios than gzip but at the cost of slower performance. It produces files with the .bz2 extension and is often used when storage space optimization is more critical than speed.
C) tar: tar is used to create archives of multiple files and directories but does not perform compression by itself. It is often combined with gzip (tar -czf archive.tar.gz) to both archive and compress files.
D) zip: zip compresses and archives files, producing .zip files compatible with multiple platforms. While versatile, it is less common in Linux-native workflows compared to gzip and tar combinations.
gzip is correct because it directly compresses individual files using a fast, efficient algorithm. bzip2 is slower but higher compression, tar is for archiving, and zip is cross-platform but less commonly used natively. Mastery of gzip is essential for Linux administrators handling file compression, backups, and network transfers.
Question 82
Which command is used to display the last login information for all users on a Linux system?
A) last
B) who
C) w
D) users
Answer A) last
Explanation
A) last: The last command reads from the /var/log/wtmp file and displays a list of all user logins, including login and logout times, terminal, IP address, and session duration. For example, last outputs entries like username pts/0 192.168.1.100 Mon Nov 18 09:15 – 10:05 (00:50). Administrators rely on last to audit user activity, detect suspicious logins, and monitor system access patterns. It provides historical data, unlike who or w, which display only current sessions. last can also track system reboots, shutdowns, and crashes by showing entries for system processes.
B) who: who shows currently logged-in users and their terminals. It provides real-time session information but does not show historical logins.
C) w: w shows logged-in users along with their activity, idle time, and current processes. While informative for active sessions, it does not provide historical login data.
D) users: users displays the usernames of currently logged-in users in a compact format but offers no timestamps, IP addresses, or historical context.
last is correct because it provides detailed historical login information for all users. who and w are focused on current sessions, and users is a simplified view of logged-in users. Mastery of last is critical for Linux administrators to audit system access, investigate security incidents, and maintain accountability.
Question 83
Which command is used to check disk I/O statistics including CPU and device utilization in Linux?
A) iostat
B) vmstat
C) sar
D) top
Answer A) iostat
Explanation
A) iostat: iostat provides detailed statistics on CPU utilization and disk I/O performance, including metrics like tps (transactions per second), read/write speeds, and utilization percentage. For example, iostat -x 1 continuously monitors devices with extended statistics. Administrators use iostat to detect bottlenecks, optimize storage performance, and monitor heavy I/O workloads. It is crucial for diagnosing slow disk responses, planning upgrades, and balancing load across storage devices. iostat helps track trends over time, enabling proactive capacity management and resource planning. It supports multiple options for interval monitoring, JSON output, and filtering by devices, making it versatile for system performance analysis.
B) vmstat: vmstat reports virtual memory, processes, CPU, and I/O statistics at a high level. While it provides a snapshot of system resource usage, it does not provide per-device disk I/O metrics or detailed utilization percentages.
C) sar: sar (System Activity Report) collects and reports historical system statistics, including CPU, memory, and I/O. While powerful for long-term monitoring, it requires pre-configured data collection and is less suitable for immediate interactive analysis compared to iostat.
D) top: top displays CPU and memory usage by processes in real-time but does not provide detailed per-device disk I/O statistics. It is process-focused rather than storage-focused.
iostat is correct because it provides detailed per-device disk I/O statistics and CPU utilization. vmstat offers high-level snapshots, sar provides historical reports, and top is process-focused. Mastery of iostat is essential for Linux administrators managing storage performance, detecting bottlenecks, and optimizing system I/O.
Question 84
Which command is used to search for files by name in a Linux filesystem?
A) find
B) locate
C) grep
D) which
Answer A) find
Explanation
A) find: find searches for files and directories based on name, type, size, permissions, timestamps, and other criteria. For example, find /home -name “*.log” locates all log files in /home and its subdirectories. find is extremely versatile, supporting complex expressions and actions such as executing commands on matched files (-exec). Administrators rely on find for backups, cleanup tasks, auditing, and troubleshooting missing or misplaced files. It works in real-time against the filesystem, ensuring up-to-date results, and is highly scriptable for automated administration tasks.
B) locate: locate searches a pre-built database (updated via updatedb) for file names. While faster than find, it may return outdated results if the database is not updated. locate is less flexible in filtering by permissions, size, or timestamps.
C) grep: grep searches the contents of files for matching text patterns. While useful for content searches, it does not locate files by name in the filesystem.
D) which: which shows the path of an executable that would be executed in the current shell environment. It is limited to executable search and does not perform a general filesystem search.
find is correct because it searches the filesystem in real-time with flexible filtering and action capabilities. locate is faster but database-dependent, grep searches file contents, and which only finds executables. Mastery of find is essential for Linux administrators to locate files, manage directories, and automate system tasks effectively.
Question 85
Which command is used to display memory usage, including total, used, free, shared, buffer, and cache in Linux?
A) free -h
B) top
C) vmstat
D) ps aux
Answer A) free -h
Explanation
A) free -h: The free command reports memory usage, including total, used, free, shared memory, buffers, and cache. The -h flag formats output in human-readable units such as KB, MB, or GB. For example, free -h displays memory allocation details for RAM and swap, helping administrators monitor system performance, detect memory pressure, and plan capacity. free differentiates between actual memory usage and cached/buffered memory, providing accurate insight into available memory resources. It is non-interactive, scriptable, and crucial for real-time and automated monitoring of system memory utilization. Administrators use free to detect memory leaks, evaluate resource usage, and ensure that systems operate efficiently under varying workloads.
B) top: top displays memory usage for individual processes in real-time but does not provide a concise summary of overall system memory allocation including buffers and cache.
C) vmstat: vmstat provides high-level memory, CPU, and I/O statistics over intervals. While informative, it does not provide the clear breakdown of total, used, free, shared, buffers, and cache memory as free does.
D) ps aux: ps aux lists running processes along with their memory and CPU usage but does not summarize overall system memory statistics. It is process-focused rather than system-focused.
free -h is correct because it provides a complete, human-readable summary of memory usage, including all critical components. top is process-focused, vmstat is high-level and interval-based, and ps aux is per-process. Mastery of free -h is essential for Linux administrators to monitor memory, optimize system performance, and diagnose memory-related issues.
Question 86
Which command is used to display the current kernel version and system architecture in Linux?
A) uname -r
B) uname -a
C) lsb_release -a
D) cat /proc/version
Answer B) uname -a
Explanation
A) uname -r: uname with the -r flag displays only the kernel release version, such as 5.15.0-67-generic. While useful for quickly checking the kernel version, it does not provide additional system information such as architecture, hostname, or kernel type.
B) uname -a: uname -a provides comprehensive information about the system, including kernel name, version, release, hostname, machine architecture, processor type, and operating system. For example, uname -a might output Linux hostname 5.15.0-67-generic #74-Ubuntu SMP x86_64 GNU/Linux. This command is crucial for administrators to verify system compatibility, troubleshoot kernel-specific issues, and document system configuration. Knowing the complete system architecture helps ensure that software installations, driver modules, and updates are compatible with the underlying hardware and kernel. It also aids in determining whether security patches are applicable to the specific system environment.
C) lsb_release -a: lsb_release -a displays Linux distribution information, such as distributor ID, description, release, and codename. While helpful for understanding the operating system version and distribution, it does not provide kernel architecture or detailed kernel version information.
D) cat /proc/version: This command shows kernel version, build information, and GCC version used to compile the kernel. While informative, it does not give architecture, processor, or hostname details, making uname -a more comprehensive.
uname -a is correct because it provides full kernel and system architecture information in a single command. uname -r only shows the kernel version, lsb_release -a focuses on distribution, and cat /proc/version is limited to kernel build info. Mastery of uname -a is critical for Linux administrators for system inventory, troubleshooting, and compatibility checks.
Question 87
Which command is used to add a new user to a Linux system and create a home directory?
A) useradd -m
B) adduser
C) passwd
D) groupadd
Answer A) useradd -m
Explanation
A) useradd -m: The useradd command with the -m flag creates a new user account and automatically generates a home directory. For example, useradd -m john creates the user john with a home directory at /home/john. This command is essential for user management in Linux, ensuring that each user has a personal directory with appropriate ownership and default permissions. It is often combined with other flags to set shell, user ID, group ID, and expiration dates. Administrators use useradd -m to standardize user creation, automate account provisioning, and enforce consistent filesystem structure. Proper use ensures security, prevents conflicts, and maintains organized home directories for multiple users.
B) adduser: adduser is a higher-level, interactive Perl script on some distributions (like Debian-based systems) that wraps useradd functionality and prompts for additional details such as password and group. While convenient, it may not exist or behave the same on all distributions, making useradd -m the universal choice.
C) passwd: passwd sets or changes a user’s password but does not create a new user account or home directory. It is used after account creation for authentication purposes.
D) groupadd: groupadd creates new groups, not users. It is necessary for organizing users into groups but does not directly create accounts or home directories.
useradd -m is correct because it creates both the user account and home directory in a single command. adduser is distribution-specific, passwd only sets passwords, and groupadd manages groups. Mastery of useradd -m is essential for Linux administrators to manage accounts, enforce security, and maintain organized user environments.
Question 88
Which command is used to display CPU and memory usage for all running processes in Linux?
A) top
B) htop
C) ps aux
D) vmstat
Answer A) top
Explanation
A) top: The top command provides a dynamic, real-time view of all running processes along with CPU, memory, and swap usage. It shows process IDs, user ownership, priority, and resource utilization. Administrators use top to monitor system performance, identify processes consuming excessive resources, and manage system load. It can be used interactively to sort by CPU or memory usage, kill processes, and observe system trends over time. top is particularly valuable for troubleshooting performance degradation, planning resource allocation, and monitoring servers under heavy load.
B) htop: htop is an enhanced interactive version of top with color-coded output, easier navigation, and additional features such as tree views. While very effective, it may not be available by default on all distributions, whereas top is universally available.
C) ps aux: ps aux displays CPU and memory usage for processes at a single point in time, producing static output. It is not real-time and cannot monitor dynamic changes without repeatedly running the command.
D) vmstat: vmstat provides high-level statistics on CPU, memory, and I/O usage, but it is system-wide and not process-specific. It is better suited for monitoring system performance trends rather than individual processes.
top is correct because it provides real-time, process-specific monitoring of CPU and memory usage. htop offers enhanced interactivity, ps aux is static, and vmstat is high-level system-focused. Mastery of top is essential for Linux administrators to manage performance, troubleshoot resource issues, and maintain optimal system operation.
Question 89
Which command is used to change the permissions of a file or directory in Linux?
A) chmod
B) chown
C) chgrp
D) ls -l
Answer A) chmod
Explanation
A) chmod: chmod changes the permissions of files and directories, controlling read, write, and execute access for the user, group, and others. For example, chmod 755 file.txt sets read, write, and execute permissions for the owner, and read and execute for group and others. Proper use of chmod is critical for security, preventing unauthorized access, and managing collaborative file environments. It supports symbolic and numeric modes, recursive operations with -R, and advanced ACLs. Linux administrators rely on chmod to enforce file access policies, ensure compliance, and maintain data integrity.
B) chown: chown changes the ownership of files and directories but does not directly alter permissions. It affects who can potentially access or modify a file based on ownership, but chmod controls the specific access rights.
C) chgrp: chgrp changes the group ownership of files and directories. It can indirectly affect permissions if group-specific access rules exist but does not modify permission bits directly.
D) ls -l: ls -l displays the permissions, owner, and group of files. It is informative but cannot modify permissions.
chmod is correct because it directly modifies file and directory permissions. chown and chgrp affect ownership, and ls -l only displays information. Mastery of chmod is essential for Linux administrators to maintain security, enforce access control, and manage collaborative environments.
Question 90
Which command is used to schedule a one-time task to run at a specific time in Linux?
A) at
B) cron
C) systemctl enable
D) batch
Answer A) at
Explanation
A) at: The at command schedules a one-time task for execution at a specified future time. For example, echo “/usr/local/bin/backup.sh” | at 23:00 schedules the backup script to run at 11 PM. at is critical for ad hoc maintenance, delayed execution, and non-recurring automation tasks. It provides flexibility for administrators to run commands without immediate intervention and supports queue management, job listing, and removal via atq and atrm. Using at ensures precise timing for individual operations without modifying recurring scheduling mechanisms.
B) cron: cron schedules recurring tasks at specified intervals. While powerful for automation, it is not intended for single, one-time execution.
C) systemctl enable: systemctl enable sets services to start at boot but does not schedule one-time commands. It manages service persistence, not ad hoc tasks.
D) batch: batch schedules jobs to run when system load is low. It may delay execution and is not time-specific, making it unsuitable for precise one-time task scheduling.
at is correct because it allows precise scheduling of single tasks at a specified time. cron handles recurring tasks, systemctl enable manages service startup, and batch is load-dependent. Mastery of at is essential for Linux administrators for flexible, ad hoc task scheduling and operational efficiency.
Question 91
Which command is used to display all active systemd services and their status on a Linux system?
A) systemctl list-units –type=service
B) service –status-all
C) ps aux
D) top
Answer A) systemctl list-units –type=service
Explanation
A) systemctl list-units –type=service: This command displays all active systemd units of type service, including their state (active, inactive, failed), loaded status, sub-status, and description. For example, systemctl list-units –type=service outputs columns showing UNIT, LOAD, ACTIVE, SUB, and DESCRIPTION. Administrators rely on this command to monitor system services, identify failures, ensure critical services are running, and troubleshoot service-related issues. It provides an organized, real-time view of the current system state and can be filtered, sorted, or combined with other systemctl commands to restart, stop, or mask services. Systemd has become the default init system in modern Linux distributions, making mastery of systemctl critical for managing services, ensuring system reliability, and auditing service activity.
B) service –status-all: This legacy command displays the status of SysV init scripts. While informative on older systems, it is largely deprecated in systemd-based distributions and may not reflect the current state of all systemd-managed services accurately.
C) ps aux: ps aux lists running processes with their resource usage. While one can infer service activity indirectly, it does not provide structured service-specific information such as loaded or sub-status.
D) top: top provides dynamic real-time monitoring of processes, CPU, and memory, but it does not provide an organized view of systemd services or their state.
systemctl list-units –type=service is correct because it provides a structured, systemd-native view of all active services. service –status-all is legacy, ps aux is process-focused, and top is performance-focused. Mastery of systemctl is essential for administrators managing modern Linux services and maintaining operational reliability.
Question 92
Which command is used to modify user passwords in Linux?
A) passwd
B) usermod
C) chage
D) adduser
Answer A) passwd
Explanation
A) passwd: passwd changes the password of a user account. For example, running passwd username prompts for the new password and updates it securely in /etc/shadow. Administrators use passwd to maintain account security, enforce password policies, and respond to compromised credentials. passwd supports options to force password expiration, lock/unlock accounts, and update password hashes. Proper management of passwords is critical to maintaining system security, preventing unauthorized access, and complying with organizational password policies.
B) usermod: usermod modifies user account attributes such as home directory, shell, UID, or GID but does not change the password directly. While usermod is essential for account administration, it is not the tool for password management.
C) chage: chage manages password aging, expiration, and account validity. While it complements passwd for enforcing password policies, it does not directly set or update the password.
D) adduser: adduser creates new user accounts interactively. It can prompt for an initial password during creation but is not the standard tool for modifying existing user passwords.
passwd is correct because it directly modifies user passwords. usermod modifies account attributes, chage manages aging policies, and adduser is for new account creation. Mastery of passwd is essential for Linux administrators to secure accounts and manage authentication effectively.
Question 93
Which command is used to display the disk space usage of a directory and its subdirectories in a human-readable format?
A) du -h
B) df -h
C) ls -lh
D) stat
Answer A) du -h
Explanation
A) du -h: du (disk usage) with the -h flag summarizes disk space usage of a directory and its contents in human-readable units (KB, MB, GB). For example, du -h /var/log shows each subdirectory’s size and the total usage, helping administrators identify large directories and optimize storage. du is essential for capacity planning, cleaning up unnecessary files, and understanding file system utilization. It can be used with additional flags such as –max-depth to limit recursion, -s for total summary, and -c for cumulative totals. Regular monitoring with du ensures efficient storage usage, prevents disk exhaustion, and supports proactive maintenance.
B) df -h: df reports filesystem-level disk usage, showing total, used, and available space for mounted partitions. While useful for overall capacity, it does not provide directory-level breakdowns.
C) ls -lh: ls -lh shows file sizes in a human-readable format within a single directory but does not provide cumulative sizes for subdirectories. It is helpful for inspecting individual files but not for recursive usage analysis.
D) stat: stat displays detailed metadata for individual files, such as size, access times, and inode numbers, but does not summarize directory usage or recursively calculate totals.
du -h is correct because it provides a detailed, recursive view of directory and subdirectory disk usage. df -h focuses on filesystems, ls -lh shows individual files, and stat provides metadata only. Mastery of du is critical for Linux administrators to manage storage, identify space-intensive directories, and prevent disk space issues.
Question 94
Which command is used to display currently loaded kernel modules in Linux?
A) lsmod
B) modprobe
C) insmod
D) rmmod
Answer A) lsmod
Explanation
A) lsmod: lsmod lists currently loaded kernel modules along with their size, usage count, and dependencies. For example, lsmod output includes module names, memory usage, and number of dependent modules. Administrators use lsmod to verify module loading, troubleshoot hardware support, identify conflicts, and ensure drivers are active. It provides a snapshot of kernel-level components that interact with hardware, networking, and system features, which is crucial for system stability and performance analysis. Understanding lsmod allows administrators to diagnose module-related issues and plan system configurations accurately.
B) modprobe: modprobe is used to load or remove modules automatically, resolving dependencies. While it manages modules, it does not display the current state of loaded modules without additional commands.
C) insmod: insmod inserts a specified module into the kernel. It does not list currently loaded modules and requires manual dependency resolution, making it less flexible than modprobe.
D) rmmod: rmmod removes a module from the kernel. Like insmod, it affects kernel modules but does not provide a listing of currently loaded modules.
lsmod is correct because it displays all loaded kernel modules along with usage and dependencies. modprobe manages loading/removal, insmod inserts modules, and rmmod removes them. Mastery of lsmod is essential for Linux administrators to monitor hardware support, troubleshoot drivers, and ensure kernel stability.
Question 95
Which command is used to terminate a running process by its PID in Linux?
A) kill
B) pkill
C) killall
D) top
Answer A) kill
Explanation
A) kill: kill sends a signal to a process specified by its PID to terminate or modify its behavior. For example, kill -9 1234 forcefully terminates the process with PID 1234 using SIGKILL. kill supports a variety of signals, including graceful termination (SIGTERM), forceful termination (SIGKILL), and user-defined signals. Administrators use kill to manage runaway processes, release system resources, and prevent performance degradation caused by rogue or unresponsive applications. Proper use of kill ensures controlled process management and system stability, and understanding signal numbers and defaults is critical for safe operation.
B) pkill: pkill terminates processes based on name or attributes rather than PID. While convenient, it is less precise when multiple processes share the same name.
C) killall: killall terminates all processes matching a specific name. It is effective for stopping groups of processes but can be risky if multiple unrelated processes share the same name.
D) top: top allows interactive process management, including sending signals to processes, but it is an interface rather than a direct command for terminating by PID.
kill is correct because it allows precise termination of a process using its PID. pkill and killall target by name, and top provides an interactive interface. Mastery of kill is essential for Linux administrators to manage processes, maintain system performance, and prevent resource exhaustion.
Question 96
Which command is used to display current network interface configuration, including IP addresses, in Linux?
A) ip addr show
B) ifconfig
C) netstat -i
D) route
Answer A) ip addr show
Explanation
A) ip addr show: The ip command with addr show displays detailed network interface information, including IP addresses, link status, and MAC addresses. For example, ip addr show eth0 outputs the IP address, netmask, and interface state. Administrators use this command to troubleshoot network issues, verify IP assignments, and configure network interfaces. ip is part of the iproute2 suite and has largely replaced ifconfig in modern distributions due to its versatility, support for IPv6, and integration with other network management tools. Understanding ip addr show is critical for monitoring interface status, diagnosing connectivity problems, and ensuring correct network configuration.
B) ifconfig: ifconfig displays network interfaces and IP addresses but is deprecated in most modern Linux distributions. While it provides basic configuration, it lacks the extended capabilities and consistent output of ip.
C) netstat -i: netstat -i shows network interface statistics, such as packet transmission and errors, but does not display assigned IP addresses or detailed interface configuration. It is more suitable for performance monitoring rather than configuration verification.
D) route: route displays the kernel routing table, showing how packets are directed through network interfaces. While useful for routing diagnostics, it does not provide full interface configuration or IP details.
ip addr show is correct because it provides comprehensive interface information including IP addresses, link status, and MAC addresses. ifconfig is deprecated, netstat -i is statistics-focused, and route is routing-focused. Mastery of ip addr show is essential for Linux administrators to configure, monitor, and troubleshoot network interfaces effectively.
Question 97
Which command is used to change the owner and group of a file or directory in Linux?
A) chown
B) chmod
C) chgrp
D) ls -l
Answer A) chown
Explanation
A) chown: chown changes the ownership of a file or directory, specifying both the user and the group. For example, chown john:developers file.txt assigns ownership of file.txt to user john and group developers. Proper ownership is critical for access control, security, and collaborative environments. Linux administrators use chown to ensure that files are only accessible to the intended users or groups, preventing unauthorized access or modification. chown can be used recursively with the -R flag to modify directories and their contents, making it a powerful tool for maintaining correct permissions in complex file hierarchies.
B) chmod: chmod changes file permissions (read, write, execute) but does not modify ownership. While it controls access, ownership is still necessary to enforce policies accurately.
C) chgrp: chgrp changes only the group ownership of a file or directory. It is useful for group-based permission management but cannot modify the user ownership.
D) ls -l: ls -l displays file ownership and permissions but cannot modify them. It is informative for auditing but not for administration.
chown is correct because it directly modifies both user and group ownership. chmod modifies permissions, chgrp modifies only group ownership, and ls -l only displays information. Mastery of chown is essential for Linux administrators to manage file ownership, enforce security, and ensure proper access control.
Question 98
Which command is used to monitor real-time network traffic on a specific interface in Linux?
A) tcpdump
B) ping
C) netstat
D) iftop
Answer A) tcpdump
Explanation
A) tcpdump: tcpdump captures and analyzes network packets in real-time on a specified interface. For example, tcpdump -i eth0 monitors all traffic passing through eth0, displaying packet headers, protocols, and source/destination addresses. Administrators use tcpdump to troubleshoot connectivity issues, analyze traffic patterns, and detect suspicious activity. tcpdump supports filtering by protocol, port, IP address, and even complex expressions for precise packet capture. Captured data can be saved for offline analysis or integrated with network monitoring systems. Understanding tcpdump is critical for security auditing, incident response, and diagnosing complex network problems.
B) ping: ping checks connectivity to a host and measures latency but does not capture traffic or provide protocol-level details. It is useful for basic network diagnostics but not for in-depth traffic analysis.
C) netstat: netstat shows active connections, listening ports, and routing tables but does not provide packet-level monitoring or real-time traffic capture. It is process and connection-focused rather than traffic-focused.
D) iftop: iftop provides a real-time overview of bandwidth usage by host connections on an interface but does not capture or analyze individual packets. It is useful for monitoring bandwidth consumption but lacks detailed packet inspection.
tcpdump is correct because it captures and displays real-time network packets, providing detailed analysis of traffic. ping tests connectivity, netstat lists connections, and iftop monitors bandwidth without packet details. Mastery of tcpdump is essential for Linux administrators handling network troubleshooting, security analysis, and traffic diagnostics.
Question 99
Which command is used to create a compressed archive of multiple files and directories in Linux?
A) tar -czf
B) gzip
C) zip
D) bzip2
Answer A) tar -czf
Explanation
A) tar -czf: The tar command with -c (create), -z (gzip compression), and -f (filename) flags creates a compressed archive. For example, tar -czf archive.tar.gz /home/user/documents packages multiple files and directories into a single gzip-compressed archive. Administrators rely on tar -czf for backups, archival storage, and efficient file transfer. It preserves directory structure, permissions, and symbolic links, ensuring data integrity. tar combined with gzip is a standard practice in Linux for creating portable, compressed archives that are widely compatible across distributions. Proper use of tar -czf allows system administrators to automate backups, manage storage efficiently, and facilitate disaster recovery.
B) gzip: gzip compresses individual files but does not archive multiple files or directories. It is commonly used in combination with tar for creating compressed archives.
C) zip: zip compresses and archives files into a .zip file format. While effective, it is less native to Linux environments and may lack some advanced features like permission preservation.
D) bzip2: bzip2 compresses individual files using higher compression ratios than gzip but does not handle archiving multiple files. It is also commonly combined with tar (tar -cjf) for archiving purposes.
tar -czf is correct because it compresses and archives multiple files and directories while preserving structure and permissions. gzip and bzip2 compress individual files, and zip is cross-platform but less native. Mastery of tar -czf is essential for Linux administrators for backups, archiving, and storage management.
Question 100
Which command is used to display the routing table and default gateway in Linux?
A) route
B) ip route show
C) netstat -r
D) traceroute
Answer B) ip route show
Explanation
A) route: route displays the routing table and default gateway in older Linux distributions. While functional, it is considered deprecated in favor of the iproute2 suite and may not reflect advanced routing configurations or IPv6 routes accurately.
B) ip route show: ip route show displays the kernel routing table, including network destinations, gateways, interface mappings, and route metrics. For example, ip route show outputs entries like default via 192.168.1.1 dev eth0 and 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100. Administrators use it to verify default gateways, troubleshoot routing issues, and ensure correct network packet flow. ip route show is part of iproute2, which provides comprehensive, modern network management features, including support for policy-based routing, multipath routing, and IPv6. Understanding this command is critical for diagnosing connectivity issues, configuring routers, and maintaining reliable network communication.
C) netstat -r: netstat -r displays the routing table and default gateway, similar to route. While useful, it is considered legacy and lacks integration with advanced iproute2 features.
D) traceroute: traceroute traces the path packets take to a destination, showing intermediate hops and latency. It is a diagnostic tool for connectivity but does not display the routing table or default gateway directly.
ip route show is correct because it provides a modern, detailed, and comprehensive view of routing tables and gateways. route and netstat -r are legacy commands, and traceroute is for path analysis. Mastery of ip route show is essential for Linux administrators for network configuration, troubleshooting, and performance optimization.
Popular posts
Recent Posts
