Unit 3: Linux File System and File Management - Practice Quiz

CSE105 — Creative Engineering Workshop 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 In Linux, the entire file system starts from a single top-level directory. What is this directory called?

Linux File System Hierarchy Easy
A. Root directory /
B. Boot directory /boot
C. System directory /sys
D. Home directory ~

2 Which directory typically stores the personal files and subdirectories of regular users?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Easy
A. /var
B. /bin
C. /home
D. /etc

3 Which directory is used to store system-wide configuration files?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Easy
A. /tmp
B. /etc
C. /lib
D. /opt

4 The /tmp directory is primarily used to store which type of files?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Easy
A. Shared libraries
B. User passwords
C. Kernel images
D. Temporary files

5 Which directory commonly contains variable data such as log files, spool files, and mail?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Easy
A. /var
B. /home
C. /usr
D. /sbin

6 Which directory mainly holds essential user command binaries like ls, cp, and cat?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Easy
A. /etc
B. /tmp
C. /var
D. /bin

7 The /sbin directory typically stores binaries intended mainly for which type of user?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Easy
A. Guest users only
B. System administrator (root)
C. Anonymous FTP users
D. Remote users only

8 Which of the following is an example of an absolute path?

Absolute and Relative Paths Easy
A. docs/file.txt
B. /home/user/docs
C. ./file.txt
D. ../docs

9 In a relative path, what does the symbol .. represent?

Absolute and Relative Paths Easy
A. The parent directory
B. The root directory
C. The home directory
D. The current directory

10 What does the pwd command display?

pwd Easy
A. The user's password
B. The disk usage of a directory
C. The full path of the current working directory
D. The list of files in a directory

11 Which command is used to change the current working directory?

cd Easy
A. cd
B. pwd
C. ls
D. mv

12 Which command lists the contents of a directory?

ls Easy
A. cat
B. ls
C. du
D. cd

13 Which command is used to create a new directory?

mkdir Easy
A. rmdir
B. touch
C. cp
D. mkdir

14 The rmdir command is used to remove a directory only when the directory is:

rmdir Easy
A. Full of files
B. Located in /tmp
C. Empty
D. Owned by root

15 What is the most common use of the touch command?

touch Easy
A. Copying a file
B. Deleting a file
C. Creating a new empty file
D. Renaming a file

16 Which command is commonly used to display the contents of a text file on the screen?

cat Easy
A. cd
B. mkdir
C. df
D. cat

17 Which command is used to copy files from one location to another?

cp Easy
A. cp
B. rm
C. ls
D. mv

18 Besides moving files, the mv command is also commonly used to:

mv Easy
A. Encrypt files
B. Rename files
C. Print files
D. Compress files

19 Which command is used to delete (remove) files in Linux?

rm Easy
A. cat
B. cp
C. rm
D. touch

20 What does the clear command do in the terminal?

clear Easy
A. Deletes all files
B. Clears the terminal screen
C. Closes the terminal
D. Clears the command history

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?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Medium
A. /lib
B. /var
C. /etc
D. /opt

22 Log files, mail spools, and print queues that constantly change in size are typically found under which directory?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Medium
A. /usr
B. /tmp
C. /etc
D. /var

23 You are currently in /home/user/projects. Which command uses a relative path to move to /home/user/documents?

Absolute and Relative Paths Medium
A. cd ../documents
B. cd /documents
C. cd ~/../documents
D. cd ./documents

24 Which of the following is an example of an absolute path?

Absolute and Relative Paths Medium
A. ./config/file.txt
B. /usr/local/bin
C. documents/report.pdf
D. ../bin/scripts

25 A user runs rmdir myfolder but receives the error Directory not empty. What is the most appropriate reason?

rmdir Medium
A. rmdir requires root privileges
B. rmdir only removes empty directories
C. rmdir only works on absolute paths
D. rmdir cannot delete hidden directories

26 Which command correctly copies an entire directory data along with all its subdirectories into /backup?

cp Medium
A. cp data /backup
B. cp -r data /backup
C. cp -d data /backup
D. cp -f data /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?

mv Medium
A. report.txt is moved to a folder named summary.txt
B. Both files exist as copies
C. An error occurs because the target is missing
D. report.txt is renamed to summary.txt

28 Which ls command lists all files including hidden ones in a long, detailed format?

ls Medium
A. ls -l
B. ls -la
C. ls -h
D. ls -a

29 Which command finds all files ending in .log within /var and its subdirectories?

File Searching using find Medium
A. find /var *.log
B. find -name /var/*.log
C. find /var -type "*.log"
D. find /var -name "*.log"

30 You want a human-readable report of free and used space on all mounted filesystems. Which command is best?

Disk Management Commands (du, df) Medium
A. df -h
B. du -h
C. du -s
D. df -i

31 Which command estimates the total disk space consumed by a specific directory called photos?

Disk Management Commands (du, df) Medium
A. du -sh photos
B. df -sh photos
C. df -h photos
D. du -i photos

32 A user runs touch notes.txt on a file that already exists. What happens?

touch Medium
A. Its access and modification timestamps are updated
B. Its contents are erased
C. The file is duplicated
D. An error is shown because the file exists

33 Which command displays the contents of file1.txt and file2.txt combined into one output stream?

cat Medium
A. cat file1.txt > file2.txt
B. cat file1.txt file2.txt
C. cat file1.txt | file2.txt
D. cat -m file1.txt file2.txt

34 Which command re-executes the command that was numbered 45 in your shell history?

history command Medium
A. !45
B. history 45
C. !!45
D. run 45

35 A regular user wants to switch to the root account with root's full environment loaded. Which command is correct?

su Medium
A. su +root
B. su root -c
C. su -
D. su --stay

36 Which tree command displays the directory structure limited to only 2 levels of depth?

Directory Visualization using tree Medium
A. tree -d 2
B. tree -L 2
C. tree --max 2
D. tree -n 2

37 Which command creates the nested directory path project/src/main in one step, even if the parent directories do not exist?

mkdir Medium
A. mkdir -n project/src/main
B. mkdir -r project/src/main
C. mkdir project/src/main
D. mkdir -p project/src/main

38 Which command forcibly deletes a directory oldapp and everything inside it without prompting?

rm Medium
A. rm -r oldapp
B. rm -rf oldapp
C. rmdir -f oldapp
D. rm -f oldapp

39 In the Linux filesystem hierarchy, what does the single character / at the very top represent?

Root Directory Structure Medium
A. The home directory of the root user
B. A mounted external device
C. The current working directory
D. The root directory of the entire filesystem

40 In a shell script, what does the command read name do when executed?

read Medium
A. Reloads the environment variable name
B. Waits for user input and stores it in the variable name
C. Reads permissions of the file name
D. Displays the contents of a file called 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?

Important Linux Directories (/bin, /sbin, /home, /etc, /usr, /var, /tmp, /opt, /lib) Hard
A. User home directories and their personal configuration files
B. Essential single-user binaries needed before /usr is mounted
C. Kernel modules and shared libraries loaded during boot
D. Log files, mail spools, and print queues that accumulate over time

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)?

Absolute and Relative Paths Hard
A. /network
B. /etc/network
C. /home/user/etc/network
D. /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?

rm Hard
A. It safely deletes only /tmp/data because trailing arguments are ignored
B. It deletes only the root filesystem and skips /tmp/data
C. It recursively deletes /tmp/data and then attempts to recursively delete the entire root filesystem /
D. It produces a syntax error and deletes nothing at all

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?

Disk Management Commands (du, df) Hard
A. du always overreports because it counts hard links multiple times
B. A deleted file is still held open by a running process, keeping its blocks allocated
C. df measures inode usage while du measures block usage
D. The filesystem is corrupted and both tools are unreliable

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?

File Searching using find Hard
A. find /var/log -type f -mtime -1 -size -10M -delete
B. find /var/log -type d -mtime -1 -size +10M -delete
C. find /var/log -type f -mtime -1 -size +10M -delete
D. 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 Hard
A. cp -p src dest
B. cp -a src dest
C. cp -r src dest
D. cp -f src dest

47 In directory /data containing files a.txt and b.txt, you run mv a.txt b.txt. What happens?

mv Hard
A. a.txt and b.txt swap their contents
B. The command fails because b.txt already exists
C. Both files are merged into a single b.txt
D. 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 Hard
A. rmdir -f /project/build
B. rmdir -p /project/build/a repeated, or rmdir /project/build/* before rmdir /project/build
C. rmdir --recursive /project/build
D. 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 Hard
A. ls -altr
B. ls -lah
C. ls -alth
D. ls -altrh

50 What is the key behavioral difference between su user and su - user?

su Hard
A. su - user only works for root, while su user works for any user
B. su - user starts a full login shell loading the target user's environment and working directory, while su user keeps the current environment
C. su user requires the root password while su - user requires the target user's password
D. There is no difference; the hyphen is purely cosmetic

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?

history command Hard
A. !-3
B. history -3
C. ^3
D. !3

52 Which tree command displays only directories (no files), limited to 2 levels of depth, including hidden directories?

Directory Visualization using tree Hard
A. tree -f -L 2
B. tree -L 2 --noreport
C. tree -d -a -L 1
D. tree -d -L 2 -a

53 In a bash script, the line read -p "Name: " -t 5 name behaves how?

read Hard
A. Reads input from a file descriptor numbered 5 into name
B. Prints the prompt Name: , waits up to 5 seconds for input, and stores it in name
C. Repeats the prompt 5 times before storing the last input in name
D. Reads exactly 5 characters into the variable 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 Hard
A. cat < file.txt << EOF\nline1\nline2\nEOF
B. cat >> file.txt << EOF\nline1\nline2\nEOF
C. cat > file.txt << EOF\nline1\nline2\nEOF
D. 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 Directory Structure Hard
A. /root
B. /usr
C. /etc
D. /var

56 You run touch -t 202401011200.30 report.log on an existing file. What is the effect?

touch Hard
A. Changes only the modification time to the current system time
B. Creates 30 empty copies of report.log
C. Sets the file size to 30 bytes and clears its content
D. Sets the file's access and modification times to Jan 1, 2024 at 12:00:30

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 Hard
A. mkdir -p -m 755 /app/config/db
B. mkdir -m 755 /app/config/db
C. mkdir --nested /app/config/db
D. 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?

pwd Hard
A. Both output /data/link
B. Both output /data/real
C. /data/link and /data/real
D. /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?

Disk Management Commands (du, df) Hard
A. du -ch /backup
B. du -sh --apparent-size /backup
C. du -ah /backup
D. 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?

Linux File System Hierarchy Hard
A. /usr/bin and /usr/sbin
B. /var and /tmp
C. /bin and /sbin
D. /opt and /lib