ITU Online IT Training
+1 855.488.5327 customerservice@ituonline.com Mon – Fri: 9:00am – 5:00pm ET

CompTIA Linux+ XK0-005 Practice Questions

100 multiple choice questions with detailed answer explanations.

Ready to start learning?Individual Plans →Team Plans →
Q1. Which command is used to display the current working directory in a Linux terminal?

Correct answer:

  • pwd

    The 'pwd' command stands for 'print working directory' and shows the current directory you are in.

Other options — why they're wrong:

  • ls

    The 'ls' command lists the contents of a directory, not the current working directory.

  • cd

    The 'cd' command is used to change directories, not to display the current directory.

  • mkdir

    The 'mkdir' command is used to create a new directory, not to show the current working directory.

Q2. What is the primary purpose of the 'chmod' command in Linux?

Correct answer:

  • Change file permissions

    The primary purpose of the 'chmod' command is to change the read, write, and execute permissions of files and directories in Linux.

Other options — why they're wrong:

  • Change file ownership

    'chmod' does not change ownership; it only modifies permissions.

  • Create a new directory

    'chmod' is not used for creating directories; that is done with the 'mkdir' command.

  • Delete a file

    'chmod' does not delete files; it is used for altering permissions instead.

Q3. In which directory would you typically find system configuration files in a Linux system?

Correct answer:

  • /etc

    The /etc directory contains system configuration files in a Linux system.

Other options — why they're wrong:

  • /home

    This directory is used for user home directories, not system configuration files.

  • /bin

    The /bin directory contains essential binary executables, not configuration files.

  • /var

    The /var directory is used for variable data files, not primarily for system configuration.

Q4. Which of the following commands would you use to search for a specific string in a file?

Correct answer:

  • grep 'specific_string' filename

    The `grep` command is used to search for specific strings in files, making it the correct choice for this question.

Other options — why they're wrong:

  • find 'specific_string' filename

    The `find` command is used to search for files and directories, not for strings within files.

  • search 'specific_string' filename

    The `search` command is not a standard command used for searching strings in files.

  • locate 'specific_string' filename

    The `locate` command is used to find files by name, not for searching specific strings within the contents of files.

Q5. What does the 'top' command display in a Linux system?

Correct answer:

  • Displays the current running processes and their resource usage

    The 'top' command provides a dynamic real-time view of system processes, showing CPU and memory usage.

Other options — why they're wrong:

  • Shows the disk usage statistics

    The 'top' command does not display disk usage; it focuses on processes and their resource consumption.|

  • Lists the files in a directory

    This is not related to the 'top' command, which is about process management, not file listing.|

  • Displays network connections

    While network connections can be monitored, the 'top' command specifically focuses on processes rather than network activity.

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

Correct answer:

  • ln -s

    The 'ln -s' command is used to create a symbolic link in Linux, where '-s' specifies that the link should be symbolic.

Other options — why they're wrong:

  • ln -f

    The 'ln -f' command is used to forcefully create a hard link, not a symbolic link.|

  • link -s

    The command 'link -s' is not a valid command in Linux for creating symbolic links.|

  • symlink

    'symlink' is not a command in Linux; it is a term used to describe symbolic links but not an executable command.

Q7. What is the purpose of the 'sudo' command in Linux?

Correct answer:

  • The 'sudo' command allows a user to run programs with the security privileges of another user, typically the superuser.

    This is essential for performing administrative tasks without having to log in as the root user.

Other options — why they're wrong:

  • The 'sudo' command is primarily for file management tasks, which is incorrect because it is not limited to file management.

    The 'sudo' command is used for executing commands with elevated privileges, not just for file management.

  • The 'sudo' command is a networking command used for connecting to remote servers, which is incorrect as it does not facilitate remote connections.

    The 'sudo' command does not pertain to networking but rather to privilege management.

  • The 'sudo' command is used to shut down the system, which is incorrect since it serves a broader purpose.

    While 'sudo' can be used to shut down the system, its main purpose is to execute commands with elevated privileges.

Q8. Which file contains user account information in a Linux system?

Correct answer:

  • /etc/passwd

    This file contains the basic user account information including usernames and user IDs.

Other options — why they're wrong:

  • /etc/shadow

    This file contains encrypted password information and is used for authentication, not basic account information.

  • /home/user

    This is a directory for a specific user's files, not a file containing account information.

  • /etc/group

    This file contains group account information, not individual user account details.

Q9. What command will you use to update the package index on a Debian-based system?

Correct answer:

  • sudo apt update

    This command refreshes the package index, allowing you to see the latest available packages and their versions.

Other options — why they're wrong:

  • sudo apt upgrade

    This command is used to upgrade installed packages to their latest versions, not to update the package index.

  • apt-get install

    This command is used to install a specific package, not to update the package index.

  • apt-cache search

    This command is used to search for packages in the package index, not to update it.

Q10. Which of the following is a common text editor available in Linux?

Correct answer:

  • Vim

    Vim is a widely used text editor in Linux environments, known for its efficiency and powerful features.

Other options — why they're wrong:

  • Nano

    Nano is also a text editor in Linux, but it is not as commonly referred to as Vim.

  • Gedit

    Gedit is a text editor for the GNOME desktop environment, but it is not universally available on all Linux systems.

  • Emacs

    Emacs is another text editor available in Linux, but it is not as widely adopted as Vim.

Q11. What is the function of the 'grep' command in a Linux environment?

Correct answer:

  • Search for specific patterns in files

    The 'grep' command is used to search for specific patterns or strings within files in a Linux environment.

Other options — why they're wrong:

  • Delete files based on patterns

    'grep' does not delete files; it is specifically used for searching text.

  • Copy files to a different location

    This is not the purpose of 'grep'; it does not handle file copying.

  • List directory contents

    'grep' does not list directory contents; it is solely focused on searching text patterns.

Q12. Which command can be used to display disk usage statistics in Linux?

Correct answer:

  • df

    The 'df' command shows the amount of disk space used and available on filesystems.

Other options — why they're wrong:

  • du

    The 'du' command is used to estimate file space usage, but it does not provide a summary of disk usage statistics for all filesystems like 'df' does.

  • ls

    The 'ls' command lists directory contents, but it does not display disk usage statistics.

  • stat

    The 'stat' command provides detailed information about file or filesystem attributes, not overall disk usage statistics.

Q13. What is the significance of the '/etc/passwd' file in a Linux system?

Correct answer:

  • The '/etc/passwd' file contains user account information.

    It is essential for the system to manage user accounts and their properties.

Other options — why they're wrong:

  • The '/etc/passwd' file stores system logs.

    Logs are typically stored in files like '/var/log/syslog', not in '/etc/passwd'.

  • The '/etc/passwd' file is used to store network configurations.

    Network configurations are usually found in files like '/etc/network/interfaces' or '/etc/sysconfig/network-scripts'.

  • The '/etc/passwd' file is a binary file used for system processes.

    '/etc/passwd' is a plain text file, not a binary file, and it is human-readable.

Q14. How can you view currently running processes in Linux?

Correct answer:

  • ps aux

    The 'ps aux' command lists all running processes along with their details in Linux.

Other options — why they're wrong:

  • top

    The 'top' command displays a dynamic view of running processes, but it is not the command specifically for listing processes.|

  • htop

    'htop' is an enhanced version of 'top', but it also does not specifically list processes in the way 'ps aux' does.|

  • ls /proc

    While 'ls /proc' shows the process directory, it does not provide a direct view of running processes like 'ps aux' does.|

Q15. What does the 'df' command do when executed in the terminal?

Correct answer:

  • Displays disk space usage

    The 'df' command reports the amount of disk space used and available on file systems.

Other options — why they're wrong:

  • Lists all files in a directory

    This describes the 'ls' command, not 'df'.

  • Shows current network connections

    This describes the 'netstat' command, not 'df'.

  • Displays current memory usage

    This describes the 'free' command, not 'df'.

Q16. Which command is used to change the ownership of a file in Linux?

Correct answer:

  • chown

    The 'chown' command is used to change the ownership of files and directories in Linux.

Other options — why they're wrong:

  • chmod

    The 'chmod' command is used to change the permissions of files and directories, not ownership.

  • chgrp

    The 'chgrp' command is used to change the group ownership of a file, not the user ownership.

  • mv

    The 'mv' command is used for moving or renaming files, not for changing ownership.

Q17. What is the purpose of the 'tar' command in Linux?

Correct answer:

  • To create and extract compressed archive files

    The 'tar' command is used to create and extract files from archive files, often used for backup and distribution.

Other options — why they're wrong:

  • To manage user permissions

    This does not relate to the 'tar' command, which is not involved in user permissions management.

  • To monitor system performance

    The 'tar' command does not have any functionality related to system performance monitoring.

  • To install software packages

    The 'tar' command is not used for installing software; it is primarily for archiving files.

Q18. How would you list all files, including hidden files, in a directory?

Correct answer:

  • ls -a

    The 'ls -a' command lists all files in a directory, including hidden files (those starting with a dot).

Other options — why they're wrong:

  • ls

    This command lists only visible files and does not include hidden files.

  • ls -l

    While this command lists files in long format, it does not include hidden files unless combined with the '-a' option.

  • ls -a -l

    Although this command lists all files in long format, it is not a standalone command to just list files.

Q19. Which configuration file is typically used for network interface settings in Linux?

Correct answer:

  • /etc/network/interfaces

    This file is commonly used in Debian-based systems for configuring network interfaces.

Other options — why they're wrong:

  • /etc/sysconfig/network-scripts/ifcfg-eth0

    This file is specific to Red Hat-based systems and may not be applicable to all Linux distributions.

  • /etc/netplan/config.yaml

    This file is used in certain Linux distributions like Ubuntu for network configuration but is not the typical file for all distributions.

  • /etc/resolv.conf

    This file is used for DNS resolution settings, not for configuring network interfaces.

Q20. What is the role of the 'init' system in managing services on a Linux system?

Correct answer:

  • The 'init' system is responsible for starting and stopping services on a Linux system during boot and shutdown.

    It initializes the system by launching the necessary services and processes.

Other options — why they're wrong:

  • The 'init' system is primarily used for managing user accounts and permissions.

    The 'init' system focuses on service management, not user account management.|

  • The 'init' system is a graphical interface for service management on Linux.

    The 'init' system operates in a command-line environment and does not provide a graphical interface.|

  • The 'init' system is a configuration file for service settings on Linux.

    The 'init' system is not just a configuration file; it is a process that manages services.

Q21. What command is used to view the contents of a file in Linux?

Correct answer:

  • cat

    The 'cat' command is used to concatenate and display the contents of a file in Linux.

Other options — why they're wrong:

  • less

    The 'less' command is used to view the contents of a file one screen at a time, but it's not the command specifically for displaying contents directly.

  • view

    The 'view' command is a variant of 'vi' for viewing files, not primarily just for displaying file contents.

  • more

    The 'more' command is used for paging through text one screen at a time, similar to 'less', but it is not the primary command for viewing file contents.

Q22. Which command allows you to change the priority of a running process?

Correct answer:

  • renice

    The 'renice' command is specifically designed to change the priority of an already running process.

Other options — why they're wrong:

  • nice

    The 'nice' command is used to start a process with a specified priority, but it does not change the priority of a running process.

  • kill

    The 'kill' command is used to terminate processes, not to change their priority.

  • ps

    The 'ps' command displays information about running processes but does not change their priority.

Q23. What is the function of the 'ps' command in a Linux environment?

Correct answer:

  • Display the current processes running on the system

    The 'ps' command is used to display information about the currently running processes, including their PID, status, and resource usage.

Other options — why they're wrong:

  • Terminate a process running on the system

    The 'ps' command does not terminate processes; it only displays information about them.

  • List all files in a directory

    The 'ps' command is not used for listing files; that function is performed by commands like 'ls'.

  • Change file permissions

    The 'ps' command does not change file permissions; it is used to view process information.

Q24. Which command is used to install a package on a Red Hat-based system?

Correct answer:

  • yum install

    This command is used to install packages on Red Hat-based systems like CentOS and Fedora.

Other options — why they're wrong:

  • apt-get install

    This command is used for package installation on Debian-based systems, not Red Hat-based systems.

  • dnf install

    While this is also a valid command for package installation, it is not the most commonly recognized for older Red Hat systems, where yum is more prevalent.

  • rpm -i

    This command is used to install RPM packages directly, but it does not handle dependencies automatically like yum does.

Q25. What does the 'chmod 755' command accomplish when applied to a file?

Correct answer:

  • Change permissions to read, write, and execute for the owner, and read and execute for the group and others

    This command sets the file permissions to allow full access for the owner and limited access for the group and others, which is a common permission setting for executable files.

Other options — why they're wrong:

  • Change permissions to read and write for everyone

    This is incorrect because 'chmod 755' does not grant write permissions to the group and others, only read and execute.

  • Change permissions to execute only for the owner

    This is incorrect because 'chmod 755' allows read and execute permissions for both the group and others, not just the owner.

  • Remove all permissions from the file

    This is incorrect as 'chmod 755' actually grants permissions rather than removing them.

Q26. In Linux, what is the purpose of the '/etc/fstab' file?

Correct answer:

  • The '/etc/fstab' file is used to define how disk partitions, filesystems, and swap space are mounted into the filesystem in Linux.

    This file contains information about the various filesystems and their mount points, allowing the system to automatically mount them at boot.

Other options — why they're wrong:

  • The '/etc/fstab' file is used to configure network settings in Linux.

    The '/etc/fstab' file does not concern itself with network configurations; it focuses on filesystems and their mounts.

  • The '/etc/fstab' file is responsible for user permissions in Linux.

    User permissions are managed by the system's access control mechanisms, not by the '/etc/fstab' file.

  • The '/etc/fstab' file contains system logs in Linux.

    System logs are typically stored in other locations, such as '/var/log', not in the '/etc/fstab' file.

Q27. How can you find the IP address of your Linux machine from the command line?

Correct answer:

  • hostname -I

    The command 'hostname -I' will display the IP address(es) of the machine in a simple format.

Other options — why they're wrong:

  • ifconfig

    The command 'ifconfig' is deprecated in many Linux distributions, and 'ip addr' is preferred for finding IP addresses.

  • ip addr

    The command 'ip addr' is correct, but 'hostname -I' is a simpler way to just get the IP address.

  • ipconfig

    The command 'ipconfig' is specific to Windows and will not work on a Linux machine.

Q28. What is the function of the 'hostnamectl' command in a Linux system?

Correct answer:

  • Display and manage the system hostname

    The 'hostnamectl' command is used to view and change the hostname and related settings in a Linux system.

Other options — why they're wrong:

  • Configure network settings

    This option is incorrect as 'hostnamectl' does not deal with network settings directly; it focuses on hostname management.

  • Show system uptime

    This is incorrect because 'hostnamectl' does not provide information about system uptime; it specifically relates to hostname.

  • Manage user accounts

    This option is incorrect; 'hostnamectl' is not used for managing user accounts in Linux.

Q29. Which command would you use to view system logs in Linux?

Correct answer:

  • cat /var/log/syslog

    This command allows you to view the system logs in Linux, specifically from the syslog file.

Other options — why they're wrong:

  • dmesg

    The 'dmesg' command displays the kernel ring buffer messages, not the system logs.

  • tail -f /var/log/messages

    The 'tail -f /var/log/messages' command is used to monitor log file updates in real-time, but it requires the log to exist and is not a general command for viewing logs.

  • ls /var/log

    The 'ls /var/log' command lists the log files in the directory but does not display their contents.

Q30. What does the 'kill' command do when used with a process ID?

Correct answer:

  • Terminate a running process

    The 'kill' command sends a signal to the specified process ID, which typically results in terminating that process.

Other options — why they're wrong:

  • Send a signal to pause a process

    The 'kill' command is not used to pause processes; it is primarily for termination.

  • Restart a process

    The 'kill' command does not restart processes; it only terminates them.

  • Change the priority of a process

    The 'kill' command does not change process priority; it is used to stop processes.

Q31. What is the purpose of the 'ls' command in a Linux environment?

Correct answer:

  • List files and directories in the current directory

    The 'ls' command is used to list files and directories in the current working directory in a Linux environment.

Other options — why they're wrong:

  • Display the contents of a file

    The 'cat' command is used to display the contents of a file, not 'ls'.

  • Change the current directory

    The 'cd' command is used to change the current directory, not 'ls'.

  • Show system information

    The 'uname' command is typically used to show system information, not 'ls'.

Q32. How can you check the current version of the Linux kernel running on your system?

Correct answer:

  • uname -r

    This command displays the kernel version currently in use.

Other options — why they're wrong:

  • cat /etc/os-release

    This command shows the operating system information but not the kernel version.

  • lsb_release -a

    This command provides information about the Linux distribution but not the kernel version.

  • dmesg

    |This command may show kernel messages but is not a direct way to check the kernel version.

Q33. Which command is used to change the default run level in a Linux system?

Correct answer:

  • initdefault

    The 'initdefault' command is used in the '/etc/inittab' file to set the default run level for the system.

Other options — why they're wrong:

  • setrunlevel

    This is not a valid command in Linux for changing the default run level.

  • runlevel

    The 'runlevel' command is used to display the current run level, not change it.

  • systemctl set-default

    While 'systemctl set-default' can change the default target in systemd systems, it is not the traditional method used for changing the default run level in all Linux systems.

Q34. What file contains the information about system services and their statuses in a systemd-based Linux distribution?

Correct answer:

  • /etc/systemd/system/

    This directory contains systemd unit files and information about system services and their statuses.

Other options — why they're wrong:

  • /var/lib/systemd/system/

    This file does not contain service information; it holds systemd unit files.

  • /var/run/systemd/system/

    This directory is used for runtime unit files, not for persistent configurations.

  • /etc/init.d/

    This is used in SysVinit systems for managing services, not in systemd.

Q35. What does the 'find' command do when used in the terminal?

Correct answer:

  • Search for files and directories in a specified location

    The 'find' command is used to search for files and directories within a directory hierarchy based on specific criteria.

Other options — why they're wrong:

  • List all files in the current directory

    The 'ls' command is used to list files in the current directory, not 'find'.

  • Delete files in a directory

    The 'find' command can be used to delete files but is not primarily designed for that purpose; its primary function is to search for files.

  • Display the contents of a file

    The 'cat' command is used to display the contents of a file, not 'find'.

Q36. Which command can be used to display and manage user sessions in Linux?

Correct answer:

  • who -u

    The 'who -u' command displays information about user sessions, including the time they logged in and their terminal.

Other options — why they're wrong:

  • who

    The 'who' command displays who is logged on but does not manage user sessions.

  • w

    The 'w' command shows who is logged in and what they are doing, but it does not manage user sessions.

  • usermod

    The 'usermod' command is used to modify user accounts, not to display or manage user sessions.

Q37. How do you compress a directory into a .tar.gz file using the command line?

Correct answer:

  • tar -czvf archive.tar.gz /path/to/directory

    This command creates a compressed .tar.gz file of the specified directory using the tar utility.

Other options — why they're wrong:

  • zip -r archive.zip /path/to/directory

    This command creates a .zip file, not a .tar.gz file.

  • tar -cvzf archive.tar /path/to/directory

    This command creates a .tar file instead of a .tar.gz file since it is missing the gzip compression flag (-z).

  • gzip -r /path/to/directory

    This command attempts to compress files individually, not the directory as a .tar.gz file.

Q38. What is the role of the 'cron' daemon in a Linux environment?

Correct answer:

  • Manages scheduled tasks and jobs

    The 'cron' daemon is responsible for executing scheduled tasks at specified intervals in a Linux environment.

Other options — why they're wrong:

  • Handles system security

    The 'cron' daemon does not manage system security; that role is typically handled by other services and tools.

  • Processes user input

    The 'cron' daemon does not process user input; it is focused on executing scheduled commands.

  • Manages system logs

    The 'cron' daemon is not responsible for managing system logs; that is typically done by logging services.

Q39. How can you check what services are currently active on a Linux system?

Correct answer:

  • systemctl list-units --type=service

    This command lists all active services and their statuses on a Linux system using systemd.

Other options — why they're wrong:

  • service --status-all

    This command shows the status of all services but may not indicate which ones are currently active.

  • ps aux

    This command lists all running processes, not specifically services.

  • top

    This command displays running processes in real-time but does not provide information about active services.

Q40. Which command would you use to display the manual page for a specific command in Linux?

Correct answer:

  • man

    The 'man' command is used to display the manual pages for commands in Linux, providing detailed information about their usage.

Other options — why they're wrong:

  • help

    The 'help' command provides information about shell built-in commands, not general commands.

  • info

    The 'info' command is used to display documentation in a different format, but it is not the standard way to access manual pages for commands.

  • whatis

    The 'whatis' command provides a brief description of a command, but does not display the full manual page.

Q41. What is the purpose of the 'man' command in Linux?

Correct answer:

  • Display manual pages for commands

    The 'man' command in Linux is used to display the manual pages for various commands, providing users with detailed information on how to use them.

Other options — why they're wrong:

  • Show system information

    The 'man' command does not provide system information; it focuses on displaying documentation for commands.

  • Compile programs

    The 'man' command is not used for compiling; it is solely for accessing command manuals.

  • Change file permissions

    The 'man' command does not change file permissions; it is meant for obtaining command information.

Q42. Which command would you use to display the last 10 lines of a file?

Correct answer:

  • tail

    The 'tail' command is used to display the last part of a file, and by default, it shows the last 10 lines.

Other options — why they're wrong:

  • head

    The 'head' command is used to display the first part of a file, not the last lines.

  • cat

    The 'cat' command displays the entire content of a file, not just the last 10 lines.

  • less

    The 'less' command is used for paging through text one screen at a time, not specifically for displaying the last 10 lines.

Q43. What is the significance of the '/etc/sudoers' file in a Linux system?

Correct answer:

  • The '/etc/sudoers' file defines user permissions for executing commands as the superuser.

    It specifies which users can run commands with elevated privileges and under what conditions.

Other options — why they're wrong:

  • The '/etc/sudoers' file stores system logs for user activity.

    The '/etc/sudoers' file does not store logs; it is used for defining user permissions for the sudo command.|

  • The '/etc/sudoers' file is used to manage user account information.

    The '/etc/sudoers' file does not manage user accounts; it specifically governs sudo permissions for users.|

  • The '/etc/sudoers' file is a configuration file for network settings.

    The '/etc/sudoers' file is not involved in network configuration; it is solely for sudo access control.

Q44. How can you schedule a task to run at a specific time using the command line?

Correct answer:

  • at command

    The 'at' command is used to schedule a task to run at a specific time in Unix-like operating systems.

Other options — why they're wrong:

  • cron job

    The 'cron' system is used for scheduling recurring tasks, not for one-time scheduled tasks.

  • shutdown command

    The 'shutdown' command is used to turn off or restart the system, not for scheduling tasks.

  • task scheduler

    While task schedulers exist, they are typically GUI-based and not command line-based, making this answer incorrect for command line context.

Q45. What does the 'whoami' command do in a Linux environment?

Correct answer:

  • Displays the current logged-in user's username

    The 'whoami' command returns the username of the current user in the Linux environment.

Other options — why they're wrong:

  • Shows the list of all users on the system

    This command does not provide a list of all users; it only shows the current user.

  • Logs out the current user

    The 'whoami' command does not log out users; it only displays their username.

  • Displays the current system's IP address

    This command does not display IP addresses; it focuses solely on the current user's username.

Q46. Which command is used to check the status of services managed by systemd?

Correct answer:

  • systemctl status

    This command shows the current status of a service managed by systemd, providing details about whether it is active, inactive, or failed.

Other options — why they're wrong:

  • service status

    The 'service' command does not directly check the status of services managed by systemd in a unified manner.

  • check-service

    There is no such command as 'check-service' in relation to systemd services.

  • systemd status

    The correct command is 'systemctl status', not 'systemd status'.

Q47. How do you remove a directory and its contents in Linux?

Correct answer:

  • rm -r directory_name

    The command 'rm -r' is used to recursively remove a directory and all its contents in Linux.

Other options — why they're wrong:

  • rmdir directory_name

    The 'rmdir' command only removes empty directories, not those containing files.

  • rm -f directory_name

    The 'rm -f' command forces the removal of files but does not remove directories unless combined with '-r'.

  • mv directory_name /path/to/new/location

    The 'mv' command is used to move directories, not to remove them.

Q48. What is the purpose of the 'alias' command in a Linux shell?

Correct answer:

  • Create a shortcut for a command

    The 'alias' command allows users to create shortcuts for longer commands, making it easier to execute them.

Other options — why they're wrong:

  • Display a list of all commands

    The 'alias' command does not display commands; it creates shortcuts for existing commands.

  • Remove a command from the shell

    The 'alias' command does not remove commands; it only creates aliases for them.

  • Change the shell prompt appearance

    The 'alias' command does not change the shell prompt; it is used for creating command shortcuts.

Q49. Which command would you use to change the password of a user in Linux?

Correct answer:

  • passwd

    The 'passwd' command is used in Linux to change a user's password.

Other options — why they're wrong:

  • chage

    'chage' is used to change user password expiry information, not the password itself.

  • useradd

    'useradd' is used to create a new user, not to change a password.

  • usermod

    'usermod' is used to modify user accounts, but not specifically for changing passwords.

Q50. What does the 'rsync' command do in a Linux system?

Correct answer:

  • Synchronizes files and directories between two locations

    The 'rsync' command is used to efficiently transfer and synchronize files between a local and a remote system, or between two local directories.

Other options — why they're wrong:

  • Copies files without synchronization

    The statement does not accurately describe the function of the 'rsync' command. It is primarily used for synchronization rather than simple copying.

  • Deletes files in the source directory

    The statement is incorrect as 'rsync' does not delete files in the source directory; it synchronizes files and can delete files in the destination if specified.

  • Compresses files during transfer

    While 'rsync' can compress files during transfer, this is not its primary function, and the statement oversimplifies its capabilities.

Q51. What is the purpose of the 'ping' command in a Linux environment?

Correct answer:

  • Check network connectivity

    The 'ping' command is used to check if a network device is reachable and to measure the round-trip time for messages sent to the destination.

Other options — why they're wrong:

  • Test CPU performance

    The 'ping' command does not test CPU performance; it is specifically for network connectivity.

  • Display system information

    The 'ping' command does not display system information; it is used for checking network reachability.

  • Send large files over a network

    The 'ping' command is not used for sending files; it is primarily for testing network connections.

Q52. Which command is used to list environmental variables in a Linux shell?

Correct answer:

  • env

    The 'env' command is specifically used to display all environmental variables in a Linux shell.

Other options — why they're wrong:

  • printenv

    The correct command to list environmental variables is 'env' or 'echo $VARIABLE_NAME' for a specific variable.

  • set

    This command is used to set shell options and positional parameters, not specifically for listing environmental variables.

  • export

    The 'export' command is used to set environment variables, not to list them.

Q53. What does the 'uname -a' command display in a Linux system?

Correct answer:

  • Kernel Information

    The 'uname -a' command displays system information including the kernel version, hostname, and architecture.

Other options — why they're wrong:

  • Operating System License

    The command does not provide information about the operating system license; it focuses on system details.

  • User Account Details

    The 'uname -a' command does not display user account details; it provides information about the kernel and system.

  • Disk Usage Statistics

    The command does not provide disk usage statistics; it is used for displaying system and kernel information.

Q54. How do you find out which processes are using a specific port in Linux?

Correct answer:

  • lsof -i :

    Using lsof with the -i option allows you to see the processes using a specific port, where is the actual port number you want to check.

Other options — why they're wrong:

  • netstat -tuln

    This command shows network connections but does not specifically identify which processes are using a certain port.

  • ps aux

    |This command is used to search for processes but does not directly indicate which ones are using a specific port.

  • ss -ltnp

    While ss is a useful tool for displaying socket statistics, it requires additional parameters to specify the port in question.

Q55. What is the function of the 'sudoers' file in a Linux system?

Correct answer:

  • The 'sudoers' file defines which users have permission to run commands as the superuser.

    It controls user permissions for executing commands with elevated privileges, enhancing system security.

Other options — why they're wrong:

  • The 'sudoers' file is used for user authentication only.

    The 'sudoers' file does more than just authentication; it specifies command privileges too.|

  • The 'sudoers' file stores system logs related to user activity.

    The 'sudoers' file does not store logs; it is focused on user permissions for command execution.|

  • The 'sudoers' file is primarily for setting up user accounts in Linux.

    The 'sudoers' file is not for account setup; it is specifically for managing command execution privileges.

Q56. Which command can be used to display the current user's group memberships?

Correct answer:

  • groups

    The 'groups' command shows the current user's group memberships in Unix/Linux systems.

Other options — why they're wrong:

  • id

    The 'id' command provides user and group information, but does not focus specifically on displaying group memberships only.

  • whoami

    The 'whoami' command displays the current user’s name but does not show group memberships.

  • getent

    The 'getent' command retrieves entries from databases, but it does not directly display the current user's group memberships.

Q57. What is the significance of the '/var/log' directory in a Linux system?

Correct answer:

  • The '/var/log' directory stores log files for system and application events.

    This directory is crucial for monitoring system activities, troubleshooting issues, and understanding system behavior.

Other options — why they're wrong:

  • The '/etc' directory is where configuration files are stored.

    The '/etc' directory is important for configuration files, but it does not serve the purpose of logging system activity.

  • The '/home' directory contains user home directories and personal files.

    The '/home' directory is used for user files and is not related to system logging.

  • The '/bin' directory holds essential user binaries and commands.

    The '/bin' directory is for executable files and commands but does not contain log files.

Q58. How can you create a new user account in Linux from the command line?

Correct answer:

  • Use the command 'adduser username'

    The 'adduser' command is the correct way to create a new user account in Linux from the command line.

Other options — why they're wrong:

  • Use the command 'newuser username'

    'newuser' is not a valid command for creating a new user in Linux.

  • Use the command 'createuser username'

    'createuser' is not a recognized command for adding new users in Linux.

  • Use the command 'useradd username'

    While 'useradd' is a valid command, 'adduser' is often preferred for its user-friendly features.

Q59. What command would you use to view the system's hardware information?

Correct answer:

  • lshw

    The 'lshw' command lists detailed information about the hardware configuration of the system.

Other options — why they're wrong:

  • hwinfo

    'hwinfo' is not a standard command on all systems and may not provide as comprehensive information as 'lshw'.

  • dmidecode

    'dmidecode' focuses more on BIOS and hardware-related information rather than a complete view of hardware configuration.

  • lsusb

    'lsusb' only lists USB devices and does not provide a complete overview of the system's hardware information.

Q60. What is the purpose of the 'mount' command in Linux?

Correct answer:

  • The 'mount' command is used to attach a filesystem to a directory in the Linux file hierarchy.

    This command allows users to access and manage files on different storage devices by integrating them into the existing directory structure.

Other options — why they're wrong:

  • The 'mount' command is primarily for managing user permissions.

    The 'mount' command is not related to user permissions; it is specifically for attaching filesystems to the directory hierarchy.|

  • The 'mount' command is used to install software packages.

    The 'mount' command does not pertain to software installation; it is focused on filesystem management.|

  • The 'mount' command is used to display system information.

    The 'mount' command does not display system information; it is used for mounting filesystems.

Q61. What command is used to display the disk space usage of a specific directory in Linux?

Correct answer:

  • du

    The 'du' command is used to estimate file space usage for directories in Linux.

Other options — why they're wrong:

  • df

    The 'df' command is used to report file system disk space usage, not specific directories.

  • ls

    The 'ls' command lists directory contents, not disk space usage.

  • stat

    The 'stat' command provides detailed information about files or directories, but not their disk space usage.

Q62. How can you view the current user's home directory in a Linux environment?

Correct answer:

  • echo $HOME

    This command displays the path to the current user's home directory in Linux.

Other options — why they're wrong:

  • cd ~

    This command changes the current directory to the user's home directory but does not display it.|

  • ls /home

    This command lists the contents of the /home directory, which may not directly reflect the current user's home directory.|

  • pwd

    This command prints the current working directory but does not specifically indicate the home directory.|

Q63. What is the purpose of the 'wget' command in Linux?

Correct answer:

  • Download files from the web

    The 'wget' command is used to download files from the internet, making it a powerful tool for retrieving content.

Other options — why they're wrong:

  • Upload files to a web server

    The 'wget' command does not upload files; it is specifically designed for downloading.

  • Manage system processes

    The 'wget' command does not manage processes; it is focused on file retrieval.

  • Display system information

    The 'wget' command does not display system information; it is used for downloading files from the web.

Q64. Which command would you use to display the network configuration of your Linux system?

Correct answer:

  • ip addr

    This command displays the network configuration, including IP addresses and network interfaces.

Other options — why they're wrong:

  • ifconfig

    The ifconfig command is deprecated in many Linux distributions in favor of the ip command.

  • netstat

    The netstat command is used for network statistics, not for displaying the network configuration.

  • ping

    The ping command is used to test connectivity to a host, not to display network configuration.

Q65. What is the function of the 'curl' command in a Linux environment?

Correct answer:

  • The 'curl' command is used to transfer data from or to a server

    It supports various protocols including HTTP, HTTPS, FTP, and more, allowing users to interact with web services.

Other options — why they're wrong:

  • The 'curl' command is used to create directories in a Linux environment

    The 'curl' command does not create directories; it is used for transferring data between servers.

  • The 'curl' command is a text editor in Linux

    'curl' is not a text editor; it is designed for data transfer, not for editing files.

  • The 'curl' command is used to display system information in Linux

    'curl' does not display system information; its primary function is data transfer via network protocols.

Q66. How can you create a new directory in Linux from the command line?

Correct answer:

  • mkdir new_directory

    The 'mkdir' command is used to create a new directory in Linux.

Other options — why they're wrong:

  • touch new_directory

    The 'touch' command is used to create empty files, not directories.

  • create new_directory

    This is not a valid command in Linux for creating a directory.

  • new_directory

    This is not a command; it does not perform any action in the command line.

Q67. What does the 'chmod 644' command accomplish when applied to a file?

Correct answer:

  • Change permissions to read and write for the owner, and read-only for the group and others

    This is the correct interpretation of the 'chmod 644' command, which sets the permissions accordingly.

Other options — why they're wrong:

  • Change permissions to read and execute for the owner, group, and others

    This is incorrect because 'chmod 644' does not set execute permissions for any user.

  • Change permissions to read, write, and execute for the owner, and read-only for the group and others

    This is incorrect because 'chmod 644' does not grant execute permissions at all.

  • Remove all permissions from the owner, group, and others

    This is incorrect as 'chmod 644' does not remove any permissions; it sets specific read and write permissions.

Q68. Which command allows you to view the system's uptime and load average in Linux?

Correct answer:

  • uptime

    The 'uptime' command displays how long the system has been running, along with the load averages for the past 1, 5, and 15 minutes.

Other options — why they're wrong:

  • top

    The 'top' command provides a dynamic view of system processes but does not specifically focus on uptime and load average.

  • free

    The 'free' command shows memory usage and does not provide information about system uptime.

  • ps

    The 'ps' command displays currently running processes but does not give information about system uptime or load averages.

Q69. What is the purpose of the 'crontab' command in Linux?

Correct answer:

  • Schedule automated tasks

    The 'crontab' command is used to schedule jobs to run at specified intervals on a Unix-like operating system.

Other options — why they're wrong:

  • Manage user permissions

    This is not the function of the 'crontab' command; it's more related to user management.

  • Monitor system performance

    This is not a function of the 'crontab' command; it does not involve performance monitoring.

  • Update system software

    The 'crontab' command does not manage software updates; it is specifically for scheduling tasks.

Q70. Which command would you use to view and manage the firewall rules in a Linux system?

Correct answer:

  • iptables

    The iptables command is used to view and manage firewall rules in Linux systems, allowing users to configure packet filtering and NAT.

Other options — why they're wrong:

  • firewall-cmd

    firewall-cmd is specific to firewalld, which is another firewall management tool, but iptables is more universally used across various Linux distributions.

  • ufw

    ufw (Uncomplicated Firewall) is a front-end for iptables and can manage firewall rules, but it is not the primary command for viewing all firewall rules directly.

  • netstat

    netstat is primarily used for network connections and statistics, not for managing firewall rules.

Q71. What is the purpose of the 'df -h' command in a Linux system?

Correct answer:

  • Displays disk space usage in human-readable format

    The 'df -h' command shows the available and used disk space on file systems in a user-friendly format.

Other options — why they're wrong:

  • Lists all files in a directory

    This option is incorrect as 'df -h' does not list files but shows disk space usage.

  • Shows running processes

    This option is incorrect as 'df -h' does not provide information on running processes.

  • Checks network connectivity

    This option is incorrect as 'df -h' is unrelated to network connectivity checks.

Q72. How can you find the location of a specific command in Linux?

Correct answer:

  • which

    The 'which' command in Linux shows the full path of shell commands.

Other options — why they're wrong:

  • whereis

    'whereis' provides information about the binary, source, and manual page files for a command, but does not specifically show the location in the PATH like 'which' does.

  • locate

    'locate' finds files by name, not by showing the location of commands in the PATH.

  • find / -name

    'find' searches the entire filesystem for files matching the name, but it is less efficient than 'which' for finding command locations.

Q73. What is the function of the 'chown' command when applied to files?

Correct answer:

  • Change file ownership

    The 'chown' command is used to change the owner and group of a file or directory in Unix-like operating systems.

Other options — why they're wrong:

  • Change file permissions

    The 'chown' command does not change file permissions; it only modifies ownership.

  • Delete files

    The 'chown' command does not delete files; it is used for changing ownership, not removing files.

  • Copy files

    The 'chown' command does not perform file copying; its function is limited to changing ownership.

Q74. Which command is used to display the current user's environment variables in Linux?

Correct answer:

  • printenv

    The 'printenv' command is used to display the current user's environment variables in Linux.

Other options — why they're wrong:

  • env

    The 'env' command can also display environment variables, but it is not the primary command for this specific task.

  • set

    The 'set' command displays shell variables and functions, but it does not exclusively show environment variables.

  • declare

    The 'declare' command is used to declare variables in the shell, not to display environment variables.

Q75. What does the 'lsof' command do in a Linux environment?

Correct answer:

  • Lists open files and the processes that opened them

    The 'lsof' command is used in Linux to list all open files and the processes that are using them, which is helpful for monitoring system resources.

Other options — why they're wrong:

  • Displays system memory usage

    The 'lsof' command does not display memory usage; it lists open files instead.

  • Shows currently running processes

    While 'lsof' does show processes that have files open, it does not provide a complete list of all running processes.

  • Manages file permissions

    The 'lsof' command does not manage file permissions; it is specifically for listing open files and associated processes.

Q76. How can you check the available memory on a Linux system?

Correct answer:

  • free -h

    The 'free -h' command displays the total, used, and available memory in a human-readable format on a Linux system.

Other options — why they're wrong:

  • cat /proc/meminfo

    The 'cat /proc/meminfo' command shows detailed memory information but is less user-friendly compared to 'free -h'.

  • top

    The 'top' command provides real-time system monitoring, including memory usage, but is not specifically for checking available memory.

  • vmstat

    The 'vmstat' command provides information about processes, memory, paging, block IO, traps, and CPU activity, but isn't the most straightforward way to check available memory.

Q77. What is the significance of the 'swap' space in a Linux system?

Correct answer:

  • Swap space serves as an overflow area for RAM, allowing the system to handle more processes than the physical memory can support.

    Swap space enables the system to maintain performance by offloading less frequently used data from RAM, thus providing more memory for active processes.

Other options — why they're wrong:

  • Swap space is primarily used for storing user files and documents.

    Swap space is not designed for user files; it is specifically for managing memory overflow and process management.

  • Swap space is only used during system boot and not during regular operation.

    Swap space is actively used during regular operation to manage memory needs as processes run.

  • Swap space can only be used if the physical RAM is completely full.

    Swap space can be utilized even when there is still available RAM, helping to optimize memory usage.

Q78. Which command would you use to display the processes running on your system in real-time?

Correct answer:

  • top

    The 'top' command displays real-time information about running processes on a Unix-like operating system.

Other options — why they're wrong:

  • ps

    The 'ps' command shows a snapshot of current processes but does not refresh in real-time.

  • htop

    While 'htop' offers an interactive view of processes, it may not be installed by default on all systems and 'top' is the more universally available command.

  • tasklist

    The 'tasklist' command is specific to Windows and does not apply to Unix-like systems where 'top' is commonly used.

Q79. How can you configure a static IP address on a Linux machine?

Correct answer:

  • Using the command 'ifconfig eth0 192.168.1.100 netmask 255.255.255.0'

    This command assigns a static IP address to the specified network interface on a Linux machine.

Other options — why they're wrong:

  • Editing the /etc/network/interfaces file to include 'iface eth0 inet static'

    This method is incorrect; the file needs more configuration to set a static IP.

  • Using the command 'ip addr add 192.168.1.100/24 dev eth0'

    This command only adds the IP temporarily and does not configure it to be static after reboot.

  • Configuring the static IP through the Network Manager GUI

    This method is incorrect; while it is an option, the question asks for a command-line method.

Q80. What does the 'uname -r' command output in a Linux environment?

Correct answer:

  • Kernel version number

    The 'uname -r' command outputs the kernel version number of the Linux system.

Other options — why they're wrong:

  • Operating system name

    The 'uname -r' command does not provide the operating system name; it specifically returns the kernel version.

  • Machine hardware name

    The 'uname -r' command does not output the machine hardware name; it focuses on the kernel version.

  • Kernel release date

    The 'uname -r' command does not provide the kernel release date; it only outputs the version number.

Q81. What command is used to display the contents of a directory in Linux?

Correct answer:

  • ls

    The 'ls' command lists the contents of a directory in Linux.

Other options — why they're wrong:

  • dir

    'dir' is not typically used in Linux; it is more common in Windows.

  • cat

    The 'cat' command is used to display the contents of files, not directories.

  • pwd

    The 'pwd' command prints the current working directory, not its contents.

Q82. Which command allows you to view the history of commands executed in the terminal?

Correct answer:

  • history

    The 'history' command displays the list of commands previously executed in the terminal.

Other options — why they're wrong:

  • log

    The 'log' command is not a standard command for viewing terminal command history.

  • show

    The 'show' command does not exist in standard terminal usage for viewing command history.

  • commands

    The 'commands' is not a valid command for retrieving the history of executed commands in the terminal.

Q83. What is the purpose of the 'ssh' command in Linux?

Correct answer:

  • Secure Shell (SSH) for secure remote login

    The 'ssh' command is used to securely connect to remote servers and execute commands over a network.

Other options — why they're wrong:

  • File transfer between servers

    The 'ssh' command is primarily for secure remote login, not specifically for file transfer.

  • Local file access

    The 'ssh' command is not used for accessing local files; it is intended for remote connections.

  • Network diagnostics

    The 'ssh' command does not serve the purpose of network diagnostics; it is focused on secure connections.

Q84. How can you check the current disk usage of a filesystem in Linux?

Correct answer:

  • df -h

    The 'df -h' command displays the current disk usage of all mounted filesystems in a human-readable format.

Other options — why they're wrong:

  • du -sh

    The 'du -sh' command shows the disk usage of a specific directory, not the entire filesystem.

  • ls -l

    The 'ls -l' command lists files and directories in a directory but does not provide information about disk usage.

  • free -m

    The 'free -m' command displays memory usage, not disk usage.

Q85. Which command is used to change the shell of a user in Linux?

Correct answer:

  • chsh

    The 'chsh' command is used to change a user's login shell in Linux.

Other options — why they're wrong:

  • usermod

    'usermod' is used to modify user accounts, but changing the shell requires specific options.

  • passwd

    'passwd' is used to change a user's password, not their shell.

  • chage

    'chage' is used to change user password expiry information, not to change the shell.

Q86. What does the 'service' command do in a Linux environment?

Correct answer:

  • Manage services

    The 'service' command is used to manage services, allowing users to start, stop, or restart services.

Other options — why they're wrong:

  • Start a service

    The 'service' command does not start a service; it is used to manage services.

  • Stop a service

    The 'service' command does not stop a service; it is used to manage services.

  • Configure system settings

    The 'service' command does not configure system settings; it is specifically for managing services.

Q87. Which command would you use to display all active network connections on a Linux system?

Correct answer:

  • netstat

    The 'netstat' command displays all active network connections and listening ports on a Linux system.

Other options — why they're wrong:

  • ifconfig

    This command is used to configure network interfaces, not to display active connections.

  • ip addr

    This command is used to display IP address information, but does not show active connections.

  • ss

    While 'ss' can display active connections, it is not as widely recognized as 'netstat' for this purpose.

Q88. What is the function of the 'ip' command in Linux?

Correct answer:

  • Display and manage network interfaces and routing

    The 'ip' command is used to display and manage network interfaces, routing tables, and other networking aspects in Linux.

Other options — why they're wrong:

  • Show current system processes

    The 'ip' command does not relate to process management; it is focused on networking.

  • Configure user permissions

    The 'ip' command is not used for configuring user permissions; it deals with network settings.

  • Manage file systems

    The 'ip' command does not manage file systems; it is specifically for network configuration.

Q89. How can you disable a user account in Linux from the command line?

Correct answer:

  • usermod -L username

    This command locks the specified user account, effectively disabling it.

Other options — why they're wrong:

  • passwd -l username

    This command locks the password, but the account may still be usable if other authentication methods are available.

  • chage -E 0 username

    This command sets the expiration date of the account to a past date, effectively disabling it, but is less common than using usermod.

  • userdel username

    This command deletes the user account rather than disabling it.

Q90. What is the purpose of the 'chgrp' command in a Linux system?

Correct answer:

  • Change group ownership of files or directories

    The 'chgrp' command is used to change the group ownership of files and directories in a Linux system.

Other options — why they're wrong:

  • Change file permissions

    'chgrp' specifically changes group ownership, not permissions.

  • Change file ownership

    'chgrp' is for changing group ownership, not user ownership.

  • List contents of a directory

    'chgrp' does not list directory contents; it modifies ownership.

Q91. What command can be used to check the system's hostname in a Linux environment?

Correct answer:

  • hostname

    The 'hostname' command displays the system's hostname in a Linux environment.

Other options — why they're wrong:

  • uname -a

    This command provides system information including the kernel version but not specifically the hostname.

  • ifconfig

    This command is used to configure network interfaces and does not display the hostname.

  • ping

    The ping command is used to test network connectivity, not to check the hostname.

Q92. Which file is typically used to define system-wide environment variables in Linux?

Correct answer:

  • /etc/environment

    This file is used to set system-wide environment variables in Linux.

Other options — why they're wrong:

  • /etc/profile

    This file is used for setting environment variables for login shells but is not solely for system-wide variables.

  • ~/.bashrc

    This file is specific to user sessions and does not define system-wide environment variables.

  • /etc/bash.bashrc

    This file is for setting system-wide configurations for interactive bash shells but is not the primary file for environment variables.

Q93. What command can be used to check the current network routes in a Linux system?

Correct answer:

  • route -n

    This command displays the current routing table in a Linux system in a numeric format, making it the correct answer.

Other options — why they're wrong:

  • netstat -r

    This command is used to display network connections, routing tables, interface statistics, and more, but is not the best option for checking current network routes.

  • ip route

    While this command can also display the current network routes, it is not the traditional command often referenced for this purpose.

  • traceroute

    This command is used to trace the path packets take to a network destination, not to check the current network routes.

Q94. How can you view the contents of a compressed .zip file in Linux without extracting it?

Correct answer:

  • unzip -l filename.zip

    This command lists the contents of the .zip file without extracting it.

Other options — why they're wrong:

  • cat filename.zip

    This command attempts to display the binary content of the .zip file, which will not show the file names or structure correctly.|

  • zipinfo filename.zip

    This command is similar to 'unzip -l', but 'unzip -l' is more commonly used for listing contents.|

  • ls filename.zip

    The 'ls' command is used to list files in a directory, not to view the contents of a .zip file.|

Q95. What is the purpose of the 'shutdown' command in a Linux environment?

Correct answer:

  • Shutdown Command

    The 'shutdown' command is used to bring the system down in a safe manner, allowing processes to terminate and users to log out.

Other options — why they're wrong:

  • Reboot Command

    The reboot command is used to restart the system, not to shut it down.

  • Exit Command

    The exit command is typically used to close a terminal session, not to shut down the system.

  • Power Off Command

    The power off command is similar in function to shutdown, but 'shutdown' provides more options for safely shutting down the system.

Q96. Which command would you use to display the current user's login history in Linux?

Correct answer:

  • last

    The 'last' command shows the login history of users on a Linux system.

Other options — why they're wrong:

  • who

    The 'who' command shows who is currently logged in, not the login history.

  • history

    The 'history' command displays the command history of the current user, not their login history.

  • users

    The 'users' command shows who is currently logged in, not their login history.

Q97. What is the significance of the '/etc/hosts' file in a Linux system?

Correct answer:

  • The '/etc/hosts' file is used for hostname resolution

    It maps hostnames to IP addresses, allowing the system to resolve local network names without querying a DNS server.

Other options — why they're wrong:

  • The '/etc/hosts' file is primarily for system logging

    It is used for hostname resolution, not logging.

  • The '/etc/hosts' file contains system configuration settings

    It does not contain configuration settings; it specifically maps hostnames to IP addresses.

  • The '/etc/hosts' file is only relevant for network security

    While it can impact security, its primary role is hostname resolution.

Q98. How can you monitor real-time system performance and resource usage in Linux?

Correct answer:

  • top

    The 'top' command provides real-time monitoring of system performance and resource usage in Linux, displaying processes and their resource consumption.

Other options — why they're wrong:

  • htop

    'htop' is an interactive process viewer for Unix systems, but it is not available by default on all Linux distributions and may not be installed.

  • vmstat

    'vmstat' is a command that reports information about processes, memory, paging, block I/O, traps, and CPU activity, but it does not provide real-time monitoring like 'top' does.

  • iostat

    'iostat' monitors system input/output device loading but is not primarily focused on real-time system performance, making it less suitable for this purpose compared to 'top'.

Q99. Which command is used to create a new group in a Linux system?

Correct answer:

  • groupadd

    The 'groupadd' command is specifically designed to create a new group in a Linux system.

Other options — why they're wrong:

  • addgroup

    'addgroup' is a command used in some Linux distributions, but 'groupadd' is the standard command for creating groups.

  • useradd

    'useradd' is used for creating new user accounts, not groups.

  • gpasswd

    'gpasswd' is used for administering /etc/group and /etc/gshadow, but not for creating new groups.

Q100. What does the 'tar -xvf' command do when executed on a .tar file?

Correct answer:

  • Extracts the contents of the .tar file while showing the progress in the terminal.

    The 'tar -xvf' command is used to extract files from a .tar archive and the 'v' option makes it verbose, showing the files being extracted.

Other options — why they're wrong:

  • Compresses the .tar file into a smaller archive.

    The command does not compress files; it is used for extraction.

  • Lists the contents of the .tar file without extracting.

    The command does not list files; it extracts them instead.

  • Creates a new .tar file from the specified directory.

    The command does not create a .tar file; it extracts files from an existing one.

Ready to start learning?Individual Plans →Team Plans →
FREE COURSE OFFERS