Bash stands for "Bourne Again SHell" and is a command processor that typically runs in a text window where the user types commands that cause actions.
-
Compatibility: Bash is often the default shell on many Unix-based systems, making scripts written in Bash highly portable across different platforms.
-
Powerful Scripting Language: Bash is not just a command interpreter; it is also a powerful scripting language. It supports variables, loops, conditionals, functions, and other programming constructs, making it suitable for writing complex scripts and automating tasks.
-
Extensive Documentation and Community Support: Bash has been around for a long time, and as a result, it has extensive documentation and a large user community.
-
Default Shell on Many Systems: Bash is often the default shell for user accounts on Unix-like systems.
-
Interactive Shell Features: Bash provides a feature-rich interactive shell, offering command history, tab completion, and various customization options.
-
Job Control: Bash supports job control, allowing users to manage multiple processes simultaneously.
-
Extensive Built-in Commands: Bash comes with a wide range of built-in commands, providing functionality for tasks such as file manipulation, text processing, and system administration. This reduces the reliance on external utilities for many common operations.
- The terminal is the user interface that allows interaction with the computer, while the shell is the program that interprets and executes the commands entered into the terminal. The terminal can exist without a shell, but the shell requires a terminal or similar interface for user interaction
- Find where your bash interpreter is located by entering this command;
- $ which bash
- /bin/bash
- This command reveals that the Bash shell is stored in /bin/bash.
- Every shell command starts with a shebang which points the shell path - #!/bin/bash
- Bourne shell
- C shell
- Korn Shell
- GNU Bourne shell
- To know which shell your system supports type: cat/etc/shells
- To know where bash is located in your OS type : which bash
- cd:changes the directory to a different location
- ls:lists the contents of the current directory
- mkdir:create new directory
- touch:create a new file
- rm:remove a file or directory
- cp:copy a file or directory
- mv:move or rename a file or directory
- echo:print the text in the terminal
- cat:concatenate and print the contents of a file
- grep:search for a pattern in a file
- chmod:change the permissions of a file or directory
- sudo:run a command with admin privileges
- df:display the amount of disk space available
- history:show the list of previous commands
- ps:display information about running processes