Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic web terminal commands that the Mac front-end programmer must know

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "web front-end programmers must know what the basic Mac terminal commands are", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "web front-end programmers must know what the basic Mac terminal commands are" it!

What is terminal (Terminal)

The most basic use of a terminal is to browse computer folders and files.

You can run commands from the terminal that can create a new ReactJS application, install a new npm package, and so on, but we won't discuss them in this article.

When using the terminal to browse the computer, let's focus on the basic commands.

Use terminal

On Mac, the fastest way is to click "command + space", which will open the computer's "search" bar, pop up, type "Terminal", and then click "Enter", a small white box will pop up and we will see the name of the computer.

Common command

When browsing your computer's file / folder system, there are some commands that will be used most frequently. I will introduce some of the most critical and essential elements:

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Pwd

Cd

Ls

Clear

Mkdir

Touch

Open

History

Cat

Say

1.pwd

The command pwd stands for "print working directory". In essence, type the command, which will output the exact file path of your file or folder.

2.cd

This means "changing the directory" or, more simply, changing the folder we are in.

When using the command cd, we can tell it which direction to move by adding more content to the command.

Cd or cd ~-- take us to the home directory.

Cd

-- enter the specified folder

Cd.. -- move to the folder one level up.

Cd.. /.. Move us back to two levels.

When typing a folder or file name, you can click "Tab" in one step and it will automatically fill in the folder / file name.

3.ls

Now that we are in a folder, we may want to view the contents of that folder. When you run the command ls, it will show us everything in that folder.

If we want to see all the files, even hidden ones, we can run ls-a.

4.clear

This command works just as it sounds, it can "erase" your terminal. Sometimes it's easier to empty the terminal when you want to concentrate.

5.mkdir

The purpose of this command is to create a new folder, and no matter where you run the command, a new folder will be created at that location. So use the cd command to navigate to the desired location, and then type mkdir.

To enter the new folder, we will run the command: cd.

In contrast to "mkdir", if you want to delete a directory, simply run rmdir. The folder must be empty to work properly.

6.touch

Now that we know how to create a folder, let's create some files in that folder. If we follow the following command:

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Mkdir new-folder

Cd new-folder

We should now be in the New folder directory / folder. Let's create a file in that folder. A file will be created by running the following command.

Touch newfile-- this doesn't have an extension, so we want to add .html, .txt or whatever extension we need.

In contrast to "touch", the command to delete a file is rm.

7.open

Open a file or folder by typing the following command:

Open

8.history

Do you want to know all the commands that have been run in the current terminal session? Run the command history to view them.

Another technique! Use the up and Down arrows to browse the previous command.

Do you want to limit the number of commands displayed? Add a number to the command: "history 10" displays the last 10 commands you typed.

9.cat

This command allows us to view the contents of a specific file, and we need to declare a specific file for this command to work.

If we know the path to the file, we can run:

Cat / Desktop/new-folder/new-file

Alternatively, we can navigate from the home folder to the new folder and run the command.

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Cd Desktop

Cd new-folder

Cat new-file

This command is different from open in that it displays the contents of the file inside the terminal rather than opening the file outside the terminal.

10.say

This is interesting, it doesn't need navigation, but it will make your computer talk to you!

Type: say "anything here" and your computer will say it. Don't forget the quotation marks in this command!

Thank you for your reading, the above is the "web front-end programmers must know what the basic Mac terminal commands have" content, after the study of this article, I believe you must know the basic web front-end programmers Mac terminal commands have a deeper understanding of this problem, the specific use of the need for our practice to verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report