Shell vs Bash
Shell
- Shell is a program that acts as an interface between you and the Linux OS.
- It takes your commands and tells the kernel what to do.
- There are many types of shells.
Examples of shells:
sh(Bourne Shell)bash(Bourne Again Shell)zshfishksh
Think of Shell as a category.
Bash (Bourne Again Shell)
- Bash is one type of shell.
- It is the most commonly used shell in Linux.
- Default shell in most Linux distributions (Ubuntu, Debian, etc.).
- Has more features than older shells.
Think of Bash as a specific shell inside the shell family.
Difference Table
| Feature | Shell | Bash |
|---|---|---|
| Meaning | Interface to OS | A type of shell |
| Type | General concept | Specific implementation |
| Examples | sh, bash, zsh, fish | bash only |
| Default in Linux | Depends on distro | Usually default |
| Script support | Basic | Advanced (arrays, loops, history) |
| File | /bin/sh | /bin/bash |
Simple Analogy
- Shell = Vehicle
- Bash = Car
(A car is a type of vehicle, just like Bash is a type of shell.)
Check what shell you are using
echo $SHELL
ps -p $$
To see all available shells on your system
cat /etc/shells
.bashrc vs .bash_profile
.bash_profileruns once when you log in to your system..bashrcruns every time you open a new terminal..bash_profileis used for login setup and environment variables..bashrcis used for aliases, shortcuts, and terminal behavior.- Usually,
.bash_profileloads.bashrcusingsource ~/.bashrc.
source vs . (dot)
sourceand.do the same thing — they run a file in the current shell.source file.shand. file.share completely equivalent.- Changes (variables, aliases) remain active after execution.
sourceis more readable;.is shorter and POSIX-standard.- Example:
source ~/.bashrc
. ~/.bashrc sourceis a bash built-in command.- The file must be readable.
chmod +r file.sh