How to use macOS terminal

The terminal is a key part of your programming library. It allows you to perform tasks that would otherwise be impossible.

You can searchTerminalIn Spotlight, or go toApplicationsFolder, openUtilitiesSubfolder, then look forTerminalapplication.

When you open it, you will get this screen-or something similar:

Thisbash-3.2Indication typeshell, And its version. The new term here-shell. What is a shell? Shell is a program that allows us to interact with the operating system and its applications.

Note: Since Catalina used zsh, the current macOS. Any other changes not related to this tutorial

There are different kinds of enclosures:BashIs one of the most popular games. Some people useFish(Like me), some usefulZ Shell, Some use others.

The shell is basically a program that allows us to enter commands.

File system commands

We can enter firstlsCommand, and then press Enter, the shell will show us the files contained in the current folder.

The shell usually starts from your home folder, which on a Mac is located/Users/yourname. How do we know which folder we are currently in? you can use itpwdcommand:

You can change the current folder usingcd:

If you just entercd, The shell will return to your home folder.

You can create a new folder usingmkdir:

Run command

In the shell, you can access all the programs and files installed on your computer. a lot of things.

You may need to complete a task, especially when programming with Node and JavaScript,npm.

npmNot an out-of-the-box command, you need to install from the following location, But when you get it, you can access it from the command line.

When finished, you can enter any empty folder and runnpm initInitialize the Node.js project.

When you are ready, you can start any Node.js program by running the following commandnode filename.js.

There is more!

This article can help you quickly start doing this work, and you can explore more advanced features of Shell in the future.