Module 3 Quiz - File System
Instructions
This quiz contains 30 multiple-choice questions to validate your understanding of Module 3.
Tip: Answer each question before revealing the answer. The answers are hidden just after each question.
Question 1
What is the structure of the Linux file system?
See explanation
Correct answer: A single hierarchy with / as the root
Explanation: Linux uses the Filesystem Hierarchy Standard (FHS) with a single root /. All files and directories are organized under this single root, unlike Windows which uses multiple roots (C:, D:, etc.).
Question 2
Which command shows the current directory?
See explanation
Correct answer: pwd
Explanation: pwd (Print Working Directory) displays the full path of the current working directory. It is an essential command to know where you are in the hierarchy.
Question 3
Which command lists files in a directory?
See explanation
Correct answer: ls
Explanation: ls (list) displays the contents of a directory. Common options: ls -l (details), ls -a (hidden files), ls -la (details + hidden), ls -h (human-readable sizes).
Question 4
Which command changes the directory?
See explanation
Correct answer: cd
Explanation: cd (change directory) allows navigation between directories. Examples: cd /home, cd .. (parent directory), cd ~ (home directory), cd - (previous directory).
Question 5
Which command creates a directory?
See explanation
Correct answer: mkdir
Explanation: mkdir (make directory) creates a new directory. Option -p creates parent directories if necessary: mkdir -p dir1/dir2/dir3.
Question 6
Which command creates an empty file?
See explanation
Correct answer: touch
Explanation: touch creates an empty file or updates the modification date of an existing file. Example: touch myfile.txt.
Question 7
Which command copies a file?
See explanation
Correct answer: cp
Explanation: cp (copy) copies files or directories. Syntax: cp source destination. Option -r for recursive directory copying: cp -r dir1 dir2.
Question 8
Which command moves or renames a file?
See explanation
Correct answer: mv
Explanation: mv (move) moves or renames files and directories. Examples: mv file1 file2 (rename), mv file /tmp/ (move).
Question 9
Which command deletes a file?
See explanation
Correct answer: rm
Explanation: rm (remove) deletes files. Options: rm -r (recursive for directories), rm -f (force), rm -i (interactive). Caution: deletion is permanent!
Question 10
Which command displays the content of a file?
See explanation
Correct answer: cat
Explanation: cat (concatenate) displays the content of a file. Other useful commands: less (navigation), head (first lines), tail (last lines), more (pagination).
Question 11
What are the three basic permissions for Linux files?
See explanation
Correct answer: Read (r), Write (w), Execute (x)
Explanation: The basic Linux permissions are: read, write, execute. These permissions apply to the owner, the group, and other users.
Question 12
Which command modifies file permissions?
See explanation
Correct answer: chmod
Explanation: chmod (change mode) modifies permissions. Syntaxes: chmod 755 file (octal), chmod u+x file (symbolic). Examples: chmod +x script.sh, chmod 644 file.txt.
Question 13
Which command changes the owner of a file?
See explanation
Correct answer: chown
Explanation: chown (change owner) modifies the owner and/or group of a file. Examples: chown user:group file, chown user file, chown :group file. Usually requires root privileges.
Question 14
Which directory contains system configuration files?
See explanation
Correct answer: /etc
Explanation: /etc contains system and application configuration files. Examples: /etc/passwd, /etc/hosts, /etc/nginx/, /etc/ssh/.
Question 15
Which directory contains users' home directories?
See explanation
Correct answer: /home
Explanation: /home contains users' personal directories. Each user typically has their own directory under /home/username. The root's home directory is /root.
Question 16
Which command searches for files by name?
See explanation
Correct answer: find
Explanation: find searches for files in the hierarchy. Examples: find /home -name "*.txt", find . -type f -name "script*", find /var/log -mtime -7 (modified in the last 7 days).
Question 17
What is the difference between a symbolic link and a hard link?
See explanation
Correct answer: A hard link points directly to the inode, a symbolic link points to a path
Explanation: A hard link (ln file link) shares the same inode as the original file. A symbolic link (ln -s file link) is a separate file containing a path to the target file. Symbolic links can point to directories and files on other file systems.
Question 18
Which command creates a symbolic link?
See explanation
Correct answer: ln -s
Explanation: ln -s creates a symbolic link. Syntax: ln -s target link. Example: ln -s /usr/bin/python3 /usr/local/bin/python. Symbolic links are identified by l in ls -l.
Question 19
What is an inode in Linux?
See explanation
Correct answer: A data structure that stores a file's metadata
Explanation: An inode (index node) stores a file's metadata: permissions, owner, size, dates, pointers to data blocks. The file name is stored separately in the directory. Each file has a unique inode number.
Question 20
Which directory contains essential system binaries?
See explanation
Correct answer: /bin
Explanation: /bin contains essential binaries needed for system startup and repair. Examples: ls, cp, mv, rm, bash, cat. These commands are accessible to all users.
Question 21
Which command searches for text in files?
See explanation
Correct answer: grep
Explanation: grep searches for patterns in files. Examples: grep "pattern" file, grep -r "pattern" /directory (recursive), grep -i "pattern" file (case-insensitive), grep -n "pattern" file (with line numbers).
Question 22
What is the default file system on Ubuntu 24.04?
See explanation
Correct answer: ext4
Explanation: ext4 (Fourth Extended File System) is the default file system on Ubuntu. It is journaled, stable, and supports files up to 16TB and file systems up to 1EB.
Question 23
Which command displays the first lines of a file?
See explanation
Correct answer: head
Explanation: head displays the first lines of a file. Default is 10 lines. Options: head -n 20 file (20 lines), head -c 100 file (100 characters).
Question 24
Which command displays the last lines of a file?
See explanation
Correct answer: tail
Explanation: tail displays the last lines of a file. Default is 10 lines. Options: tail -n 20 file (20 lines), tail -f file (real-time follow, very useful for logs).
Question 25
What is the FHS (Filesystem Hierarchy Standard)?
See explanation
Correct answer: A standard that defines the directory structure in Linux
Explanation: The FHS defines where to place files in the Linux system. For example: /bin for essential binaries, /etc for configuration, /home for users, /var for variable data. This ensures consistency across Linux distributions.
Question 26
What is the difference between an absolute path and a relative path?
See explanation
Correct answer: An absolute path starts with /, a relative path is relative to the current directory
Explanation: An absolute path always starts with / and specifies the full location from the root (e.g., /home/user/documents). A relative path is relative to the current working directory (e.g., documents or ../parent).
Question 27
Which command shows disk space usage?
See explanation
Correct answer: df
Explanation: df (disk free) displays available disk space on mounted file systems. Options: df -h (human-readable sizes), df -T (file system types). du shows usage of a specific directory.
Question 28
Which command shows the size of a directory?
See explanation
Correct answer: du
Explanation: du (disk usage) displays the space used by a directory. Options: du -h (human-readable sizes), du -s (summary), du -sh /path (total size of a directory).
Question 29
What is the difference between a file and a directory in Linux?
See explanation
Correct answer: A directory is a special type of file that contains references to other files
Explanation: In Linux, "everything is a file". A directory is a special file that contains a list of file names and their inodes. That's why you can use ls -d to view directories as files.
Question 30
Which command changes the group of a file?
See explanation
Correct answer: chgrp
Explanation: chgrp (change group) modifies the group of a file. Examples: chgrp group file, chgrp -R group /directory (recursive). You can also use chown :group file.
Quiz Result
Congratulations on completing the Module 3 quiz!
Score:
- 25-30 correct answers: Excellent! You master the Linux file system.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on the file system.
- Less than 15: Recommended to review the module before continuing.
Next Steps
Now that you have validated your knowledge:
Module 4: Process Management
Practical Labs: Practice the file system with Module 3 labs
Quiz created on: December 2024 - Tested on Ubuntu 24.04