



















































































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 is used to display the first 10 lines of a file? A) tail B) head C) cat D) less Answer: B Explanation: head prints the beginning of a file; by default it shows the first 10 lines. Question 2. Which option with rm removes a directory and its contents recursively? A) - i B) - r C) - f D) - d Answer: B Explanation: The -r (or --recursive) flag tells rm to delete directories and their contents recursively. Question 3. To view the manual page for the chmod command, which utility is used? A) info B) man C) apropos D) whatis Answer: B Explanation: man chmod displays the manual page for the chmod command.
Question 4. Which file contains system-wide environment variable definitions for all users? A) ~/.bashrc B) /etc/profile C) /etc/environment D) /etc/bash.bashrc Answer: C Explanation: /etc/environment is used for setting system-wide environment variables that apply to all users. Question 5. Which command creates a hard link named linkfile to an existing file source.txt? A) ln - s source.txt linkfile B) ln source.txt linkfile C) cp source.txt linkfile D) mv source.txt linkfile Answer: B Explanation: ln source.txt linkfile creates a hard link; -s would create a symbolic link. Question 6. What does the chmod 750 file command set for the file’s permissions? A) rwxr-x--- B) rwxr-xr-x C) rw-r--r-- D) rwxrwxrwx Answer: A Explanation: 7 = rwx for owner, 5 = r-x for group, 0 = --- for others.
Explanation: >> appends standard output to the target file. Question 10. What does the pipeline ps aux | grep httpd accomplish? A) Lists all processes and filters those containing “httpd”. B) Sends the output of grep to ps. C) Replaces ps with grep. D) Creates a new process named “httpd”. Answer: A Explanation: The pipe sends the output of ps aux to grep, which filters lines containing “httpd”. Question 11. Which command creates a compressed tar archive named backup.tar.gz of the /etc directory? A) tar - cvf backup.tar.gz /etc B) tar - czf backup.tar.gz /etc C) tar - xzf backup.tar.gz /etc D) gzip - c backup.tar /etc > backup.tar.gz Answer: B Explanation: tar - czf creates a gzip‑compressed archive. Question 12. To extract a .bz2 compressed tar archive data.tar.bz2 into the current directory, which command is used? A) tar - xjf data.tar.bz B) tar - xzf data.tar.bz C) tar - xvf data.tar.bz D) bunzip2 - c data.tar.bz2 | tar - xf -
Answer: A Explanation: -j tells tar to use bzip2 for decompression. Question 13. Which tool is used to view the contents of a binary file in a readable hexadecimal format? A) cat B) hexdump C) less D) grep Answer: B Explanation: hexdump (or xxd) displays binary data as hexadecimal. Question 14. Which command displays the current run level of a System V init system? A) runlevel B) systemctl get-default C) whoami D) uptime Answer: A Explanation: The runlevel command prints the previous and current run levels. Question 15. To reboot a system safely from the command line, which command should be used? A) init 0 B) shutdown - r now C) poweroff
B) kill - 15 1234 C) pkill - TERM 1234 D) killall - TERM 1234 Answer: B Explanation: -15 (or -TERM) is the default termination signal; -9 is SIGKILL. Question 19. Which command shows a real‑time view of CPU and memory usage for all processes? A) ps aux B) top C) df - h D) free - m Answer: B Explanation: top provides an interactive, real‑time display of system resource usage. Question 20. In a Debian‑based system, which command installs the package curl from the default repositories? A) yum install curl B) dnf install curl C) apt-get install curl D) zypper install curl Answer: C Explanation: Debian and Ubuntu use apt-get (or apt) for package management. Question 21. Which file stores the list of APT package sources on a Debian system?
A) /etc/yum.repos.d/ B) /etc/apt/sources.list C) /etc/pacman.conf D) /etc/dnf/dnf.conf Answer: B Explanation: /etc/apt/sources.list (and files under /etc/apt/sources.list.d/) define APT repositories. Question 22. To verify the integrity of an installed RPM package httpd, which command is used? A) rpm - V httpd B) dpkg - V httpd C) yum verify httpd D) apt verify httpd Answer: A Explanation: rpm - V verifies the package’s files against the RPM database. Question 23. Which command displays the last 100 lines of the system journal for the ssh service? A) journalctl - u ssh - n 100 B) tail - n 100 /var/log/ssh.log C) systemctl status ssh | tail - 100 D) grep ssh /var/log/journal/* | tail - 100 Answer: A Explanation: journalctl - u ssh - n 100 shows the most recent 100 entries for the ssh unit.
Question 27. Which command displays the current SELinux mode (enforcing, permissive, or disabled)? A) getenforce B) sestatus C) selinux‑status D) both A and B Answer: D Explanation: Both getenforce and sestatus provide the current SELinux mode. Question 28. To create a new LVM logical volume named lv_data of size 10 GB in volume group vg_main, which command sequence is correct? A) lvcreate - L 10G - n lv_data vg_main B) vgcreate - L 10G - n lv_data vg_main C) pvcreate - L 10G - n lv_data vg_main D) lvcreate - n vg_main - L 10G lv_data Answer: A Explanation: lvcreate - L <size> - n <name> <VG> creates a logical volume. Question 29. Which file contains static information about block devices and their mount points? A) /etc/fstab B) /proc/partitions C) /etc/mtab D) /var/log/dmesg Answer: C
Explanation: /etc/mtab (or the symlink to /proc/self/mounts) lists currently mounted filesystems. Question 30. To mount a filesystem defined in /etc/fstab without rebooting, which command is used? A) mount - a B) mount /etc/fstab C) systemctl restart fstab D) blkid - a Answer: A Explanation: mount - a mounts all filesystems marked with the auto option in /etc/fstab. Question 31. Which command creates a 2 GB swap file named /swapfile and activates it? A) dd if=/dev/zero of=/swapfile bs=1M count=2048 && mkswap /swapfile && swapon /swapfile B) fallocate - l 2G /swapfile && mkswap /swapfile && swapon /swapfile C) truncate - s 2G /swapfile && mkswap /swapfile && swapon /swapfile D) any of the above Answer: D Explanation: All three methods create a file of the required size; then mkswap and swapon enable it. Question 32. Which command shows the amount of free and used memory in a human‑readable format? A) free - h B) df - h C) top - b | head - n 5
D) passwd - s /bin/zsh alice Answer: C Explanation: Both chsh and usermod - s set the login shell. Question 36. Which file is used as a template for new user home directories? A) /etc/skel B) /etc/passwd C) /etc/default/useradd D) /etc/profile.d Answer: A Explanation: Files under /etc/skel are copied into a new user’s home directory on creation. Question 37. To set a password expiration of 90 days for user charlie, which command is appropriate? A) chage - M 90 charlie B) passwd - x 90 charlie C) usermod - e 90 charlie D) both A and B Answer: D Explanation: chage - M and passwd - x both set the maximum number of days between password changes. Question 38. Which command sets a default file creation limit of 1024 open files for all users? A) ulimit - n 1024 B) echo "* hard nofile 1024" >> /etc/security/limits.conf
C) sysctl - w fs.file‑max= D) both A and B Answer: B Explanation: Adding a line to /etc/security/limits.conf sets a permanent per‑user limit; ulimit only affects the current shell. Question 39. Which command displays the Access Control List (ACL) for file report.txt? A) getfacl report.txt B) ls - l report.txt C) setfacl - L report.txt D) aclshow report.txt Answer: A Explanation: getfacl prints the ACL entries associated with a file. Question 40. To grant user dave read and write permissions on directory /data via ACL, which command is used? A) setfacl - m u:dave:rw /data B) chmod u+dave:rw /data C) chown dave /data D) setfacl - x u:dave /data Answer: A Explanation: setfacl - m u:dave:rw modifies the ACL to give dave read/write rights. Question 41. Which file stores LDAP client configuration on most Linux distributions? A) /etc/ldap.conf
version: 2 ethernets: ens33: address: dhcp C) network: version: 2 interfaces: ens33: dhcp4: yes D) None of the above Answer: A Explanation: Netplan uses dhcp4: true under the interface definition to enable IPv4 DHCP. Question 44. Which command sets the system hostname to web01 temporarily (until next reboot)? A) hostnamectl set-hostname web01 --static B) echo "web01" > /etc/hostname C) hostname web D) sysctl kernel.hostname=web Answer: C Explanation: hostname web01 changes the hostname in the current session; hostnamectl writes it to configuration files for persistence. Question 45. To synchronize time with an NTP server time.example.com using chrony, which line must be added to /etc/chrony.conf?
A) server time.example.com iburst B) pool time.example.com offline C) time server time.example.com D) ntpserver time.example.com Answer: A Explanation: server <address> iburst tells chrony to query the specified NTP server. Question 46. Which command adds a static route for network 10.0.0.0/24 via gateway 192.168.1.1? A) ip route add 10.0.0.0/24 via 192.168.1. B) route add - net 10.0.0.0/24 gw 192.168.1. C) both A and B D) netstat - r add 10.0.0.0/24 192.168.1. Answer: C Explanation: Both ip route add and the legacy route command achieve the same result. Question 47. Which firewall utility uses the command syntax ufw allow 22/tcp? A) firewalld B) iptables C) ufw D) nftables Answer: C Explanation: ufw (Uncomplicated Firewall) uses that syntax for opening ports.
Question 51. Which command displays active network sockets and listening ports? A) ss - tuln B) netstat - tuln C) both A and B D) lsof - i Answer: C Explanation: Both ss and netstat with -tuln list TCP/UDP listening sockets; lsof - i also shows them but with a different format. Question 52. To test DNS resolution for example.com using the dig tool, which command is correct? A) dig example.com B) host example.com C) nslookup example.com D) any of the above Answer: D Explanation: All three utilities perform DNS lookups; dig is the most detailed. Question 53. Which systemd target is equivalent to the traditional “multi‑user” run level? A) graphical.target B) multi-user.target C) runlevel3.target D) rescue.target Answer: B
Explanation: multi-user.target provides a non‑graphical multi‑user environment, analogous to runlevel 3. Question 54. To start the Apache service immediately and enable it at boot, which command sequence is required? A) systemctl start httpd && systemctl enable httpd B) service httpd start && chkconfig httpd on C) both A and B (depending on init system) D) systemctl restart httpd Answer: C Explanation: On systemd systems use systemctl; on SysV init use service/chkconfig. Both achieve the same result. Question 55. Which directory typically contains custom systemd unit files created by the administrator? A) /etc/systemd/system B) /usr/lib/systemd/system C) /run/systemd/system D) /var/lib/systemd/unit Answer: A Explanation: /etc/systemd/system holds administrator‑provided unit files that override vendor defaults. Question 56. To view the status of the nginx service, which command is appropriate? A) systemctl status nginx B) service nginx status