Practice Free XK0-005 Exam Online Questions
What command is used to display the Linux kernel version your system is currently running?
- A . uname -r
- B . kernel -v
- C . linux -version
- D . osinfo
A systems administrator received a notification that a system is performing slowly.
When running the top command, the systems administrator can see the following values:
Which of the following commands will the administrator most likely run NEXT?
- A . vmstat
- B . strace
- C . htop
- D . lsof
A
Explanation:
The command vmstat will most likely be run next by the administrator to troubleshoot the system performance. The vmstat command is a tool for reporting virtual memory statistics on Linux systems. The command shows information about processes, memory, paging, block IO, interrupts, and CPU activity. The command can help the administrator identify the source of the performance issue, such as high CPU usage, low free memory, excessive swapping, or disk IO bottlenecks. The command can also be used with an interval and a count to display the statistics repeatedly over time and observe the changes. The command vmstat will provide useful information for diagnosing the system performance and finding the root cause of the issue. This is the most likely command to run next after the top command. The other options are incorrect because they either do not show the virtual memory statistics (strace or lsof) or do not provide more information than the top command (htop). CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Processes and Scheduling Tasks, page 425.
A Linux engineer receives reports that files created within a certain group are being modified by users who are not group members. The engineer wants to reconfigure the server so that only file owners and group members can modify new files by default.
Which of the following commands would accomplish this task?
- A . chmod 775
- B . umask. 002
- C . chactr -Rv
- D . chown -cf
B
Explanation:
The command umask 002 will accomplish the task of reconfiguring the server so that only file owners and group members can modify new files by default. The umask command is a tool for setting the default permissions for new files and directories on Linux systems. The umask value is a four-digit octal number that represents the permissions that are subtracted from the default permissions. The default permissions for files are 666, which means read and write for owner, group, and others. The default permissions for directories are 777, which means read, write, and execute for owner, group, and others. The umask value consists of four digits: the first digit is for special permissions, such as setuid, setgid, and sticky bit; the second digit is for the owner permissions; the third digit is for the group permissions; and the fourth digit is for the others permissions. The umask value can be calculated by subtracting the desired permissions from the default permissions. For example, if the desired permissions for files are 664, which means read and write for owner and group, and read for others, then the umask value is 002, which is 666 – 664. The command umask 002 will set the umask value to 002, which will ensure that only file owners and group members can modify new files by default. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not set the default permissions for new files (chmod 775 or chown -cf) or do not exist (chattr -Rv). CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing File Permissions and Ownership, page 349.
A Linux engineer is removing a previously created firewall rule.
Which of the following commands will help the administrator accomplish this task?
- A . ufw delete 80/tcp
- B . ufw delete deny 80/tcp
- C . ufw delete 80/tcp deny
- D . delete7!
B
Explanation:
The ufw (Uncomplicated Firewall) delete command is used to remove rules.
If the original rule was ufw deny 80/tcp, it must be deleted with:ufw delete deny 80/tcp
If the original rule was ufw deny 80/tcp, it must be deleted with:ufw delete deny 80/tcp
If the original rule was ufw deny 80/tcp, it must be deleted with:ufw delete deny 80/tcp
Why the other options are incorrect?
A User on a Linux workstation needs to remotely start an application on a Linux server and then forward the graphical display of that application back to the Linux workstation.
Which of the following would enable the user to perform this action?
- A . ssh -X user@server application
- B . ssh -y user@server application
- C . ssh user@server application
- D . ssh -D user@server application
A
Explanation:
The ssh -X option enables X11 forwarding, which allows the user to run graphical applications on the remote server and display them on the local workstation. The user needs to specify the username, the server address, and the application name after the ssh -X command. The remote server also needs to have X11Forwarding enabled and xauth installed for this to work.
The web search result 8 explains how to run a GUI application through SSH by configuring both the SSH client and server.
The web search result 6 provides a detailed answer on how to forward X over SSH to run graphics applications remotely, with examples and troubleshooting tips.
The CompTIA Linux+ Certification Exam Objectives mention that the candidate should be able to “use SSH for remote access and management” as part of the System Operation and Maintenance domain1.
A systems administrator receives the following message after running an ip link command to verify the status of a network interface named enp0s3:
state DOWN
Which of the following commands should the administrator use to resolve this issue?
- A . ip link set enp0s3 up
- B . ip link ifb enp0s3 up
- C . ip link add enp0s3 up
- D . ip link enp0s3 up
A
Explanation:
A is correct syntax to bring up a network interface.
Incorrect Options:
B, C, D: Invalid or misused ip link subcommands.
Reference: CompTIA Linux+ XK0-005 Study Guide, Chapter 5
man ip
A Linux administrator needs to replace the content of the test1.sh file with the content of the test2.sh file.
Which of the following commands will help accomplish this task?
- A . cat test2.sh >> test1.sh
- B . cat test2.sh > test1.sh
- C . cat test2.sh < test1.sh
- D . cat test2.sh « test1.sh
B
Explanation:
The > operator overwrites the content of the target file with the source file. So cat test2.sh > test1.sh will copy contents of test2.sh to test1.sh, replacing existing data.
Source: CompTIA Linux+ XK0-005 Study Guide C Chapter 14: Bash Scripting
Reference: Linux Shell Redirection Documentation
Which of the following can be used as a secure way to access a remote termi-nal?
- A . TFTP
- B . SSH
- C . SCP
- D . SFTP
B
Explanation:
SSH, or Secure Shell, is a protocol that allows you to access a remote terminal or virtual machine securely over an encrypted connection. You can use SSH to run commands, transfer files, or tunnel network traffic on a remote system. To use SSH, you need an SSH client program on your local system and an SSH server program on the remote system. You also need to authenticate yourself using a
username and password or a public/private key pair. SSH is widely used by system administrators, developers, and engineers to remotely manage Linux servers and other devices.
The other options are not correct answers. TFTP, or Trivial File Transfer Protocol, is a simple protocol that allows you to transfer files between systems, but it does not provide any security or encryption features. SCP, or Secure Copy Protocol, is a protocol that uses SSH to securely copy files between systems, but it does not provide a remote terminal access. FTP, or File Transfer Protocol, is another protocol that allows you to transfer files between systems, but it also does not provide any security or encryption features.
After connecting to a remote host via SSH, an administrator attempts to run an application but receives the following error:
[user@workstation ~]$ ssh admin@srv1
Last login: Tue Mar 29 18:03:34 2022
[admin@srvl ~] $ /usr/local/bin/config_manager
Error: cannot open display:
[admin@srv1 ~] $
Which of the following should the administrator do to resolve this error?
- A . Disconnect from the SSH session and reconnect using the ssh -x command.
- B . Add Options X11 to the /home/admin/.ssh/authorized_keys file.
- C . Open port 6000 on the workstation and restart the firewalld service.
- D . Enable X11 forwarding in /etc/ssh/ssh_config and restart the server.
A
Explanation:
The error indicates that the application requires an X11 display, but the SSH session does not forward the X11 connection. To enable X11 forwarding, the administrator needs to use the ssh -X option, which requests X11 forwarding with authentication spoofing. This will set the DISPLAY environment variable on the remote host and allow the application to open a window on the local display.
CompTIA Linux+ (XK0-005) Certification Study Guide, page 314
Open a window on a remote X display (why “Cannot open display”)?, answer by Gilles ‘SO- stop being evil’
A Linux systems administrator needs to compress a file named passwords.txt. The compressed file should be saved as passwords.txt.gz.
Which of the following commands should the administrator use to accomplish this task?
- A . gzip -c passwords.txt > passwords.txt.gz
- B . gzip -d passwords.txt | passwords.txt.gz
- C . gzip -n passwords.txt > passwords.txt.gz
- D . gzip -n passwords.txt < passwords.txt.gz
A
Explanation:
The gzip command with the -c flag outputs the compressed data to standard output, which can then be redirected to create a .gz file. This approach maintains the original file while creating a compressed version.
Reference: Gzip Command Documentation