Identifying the Bash Shell
/bin/bash is very popular because it offers a rich set of features, including command history, tab completion, and scripting capabilities.env command to confirm the current shell:
Changing the Default Shell
If you want to change your default shell to Bash, use thechsh (change shell) command.
- Interactive
- Non-interactive
Bash Features
Command Auto-completion
Command Auto-completion
Bash supports command auto-completion, which lets you quickly complete commands and file names by pressing the Pressing
Tab key.Tab after typing folder will auto-complete to the available matching directory names. If there is no ambiguity, it completes automatically.Command History
Command History
Bash maintains a history of commands you’ve executed. Access it with the
history command or by pressing the Up and Down arrow keys to cycle through previous commands.Aliases
Aliases
Bash allows you to create shortcuts for frequently used commands using the To see all currently defined aliases, run To make an alias permanent, add its definition to your
alias command.alias with no arguments:~/.bashrc file.Customizing the Bash Prompt
When you log in to a Bash shell, you typically see~$ as your prompt. You can customize this by modifying the PS1 variable in your ~/.bashrc file.
Check the current value of PS1:
| Sequence | Description |
|---|---|
\u | Username |
\h | Hostname |
\w | Current working directory |
\d | Date |
\t | Current time |