macos 终端_如何使用macOS终端

macos 终端

You can search Terminal in Spotlight, or go to the Applications folder, open the Utilities subfolder, and look for the Terminal app.

您可以在Spotlight中搜索“ Terminal ,或转到“ Applications文件夹,打开“ Utilities子文件夹,然后查找“ Terminal应用程序。

When you open it, you’ll get this screen - or something really similar:

当您打开它时,将得到此屏幕-或类似的东西:

The bash-3.2 indicates the type of shell, and its version. New term here - shell. What is a shell? A shell is a program that allows us to interact with the operating system and its applications.

bash-3.2指示shell的类型及其版本。 此处的新术语-外壳。 什么是贝壳? Shell是一个程序,它使我们可以与操作系统及其应用程序进行交互。

Note: current macOS since Catalina uses zsh. Nothing else changes related to this tutorial

注意:自Catalina使用zsh以来,当前的macOS。 与本教程无关的其他任何更改

There are different kinds of shells: Bash is one of the most popular. Some people use Fish (like me), some use Z Shell, some use other ones.

有多种外壳: Bash是最受欢迎的外壳之一。 有些人使用Fish (像我一样),有些人使用Z Shell ,有些人使用其他人。

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

shell基本上是允许我们输入命令的程序。

文件系统命令 (File system commands)

We can start by entering the ls command, and when we press enter the shell shows us the files contained in the current folder.

我们可以从输入ls命令开始,然后按Enter键,shell将向我们显示当前文件夹中包含的文件。

The shell normally starts from your home folder, which on a Mac is in /Users/yourname. How do we know in which folder we currently are? You can get it using the pwd command:

该外壳程序通常从您的主文件夹开始,在Mac上,该主文件夹位于/Users/yourname 。 我们如何知道我们当前在哪个文件夹中? 您可以使用pwd命令获取它:

You can change the current folder using cd:

您可以使用cd更改当前文件夹:

If you just type cd, the shell will get back to your home folder.

如果您仅键入cd ,则外壳程序将返回您的主文件夹。

You can create a new folder using mkdir:

您可以使用mkdir创建一个新文件夹:

运行命令 (Running commands)

In the shell you have access to all the programs and files installed on your computer. A lot of stuff.

在外壳程序中,您可以访问计算机上安装的所有程序和文件。 很多东西。

One task you might be required to do, especially when programming in Node and JavaScript, is to use npm.

您可能需要执行的一项任务是使用npm ,尤其是在使用Node和JavaScript编程时。

npm is not a command that’s available out of the box, you need to install it from https://www.npmjs.com/get-npm, but when you get it, you can access it from the command line.

npm不是开箱即用的命令,您需要从https://www.npmjs.com/get-npm安装它,但是当您获取它时,可以从命令行访问它。

Once you do so, you can go into any empty folder and run npm init to initialize a Node.js project.

完成后,您可以进入任何空文件夹并运行npm init来初始化Node.js项目。

Once you are ready you can start any Node.js program by running node filename.js.

准备就绪后,可以通过运行node filename.js启动任何Node.js程序。

还有更多的东西! (There’s a lot more to it!)

This post can get you started quickly to do the job, and you can explore more advanced features and capabilities of the shell later.

这篇文章可以帮助您快速开始做这项工作,并且以后可以探索Shell的更多高级功能。

翻译自: https://flaviocopes.com/macos-terminal/

macos 终端

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值