What is the primary purpose of /bin/bash in Linux systems?
2024
What is the primary purpose of /bin/bash in Linux systems?
- A.
To manage disk partitions
- B.
To execute shell commands and shell scripts
- C.
To configure network interfaces
- D.
To store system log files
- E.
To compile C programs automatically
Attempted by 131 students.
Show answer & explanation
Correct answer: B
In Unix-like operating systems, /bin/bash is the executable file for Bash (the "Bourne-Again SHell"). It is a command-line interpreter, or shell.
Its primary purpose is to read commands typed by a user (interactive mode) or commands stored in a file called a shell script (non-interactive mode), and then execute them. It acts as the interface between the user and the operating system kernel, launching programs, expanding variables, handling pipes and redirection, and controlling job/flow with loops and conditionals.
Therefore, the correct answer is: to execute shell commands and shell scripts.
The other tasks are performed by separate, specialised tools that Bash merely invokes as external commands: disk partitioning by utilities such as fdisk/parted, network configuration by tools such as ip/ifconfig, system logs by services such as syslog/journald (stored under /var/log), and C-program compilation by a compiler such as gcc.