Unit 3: Linux File System and File Management - Practice Quiz
1 In Linux, the entire file system starts from a single top-level directory. What is this directory called?
/
/boot
/sys
~
2 Which directory typically stores the personal files and subdirectories of regular users?
/var
/bin
/home
/etc
3 Which directory is used to store system-wide configuration files?
/tmp
/etc
/lib
/opt
4
The /tmp directory is primarily used to store which type of files?
5 Which directory commonly contains variable data such as log files, spool files, and mail?
/var
/home
/usr
/sbin
6
Which directory mainly holds essential user command binaries like ls, cp, and cat?
/etc
/tmp
/var
/bin
7
The /sbin directory typically stores binaries intended mainly for which type of user?
8 Which of the following is an example of an absolute path?
docs/file.txt
/home/user/docs
./file.txt
../docs
9
In a relative path, what does the symbol .. represent?
10
What does the pwd command display?
11 Which command is used to change the current working directory?
cd
pwd
ls
mv
12 Which command lists the contents of a directory?
cat
ls
du
cd
13 Which command is used to create a new directory?
rmdir
touch
cp
mkdir
14
The rmdir command is used to remove a directory only when the directory is:
/tmp
15
What is the most common use of the touch command?
16 Which command is commonly used to display the contents of a text file on the screen?
cd
mkdir
df
cat
17 Which command is used to copy files from one location to another?
cp
rm
ls
mv
18
Besides moving files, the mv command is also commonly used to:
19 Which command is used to delete (remove) files in Linux?
cat
cp
rm
touch
20
What does the clear command do in the terminal?
21 A system administrator needs to store a third-party application that is not part of the default distribution. Which directory is conventionally intended for such optional add-on software packages?
22 Log files, mail spools, and print queues that constantly change in size are typically found under which directory?
23
You are currently in /home/user/projects. Which command uses a relative path to move to /home/user/documents?
24 Which of the following is an example of an absolute path?
25
A user runs rmdir myfolder but receives the error Directory not empty. What is the most appropriate reason?
rmdir requires root privileges
rmdir only removes empty directories
rmdir only works on absolute paths
rmdir cannot delete hidden directories
26
Which command correctly copies an entire directory data along with all its subdirectories into /backup?
27
In a single directory, a user runs mv report.txt summary.txt where summary.txt does not yet exist. What is the result?
report.txt is moved to a folder named summary.txt
report.txt is renamed to summary.txt
28
Which ls command lists all files including hidden ones in a long, detailed format?
29
Which command finds all files ending in .log within /var and its subdirectories?
30 You want a human-readable report of free and used space on all mounted filesystems. Which command is best?
31
Which command estimates the total disk space consumed by a specific directory called photos?
32
A user runs touch notes.txt on a file that already exists. What happens?
33
Which command displays the contents of file1.txt and file2.txt combined into one output stream?
34 Which command re-executes the command that was numbered 45 in your shell history?
35 A regular user wants to switch to the root account with root's full environment loaded. Which command is correct?
36
Which tree command displays the directory structure limited to only 2 levels of depth?
37
Which command creates the nested directory path project/src/main in one step, even if the parent directories do not exist?
38
Which command forcibly deletes a directory oldapp and everything inside it without prompting?
39
In the Linux filesystem hierarchy, what does the single character / at the very top represent?
40
In a shell script, what does the command read name do when executed?
name
name
name
name
41
A system administrator notices that /var is filling up rapidly on a busy web server. Which combination of contents is most likely responsible for this growth?
/usr is mounted
42
The current working directory is /home/user/projects. After running cd ../../etc, then cd ./network, what is the resulting absolute path (assuming it exists)?
/network
/etc/network
/home/user/etc/network
/home/etc/network
43
A user runs rm -rf /tmp/data / (with an accidental space before the final /). Assuming no protection flags are active, what is the intended target versus the actual danger?
/tmp/data because trailing arguments are ignored
/tmp/data
/tmp/data and then attempts to recursively delete the entire root filesystem /
44
You run df -h and see / at 100% full, but du -sh / reports far less than the disk capacity. What is the most likely explanation?
du always overreports because it counts hard links multiple times
df measures inode usage while du measures block usage
45
Which find command correctly locates all regular files under /var/log modified in the last 24 hours and larger than 10 MB, then deletes them?
find /var/log -type f -mtime -1 -size -10M -delete
find /var/log -type d -mtime -1 -size +10M -delete
find /var/log -type f -mtime -1 -size +10M -delete
find /var/log -type f -mtime +1 -size +10M -delete
46
You want to copy directory src to dest while preserving all attributes (permissions, timestamps, ownership, symlinks) and recursing into subdirectories. Which single option achieves this most completely?
cp -p src dest
cp -a src dest
cp -r src dest
cp -f src dest
47
In directory /data containing files a.txt and b.txt, you run mv a.txt b.txt. What happens?
a.txt and b.txt swap their contents
b.txt already exists
b.txt
a.txt is renamed to b.txt, silently overwriting the existing b.txt
48
You attempt rmdir /project/build but get Directory not empty. The directory contains only empty subdirectories a/, b/, and c/. Which command removes the whole tree using rmdir semantics?
rmdir -f /project/build
rmdir -p /project/build/a repeated, or rmdir /project/build/* before rmdir /project/build
rmdir --recursive /project/build
rmdir -r /project/build
49
Which ls command lists all entries (including hidden), sorts by modification time with newest last, and shows sizes in human-readable form in long format?
ls -altr
ls -lah
ls -alth
ls -altrh
50
What is the key behavioral difference between su user and su - user?
su - user only works for root, while su user works for any user
su - user starts a full login shell loading the target user's environment and working directory, while su user keeps the current environment
su user requires the root password while su - user requires the target user's password
51 A user wants to re-execute the command that was run 3 commands ago in the current session. Which shell shortcut does this correctly in bash?
!-3
history -3
^3
!3
52
Which tree command displays only directories (no files), limited to 2 levels of depth, including hidden directories?
tree -f -L 2
tree -L 2 --noreport
tree -d -a -L 1
tree -d -L 2 -a
53
In a bash script, the line read -p "Name: " -t 5 name behaves how?
name
Name: , waits up to 5 seconds for input, and stores it in name
name
name after showing a prompt
54
Which command uses cat with a here-document to write two lines into file.txt, overwriting any existing content?
cat < file.txt << EOF\nline1\nline2\nEOF
cat >> file.txt << EOF\nline1\nline2\nEOF
cat > file.txt << EOF\nline1\nline2\nEOF
cat file.txt << EOF\nline1\nline2\nEOF
55 According to the Filesystem Hierarchy Standard (FHS), which directory is intended to be mountable read-only and shareable across multiple hosts because it contains no host-specific or variable data?
/root
/usr
/etc
/var
56
You run touch -t 202401011200.30 report.log on an existing file. What is the effect?
report.log
57
Which command creates the nested path /app/config/db in one step even if /app and /app/config do not yet exist, and sets permissions to 755?
mkdir -p -m 755 /app/config/db
mkdir -m 755 /app/config/db
mkdir --nested /app/config/db
mkdir -r /app/config/db
58
A directory /data/real has a symlink /data/link pointing to it. You cd /data/link then run pwd and pwd -P. What do they output respectively?
/data/link
/data/real
/data/link and /data/real
/data/real and /data/link
59
Which command reports the total apparent size (not disk-allocated blocks) of a directory /backup in a single summarized human-readable line?
du -ch /backup
du -sh --apparent-size /backup
du -ah /backup
df -h /backup
60
During early boot before /usr is mounted, the system must run essential recovery and administrative binaries. Which pair of directories was historically kept on the root filesystem specifically to guarantee these binaries are available at that stage?
/usr/bin and /usr/sbin
/var and /tmp
/bin and /sbin
/opt and /lib
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 →