First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Linux Fundamentals
On a Linux system, which directory conventionally holds host-specific configuration files such as fstab and sshd_config?
- /usr/lib
- /opt
- /var
- /etc Correct answer.
Explanation
The Filesystem Hierarchy Standard reserves /etc for host-specific configuration files. Executables and libraries live under /usr, variable data such as logs and spools lives under /var, and optional add-on software lives under /opt.
Question 2Linux Fundamentals
Which command prints the absolute path of the shell's current working directory?
- pwd Correct answer.
- ls
- cd
- dirname
Explanation
pwd stands for print working directory and outputs the absolute path of the directory the shell is currently in. ls lists directory contents, cd changes the working directory, and dirname extracts the directory portion of a supplied path.
Question 3Linux Fundamentals
Which command changes the permission bits of a file or directory?
- umask
- chmod Correct answer.
- chgrp
- chown
Explanation
chmod modifies the read, write, and execute permission bits on a file or directory. chown changes ownership, chgrp changes group ownership, and umask controls the default permissions used for newly created files and directories.
Question 4Linux Fundamentals
A regular file has permission mode 640. What access does this mode grant?
- Owner read/write, group execute, others none
- Owner read/write, group read, others none Correct answer.
- Owner read only, group read, others none
- Owner read/write, group read/write, others none
Explanation
In numeric mode the three digits represent owner, group, and others. The digit 6 is read plus write, 4 is read, and 0 is no permissions, so 640 allows the owner to read and write, the group to read, and others nothing.
Question 5Linux Fundamentals
Which command searches a text file for lines matching a regular expression and prints the matching lines?
- awk
- find
- sed
- grep Correct answer.
Explanation
grep scans input line by line and prints lines that match a pattern, which may be a basic or extended regular expression. find searches the filesystem for pathnames, sed edits streams of text, and awk is a field-oriented programming language.
Question 6Linux Fundamentals
Which command sends the default termination signal, SIGTERM, to the process with PID 1234?
- kill 1234 Correct answer.
- killall 1234
- pkill 1234
- kill -9 1234
Explanation
kill PID sends SIGTERM by default, giving the process a chance to clean up before exiting. kill -9 sends SIGKILL, which cannot be caught, while killall and pkill match process names or patterns rather than a numeric PID.
Question 7Linux Fundamentals
On a Debian-derived distribution, which command installs the package named curl from configured repositories?
- pacman -S curl
- dnf install curl
- yum install curl
- apt install curl Correct answer.
Explanation
Debian-derived distributions use the APT package manager, so apt install curl resolves and installs the curl package from configured repositories. yum and dnf are used on RPM-based distributions, and pacman is the Arch Linux package manager.
Question 8Linux Fundamentals
Which useradd option creates the new user's home directory if it does not already exist?
- -G
- -r
- -s
- -m Correct answer.
Explanation
The -m option tells useradd to create the home directory, typically by copying skeleton files from /etc/skel. The -r option creates a system account, -s sets the login shell, and -G adds supplementary groups.
Question 9Linux Fundamentals
A directory has mode drwxr-x--- and is owned by alice with group dev. User bob is a member of group dev but is not alice. What can bob do inside this directory?
- List entries and traverse into it, but not create or remove files. Correct answer.
- Read, write, and execute, because group membership grants full access.
- List entries only, because execute is not granted to the group.
- Nothing, because bob is not the owner.
Explanation
The group permission triad is r-x, so members of dev can read the directory listing and traverse through the directory. The absence of w in the group triad prevents bob from creating, renaming, or deleting entries in the directory.
Question 10Linux Fundamentals
A directory has the setgid bit set and is owned by alice:dev. What happens to a new regular file created inside it by a member of dev?
- The file ownership is transferred to alice instead of the creating user.
- The file receives the setgid bit and becomes executable for the group.
- The file's group is always set to the creator's primary group.
- The file inherits the group dev when the creator is in dev. Correct answer.
Explanation
On a directory, setgid causes new files to inherit the directory's group instead of the creator's primary group, and new subdirectories also inherit setgid. Ownership still belongs to the creating user, and the setgid bit on a regular file means something different from setgid on a directory.
Question 11Linux Fundamentals
In a Bash shell, which redirection sends only the standard error stream of ./deploy.sh to a file named err.log?
- ./deploy.sh > err.log
- ./deploy.sh 2> err.log Correct answer.
- ./deploy.sh &> err.log
- ./deploy.sh 2>&1 | tee err.log
Explanation
File descriptor 2 is standard error, so 2> sends only that stream to err.log while standard output (fd 1) continues to the terminal. A bare > touches only standard output, and &> merges both streams into one destination.
Question 12Linux Fundamentals
Which command reports used and available space on mounted filesystems with sizes shown in powers of 1024 such as K, M, and G?
- du -sh
- df -h Correct answer.
- lsblk -f
- free -h
Explanation
df reads each mounted filesystem's superblock and reports total, used, and available blocks, and the -h flag prints those figures in human-readable powers of 1024. It answers the question of how full a filesystem is, which is different from how big a directory tree is.
Question 13Linux Fundamentals
Which file in a user's home directory lists the public keys that are permitted to log in to that account over SSH?
- ~/.ssh/known_hosts
- ~/.ssh/config
- ~/.ssh/id_rsa.pub
- ~/.ssh/authorized_keys Correct answer.
Explanation
The SSH server, when a client offers a key, checks the target account's ~/.ssh/authorized_keys and grants access if a listed public key matches the client's private key. The directory and the file must not be group- or world-writable, or the server ignores them.
Question 14Linux Fundamentals
An administrator wants the nginx unit to start automatically at every boot but does not want to start it during the current session. Which command accomplishes this?
- systemctl start nginx
- systemctl restart nginx
- systemctl enable --now nginx
- systemctl enable nginx Correct answer.
Explanation
systemctl enable installs the WantedBy symlinks that pull the unit in during boot, and by itself it leaves the current runtime state unchanged. Adding --now would combine enabling with an immediate start, which the requirement excludes.
Question 15Linux Fundamentals
Which crontab line runs /usr/local/bin/backup.sh every day at 02:30?
- */30 2 * * * /usr/local/bin/backup.sh
- 30 2 * * 1 /usr/local/bin/backup.sh
- 2 30 * * * /usr/local/bin/backup.sh
- 30 2 * * * /usr/local/bin/backup.sh Correct answer.
Explanation
The five time fields are minute, hour, day-of-month, month, and day-of-week, so minute 30 with hour 2 means 02:30, and the asterisks make it apply every day of every month. A day-of-week value would restrict the schedule to one weekday.
Question 16Linux Fundamentals
Which command unpacks the gzip-compressed archive app.tar.gz into the existing directory /opt/app?
- tar -xzf app.tar.gz -C /opt/app Correct answer.
- tar -czf app.tar.gz /opt/app
- gzip -d app.tar.gz -C /opt/app
- tar -tzf app.tar.gz /opt/app
Explanation
tar -x extracts, -z applies the gzip filter, -f names the archive file, and -C changes directory before extraction so members are written below /opt/app. The order of the letters does not matter, but the -f option must be followed directly by the archive name.
Question 17Linux Fundamentals
The file /data/report.txt has a single hard link named /data/report.bak. An administrator runs rm /data/report.txt. What is the effect on /data/report.bak?
- It still opens the same content, because the inode and its data blocks remain allocated. Correct answer.
- It becomes a dangling symbolic link that points to a file which no longer exists.
- It keeps the content but loses its permission bits until it is relinked.
- It is removed as well, because both names are stored in one shared directory entry.
Explanation
A hard link is simply another directory entry for the same inode, and the kernel releases the data blocks only when the link count drops to zero. Removing one of two names decrements the count from two to one, leaving the surviving name fully functional.
Question 18Linux Fundamentals
Which command finds regular files below /var/log that were modified within the last 24 hours?
- find /var/log -type f -mtime +1
- find /var/log -type f -mtime 1
- find /var/log -type f -mtime -1 Correct answer.
- find /var/log -type f -atime -1
Explanation
In find expressions a leading minus means less than, so -mtime -1 selects files whose data was modified less than one 24-hour period ago. The -type f test restricts the results to regular files and excludes directories, sockets, and devices.
Question 19Linux Fundamentals
Writes to the /var filesystem fail with "No space left on device", yet df -h reports that plenty of blocks are free. Which command best diagnoses the cause?
- fsck -n /var
- df -i Correct answer.
- lsblk -f
- du -sh /var
Explanation
Every file and directory consumes an inode, and a filesystem can exhaust its inode table while data blocks remain available, which typically happens with huge numbers of tiny files. df -i prints total, used, and free inode counts for each mounted filesystem and reveals that condition directly.
Question 20Linux Fundamentals
Run as root, which command sets the nice value of the running process with PID 4242 to -5, giving it a larger share of CPU time?
- renice 5 -p 4242
- renice -5 -p 4242 Correct answer.
- renice 19 -p 4242
- nice -n -5 4242
Explanation
Nice values range from -20, most favorable to the process, to 19, least favorable, and only root may assign a negative value. renice changes the nice value of an already running process, so -5 with -p 4242 lowers the value from its current level and increases scheduling priority.
Question 21Linux Fundamentals
Which command prints the first ten lines of the file /etc/hosts to standard output?
- tail /etc/hosts
- head /etc/hosts Correct answer.
- less /etc/hosts
- cat -n /etc/hosts
Explanation
head reads from the start of a file and, with no count option, prints the first ten lines. tail defaults to the last ten lines, less opens an interactive pager, and cat -n numbers every line rather than limiting output.
Question 22Linux Fundamentals
Which command lists the entries of the current directory, including names that begin with a dot?
- ls -a Correct answer.
- ls -t
- ls -l
- ls -R
Explanation
The -a option tells ls to include directory entries whose names begin with a dot, which are normally hidden. The -l option selects a long listing, -R recurses into subdirectories, and -t sorts by modification time.
Question 23Linux Fundamentals
Which command creates an empty file named ready if it does not exist, and updates its timestamps if it does?
- echo ready
- mkdir ready
- stat ready
- touch ready Correct answer.
Explanation
touch creates a zero-length file when the path does not exist and otherwise updates the access and modification times. mkdir creates a directory, stat reports metadata, and echo prints text without creating a file.
Question 24Linux Fundamentals
A user's umask is 027. What permission mode will a newly created regular file receive, assuming the application requests mode 666?
- 0644
- 0600
- 0640 Correct answer.
- 0666
Explanation
The umask clears permission bits from the requested mode. Applying 027 to 666 removes group write and all permissions for others, leaving 640.
Question 25Linux Fundamentals
Which pipeline prints each distinct line of access.log together with the number of times that line occurs?
- sort access.log | uniq -c Correct answer.
- uniq access.log | sort -c
- grep -c access.log | sort
- wc -l access.log | uniq
Explanation
uniq -c counts adjacent duplicate lines, so the input must be sorted first to group identical lines together. The pipeline sort access.log | uniq -c therefore prints one count per distinct line.
Question 26Linux Fundamentals
Which command recursively changes the owner of /srv/www to alice and its group to web?
- chmod -R alice:web /srv/www
- usermod -R alice:web /srv/www
- chown -R alice:web /srv/www Correct answer.
- chgrp -R alice:web /srv/www
Explanation
chown changes file ownership, and the owner:group form sets both the user and the group. The -R option applies the change recursively to the directory and its contents.
Question 27Linux Fundamentals
Which command displays the journal entries recorded by the systemd unit named nginx.service?
- journalctl -u nginx.service Correct answer.
- dmesg -u nginx.service
- tail -u nginx.service
- systemctl log nginx.service
Explanation
journalctl reads the systemd journal, and the -u option filters entries to the specified unit. systemctl manages unit state rather than displaying journal contents.
Question 28Linux Fundamentals
Which command creates a symbolic link at /opt/app/current that points to /opt/app/releases/v2?
- ln /opt/app/current /opt/app/releases/v2
- link -s /opt/app/current /opt/app/releases/v2
- ln -h /opt/app/current /opt/app/releases/v2
- ln -s /opt/app/releases/v2 /opt/app/current Correct answer.
Explanation
The ln -s form takes the link target first and the new link name second, so the target is /opt/app/releases/v2 and the link is /opt/app/current. Without -s, ln creates a hard link rather than a symbolic link.
Question 29Linux Fundamentals
A file has the ACL entries user::rw-, group::r--, user:alice:rw-, and mask::r--. What effective access does alice receive?
- no access
- read and write
- read only Correct answer.
- write only
Explanation
The ACL mask limits the effective permissions of named users and the owning group. Alice's entry grants rw-, but the mask r-- removes write, so her effective access is read only.
Question 30Linux Fundamentals
In an /etc/fstab entry, which field contains mount options such as noatime and defaults?
- the second field
- the sixth field
- the fourth field Correct answer.
- the fifth field
Explanation
An fstab entry has six fields in order: device, mount point, filesystem type, mount options, dump flag, and fsck pass number. Mount options such as noatime and defaults therefore belong in the fourth field.
Question 31Linux Fundamentals
Which command changes the shell's working directory back to the directory that was current before the most recent cd?
- cd ~
- cd - Correct answer.
- cd /
- cd ..
Explanation
The cd - form uses the OLDPWD variable that the shell updates after each directory change, so it returns to the previous directory. cd .. moves to the parent, cd ~ goes to the home directory, and cd / goes to the filesystem root.
Question 32Linux Fundamentals
Which command shows a one-time snapshot of all processes with columns for user, PID, CPU percentage, and memory percentage?
- pidof sshd
- bg
- jobs
- ps aux Correct answer.
Explanation
ps aux prints a snapshot of every process on the system, including the owning user and resource usage columns. jobs and bg operate on jobs in the current shell, while pidof returns only PIDs for a named program.
Question 33Linux Fundamentals
Which command reads the kernel ring buffer to display recent hardware and driver messages?
- free
- last
- dmesg Correct answer.
- uptime
Explanation
dmesg prints the kernel ring buffer, which holds boot-time and recent kernel messages about hardware, drivers, and device events. last reads login records, uptime shows load averages, and free reports memory usage.
Question 34Linux Fundamentals
Which command opens the manual page that documents the passwd file format rather than the passwd command?
- man -k passwd
- man 5 passwd Correct answer.
- man 1 passwd
- man passwd
Explanation
Manual pages are divided into sections; section 5 holds file formats, so man 5 passwd opens the passwd file-format page. Without a section, man passwd may open the command page, and man 1 passwd explicitly selects the command section.
Question 35Linux Fundamentals
Which command prints every line containing the string timeout from all files below /etc/nginx, including files in subdirectories?
- grep timeout /etc/nginx
- grep -r timeout /etc/nginx Correct answer.
- grep -c timeout /etc/nginx/*
- find /etc/nginx -name timeout
Explanation
The -r option makes grep recurse through the directory tree and print matching lines from each file. Without -r, grep treats the directory as a single operand, -c only counts matches, and find -name matches file names rather than file contents.
Question 36Linux Fundamentals
Which command reports the total space used by /var/log and all of its subdirectories as one human-readable number?
- df -h /var/log
- ls -lh /var/log
- stat /var/log
- du -sh /var/log Correct answer.
Explanation
du -s summarizes the space consumed by a directory tree, and -h prints the total in human-readable units. df reports filesystem capacity, ls lists individual entries, and stat describes a single inode's metadata.
Question 37Linux Fundamentals
When an administrator runs kill -TERM 1234, what signal is delivered and what is its usual effect?
- SIGTERM, which requests that the process shut down gracefully Correct answer.
- SIGHUP, which reloads configuration without stopping the process
- SIGKILL, which cannot be caught and stops the process immediately
- SIGINT, which is generated by pressing Ctrl+C at the terminal
Explanation
The -TERM argument selects signal 15, SIGTERM, whose default action is termination after the process is given a chance to clean up. SIGKILL is signal 9 and cannot be caught, SIGHUP is signal 1, and SIGINT is signal 2.
Question 38Linux Fundamentals
In a systemd service unit file, which directive specifies the command that starts the service?
- After=
- ExecStart= Correct answer.
- WantedBy=
- Description=
Explanation
ExecStart= defines the command line systemd runs when the service is started. Description= is free-form text, After= orders units, and WantedBy= controls which target pulls the unit in.
Question 39Linux Fundamentals
A directory has mode 2775 and is owned by alice with group developers. Bob is a member of developers but is not the owner. What access does Bob have to the directory?
- Read and execute only, because setgid restricts writes
- Read, write, and execute Correct answer.
- Read only, because Bob is not the owner
- No access at all, because the directory is setgid
Explanation
Mode 2775 gives the group the rwx bits, and the leading 2 sets the setgid bit without changing group permissions. Bob inherits the developers group permissions, so he can read, write, and traverse the directory.
Question 40Linux Fundamentals
Which command lists open files held by processes whose command name is nginx?
- lsof -c nginx Correct answer.
- lsof -p nginx
- fuser -k nginx
- strace nginx
Explanation
lsof -c matches processes by command name and lists their open files. -p expects a PID, fuser -k sends signals to processes using files or sockets, and strace traces system calls rather than listing open files.
Question 41System Administration Fundamentals
On a typical Linux distribution, which command creates a new local user account named alice together with a home directory populated from /etc/skel?
- usermod -m alice
- passwd -m alice
- useradd -m alice Correct answer.
- groupadd -m alice
Explanation
useradd creates the account, and the -m flag tells it to create the home directory and copy the skeleton files from /etc/skel into it. The command does not assign a password, so passwd alice must be run afterwards to make the account usable for login.
Question 42System Administration Fundamentals
A Linux server uses systemd as its init system. After installing a new service unit file, which command configures the service to start automatically at every boot?
- systemctl status unit
- systemctl enable unit Correct answer.
- systemctl reload unit
- systemctl start unit
Explanation
enable creates the symlinks inside the appropriate target's wants directory so that systemd pulls the unit in during boot. start only launches the service in the current session, so administrators usually run both commands to activate a service now and keep it active after reboots.
Question 43System Administration Fundamentals
An administrator runs chmod 750 report.txt. Which access does the file's group receive?
- read and execute only Correct answer.
- no access at all
- read and write only
- read, write and execute
Explanation
The mode 750 decomposes into owner 7 (rwx), group 5 (r-x) and others 0 (---). The digit 5 is the sum of 4 for read and 1 for execute, so group members can read and execute the file but cannot modify it.
Question 44System Administration Fundamentals
A crontab entry reads: 0 3 * * 1 /usr/local/bin/backup.sh. When does this job run?
- Every three hours on Monday
- At 01:00 on the third day of each month
- At 03:00 every day of the month
- At 03:00 every Monday Correct answer.
Explanation
Cron fields are ordered minute, hour, day-of-month, month and day-of-week. Here minute 0 and hour 3 give 03:00, the two asterisks allow any day and month, and weekday 1 is Monday, so the job runs at 03:00 every Monday.
Question 45System Administration Fundamentals
An administrator needs to list every regular file beneath /var that is larger than 100 MB. Which command accomplishes this?
- du -h /var | grep 100M
- ls -lR /var | grep 100M
- df -h /var
- find /var -type f -size +100M Correct answer.
Explanation
find walks the tree and the tests -type f and -size +100M restrict output to regular files exceeding 100 mebibytes. The plus sign means greater than, while a minus sign would mean less than and no sign would mean exactly that size.
Question 46System Administration Fundamentals
A systemd-based server stores service messages in the journal. Which command displays log entries for the unit nginx.service only?
- journalctl -u nginx.service Correct answer.
- dmesg | grep nginx
- tail -f /var/log/nginx.service
- systemctl status --log nginx.service
Explanation
journalctl -u filters the journal to entries belonging to a single systemd unit, and adding -f would follow new entries as they arrive. This is the standard way to inspect service output on hosts where the journal is the primary log store.
Question 47System Administration Fundamentals
Which command reports the total disk space consumed by the /var/log directory tree, summarised in human-readable units?
- stat -f /var/log
- du -sh /var/log Correct answer.
- df -h /var/log
- ls -lh /var/log
Explanation
du walks the directory tree and sums the blocks used by its files, with -s reducing the output to a single total and -h converting the figure to human-readable units. It reports consumption by files, whereas the other tools describe filesystems or individual entries.
Question 48System Administration Fundamentals
A user's shell has umask 022. Which permissions does a newly created regular file receive by default?
- 0666
- 0777
- 0644 Correct answer.
- 0755
Explanation
Programs request mode 0666 when creating a regular file, and the umask clears the bits it specifies, here write permission for group and others. The result is 0644. Directories start from 0777 and become 0755 under the same umask, but files never gain an execute bit from creation alone.
Question 49System Administration Fundamentals
A batch job is launched with nice -n 10, while an interactive process on the same host runs with the default nice value. How does the kernel treat the batch job's CPU scheduling?
- It is scheduled with lower priority than the default process Correct answer.
- It is scheduled with higher priority than the default process
- It is pinned to one CPU and promoted to real-time priority
- It receives identical priority because nice values are capped at 0
Explanation
Nice values range from -20, the most favourable, to 19, the least favourable, with 0 as the default inherited by ordinary processes. Raising the value to 10 therefore makes the batch job yield CPU time more readily than a default-priority process. Only privileged users can assign negative values to increase priority.
Question 50System Administration Fundamentals
In an /etc/fstab entry, what does the sixth field (the pass field) control?
- The mount priority used when two devices claim the same mount point
- Whether the filesystem is skipped by fsck during boot Correct answer.
- The number of days between automatic backup dumps of the filesystem
- The order in which filesystems are mounted when several share a mount point
Explanation
The sixth field is the fsck pass number: 0 disables boot-time checking, 1 is reserved for the root filesystem, and 2 or higher sets the order for the remaining filesystems. Backup behaviour is governed by the fifth field, the dump value, which is usually 0 on modern systems.