This website is against the Russian invasion of Ukraine
See more information here


Find your shell's configuration file

Written: 17 Dec 2021 | Last updated: 20th Dec 2021

Most (all?) Bourne Shell based shells (*sh shells) use a configuration file which is run every time a new terminal is opened. These (tend to|all) end with rc. rc stands for run commands.

These configuration files are good for using for local (for one user) CLI changes such as adding custom commands or variables.

Information on locating your configuration file can be found here. As a general rule they (tend to) be found at ~/.SHELLrc where SHELL is the name of your shell.

If the configuration file appears to be missing:

  1. Check you can see hidden files. The . at the start of the file name indicates that it is a hidden file.
    In your terminal you can use ls -a to see all files in a directory.
  2. If you still can't find it create the file in its expected location.
Bash (Bourne-Again shell)
Located at: ~/.bashrc.
Csh (C shell)
Located at: ~/.cshrc.
Ksh (Korn shell)
Located at: ~/.kshrc.
Zsh (Z shell)
Located at: ~/.zshrc.
On macOs the configuration file does not exist by defualt so you will need to create it in that location.

Create shell rc file

Create your file at the correct location.

Add #!bin/sh to the first line. Alternatively, you could just put a single colon (:) instead however the first method is preffered.

If this returns errors later when run you can check the location of sh using which sh.