Terminal
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:
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
ls
– list: lists the contents of the directory you are currently inpwd
– present working directory: prints the path to the directory you are currently incd folderName
– change directory: moves you into the directory ‘folderName’, if such a directory exists in your current locationcd ..
– takes you to the parent directorymkdir newFolder
– make directory: makes a new directory called “newFolder” in your current locationopen .
– opens the current directory in findercode .
– 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.