MIT缺失的一课——Lecture1:Shell

学习的动机

As computer scientists, we know that computers are great at aiding in repetitive tasks. However, far too often, we forget that this applies just as much to our use of the computer as it does to the computations we want our programs to perform. We have a vast range of tools available at our fingertips that enable us to be more productive and solve more complex problems when working on any computer-related problem. Yet many of us utilize only a small fraction of those tools; we only know enough magical incantations by rote to get by, and blindly copy-paste commands from the internet when we get stuck.

作为计算机科学家,我们知道计算机在帮助重复性任务方面非常出色。然而,我们常常忘记,这同样适用于我们对计算机的使用,就像它适用于我们希望程序执行的计算一样。我们手头有各种各样的工具,可以让我们在处理任何与计算机相关的问题时更高效,解决更复杂的问题。然而,我们中的许多人只使用了这些工具中的一小部分;我们只能死记硬背足够多的魔法咒语,当我们陷入困境时,我们会盲目地从互联网上复制粘贴命令。

This class is an attempt to address this.

本课程试图解决这个问题。

We want to teach you how to make the most of the tools you know, show you new tools to add to your toolbox, and hopefully instill in you some excitement for exploring (and perhaps building) more tools on your own. This is what we believe to be the missing semester from most Computer Science curricula.

我们想教你如何最大限度地利用你所知道的工具,向你展示新的工具来添加到你的工具箱中,并希望为你自己探索(也许是构建)更多工具注入一些兴奋。

我们认为这是大多数计算机科学课程中缺失的一个学期。

课程结构

The class consists of 11 1-hour lectures, each one centering on a particular topic. The lectures are largely independent, though as the semester goes on we will presume that you are familiar with the content from the earlier lectures. We have lecture notes online, but there will be a lot of content covered in class (e.g. in the form of demos) that may not be in the notes. We will be recording lectures and posting the recordings online.

课程共11堂课,每堂课时长1小时,每堂课围绕一个主题(/2020/)。课程基本上是独立的,但随着学期的进行,我们会假设你已经熟悉了之前课程的内容。我们网上有课堂讲稿,但会有很多课堂上讲过的内容(例如,演示的形式)可能不在课堂讲稿中。我们会录制讲座并将录音发布到网上。

We are trying to cover a lot of ground over the course of just 11 1-hour lectures, so the lectures are fairly dense. To allow you some time to get familiar with the content at your own pace, each lecture includes a set of exercises that guide you through the lecture's key points. After each lecture, we are hosting office hours where we will be present to help answer any questions you might have. If you are attending the class online, you can send us questions at [email protected].

我们试图在11个1小时的课程中涵盖很多内容,所以课程相当密集。为了让你有时间按照自己的节奏熟悉课程内容,每节课都包括一套指导你通过课程要点的练习。每堂课结束后,我们都会安排办公时间,届时我们将为您解答任何问题。如果你在网上上课,你可以把问题发送到[email protected].

Due to the limited time we have, we won't be able to cover all the tools in the same level of detail a full-scale class might. Where possible, we will try to point you towards resources for digging further into a tool or topic, but if something particularly strikes your fancy, don't hesitate to reach out to us and ask for pointers!

由于时间有限,我们不可能像一个完整的课程那样详细地介绍所有的工具。在可能的情况下,我们将尝试为您提供进一步挖掘工具或主题的资源,但如果您特别喜欢某个工具或主题,请不要犹豫,联系我们并寻求指导!

Topic 1: The Shell

Shell 是什么?

Computers these days have a variety of interfaces for giving them commands; fanciful graphical user interfaces, voice interfaces, and even AR/VR are everywhere. These are great for 80% of use-cases, but they are often fundamentally restricted in what they allow you to do — you cannot press a button that isn't there or give a voice command that hasn't been programmed. To take full advantage of the tools your computer provides, we have to go old-school and drop down to a textual interface: The Shell.

现在的计算机有各种各样的界面来给它们发命令;奇特的图形用户界面、语音界面,甚至AR/VR无处不在。对于80%的用例来说,这些都是很好的,但它们通常在允许你做的事情上受到根本性的限制——你不能按下不在那里的按钮,也不能发出未编程的语音命令。为了充分利用您的计算机提供的工具,我们必须走老路,转而使用文本界面:Shell。

Nearly all platforms you can get your hand on has a shell in one form or another, and many of them have several shells for you to choose from. While they may vary in the details, at their core they are all roughly the same: they allow you to run programs, give them input, and inspect their output in a semi-structured way.

几乎所有您可以接触到的平台都有一种或另一种形式的shell,其中许多平台都有几种shell供您选择。 虽然它们在细节上可能有所不同,但它们的核心都大致相同:它们允许您以半结构化的方式运行程序、向它们提供输入并检查它们的输出。

In this lecture, we will focus on the Bourne Again SHell, or "bash" for short. This is one of the most widely used shells, and its syntax is similar to what you will see in many other shells. To open a shell prompt (where you can type commands), you first need a terminal. Your device probably shipped with one installed, or you can install one fairly easily.

在这一讲中,我们将关注Bourne Again SHell,或简称为“bash”。这是使用最广泛的shell之一,它的语法与您将在许多其他shell中看到的类似。要打开shell_prompt(可以在其中键入命令),首先需要一个terminal_。 您的设备可能附带安装了一个,或者您可以相当容易地安装一个。

使用Shell

When you launch your terminal, you will see a prompt that often looks a little like this:

当你启动

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值