Unit 1: Introduction to Linux - Practice Quiz
1 Which of the following is a defining characteristic of the Linux kernel?
2 What is the core component of the Linux operating system that directly manages the system's hardware and resources?
3
What is the primary role of a shell, like bash, in Linux?
4 In the Bash shell, which command is used to list the files and directories in the current location?
list
dir
ls
show
5
What does the pwd command do in a Linux terminal?
6
To view the comprehensive manual page for the cp command, which command would you type?
man cp
guide cp
info cp
help cp
7 For a quick summary of a command's usage and its options, which flag is most commonly used with the command itself?
--help
--assist
--manual
--doc
8 Which command is used to create a new user account in a Linux system?
newuser
useradd
mkusr
createuser
9 In which file is user account information, such as the username, user ID (UID), and home directory path, stored?
/etc/passwd
/etc/shadow
/etc/group
/etc/hosts
10
What is the purpose of the passwd command?
/etc/passwd file
11 To create a new group named 'developers', which command would you use?
groupadd developers
creategroup developers
mkgrp developers
newgroup developers
12 Information about group names and their associated Group IDs (GIDs) is stored in which file?
/etc/group
/etc/gshadow
/etc/users
/etc/passwd
13 Which command is standardly used to execute a command with the privileges of another user, most commonly the root user?
su-exec
root
runas
sudo
14
The configuration file that controls which users can use the sudo command is:
/etc/security.conf
/etc/passwd
/etc/sudoers
/etc/sudo.conf
15 A user reports they cannot log in. You suspect a locked account. Which command can you use to check the status of a user's account password and aging information?
chage -l <username>
status <username>
checkpass <username>
userinfo <username>
16 Which simple command displays the User ID (UID), primary Group ID (GID), and all the groups a user belongs to?
groups
userinfo
id
whoami
17 What is the primary role of a bootloader like GRUB?
18 In the Linux boot process, what is the very first program the computer hardware runs when it is powered on?
19 On a modern Linux system using GRUB2, which file is typically edited to make permanent changes to boot settings like the default timeout?
/etc/grub.conf
/boot/grub/grub.cfg
/boot/config
/etc/default/grub
20 How can a user typically make a temporary change to the kernel boot parameters for a single boot session?
/etc/fstab file before rebooting
21 A developer needs to modify a specific driver for a custom hardware device to optimize its performance. Which core characteristic of the Linux kernel is most crucial for allowing this type of modification?
22
A system administrator wants to find all files ending with .log in the /var/log directory that have been modified in the last 24 hours and then safely delete them. Which of the following command pipelines correctly and safely accomplishes this, especially for filenames containing spaces?
find /var/log -name "*.log" -mtime -1 | rm
find /var/log -name "*.log" -mtime -1 -print0 | xargs -0 rm
grep -lR "" /var/log/*.log -mtime -1 | xargs rm
ls /var/log/*.log | grep "-1 day" | xargs rm
23
An administrator needs to grant the user auditor the ability to run the tail -f /var/log/secure command as root, but nothing else. Which is the most secure and correct entry to add to the /etc/sudoers file using visudo?
auditor ALL=(root) /usr/bin/tail -f /var/log/secure
auditor ALL=NOPASSWD: /usr/bin/tail *
%auditor ALL=(root) /usr/bin/tail -f /var/log/secure
auditor ALL=(root) ALL
24
During the boot process of a modern Linux system using systemd, what is the primary role of the initramfs (initial RAM filesystem)?
sshd and httpd
25
An administrator needs to create a new user named temp_worker. The account should have a home directory, use /bin/bash as the shell, and automatically be disabled on January 1st, 2025. Which command achieves all these requirements?
useradd -m -s /bin/bash temp_worker && chage -E 2025-01-01 temp_worker
useradd -c "Expires 2025-01-01" -s /bin/bash temp_worker
useradd -m -s /bin/bash -x 2025-01-01 temp_worker
useradd -m -s /bin/bash -e 2025-01-01 temp_worker
26
A junior administrator knows a command exists for managing logical volumes but cannot remember if it's lvm, lvcreate, or something else. They want to find all manual pages whose names or short descriptions relate to "logical volume". Which command is best suited for this discovery?
man -k "logical volume"
man logical-volume
find / -name "logical volume"
whatis logical volume
27
A project requires that a user, bwayne, be added to the justice_league group. However, it's critical that his existing supplementary group memberships are not affected. What is the key difference between usermod -G justice_league bwayne and usermod -aG justice_league bwayne?
-a is simply an alias for verbosity.
-G option sets the primary group, while -aG sets a supplementary group.
-aG option is for adding a group to a system, while -G is for adding a user to a group.
-aG option appends the group to the user's existing supplementary groups, while -G replaces the entire list of supplementary groups with the new one.
28
A user, clarkk, reports he is unable to write to a directory at /srv/project_krypton. The permissions on the directory are drwxrwx---. 1 root editors 4096 Jan 5 11:00 project_krypton. The administrator adds clarkk to the editors group with usermod -aG editors clarkk. The user immediately tries to write to the directory again but still gets a "Permission denied" error. What is the most likely reason for this continued failure?
editors.
29
An administrator needs to add the kernel parameter pci=nomsi to the default boot configuration to troubleshoot a hardware issue. After adding this parameter to the GRUB_CMDLINE_LINUX_DEFAULT line in /etc/default/grub, what is the next essential command to run to make this change persistent across reboots on a RHEL/CentOS system?
grub2-mkconfig -o /boot/grub2/grub.cfg
update-initramfs -u
systemctl reboot
grub2-install /dev/sda
30
A policy requires that members of the jr_admins group can restart the nginx service, but only after authenticating with their own password. Which sudoers rule best enforces this policy?
%jr_admins ALL = /usr/bin/systemctl restart nginx
%jr_admins ALL = (nginx) /usr/bin/systemctl restart
jr_admins ALL = /usr/bin/systemctl restart nginx
%jr_admins ALL = NOPASSWD: /usr/bin/systemctl restart nginx
31
What is the primary function of the | (pipe) character in the command ps aux | grep 'httpd'?
ps aux to a file named grep.
ps aux command to be the standard input of the grep 'httpd' command.
ps aux to the output of grep 'httpd'.
32
Upon inspection of the /etc/passwd file, a system administrator sees the following line: jdoe:!:19423:0:99999:7:::. What is the status of the jdoe user account?
33 Which sequence correctly represents the major stages of a modern UEFI-based Linux boot process?
34
A script owned by the root user fails with a 'permission denied' error when run by user jane. The file permissions are -rwxr-x--- 1 root devs 48 Mar 10 10:20 run_report.sh. User jane is a member of the devs group. The permissions on the directory containing the script are drwxr-x--x. What is the most likely cause of the failure?
jane does not have permission.
jane does not have execute permission on the directory containing the script.
35 A system is running a database server, a web server, and a compilation task simultaneously. The operating system ensures that the compilation task, which is CPU-intensive, does not starve the time-sensitive database and web servers of CPU resources. Which Linux characteristic is primarily responsible for this behavior?
36
To enter single-user mode on a systemd-based Linux distribution from the GRUB menu, an administrator edits the boot parameters. Which parameter should be added to the end of the line that starts with linux or linux16?
systemd.unit=rescue.target
init=/bin/sh
boot.mode=single
--single-user
37
An administrator needs to create a new system group named appacct for a service account, ensuring it gets a GID from the system range (typically below 1000). Which command is the most appropriate for this task?
groupadd -g 500 appacct
groupadd -r appacct
newgrp appacct
addgroup --system appacct
38
An administrator is viewing a man page for the ss command and wants to search for all occurrences of the word "LISTEN" within the page. After opening the page with man ss, what should they type next?
grep LISTEN
?LISTEN and then press p to find previous matches
/LISTEN and then press n to find subsequent matches
f LISTEN
39
What is the primary security advantage of using visudo to edit the /etc/sudoers file instead of a standard text editor like vi or nano?
visudo logs all changes made to the /etc/sudoers file in the system journal.
visudo automatically encrypts the /etc/sudoers file to prevent unauthorized viewing.
visudo performs a syntax check on the file before saving and exiting, preventing lockouts due to syntax errors.
visudo only allows the root user to open the file, whereas vi can be used by any user.
40 A user's account needs to be deleted, and the company policy states that all of their files and their home directory must also be removed from the system. Which command will accomplish this deletion of both the user account and their associated home directory data?
userdel jsmith
rm -rf /home/jsmith && userdel jsmith
usermod --remove jsmith
userdel -r jsmith
41
A system fails to boot, dropping into an initramfs emergency shell. The root filesystem on /dev/sda2 is intact and its UUID is correctly specified in the bootloader. However, the system reports it cannot find the device. Which of the following is the most probable cause related to the initramfs build process?
initramfs is missing the necessary storage controller driver (e.g., ahci.ko) or the specific filesystem driver (e.g., ext4.ko) required to access /dev/sda2.
vmlinuz) is corrupted and cannot properly initialize the hardware, forcing a fallback to the emergency shell.
/etc/fstab file on the root filesystem is corrupted, preventing the initramfs from mounting it.
42
A junior administrator needs to run /usr/sbin/tcpdump and /usr/bin/top with root privileges. An administrator adds the following sudo rule: junior_admin ALL=(ALL) NOPASSWD: /usr/sbin/tcpdump, /usr/bin/top. After saving, the user can run sudo tcpdump without a password, but is still prompted for a password when running sudo top. What is the most likely reason for this discrepancy in a complex sudoers configuration?
NOPASSWD tag must be specified individually for each command on the list.
sudoers file contains a later rule that also matches the user and top, such as junior_admin ALL=(ALL) ALL, which overrides the earlier specific rule.
top command is a setuid binary, which interacts differently with sudo's NOPASSWD tag.
Defaults entry like Defaults rootpw is set globally, forcing a password prompt for any command that impersonates the root user.
43
A script needs to process a list of filenames that may contain spaces. Consider the following command: find . -name "*.log" -print0 | xargs -0 -I {} bash -c 'echo "Processing file: {}"'. What is the primary advantage of using the -print0 and -0 combination over a simpler find ... | xargs pipeline?
xargs to run the command once for every single file found, which is more reliable.
bash -c command to inherit the environment variables of the parent shell.
44
An administrator executes userdel -r john. The user john owned several critical files in /srv/data, a directory which is not their home directory. After the command completes successfully, what is the ownership state of the files in /srv/data that were previously owned by john?
nobody user to prevent privilege escalation.
john previously had, as the username-to-UID mapping no longer exists.
/srv/data because the -r flag recursively removes all files owned by the user system-wide.
root and the group root as a security measure.
45
An administrator needs to boot a Linux system with the systemd.unit=rescue.target kernel parameter. They interrupt the boot process, edit the GRUB menu entry for the current boot, and add the parameter to the linux line. What is the persistence of this change?
initramfs image on disk, making it semi-permanent until the next kernel update.
/etc/default/grub but not applied until update-grub is run.
46
A user jane, a member of the developers group, cannot cd into /opt/app/data. The directory permissions are drwxr-x--- with ownership app_admin:developers. id jane confirms her membership. Assuming no ACLs or SELinux policies are interfering, what is the most likely cause for the "Permission denied" error?
/opt/app is mounted with the nogroup option, ignoring group permissions.
/opt or /opt/app, does not have the execute (x) permission set for Jane.
developers group has a GID above 65535, which is not supported on this filesystem.
newgrp developers to activate the group for her current session before she can access the directory.
47
During boot, the kernel loads but then panics with the message "VFS: Unable to mount root fs on unknown-block(0,0)". This occurred immediately after a kernel upgrade. The bootloader correctly points to the new kernel and initramfs images, and the root= parameter is correct. What is the most likely underlying problem?
initramfs image was not generated correctly and is missing a critical driver for the storage controller (e.g., NVMe) or the root filesystem type (e.g., XFS).
/etc/fstab file contains a typographical error in the UUID for the root filesystem.
48
An administrator wants to allow users in the web_devs group to restart Apache. They add the following line to /etc/sudoers: %web_devs ALL = /bin/systemctl restart httpd. However, users report the command fails. which systemctl returns /usr/bin/systemctl. Which change fixes this configuration while adhering to the principle of least privilege?
%web_devs ALL = /bin/systemctl, /usr/bin/systemctl restart httpd
%web_devs ALL = /usr/bin/systemctl *
%web_devs ALL = (root) NOPASSWD: /bin/systemctl restart httpd
%web_devs ALL = /usr/bin/systemctl restart httpd
49
A user 'analyst' is a member of groups analysts (primary), data, and reports. The user executes the command newgrp data. What is the immediate effect on the user's shell session?
data, but supplementary group memberships are lost in this new shell.
data for all subsequent commands within that same shell process.
data, and all original supplementary group memberships are retained.
data in /etc/passwd.
50
What is the primary function of wrapping commands in parentheses, as in (cd /var/log && tar -czf /tmp/logs.tar.gz .)?
tar only executes if cd is successful, providing atomicity.
cd) does not affect the parent shell's working directory.
> operator.
51
An administrator needs to find the specific integer value for a Linux system call, for example, __NR_openat. Standard man pages for the call describe its function but not its numerical value. Which command or file is the most direct and reliable source for this information on a typical Linux system?
info libc
apropos --long openat
man 5 syscalls
/usr/include/asm/unistd.h or /usr/include/x86_64-linux-gnu/asm/unistd_64.h header files.
52 In the context of the Linux kernel's process scheduler, what is the fundamental difference between a preemptive kernel and a non-preemptive kernel?
53
A sysadmin needs to create a user temp_user with UID 1500, primary group users, home directory /home/temp, but wants to create the home directory without populating it from /etc/skel. Which useradd command achieves this exact outcome?
useradd -u 1500 -g users -d /home/temp --no-skel temp_user
useradd -u 1500 -g users -d /home/temp -m --skel=/nonexistent temp_user
useradd -u 1500 -g users -d /home/temp -m -k /dev/null temp_user
useradd -u 1500 -g users -d /home/temp -M temp_user
54
A user brian can successfully authenticate via SSH, but the connection immediately closes. The SSH daemon logs show a successful login followed by a session close. The user's account is not locked, their password is valid, and the file /etc/nologin does not exist. Which of the following is the most probable administrative configuration causing this?
700 but is owned by root:root.
sshd_config) has a DenyUsers brian directive.
/etc/passwd specifies their login shell as /sbin/nologin or /bin/false.
.bashrc or .profile script has a syntax error that causes the shell to exit immediately.
55
What is the precise effect of the following sudoers line: Defaults!/usr/bin/find !requiretty?
requiretty setting for all sudo commands.
Defaults cannot be scoped to a single command.
/usr/bin/find from being run via sudo if the user is connected via a TTY.
/usr/bin/find command to be run via sudo from a non-interactive session (like a cron job), while not affecting the requiretty setting for any other command.
56
An administrator is managing a system that uses systemd-boot instead of GRUB. To permanently add the kernel parameter iommu=pt for all future boots of the default kernel, which is the standard procedure?
grub2-mkconfig -o /boot/grub/grub.cfg after modifying a source file.
options line in the relevant boot entry file, such as /boot/loader/entries/arch.conf.
/etc/default/grub and add the parameter to GRUB_CMDLINE_LINUX.
/etc/kernel/cmdline and then run bootctl update.
57
A directory /data/shared has permissions drwxrws--- (mode 2770) and is owned by root:projecta. User bob, a member of the projecta group, creates a new subdirectory /data/shared/bobs_work. What will be the group ownership and permissions of this new subdirectory?
bob's primary group; permissions rwxr-x---
projecta; permissions rwxr-x---
bob's primary group; permissions rwxrws---
projecta; permissions rwxrws---
58
What is the primary role of the switch_root utility at the end of the initramfs stage of the Linux boot process?
initramfs to a new directory and then chroots to the real root filesystem.
initramfs and remounts the real root filesystem over the same mount point.
initramfs to free memory, then chroots into the new root filesystem and executes the final /sbin/init process.
59
A bash script contains the line: exec 3<>/dev/tcp/example.com/80. What does this command accomplish?
example.com on port 80 and associates it with file descriptor 3.
/dev/tcp/example.com/80 command, replacing the current shell process.
60
A system administrator examines the /etc/shadow file and finds this entry: testuser:$6$somerandomsalt$anotherlongstring:0:0:99999:7:::. What is the immediate consequence for testuser at their next login?
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →