wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Linux Commands Quiz - Basic 03 to Basic 04

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

Which command is used to display disk usage by directory in human-readable form?

a)

df -h

b)

du -sh *

c)

ls -lh

d)

mount -h

2.

What does the `nice` command do in Linux?

a)

Changes file ownership

b)

Adjusts user login limits

c)

Sets priority for a process

d)

Encrypts a file

3.

What is the default runlevel for multi-user mode without GUI in most Linux distributions using SysVinit?

a)

2

b)

3

c)

5

d)

1

4.

Which command is used to change the hostname of a Linux system (runtime)?

a)

hostnamectl set-host

b)

hostnamectl set-hostname

c)

set-hostname

d)

sysctl hostname

5.

Which of the following tools is used for analyzing system boot performance in systemd-based Linux systems?

a)

journalctl

b)

systemctl

c)

bootstat

d)

systemd-analyze

6.

What is the use of `/etc/sudoers` file?

a)

To manage user groups

b)

To define system resource limits

c)

To control sudo access permissions

d)

To store user passwords

7.

What does the command `iptables -L` do?

a)

Lists all users

b)

Loads firewall rules

c)

Lists active firewall rules

d)

Logs incoming traffic

8.

Which utility is used to view real-time logs from systemd journal?

a)

logcat

b)

journald

c)

journalctl -f

d)

syslog -r

9.

Which file is used to configure kernel parameters at runtime?

a)

/etc/kernel.conf

b)

/boot/config

c)

/etc/sysctl.conf

d)

/usr/syslog.conf

10.

How do you grant a user sudo privileges in Ubuntu?

a)

Add to /etc/shadow

b)

Add to /etc/passwd

c)

Add to the sudo group

d)

Give them root password

11.

Which command is used to check system services status in systemd?

a)

service status

b)

chkconfig

c)

systemctl status

d)

initctl list

12.

What does the `/proc` directory represent?

a)

Static device files

b)

Mount points

c)

Runtime kernel and process information

d)

Log files

13.

Which command lists all users currently logged into the system?

a)

id

b)

who

c)

users

d)

group

14.

Which tool is used for system resource profiling in Linux?

a)

ps

b)

top

c)

strace

d)

perf

15.

How do you schedule a one-time job to run at a specific time?

a)

cron

b)

at

c)

now

d)

systemd

16.

Which of the following best describes the `umask` command?

a)

Lists mounted file systems

b)

Displays available users

c)

Sets default permissions for newly created files

d)

Encrypts user directories

17.

Which command displays detailed system hardware info?

a)

uname -a

b)

lscpu

c)

lshw

d)

top

18.

What is the purpose of `/etc/fstab` file?

a)

Configure user accounts

b)

Configure disk encryption

c)

Define static file systems to be mounted on boot

d)

Store passwords

19.

Which command is used to record and replay terminal sessions?

a)

log

b)

script

c)

screen

d)

journalctl -r

20.

Which Linux tool allows you to trace system calls made by a process?

a)

tcpdump

b)

tracepath

c)

strace

d)

gdb

21.

What is the function of `setuid` in Linux file permissions?

a)

Allows files to be deleted by any user

b)

Allows execution of a file with the file owner’s privileges

c)

Prevents file from being executed

d)

Forces logout after timeout

22.

Which command can be used to create a chroot jail in Linux?

a)

chroot /newroot

b)

jail /bin/bash

c)

sandbox -new

d)

restrict /chroot

23.

What is the role of `cgroups` in Linux?

a)

Encrypt disk partitions

b)

Group processes for multi-threading

c)

Limit and isolate resources (CPU, memory, I/O) for processes

d)

Manage group policies

24.

What does the sticky bit do when set on a directory?

a)

Files are always hidden

b)

Files are executed with elevated privileges

c)

Only the owner can delete or rename files in the directory

d)

Prevents files from being read

25.

Which mechanism does Linux use to load kernel modules dynamically?

a)

systemctl

b)

lsmod

c)

modprobe

d)

ulimit

26.

How can you audit system calls made by a user or process?

a)

sar

b)

strace

c)

gcore

d)

sysdig

27.

Which command in Linux can you use to set SELinux policies?

a)

apparmor

b)

semanage

c)

chcon

d)

selmod

28.

What is the purpose of the `/etc/ld.so.conf` file?

a)

Stores sudoers policy

b)

Contains shared library search paths

c)

Defines mount permissions

d)

Lists cron jobs

29.

Which of the following ensures memory pages are aligned to hugepage size in Linux?

a)

swapoff

b)

vmstat

c)

hugetlbfs

d)

mmap

30.

How do you isolate a process into its own namespace for PID, mount, etc.?

a)

fork()

b)

clone() with appropriate flags

c)

init --isolate

d)

run --jail

31.

Which of the following commands is used to trace block I/O events in the kernel?

a)

iostat

b)

dstat

c)

blktrace

d)

lsof

32.

What is `auditd` in Linux?

a)

Service for filesystem defragmentation

b)

Kernel security daemon

c)

Daemon responsible for logging security audit events

d)

DNS service

33.

Which kernel module allows container-like process isolation in Linux?

a)

aufs

b)

namespaces

c)

blkid

d)

iptables

34.

How do you make a user account expire automatically on a given date?

a)

passwd -x

b)

usermod -e YYYY-MM-DD username

c)

chage -l username

d)

setuid username

35.

Which command enables you to see how long a process spends in kernel vs user mode?

a)

time

b)

uptime

c)

nice

d)

sleep

36.

Which Linux command shows TCP, UDP, and UNIX socket statistics?

a)

tcpdump

b)

netstat -s

c)

ss -tunap

d)

ip a

37.

What is `capsh` used for in Linux?

a)

Running GUI applications

b)

Managing container permissions

c)

Viewing and modifying process capabilities

d)

Enabling secure shell

38.

Which tool is used to create Linux kernel crash dumps for debugging?

a)

vmcore

b)

kdump

c)

fsck

d)

perf

39.

Which system call is used to execute a program in Linux, replacing the current process?

a)

fork()

b)

spawn()

c)

execve()

d)

wait()

40.

What is the purpose of `AppArmor` in Linux systems?

a)

Manage backup systems

b)

Track user logins

c)

Mandatory access control security framework

d)

Package update manager