ExamGecko
Home Home / CompTIA / XK0-005

CompTIA XK0-005 Practice Test - Questions Answers, Page 30

Question list
Search
Search

List of questions

Search

Related questions











overwrite any existing files. Which of the following commands would indicate that the file already exists?

A.
mv -i filename /tmp/backup
A.
mv -i filename /tmp/backup
Answers
B.
mv -b filename /tmp/backup
B.
mv -b filename /tmp/backup
Answers
C.
mv -n filename /tmp/backup
C.
mv -n filename /tmp/backup
Answers
D.
mv -f filename /tmp/backup
D.
mv -f filename /tmp/backup
Answers
Suggested answer: A

Explanation:

The -i option stands for 'interactive' and it prompts before overwriting any existing files. This ensures that no existing files are accidentally overwritten during the move operation.

An administrator is provisioning an Apache web server. When the administrator visits the server website, the browser displays a message indicating the website cannot be reached. Which of the following commands should the administrator use to verify whether the service Is running?

A.
systemctl status httpd
A.
systemctl status httpd
Answers
B.
systemctl mask httpd
B.
systemctl mask httpd
Answers
C.
systemctl reload httpd
C.
systemctl reload httpd
Answers
D.
systemctl restart httpd
D.
systemctl restart httpd
Answers
Suggested answer: A

Explanation:

systemctl status httpd is the correct option to check if the Apache web server (httpd) is running. The systemctl status command provides detailed information about the service, including whether it is active and running.



The journald entries have filled a Linux machine's /var volume. Which of the following is the best command for a systems administrator to use to free up the disk space occupied by these entries?

A.
journalctl ---rotate journalctl --vacuum-time=ls
A.
journalctl ---rotate journalctl --vacuum-time=ls
Answers
B.
systemctl stop systemd-journald systemctl start systemd-journald
B.
systemctl stop systemd-journald systemctl start systemd-journald
Answers
C.
rm -rf /var/log/journal systemctl restart systemd-journald
C.
rm -rf /var/log/journal systemctl restart systemd-journald
Answers
D.
pkill -HUP systemd-journald systemctl restart systemd-journald
D.
pkill -HUP systemd-journald systemctl restart systemd-journald
Answers
Suggested answer: B

Explanation:

systemctl stop systemd-journald systemctl start systemd-journald is the best approach among the given options. Stopping and starting the systemd-journald service can help in managing the disk space used by journal logs without manually deleting log files or using more aggressive cleanup methods. This method ensures that log management is handled gracefully by the system's own services.

A server administrator has scheduled a cron job to run YUM updates on all servers without manual intervention, but kernel packages must be excluded from the updates at all times. Which of the following configuration files needs to be modified to make these changes persistent?

A.

/etc/yum.conf

A.

/etc/yum.conf

Answers
B.

/etc/dnf/dnf.conf

B.

/etc/dnf/dnf.conf

Answers
C.

/etc/yum/pluginconf.d/packages.conf

C.

/etc/yum/pluginconf.d/packages.conf

Answers
D.

/etc/yum.repo.d/kernel.repo

D.

/etc/yum.repo.d/kernel.repo

Answers
Suggested answer: A

Explanation:

The /etc/yum.conf file contains configuration settings for the YUM package manager. To exclude kernel updates, the administrator should add exclude=kernel* to the [main] section of this file. This ensures that all future YUM updates skip kernel packages, making the exclusion persistent.

A Linux administrator wants a permission bit on a shared folder that allows only the owner of the file within that directory or the root user to delete or rename the file. Which of the following commands will help achieve this goal?

A.

chmod u-w /directory/

A.

chmod u-w /directory/

Answers
B.

chmod a-r /directory/

B.

chmod a-r /directory/

Answers
C.

chmod o-t /directory/

C.

chmod o-t /directory/

Answers
D.

chmod +t /directory/

D.

chmod +t /directory/

Answers
Suggested answer: D

Explanation:

The +t option sets the 'sticky bit' on a directory, which restricts deletion or renaming of files in the directory to the file's owner or the root user. This is commonly used in shared directories like /tmp, where multiple users may have access, but only the file owner should be allowed to modify their own files. The command chmod +t /directory/ applies this permission.

Linux system users report that over the past few months, a server has stopped responding at least twice each day. Every time this happens, the users have to restart the server to recover it. A systems administrator diagnosing the issue collects the following outputs:

csharp

Output 1

[Tue Aug 31 16:36:42 2021] oom-killer invoked by java: gfp_mask=0x280da2 order=0, oom_score_adj=0

[Tue Aug 31 16:36:42 2021] java cpuset=/ mems_allowed=0

makefile

Output 2

[root@server]# free -m

total used free shared buff/cache available

Mem: 15819 15026 174 92 619 134

Swap: 0 0 0

Which of the following is the best permanent resolution for the system?

A.

More memory resources

A.

More memory resources

Answers
B.

More CPU resources

B.

More CPU resources

Answers
C.

More network bandwidth

C.

More network bandwidth

Answers
D.

Extended root filesystem

D.

Extended root filesystem

Answers
Suggested answer: A

Explanation:

The oom-killer is invoked when the system runs out of memory, as indicated by the memory usage in the free -m output. Since swap space is not being used and physical memory is almost entirely consumed, adding more memory resources will prevent the system from running out of memory and invoking the oom-killer to terminate processes.

A Linux administrator is configuring network traffic forwarding. Despite having proper iptables rules, the traffic forwarding is not working. Which of the following commands will allow Linux to pass network traffic between different interfaces?

A.

nmcli allow-forwarding eth0

A.

nmcli allow-forwarding eth0

Answers
B.

echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf; sysctl -p

B.

echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf; sysctl -p

Answers
C.

ip route forward allow --all-interfaces; systemctl restart network

C.

ip route forward allow --all-interfaces; systemctl restart network

Answers
D.

modprobe ip_forward

D.

modprobe ip_forward

Answers
Suggested answer: B

Explanation:

To enable IP forwarding, the kernel parameter net.ipv4.ip_forward must be set to 1. This is done by appending net.ipv4.ip_forward=1 to /etc/sysctl.conf and applying the changes using sysctl -p. This command ensures that the system can forward packets between different network interfaces.

Joe, a user, is unable to log in to the system. The Linux administrator checks the /etc/passwd file and reviews the following output:

Joe:x:1002:1002::/home/Joe:/sbin/nologin

Which of the following should the administrator do to fix this issue?

A.

Remove the x entry in the /etc/passwd file for Joe

A.

Remove the x entry in the /etc/passwd file for Joe

Answers
B.

Change the /sbin/nologin entry to /bin/sh for Joe

B.

Change the /sbin/nologin entry to /bin/sh for Joe

Answers
C.

Issue the usermod -l Joe command

C.

Issue the usermod -l Joe command

Answers
D.

Ensure that a corresponding entry is in the /etc/shadow file for Joe

D.

Ensure that a corresponding entry is in the /etc/shadow file for Joe

Answers
Suggested answer: B

Explanation:

The /sbin/nologin shell is used to prevent a user from logging in. To allow Joe to log in, the administrator should change his shell to /bin/sh, which is a standard login shell in Linux. This change will allow Joe to access the system normally.

A systems administrator is configuring a Linux system so that network traffic from the internal network 172.17.0.0/16 going out through the eth0 interface would appear as if it was sent directly from this interface. Which of the following commands will accomplish this task?

A.

iptables -A POSTROUTING -s 172.17.0.0/16 -o eth0 -j MASQUERADE

A.

iptables -A POSTROUTING -s 172.17.0.0/16 -o eth0 -j MASQUERADE

Answers
B.

firewalld -A OUTPUT -s 172.17.0.0/16 -o eth0 -j DIRECT

B.

firewalld -A OUTPUT -s 172.17.0.0/16 -o eth0 -j DIRECT

Answers
C.

nmcli snasq-traffic eth0 -s 172.17.0.0/16 -j MASQUERADE

C.

nmcli snasq-traffic eth0 -s 172.17.0.0/16 -j MASQUERADE

Answers
D.

ifconfig --nat eth0 -s 172.17.0.0/16 -j DIRECT

D.

ifconfig --nat eth0 -s 172.17.0.0/16 -j DIRECT

Answers
Suggested answer: A

Explanation:

The command iptables -A POSTROUTING -s 172.17.0.0/16 -o eth0 -j MASQUERADE configures Network Address Translation (NAT) using iptables. This ensures that traffic from the internal network (172.17.0.0/16) going out through the eth0 interface will appear to be originating from the eth0 IP address. This is commonly used for internet-sharing or NAT setups in Linux.

An administrator thinks that a package was installed using a snap. Which of the following commands can the administrator use to verify this information?

A.

snap list

A.

snap list

Answers
B.

snap find

B.

snap find

Answers
C.

snap install

C.

snap install

Answers
D.

snap try

D.

snap try

Answers
Suggested answer: A

Explanation:

The snap list command lists all installed snap packages on the system. It provides details such as the package name, version, and installation status. This command is useful for verifying whether a specific package was installed using the snap package manager.

Total 371 questions
Go to page: of 38