Nhảy tới nội dung

Intro to shell

Things you've done in shell could be permanent. There's no undelete or undo.

What is shell?

It runs programs by typing command. A command line is a text based UI.

Bash and Zsh (Z Shell) are popular shells. Bash is most popular, while Zsh is default on Mac since Catalina.

Other shells are: sh, ksh, csh, tcsh, etc.

Windows uses cmd & Powershell, but you can install Linux subsystems and run bash/zsh.

Where are they?

Usually, you don't start the shell directly but run through a terminal emulator to help with fonts, colors, keystrokes, etc. (since shell is mostly limited to text).

The text you see when you start the shell is called the prompt. E.g.:

N9TJYJCTVY:~ tuhuynguyen$

Usually, it will show current username, hostname and working directory.

Checking

Bash starts with $:

Bash terminalBash terminal

While zsh starts with %:

Zsh terminalZsh terminal

To change you terminal type, go to System Preferences > Users & Groups. Then right-click on your user account > Advanced Options.

Users and groupsUsers and groups

Choose your prefer shell and click OK:

Advanced optionsAdvanced options