


























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



























































































Question 1. Which command recursively searches for the string “error” in all .log files under /var/log? A) grep - r "error" /var/log/.log B) find /var/log - name ".log" - exec grep "error" {} ; C) locate ".log" | xargs grep "error" D) cat /var/log/*.log | grep "error" Answer: B Explanation: find locates the files and -exec … {} runs grep on each, providing a true recursive search limited to *.log files. Question 2. What does the following pipeline do? ps aux | awk '{print $1,$3}' | sort - k2 - nr | head - 5 A) Lists the top five processes by memory usage, showing user and %CPU. B) Shows the five users with the most processes. C) Displays the five processes using the most CPU, showing user and %MEM. D) Prints the first five lines of the process list sorted alphabetically. Answer: C Explanation: ps aux outputs all processes; awk prints the user and %MEM ($3); sort - k2 - nr sorts numerically descending on the second field; head - 5 limits to five lines. Question 3. Which of the following commands creates a compressed tar archive named backup.tar.gz containing the /etc directory? A) tar - cvf backup.tar.gz /etc B) tar - czf backup.tar.gz /etc
C) tar - cjf backup.tar.gz /etc D) gzip - c /etc > backup.tar.gz Answer: B Explanation: -c creates, -z filters through gzip, and -f specifies the filename. Question 4. To change the group ownership of /opt/app to the group “devops” without affecting the user owner, which command is correct? A) chown devops /opt/app B) chgrp devops /opt/app C) chmod g+rw /opt/app D) chown :devops /opt/app Answer: D Explanation: chown :group file changes only the group; chgrp also works but the question asks for a command that explicitly does not affect the user, both B and D are valid, but D shows the syntax that preserves the user. Question 5. Which file contains static information about filesystems to be mounted at boot time? A) /etc/fstab B) /etc/mtab C) /proc/mounts D) /etc/rc.local Answer: A
C) systemctl list‑enabled D) systemctl show - p ActiveState Answer: C Explanation: systemctl list‑enabled directly lists units that are enabled to start at boot. Question 9. Which command will display the current system timezone? A) timedatectl status | grep "Time zone" B) date +%Z C) hwclock --show D) cat /etc/timezone Answer: A Explanation: timedatectl status provides detailed time settings, including the timezone line. Question 10. A user reports that “ping google.com” fails with “unknown host”. Which file should you inspect first to troubleshoot DNS resolution? A) /etc/resolv.conf B) /etc/hosts C) /etc/nsswitch.conf D) /etc/network/interfaces Answer: A Explanation: /etc/resolv.conf defines the DNS servers used for name resolution.
Question 11. Which command shows the amount of free and used space on all mounted filesystems in a human‑readable format? A) df - h B) du - sh /* C) lsblk - f D) mount - v Answer: A Explanation: df - h reports filesystem disk space usage with sizes in human‑readable units. Question 12. What does the ln - s /var/www/html /srv/www command do? A) Creates a hard link named /srv/www pointing to /var/www/html. B) Creates a symbolic link named /srv/www that points to /var/www/html. C) Moves /var/www/html to /srv/www. D) Copies /var/www/html to /srv/www preserving attributes. Answer: B Explanation: -s creates a symbolic (soft) link. Question 13. Which of the following regular expressions matches an IPv4 address? A) ^\d{1,3}(\.\d{1,3}){3}$ B) ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ C) ^([0-9]{1,3}\.){3}[0-9]{1,3}$ D) All of the above
Question 16. In a Dockerfile, which instruction sets the default command to run when a container starts? A) CMD B) ENTRYPOINT C) RUN D) EXPOSE Answer: A Explanation: CMD provides the default command; ENTRYPOINT defines the executable that cannot be overridden easily. Question 17. Which of the following statements about hard links is FALSE? A) A hard link points directly to the inode of a file. B) Hard links can span different filesystems. C) Deleting the original file does not remove the data as long as a hard link exists. D) Hard links cannot be created for directories by regular users. Answer: B Explanation: Hard links must reside on the same filesystem because they reference the same inode. Question 18. Which command will list all listening TCP ports on the host? A) ss - tuln | grep LISTEN B) netstat - tulnp | grep LISTEN C) lsof - iTCP - sTCP:LISTEN D) All of the above
Answer: D Explanation: All three commands can be used to view listening TCP sockets. Question 19. To set the static IP address 192.168.10.25/24 on interface eth0 using nmcli, which command is correct? A) nmcli con add type ethernet ifname eth0 ip4 192.168.10.25/ B) nmcli dev set eth0 ipv4.addresses 192.168.10.25/ C) nmcli con modify eth0 ipv4.addresses 192.168.10.25/24 ipv4.method manual D) ifconfig eth0 192.168.10.25 netmask 255.255.255.0 up Answer: C Explanation: nmcli con modify changes an existing connection, setting the address and method to manual. Question 20. Which command will display the current kernel version? A) uname - r B) cat /proc/version C) dmesg | grep Linux D) All of the above Answer: D Explanation: All listed commands provide the kernel version information. Question 21. What is the purpose of the cloud‑init package in cloud VMs?
Answer: A Explanation: diff reports line‑by‑line differences. Question 24. Which of the following is a valid way to redirect both standard output and standard error of a command to the same file? A) command > file 2>& B) command &> file C) command > file 2> file D) Both A and B Answer: D Explanation: > file 2>&1 and &> file both redirect stdout and stderr to the same destination. Question 25. In a system that uses systemd, which command disables a service named httpd from starting at boot? A) systemctl stop httpd B) systemctl disable httpd C) systemctl mask httpd D) systemctl remove httpd Answer: B Explanation: disable removes the service from the boot sequence but does not stop a running instance. Question 26. Which of the following commands will display the current SELinux mode? A) sestatus | grep "Current mode"
B) getenforce C) selinuxenabled && echo enabled || echo disabled D) All of the above Answer: D Explanation: All listed methods can be used to query SELinux status. Question 27. To create a new logical volume named lvdata of size 10G in volume group vg01, which command is correct? A) lvcreate - L 10G - n lvdata vg B) vgcreate - L 10G - n lvdata vg C) lvcreate - n lvdata - V 10G vg D) lvcreate - s - L 10G - n lvdata vg Answer: A Explanation: lvcreate - L <size> - n <name> <vg> creates a logical volume of the given size. Question 28. Which command will show the current network interfaces and their IP addresses in a concise format? A) ip addr show B) ifconfig - a C) ip - brief address D) netstat - i Answer: C
C) ls - lh /var/log/* D) find /var/log - maxdepth 1 - type d - exec du - sh {} ; Answer: A Explanation: du - sh reports the disk usage of each argument, making it ideal for directory size summaries. Question 32. Which file defines the default runlevels and startup scripts for SysV init systems? A) /etc/inittab B) /etc/rc.conf C) /etc/systemd/system.conf D) /etc/init.d/rc Answer: A Explanation: /etc/inittab contains the configuration for the traditional SysV init process. Question 33. Which command will display the kernel ring buffer messages that contain the word “usb”? A) dmesg | grep usb B) journalctl - k | grep usb C) syslog | grep usb D) Both A and B Answer: D Explanation: Both dmesg and journalctl - k read kernel logs; piping to grep filters for “usb”.
Question 34. In a Kubernetes context, which component is responsible for maintaining the desired state of the cluster? A) kubelet B) kube-proxy C) kube-apiserver D) controller‑manager Answer: D Explanation: The controller‑manager runs controllers that reconcile actual state with the desired state. Question 35. Which of the following commands adds a new A record for “app.example.com” pointing to 10.0.0.5 in a BIND zone file? A) echo "app IN A 10.0.0.5" >> /etc/bind/db.example.com B) nsupdate - k /etc/bind/key - v "update add app.example.com 86400 A 10.0.0.5" C) dig @localhost app.example.com A +add=10.0.0. D) rndc reload example.com Answer: A Explanation: Directly appending the record to the zone file is the simplest way; after editing, the zone must be reloaded (but the question asks only for adding). Question 36. Which of the following is the correct way to set the executable permission for the owner only on file script.sh? A) chmod u+x script.sh
Explanation: tail - f follows the file; less +F also follows when invoked. Question 39. Which of the following statements about the awk utility is TRUE? A) It processes input line by line and can split fields based on a delimiter. B) It can only be used for numeric calculations. C) It cannot perform pattern matching. D) It replaces text in files like sed. Answer: A Explanation: awk reads input line by line, splits fields (default whitespace), and can perform pattern matching and arithmetic. Question 40. To create a new user “bob” with a home directory /home/bob and default shell /bin/bash, which command is correct? A) useradd - m - d /home/bob - s /bin/bash bob B) adduser bob --home /home/bob --shell /bin/bash C) useradd bob - m - s /bin/bash D) All of the above Answer: D Explanation: All listed commands create the user with the specified attributes (the syntax varies between distributions). Question 41. Which of the following commands will list all open files for the process with PID 1234? A) lsof - p 1234
B) ps - p 1234 - o fd C) fuser - p 1234 D) netstat - p 1234 Answer: A Explanation: lsof - p lists open files for a given PID. Question 42. In a Dockerfile, which instruction adds metadata to the image that can be inspected later? A) LABEL B) ENV C) MAINTAINER D) EXPOSE Answer: A Explanation: LABEL creates key‑value metadata accessible via docker inspect. Question 43. Which command will display the current CPU usage per core in real time? A) top - 1 B) mpstat - P ALL 1 C) vmstat 1 D) iostat - c 1 Answer: B Explanation: mpstat - P ALL 1 reports per‑CPU statistics at 1‑second intervals.
D) Both A and C Answer: D Explanation: git log A..B lists commits reachable from B not from A; git cherry also shows such commits. Question 47. To view the SELinux context of a file /etc/shadow, which command should you use? A) ls - Z /etc/shadow B) getfattr - d /etc/shadow C) stat - c %C /etc/shadow D) seinfo - f /etc/shadow Answer: A Explanation: ls - Z displays SELinux security contexts. Question 48. Which command will list all Docker containers (including stopped ones) in a short format? A) docker ps - a --format "{{.ID}} {{.Status}}" B) docker container ls - a - q C) docker images - a D) docker ps - a - s Answer: B Explanation: docker container ls - a - q lists container IDs only, including stopped containers.
Question 49. Which of the following is the correct syntax to schedule a daily backup at 02:30 using cron? A) 30 2 * * * /usr/local/bin/backup.sh B) 02:30 * * * * /usr/local/bin/backup.sh C) @daily /usr/local/bin/backup.sh D) 30 2 * * * backup.sh Answer: A Explanation: Cron fields are minute hour day‑of‑month month day‑of‑week; 30 2 * * * runs at 02:30 daily. Question 50. In a system using systemd, which directory contains user‑level unit files? A) /etc/systemd/system B) /usr/lib/systemd/system C) ~/.config/systemd/user D) /run/systemd/system Answer: C Explanation: User‑specific units are stored in ~/.config/systemd/user. Question 51. Which command will show the amount of memory currently used by the process with PID 5678? A) ps - p 5678 - o %mem= B) cat /proc/5678/status | grep VmRSS C) top - b - n 1 | grep 5678 D) All of the above