What shell am I using?

The terminal is a program that outputs text to a window on the screen, and which accepts typed keyboard commands as input. The shell, on the other hand, is the program which interprets the commands you enter into terminal, and tells terminal what text to show in any given situation.

To find out what shell we are using in terminal, try writing an incorrect command, such as cheese, and pressing enter. Unless you have a program called “cheese” installed on your computer, you should see an error printed to the terminal:

shell error message

Here you can see:

fish: Unknown command: cheese

This error message is the shell complaining that it doesn’t know what to do with the word “cheese”. The first word of the error message is the shell, in this case, fish.

It is more likely that your terminal will be using zsh, as this is the default shell program for macOS since Catalina, or Bash, which was the default before zsh. In any case, you should be able to tell from the error message what shell terminal is using.

Common Unix Shell Commands

  • lslist: lists the contents of the directory you are currently in
  • pwdpresent working directory: prints the path to the directory you are currently in
  • cd folderNamechange directory: moves you into the directory ‘folderName’, if such a directory exists in your current location
  • cd .. – takes you to the parent directory
  • mkdir newFoldermake directory: makes a new directory called “newFolder” in your current location
  • open . – opens the current directory in finder
  • code . – opens the current directory in VS Code

Windows

On Windows, the default shells are cmd, and PowerShell, which are not unix style. The commands used in by these shells are slightly different. You can find some of the useful commands here, and a full list here.

However, it looks like it is possible to use unix style shells such as bash and zsh directly in the latest Windows Terminal, if you install Windows Subsystem for Linux. There is a decent video chapter on this topic, here.