初学者命令行

Computers are great because using the mouse or touch devices we can do a lot of work, leaving the keyboard to typing our emails, blog posts or reports.

电脑之所以出色,是因为使用鼠标或触摸设备,我们可以做很多工作,而不必用键盘来键入电子邮件,博客文章或报告。

Once upon a time, this didn’t exist. Computers were only accessed using the keyboard, typing weird and cryptic messages, called commands, in a terminal.

很久以前,这并不存在。 只能使用键盘访问计算机,在终端中键入称为命令的怪异和隐秘消息。

This was true when computers were big as entire rooms, but also was true when the first personal computers started becoming affordable and they would start with a BASIC command prompt.

当计算机像整个房间一样大时,这是正确的,但当第一台个人计算机开始变得负担得起且它们将以BASIC命令提示符开头时,也是如此。

Today, well hidden and never used by consumers, we still have this way of using our computer.

如今,隐藏得很深,消费者从未使用过它,我们仍然可以使用这种方式使用计算机。

We can do so using a terminal.

我们可以使用终端来做到这一点。

macOS comes with an app called Terminal, appropriately named.

macOS附带一个名为Terminal的应用程序,该应用程序的名称恰当。

Microsoft provides an app called Windows Terminal.

Microsoft提供了一个名为Windows Terminal的应用程序。

And Linux users know their terminals very well.

Linux用户非常了解他们的终端。

The terminal is not just for programmers. It’s essential for every professional computer user, because it unlocks you things that are impossible to do with a GUI (Graphical User Interface).

该终端不仅仅适合程序员。 这对于每个专业计算机用户都是必不可少的,因为它可以解锁您使用GUI(图形用户界面)无法完成的工作。

Oh, I mention GUI. The acronym for the terminal is CLI (Command Line Interface).

哦,我提到了GUI。 终端的缩写是CLI(命令行界面)。

There is not just one terminal. You wish. Instead, we have lots and lots of different terminal interfaces, called shells.

不仅有一个航站楼。 你希望。 相反,我们有很多不同的终端接口,称为shell

We have Bash, ZSH, Fish Shell, CSH, and many more. But the most popular ones are Bash and ZSH.

我们有Bash ,ZSH,Fish Shell,CSH等等。 但是最受欢迎的是Bash和ZSH。

Bash is often the default, and until very recently it was the default macOS shell, but now it’s been changed to ZSH.

Bash通常是默认的,直到最近它还是默认的macOS Shell,但现在它已更改为ZSH。

My favorite shell, to be honest, is Fish Shell. I really like it because it’s simple, straightforward, comes with great defaults, and also a web-based configuration. I don’t have time to spend configuring my shell prompts and colors manually and when something works out of the box, I take it.

老实说,我最喜欢的贝壳是Fish Shell 。 我非常喜欢它,因为它简单,直接,具有出色的默认设置以及基于Web的配置。 我没有时间花时间手动配置我的shell提示和颜色,当开箱即用时,我接受了。

The terminal is also the way you access a server. You can create a VPS server on Amazon or DigitalOcean or where you want, and you can access it using SSH, the secure protocol to connect to a remote shell.

终端也是您访问服务器的方式。 您可以在Amazon或DigitalOcean上或您想要的地方创建VPS服务器,并且可以使用SSH(连接到远程Shell的安全协议)访问它。

You use the shell locally but you could actually be connected to a server at the other side of Earth, which is pretty cool. Except some delay, if the connection is a bit laggy.

您可以在本地使用外壳,但实际上可以连接到地球另一端的服务器,这非常酷。 如果连接有点滞后,除了一些延迟。

This is my macOS shell:

这是我的macOS shell:

I can list all the files in my home folder by typing ls and pressing enter:

我可以通过输入ls并按Enter键ls主文件夹中的所有文件:

I can change the current working directory to another folder using the cd command:

我可以使用cd命令将当前工作目录更改为另一个文件夹:

And every time I don’t know how to use a command, I type man <command> to get the manual:

每当我不知道如何使用命令时,我都会输入man <command>来获得手册:

This is a man page. Although I find man pages to contain too much information, as this is 1 of 14 screens of explanation for the ls command.

这是一个手册页。 尽管我发现手册页包含太多信息,但由于这是ls命令的14个解释屏幕之一。

Most of the times when in need I use this site called tldr pages: https://tldr.sh/. It’s a command you install, then you run it like this: tldr <command>

在大多数情况下,我需要使用称为tldr页面的站点: https : //tldr.sh/ 。 这是安装的命令,然后像这样运行它: tldr <command>

It just gave me a few useful options with examples.

它仅通过示例为我提供了一些有用的选项。

Anyway, I’m digressing. When typing commands you can move around with your left and right arrow to move the cursor around.

无论如何,我离题了。 键入命令时,您可以使用左右箭头来移动光标。

Some systems also let you use the mouse to go to a specific place in the line. For example on macOS I can use option-click to position the cursor anywhere I want.

某些系统还允许您使用鼠标转到行中的特定位置。 例如,在macOS上,我可以使用Option-click将光标定位在所需的任何位置。

Pressing the up arrow will show the command you last typed. It’s nice when you make a typo and you don’t need to re-type all the thing.

按向上箭头将显示您上次键入的命令。 打字时很不错,不需要重新输入所有内容。

If you type a command not found, the shell will tell you:

如果键入未找到的命令,则外壳程序将告诉您:

I made a few tutorials on using shells:

我编写了一些有关使用Shell的教程:

There’s a lot to read if you want!

如果您想阅读的东西很多!

翻译自: https://flaviocopes.com/cli-for-beginners/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值