CompTIA Linux+ (XK0-005) — Question 171
As part of the requirements for installing a new application, the swappiness parameter needs to be changed to 0. This change needs to persist across reboots and be applied immediately. A Linux systems administrator is performing this change. Which of the following steps should the administrator complete to accomplish this task?
Answer options
- A. echo "vm.swappiness=0" >> /etc/sysctl.conf && sysctl -p
- B. echo "vm.swappiness=0" >> /proc/meminfo && sysctl -a
- C. sysctl -v >> /proc/meminfo && echo "vm.swapiness=0"
- D. sysctl -h "vm.swapiness=0" && echo /etc/vmswapiness
Correct answer: A
Explanation
The correct answer is A because it properly adds the configuration to the /etc/sysctl.conf file for persistence and applies the change immediately with sysctl -p. Option B incorrectly targets /proc/meminfo, which is read-only, while C has a typo in 'swapiness' and doesn’t apply the setting correctly. Option D also contains a typo and does not implement the change as needed.