Terminal is an application that runs commands given by user, actually there is a special program inside Terminal called Shell – which reads in commands and execute them on Mac OS operating system.Terminal’s only job is to open windows and manage shells, while shells actually do real work of Command Execution.
How to open Terminal on Mac?
Terminal like any other program on Mac, can be found either using search bar in top right corner of mac screen or by searching it inside launchpad of Mac.
Opening Terminal – Search Bar in top right Corner of MAC Screen
Opening Terminal – Searching it inside launchpad of Mac
What is Shell?
Shell is a program which runs inside Terminal. Whenever user enters any command into Terminal, then its executed by Shell Program. For example – When you enter Command ls -1 ~/Documents inside Terminal then shell program will take it as an input, interpret it and execute it, then print out output on Terminal window. There can be different types of Shell like Bourne Shell, Korn Shell, C Shell.
Most known of these is Bourne Shell, which is commonly known as bash.
What does Shell inside Terminal actually do?
- Displays a prompt message in Terminal Window and then waits for user to enter commands
- Shell reads user-entered command and interprets special symbols in it
- If command typed in Terminal needs to run some program, then shell will located it and then run it
- If command typed by user results in some output, then shell will take that output from MacOS Operating System and will print it on Terminal Window.
Below is a picture showing How Shell, Terminal are linked with each other and with MacOS Operating System.
What are Terminal Commands?
Terminal Commands are specific instructions which can be given to Mac OS Operating. For example – pwd, cd ~, ls and many more. Just note that these commands are case-sensitive, so PWD will not work and pwd will work.
Some Common Terminal Commands
- clear – Clears out all information on terminal screen
- ls – Lists all of files in a directory
- cd ~ – Return to home directory
- mkdir – Make a new directory or folder
Similar to these, there are a lot of other Terminal Commands for doing cool stuff right from Terminal without navigating inside file system.