WorksheetsLinux Commands Quiz - Basic 03 to Basic 04
Total questions: 40
Worksheet time: 20mins
Which command is used to display disk usage by directory in human-readable form?
df -h
du -sh *
ls -lh
mount -h
What does the `nice` command do in Linux?
Changes file ownership
Adjusts user login limits
Sets priority for a process
Encrypts a file
What is the default runlevel for multi-user mode without GUI in most Linux distributions using SysVinit?
2
3
5
1
Which command is used to change the hostname of a Linux system (runtime)?
hostnamectl set-host
hostnamectl set-hostname
set-hostname
sysctl hostname
Which of the following tools is used for analyzing system boot performance in systemd-based Linux systems?
journalctl
systemctl
bootstat
systemd-analyze
What is the use of `/etc/sudoers` file?
To manage user groups
To define system resource limits
To control sudo access permissions
To store user passwords
What does the command `iptables -L` do?
Lists all users
Loads firewall rules
Lists active firewall rules
Logs incoming traffic
Which utility is used to view real-time logs from systemd journal?
logcat
journald
journalctl -f
syslog -r
Which file is used to configure kernel parameters at runtime?
/etc/kernel.conf
/boot/config
/etc/sysctl.conf
/usr/syslog.conf
How do you grant a user sudo privileges in Ubuntu?
Add to /etc/shadow
Add to /etc/passwd
Add to the sudo group
Give them root password
Which command is used to check system services status in systemd?
service status
chkconfig
systemctl status
initctl list
What does the `/proc` directory represent?
Static device files
Mount points
Runtime kernel and process information
Log files
Which command lists all users currently logged into the system?
id
who
users
group
Which tool is used for system resource profiling in Linux?
ps
top
strace
perf
How do you schedule a one-time job to run at a specific time?
cron
at
now
systemd
Which of the following best describes the `umask` command?
Lists mounted file systems
Displays available users
Sets default permissions for newly created files
Encrypts user directories
Which command displays detailed system hardware info?
uname -a
lscpu
lshw
top
What is the purpose of `/etc/fstab` file?
Configure user accounts
Configure disk encryption
Define static file systems to be mounted on boot
Store passwords
Which command is used to record and replay terminal sessions?
log
script
screen
journalctl -r
Which Linux tool allows you to trace system calls made by a process?
tcpdump
tracepath
strace
gdb
What is the function of `setuid` in Linux file permissions?
Allows files to be deleted by any user
Allows execution of a file with the file owner’s privileges
Prevents file from being executed
Forces logout after timeout
Which command can be used to create a chroot jail in Linux?
chroot /newroot
jail /bin/bash
sandbox -new
restrict /chroot
What is the role of `cgroups` in Linux?
Encrypt disk partitions
Group processes for multi-threading
Limit and isolate resources (CPU, memory, I/O) for processes
Manage group policies
What does the sticky bit do when set on a directory?
Files are always hidden
Files are executed with elevated privileges
Only the owner can delete or rename files in the directory
Prevents files from being read
Which mechanism does Linux use to load kernel modules dynamically?
systemctl
lsmod
modprobe
ulimit
How can you audit system calls made by a user or process?
sar
strace
gcore
sysdig
Which command in Linux can you use to set SELinux policies?
apparmor
semanage
chcon
selmod
What is the purpose of the `/etc/ld.so.conf` file?
Stores sudoers policy
Contains shared library search paths
Defines mount permissions
Lists cron jobs
Which of the following ensures memory pages are aligned to hugepage size in Linux?
swapoff
vmstat
hugetlbfs
mmap
How do you isolate a process into its own namespace for PID, mount, etc.?
fork()
clone() with appropriate flags
init --isolate
run --jail
Which of the following commands is used to trace block I/O events in the kernel?
iostat
dstat
blktrace
lsof
What is `auditd` in Linux?
Service for filesystem defragmentation
Kernel security daemon
Daemon responsible for logging security audit events
DNS service
Which kernel module allows container-like process isolation in Linux?
aufs
namespaces
blkid
iptables
How do you make a user account expire automatically on a given date?
passwd -x
usermod -e YYYY-MM-DD username
chage -l username
setuid username
Which command enables you to see how long a process spends in kernel vs user mode?
time
uptime
nice
sleep
Which Linux command shows TCP, UDP, and UNIX socket statistics?
tcpdump
netstat -s
ss -tunap
ip a
What is `capsh` used for in Linux?
Running GUI applications
Managing container permissions
Viewing and modifying process capabilities
Enabling secure shell
Which tool is used to create Linux kernel crash dumps for debugging?
vmcore
kdump
fsck
perf
Which system call is used to execute a program in Linux, replacing the current process?
fork()
spawn()
execve()
wait()
What is the purpose of `AppArmor` in Linux systems?
Manage backup systems
Track user logins
Mandatory access control security framework
Package update manager
