Skip to content

Which Shell?

There are a number of different shells for Unix. People can become very attached to the shell they prefer. Popular shells include

sh - the bourne shell
bash - the bourne again shell
csh - the c shell
ksh - the Korn shell (strangely, not named for the band)
zsh - the z shell

Each shell will have it's own profile, so it is important to know what shell you are using, you can tell with ps -p $$ or echo "$SHELL". Here is the typical order in which shell initialization files are read:

  • /etc/profile: This is the system-wide profile file that is executed for all users on the system when they log in. It sets up global environment variables and applies settings that should be available to all users.

  • ~/.profile: This is the user-specific profile file located in the user's home directory. It is executed for the user when they log in and allows them to customize their environment.

  • Shell-specific startup files: Different shells may have their own specific startup files. For example:

    • Bash: ~/.bash_profile, ~/.bash_login, or ~/.bashrc (depending on the specific configuration).
    • Zsh: ~/.zprofile or ~/.zshrc.
    • Fish: ~/.config/fish/config.fish.
    • /etc/bashrc (for Bash): This is the system-wide Bash configuration file that is executed for all users, but only if the user-specific Bash startup files (~/.bash_profile, ~/.bash_login, or ~/.bashrc) are not found.
  • Shell-specific system-wide files: Some shells may have additional system-wide configuration files that are executed for all users. For example:

  • Bash: /etc/bash.bashrc.

The exact order and names of these files can vary depending on the shell and the specific Linux distribution or Unix-like system being used. Additionally, some shells may have slightly different conventions for naming and reading these files.

In this course, we will be working on the bash shell