Font size
WorksheetsLinux Command and Scripting Quiz
Total questions: 78
Worksheet time: 42mins
Which key must be pressed in the interactive mode of the top utility to sort processes by memory consumption?
h
M (Shift+m)
k
P (Shift+p)
q
Which command returns a background process to the foreground?
back
jobs
nohup
fg
restore
How to display the latest log entries in real time?
systemctl watch-logs
sudo dmesg-l
sudo journalctl-f
sudo tail /var/log/messages
journalctl--live
Which command is used to change the priority (nice) of an already running process?
ps --nice
change_priority
priority
nice
renice
Which tool analyzes shell scripts for errors and provides recommendations?
shellcheck
shfmt
grep
awk
systemd-analyze
What does the recommendation 'Never work as root permanently' mean?
Root should be used to launch user processes.
This rule can be ignored in a local network.
Use a regular user and perform administrative actions via sudo.
The root account should be deleted after system installation.
The root user should always be active on all servers.
Which bootloader is the most common in Linux?
BOOTMGR
LILO
SYSLINUX
GRUB2
PXE Loader
What is the name of the 'mother' distribution that is the benchmark of stability for the family that includes Ubuntu and Kali?
SUSE
Red Hat Enterprise Linux
Slackware
Gentoo
Debian
How to hide password input in a shell script?
Enter the password into a variable without quotes.
Use read -s -p 'Enter password: ' user_password.
Use the echo $password command.
Use cat /dev/null > password.
Hide the password via chmod.
What is the primary function of the Kernel during system boot?
Configure user interfaces.
Monitor network connections.
Manage BIOS parameters.
Check checksums of all files.
Initialize hardware, mount the root filesystem, and launch the first process.
What is the Shell in Linux?
A graphical shell for designing interfaces.
A command interpreter that provides interaction between the user and the operating system.
A service for managing user accounts.
A kernel module responsible for network connections.
A program for compiling source code.
What does the command ping -c1 -W1 '$TARGET' &>/dev/null do in a script?
Checks the availability of the $TARGET host by sending one ICMP packet and suppressing the output.
Checks for an SSH key on the server.
Establishes a persistent connection with $TARGET.
Measures download speed from the host.
Scans the network for open TCP ports.
What is a 'process' in the context of the Linux operating system according to the lecture?
A static program file stored on a hard disk.
The smallest unit of execution that shares memory with other units.
A set of drivers for connecting peripheral devices.
An instance of a running program that has its own address space and resources.
A special command for updating the system kernel.
Which of the listed IP address ranges belongs to private addresses (Private IP, RFC 1918) and is not routable on the internet?
8.8.8.8/32
192.168.0.0/16
77.88.55.242/24
1.1.1.1/32
150.10.10.0/24
What is the main difference between the TCP and UDP protocols according to the lecture?
TCP is used exclusively for DNS queries, while UDP is for websites.
There is no difference; they are two names for the same protocol.
UDP guarantees packet delivery in strict order, unlike TCP.
TCP works only in local networks, while UDP works only on the global internet.
TCP guarantees data delivery and establishes a connection, while UDP does not (faster but without guarantees).
What is the primary task of the BIOS/UEFI stage during Linux boot?
Launch security diagnostic utilities.
Mount the root filesystem.
Check the integrity of systemd logs.
Initialize hardware and prepare to launch the bootloader.
Load the user desktop.
What is the advantage of the mtr utility over standard ping and traceroute?
It combines the functions of ping and traceroute, providing real-time statistics.
It works without using a network card (offline).
It allows cracking Wi-Fi network passwords.
It encrypts all traffic passing through it.
It automatically fixes connection issues on the line.
What does the process state 'Z' (Zombie) mean in the output of monitoring commands?
The process has finished execution, but the parent process has not read its exit status (has not called wait()).
The process is running with maximum real-time priority.
The process is in a deep sleep and waiting for disk I/O.
The process is infected with malware and blocked by antivirus.
The process was forcibly terminated by the system due to lack of memory (OOM Killer).
What does 'regular auditing' imply in the context of best practices?
Archiving logs without analysis.
Counting users in /home.
Checking system permissions, ACLs, and SUID files for security violations.
Allowing all users to run sudo.
Clearing temporary directories without checking.
Why is shell scripting required for a security specialist?
To install graphical themes.
To manage the NTFS file system.
To manually edit the Linux kernel.
To configure user desktop profiles.
To automate tasks-collecting artifacts, analyzing logs, monitoring, and penetration testing.
Why should variables always be enclosed in quotes when substituting ('$var', not $var)?
To prevent splitting the value into multiple arguments and avoid erroneous deletions or expansions.
To convert the value to uppercase.
So that Bash treats the value as numeric.
To speed up script execution.
To make the variable global.
How do local variables differ from environment variables?
Local variables are automatically exported.
Local variables are available to all system users.
There is no difference-they are the same.
Local variables are only valid within the current script, while environment variables are inherited by child processes.
Environment variables are stored only in /etc/environment.
What does the TTL (Time To Live) parameter do in network packets?
Defines the 'lifetime' of a packet, decreasing by 1 at each router (protection against looping).
Determines the maximum size of the transmitted file.
Shows the exact sending time of the packet in milliseconds.
Indicates how many times the packet was lost during transmission.
Determines the priority of the packet over other data (higher TTL means faster delivery).
Which command clears old logs to a size of 200 MB?
journalctl-clear 200M
sudo journalctl--truncate=200M
sudo logclean--size=200M
sudo journalctl--vacuum-size=200M
systemctl clean-journal 200M
Why is it necessary to protect the /root directory?
Its contents are duplicated in /tmp.
It is used for backing up users' home directories.
It contains superuser configurations and scripts; access to them gives full control over the system.
It is writable by every user.
It only stores temporary files and poses no risk.
Why is it important to forward system logs to a remote server?
To speed up the work of systemd-journald.
To reduce disk load.
For automatic package updates.
So that an attacker cannot delete or modify local logs on a compromised machine.
For organizing file backups.
Which low-level utility in the Debian family installs .deb files but does NOT resolve dependencies?
dpkg
synaptic
tasksel
dnf
apt
Why is the [[ ... ]] construct safer than [ ... ] for condition checks?
It works faster than [ ... ] and executes in parallel.
There is no difference between them.
[[ ... ]] does not perform expansion of special characters, thus protecting values from Bash interpretation.
It allows using Python syntax.
It ignores command execution errors.
What is EPEL in the context of RHEL systems?
The 'Extra Packages for Enterprise Linux' repository, containing thousands of additional packages.
A graphical interface for server management.
A paid subscription for technical support from Oracle.
A utility for recovering deleted configuration files.
A special kernel mode for improving database performance.
Which command allows displaying logs of a specific systemd service?
syslog-s
journalctl-u
systemctl logs
logshow
cat /var/log/.log
Why is it recommended to use the ss utility instead of netstat in modern Linux distributions?
ss is a modern utility that works faster and shows more accurate information.
ss allows remotely rebooting routers.
ss has a beautiful graphical interface, unlike netstat.
ss is used only for IPv6, while netstat is only for IPv4.
netstat no longer supports the TCP protocol.
What are the recommended permissions for the /etc/passwd file?
755 (rwxr-xr-x)
600 (rw-------)
700 (rwx------)
777 (rwxrwxrwx)
644 (rw-r--r--)
What is the main purpose of the Secure Boot function?
What is the main purpose of the Secure Boot function?
Provide remote recovery of the boot partition.
Monitor network connections during system startup.
Verify the digital signature of the bootloader to prevent launching unsigned (malicious) code.
Automatically select the kernel version at each boot.
Compress initramfs before booting.
How does the traceroute utility determine the path of packets?
It sends a series of packets with a gradually increasing TTL (Time To Live) value.
It downloads the routing table from the provider's central server.
It connects to each router via SSH and requests its IP.
It uses the DNS protocol to query the location of each router.
It sends one packet with maximum priority and waits for a full report from the target node.
Why is a password set on GRUB2?
To automatically update GRUB configuration.
To prevent changing boot parameters (e.g., booting into single-user mode to reset the root password).
To hide the list of available kernels.
To suppress kernel messages on the screen.
To speed up system boot.
What is the shfmt command used for?
For running bash scripts as system services.
For checking file integrity.
For searching for vulnerabilities in logs.
For automatic formatting and alignment of shell code.
For encrypting environment variables.
What is Heap Overflow?
An error when reading kernel logs.
An error where data is written beyond the allocated memory area (heap), which can lead to arbitrary code execution.
Excessive traffic in the network buffer.
A memory shortage leading to system hangs.
Corruption of the filesystem table.
What does the directive set -euo pipefail do at the beginning of a script?
Increases reliability: terminates execution on errors, undeclared variables, and pipeline failures.
Sets the PIPEFAIL environment variable.
Ignores all errors except fatal ones.
Runs the script in the background.
Uses the Python interpreter.
What is the Fail2Ban tool, mentioned in the lecture, used for?
To monitor the server's CPU temperature.
To speed up the web server by caching requests.
To block ads in the browser on the server.
To automatically block IP addresses after several failed login attempts.
To recover forgotten user passwords.
Which kernel vulnerability allowed modification of system files and obtaining root access?
Dirty Pipe
Meltdown
Log4J
Heartbleed
EternalBlue
What is Kali Linux mainly used for?
Scientific computing and data analysis
Cybersecurity and penetration testing
Office applications and document work
Gaming platform
Web development and programming
Which package manager is used in Debian-based distributions (e.g., Ubuntu)?
zypper
apt
pacman
yum
dnf
How do you redirect standard output and errors to a single file?
command >> file.log 2>> file.log
command &> file.log
command > file.log 2>&1
command | tee file.log
command > file.log 2> file.log
What does the command mkdir project && cd project do?
Copies project to the current directory
Shows the contents of project
Deletes the project directory and creates a new one
Creates the project directory or changes to it
Creates the project directory and changes to it
Which command copies a directory with all its contents?
copy-all
cp--recursive
rcp
cp-a
cp-r
Which find command searches for all files with .log extension in the /var/log directory?
find /var/log -name "*.log"
find /var/log -pattern "*.log"
find /var/log -ext log
find /var/log -type "*.log"
find /var/log -file "*.log"
How can I add text to the end of an existing file without deleting its contents?
cat "text" >> file.txt
write "text" file.txt
append "text" file.txt
echo "text" >> file.txt
echo "text" > file.txt
Which command can be used to safely delete a directory with confirmation for each file?
remove--safe
rm-rf
rmdir
rm-ri
delete-i
Which key combination is used in the Nano editor to save a file?
Ctrl + X
Ctrl + W
Alt + S
Ctrl + S
Ctrl + O
What command can be used to find all .txt files modified in the last 7 days?
find . -type txt -days 7
search "*.txt" -modified 7
grep "*.txt" -mtime 7
find . -name "*.txt" -mtime -7
ls *.txt -new 7
Which command can be used to view the value of the HOME environment variable?
echo $HOME
env HOME
show $HOME
get HOME
print HOME
What does the cd .. command do?
Go to the root directory
Create a new directory
Go to the home directory
Go to the parent directory
Show the command history
Which key combination in Nano starts selecting a block of text?
Ctrl + A
Alt + A
Ctrl + K
Ctrl + H
Ctrl + 6
How to exit the nano editor with saving changes?
Ctrl + S
Ctrl + W
Esc
Ctrl + X
Ctrl + Q
Which pattern (globbing) matches any single character in a filename?
*
?
[]
%
_
How to create a directory named "projects" in the Linux terminal?
newdir projects
create projects
mkdir projects
dir projects
Which command in Vim copies the current line?
copy
cc
yy
pp
dd
Which key combination in Nano undoes the last action?
Ctrl + R
Alt + U
Ctrl + Z
Ctrl + U
Alt + Z
What command in Vim allows you to exit without saving changes?
:wq
:x!
:quit
:exit!
:q!
Which of the following freedoms is NOT included in the four freedoms of the GPL license?
The freedom to distribute modified versions
The freedom to distribute copies
The freedom to run the program for any purpose
The freedom to sell the program without disclosing the source code
The freedom to study how the program works and modify it
Which command counts the number of lines in a file or input data?
total-l
wc -l
lines
count-l
grep-c
What command in Linux creates a new group called "developers"?
creategroup developers
newgrp developers
addgroup developers
groupadd developers
mkgroup developers
Which numeric code corresponds to "read and write" access rights for the owner and "read only" for everyone else?
600
777
644
755
744
What command sets the "sticky bit" on the /tmp directory to protect files from being deleted by non-owners?
chmod +s /tmp
setfacl -m t /tmp
chmod +t /tmp
chmod 1755 /tmp
chattr +s /tmp
Which command in Vim displays line numbers?
:line numbers
:numbers on
:show numbers
:set linenum
:set number
How to delete a directory with all its contents in Linux?
rmdir
rm-d
rm -r
remove-all
delete-r
Which command allows you to find all files with 777 access rights in the current directory and its subdirectories?
ls -l | grep 777
search --mode 777
find . -perm 777
chmod 777 *
locate -perm 777
Which character at the beginning of a line in the output of ls -l indicates a regular file?
c
l
-
f
d
Which command is used to view the used and free space on mounted partitions?
fdisk -l
du -h
mount | grep dev
df -h
lsblk
Which file attribute, using the chattr command, makes a file immutable (cannot be deleted or modified)?
+d
+u
+i
+a
+s
What does the command ls [ab]*.log mean?
Show all .log files
Show .log files beginning with a or b
Show .log files with two-character names
Show hidden .log files
Show .log files containing a or b
What is the UID (user ID) of the root superuser in Linux?
0
1000
999
100
1
Which project did Richard Stallman aim to create a free UNIX-like operating system?
The Hurd Project
The BSD Project
The OpenSource Project
The Minix Project
The GNU Project
Which file system is recommended for working with large files and has high performance?
Btrfs
XFS
ext4
FAT32
NTFS
Which uniq command shows the number of repetitions of each line?
uniq-count
uniq-d
uniq--repeat
uniq-n
uniq -c
Which operator is used to redirect command output to a file with content overwriting?
>>
|
<
>
&
How do you perform a global replacement of "old" with "new" throughout an entire file in Vim?
:s/old/new/g
:%s/old/new/g
:replace old new
:all s/old/new/
:global s/old/new/
