The shell is a powerful interface for interacting with the operating system. Learn about the types of shells, basic shell commands, and how to navigate the file system efficiently.
What is a Shell?
What is the primary function of a shell? a) To manage hardware resources b) To provide a user interface for interacting with the operating system c) To compile programs d) To create network connections
Which of the following is true about a shell in computing? a) It is a graphical user interface for the operating system b) It allows users to execute commands and manage system operations c) It is responsible for managing the network connections d) It is used for memory management
Which of these is NOT typically a feature of a shell? a) Command execution b) File system navigation c) Memory management d) Job control
Which of the following commands would launch a shell in Linux? a) start shell b) launch bash c) bash d) shell start
What does a shell typically interpret and execute? a) Python code b) Shell commands and scripts c) Java programs d) HTML files
Types of Shells
Which of the following is a common shell used in Linux? a) PowerShell b) Bash c) Command Prompt d) Zsh
What is the main feature of the Zsh shell compared to Bash? a) It does not support scripting b) It provides better autocompletion and customization options c) It does not support command history d) It is not available in Linux
Which shell is known for its compatibility with Unix-based systems? a) Zsh b) PowerShell c) Command Prompt d) Bash
Which shell is most commonly used in macOS by default? a) Bash b) Zsh c) PowerShell d) Fish
Which of these shells is commonly used for scripting on Linux systems? a) Zsh b) Bash c) PowerShell d) Cmd
Basic Shell Commands
What does the pwd command do in a shell? a) Changes the current directory b) Prints the current working directory c) Lists files in the current directory d) Creates a new directory
Which command is used to list files in a directory in the shell? a) list b) ls c) dir d) show
What does the command mkdir do? a) Changes the current directory b) Displays files in a directory c) Creates a new directory d) Deletes a file
Which of these commands is used to remove a file in a Unix-like system? a) del b) rm c) delete d) remove
What is the purpose of the echo command in a shell? a) To list files in a directory b) To print text or variables to the screen c) To change directory d) To search for a pattern in files
Which of the following commands is used to view the contents of a file? a) cat b) view c) see d) list
How would you display the first 10 lines of a file using the shell? a) head b) tail c) show d) list
What does the rm -r command do? a) Removes a file b) Removes a directory and its contents c) Renames a file d) Creates a directory
Which command is used to copy files or directories? a) mv b) cp c) copy d) dup
What does the man command do? a) Displays the manual page for a command b) Lists files in a directory c) Creates a new user d) Modifies system settings
Navigating the File System
How would you move into a directory named Documents? a) cd Documents b) cd /Documents c) move Documents d) dir Documents
What does the cd .. command do? a) Creates a new directory b) Changes to the parent directory c) Deletes the current directory d) Lists the contents of the current directory
How can you return to your home directory in the shell? a) cd ~ b) cd /home c) cd d) cd /
Which of the following commands would take you to the root directory? a) cd / b) cd ~ c) cd /home d) cd root
In a Unix-like system, how would you display the contents of the /etc directory? a) ls /etc b) cd /etc c) dir /etc d) show /etc
How would you find the path of the current directory? a) echo $PWD b) pwd c) echo $HOME d) get path
What does the ls -l command do? a) Lists files with details such as permissions, size, and modified date b) Lists files in a simple format c) Lists files recursively d) Lists directories only
How would you navigate to a subdirectory Projects inside the current directory? a) cd Projects b) cd ./Projects c) cd ../Projects d) cd ~/Projects
Which command would you use to navigate to the parent directory of your current directory? a) cd / b) cd .. c) cd parent d) cd back
What does the ls -a command do? a) Lists all files, including hidden ones b) Lists only directories c) Lists files alphabetically d) Lists files with permissions
Answer Key
QNo
Answer (Option with text)
1
b) To provide a user interface for interacting with the operating system
2
b) It allows users to execute commands and manage system operations
3
c) Memory management
4
c) bash
5
b) Shell commands and scripts
6
b) Bash
7
b) It provides better autocompletion and customization options
8
d) Bash
9
b) Zsh
10
b) Bash
11
b) Prints the current working directory
12
b) ls
13
c) Creates a new directory
14
b) rm
15
b) To print text or variables to the screen
16
a) cat
17
a) head
18
b) Removes a directory and its contents
19
b) cp
20
a) Displays the manual page for a command
21
a) cd Documents
22
b) Changes to the parent directory
23
a) cd ~
24
a) cd /
25
a) ls /etc
26
a) echo $PWD
27
a) Lists files with details such as permissions, size, and modified date