python简史_命令行简史
python简史
by Gitter
通过吉特
命令行简史 (A Brief History of the Command Line)
This post by Andy Trevorah, Engineer at Gitter, has been adapted from a talk that he originally gave at codebar, a non-profit initiative that facilitates the growth of a diverse tech community by running regular programming workshops.
Gitter工程师Andy Trevorah的帖子改编自他最初在 Codebar上 发表的演讲,该演讲是 一项非盈利性计划,通过举办定期的编程研讨会来促进多元化技术社区的发展。
This post is in two parts: a little history, followed by some live command line examples.
这篇文章分为两部分:一段历史,然后是一些实时命令行示例。
一个简短的历史 (A Brief History)
Way back in the 1960s — 70s, computers were becoming more than just calculators. They could save files to disk and have multiple running applications with multiple users. But these things were difficult to control and easy to break. Thankfully, there was a very smart idea to cover all these internal bits in a nice, usable shell.
追溯到1960年代-70年代,计算机已不仅仅是计算器。 他们可以将文件保存到磁盘,并具有多个用户的多个正在运行的应用程序。 但是这些事情很难控制并且容易打破。 值得庆幸的是,有一个非常聪明的主意,可以用一个不错的,可用的外壳覆盖所有这些内部位。
These shells have since evolved to be Windows desktop, Mac OS, and all the touchy screeny bits of your phone. Basically all the user interaction stuff. They make your computer easy to use and (reasonably) hard to break.
从那时起,这些外壳就发展成为Windows台式机,Mac OS和手机的所有触摸屏。 基本上所有用户交互的东西。 它们使您的计算机易于使用,并且(合理地)难以损坏。
But before these shells started looking pretty and graphical, they were just a command line. You would type something in, and you would get a response. They looked like this:
但是在这些shell看起来漂亮而图形化之前,它们只是命令行。 您将输入一些内容,您将得到响应。 他们看起来像这样:
Here’s a shell running the cal command and printing out a calendar.
这是一个运行cal命令并打印日历的shell。
This particular shell is called bash which is short for “Bourne Again SHell” because before that there was the “Bourne Shell” by Stephen Bourne. Never let a software engineer name something that will end up lasting.
这种特殊的外壳称为bash ,是“ Bourne Again SHell”的缩写,因为在此之前,Stephen Bourne曾使用过“ Bourne Shell” 。 永远不要让软件工程师命名那些会持久的东西。
There’s a rich history of shells, and these “Unix style” shells began with Unix System 1’s shell in 1969. But even that was influenced by older programs such as RUNCOM. If you’ve ever noticed that some config files end in “rc” (e.g .vimrc), thats why.
外壳的历史很悠久,这些“ Unix风格”的外壳始于1969年Unix System 1的外壳 。但是,即使那样,它也受到RUNCOM等旧程序的影响。 如果您曾经注意到某些配置文件以“ rc”结尾(例如。vimrc ),那就是为什么。
If these shells have changed since the 1960s, then why do developers keep on using them?
如果这些外壳自1960年代以来发生了变化,那么为什么开发人员会继续使用它们呢?
Because they haven’t really changed since the 60s. Graphical interfaces for your phone or computer fashionably change with every update (with usability improvements), but command line shells don’t. When you are scripting things or dealing with an entire farm of servers, you really don’t want your (user) interface to change, as it will break your scripts.
因为自60年代以来它们并没有真正改变。 手机或计算机的图形界面会随每次更新而更改(具有可用性方面的改进),但命令行外壳程序却不会。 当您编写脚本或处理整个服务器场时,您确实不希望更改(用户)界面,因为它会破坏脚本。
Thankfully, both command line and graphical shells are both shells around the same thing, so we can use them both interchangeably. Here’s some examples to show what command line shells can do.
值得庆幸的是,命令行和图形外壳程序都是围绕同一事物的外壳程序,因此我们可以将它们互换使用。 这是一些示例,说明命令行外壳程序可以做什么。
行动中的炮弹 (Shells in Action)
We can start small and just get the computer to repeat what we say:
我们可以从小做起,只是让计算机重复我们所说的话:
bash-3.2$ echo hello hello
The computer also has some special words like $RANDOM:
计算机上还有一些特殊的词,例如$ RANDOM:
bash-3.2$ echo $RANDOM 23914
Bear in mind that almost all of these commands are just little programs that accept some input and emit output. You can find out where they are using which:
请记住,几乎所有这些命令都是接受某些输入并发出输出的小程序。 你可以找出他们正在使用的其中:
bash-3.2$ which echo /bin/echo
With Mac OS, we can even make the computer say stuff:
使用Mac OS,我们甚至可以让计算机说出一些东西:
bash-3.2$ say hello ["hello" comes from the speakers]
bash-3.2$ say butts butts butts ["butts butts butts" comes from the speakers without complaint]
There’s also cat which will print out file contents. It’s from 1971.
还有猫会打印出文件内容。 是从1971年开始的。
bash-3.2$ cat cool_websites.txt Some websites that I like:
http://codebar.io http://ocw.mit.edu/ans7870/6/6.006/s08/lecturenotes/files/t8.shakespeare.txt
We can use it to read some built in files on your computer:
我们可以使用它来读取您计算机上的一些内置文件:
bash-3.2$ cat /usr/share/dict/words [skip a few thousand lines]zymotically zymotize zymotoxic zymurgy Zyrenian Zyrian Zyryan zythem Zythia zythum Zyzomys Zyzzogeton
That’s every word that your computer knows! That list is pretty long (almost too long to scroll!), but we can use the head command to see the top of it:
那就是您的计算机知道的每一个字! 该列表很长(几乎太长,无法滚动!),但是我们可以使用head命令查看它的顶部:
bash-3.2$ head /usr/share/dict/words A a aa aal aalii aam Aani aardvark aardwolf Aaron
And there is an opposite command, tail:
还有一个相反的命令, tail :
bash-3.2$ tail /usr/share/dict/words zymotoxic zymurgy Zyrenian Zyrian Zyryan zythem Zythia zythum Zyzomys Zyzzogeton
It would be neat to just get the last word. tail can do this, but requires a special argument. We can look it up using man:
拿到最后的话会很整齐。 tail可以做到这一点,但是需要一个特殊的参数。 我们可以使用man查找它:
bash-3.2$ man tail
TAIL(1) BSD General Commands Manual
NAME tail -- display the last part of a file
SYNOPSIS tail [-F | -f | -r] [-q] [-b number | -c number | -n number] [file ...]
DESCRIPTION The tail utility displays the contents of file or, by default, its stan- dard input, to the standard output.
The display begins at a byte, line or 512-byte block location in the input. Numbers having a leading plus (`+') sign are relative to the beginning of the input, for example, ``-c +2'' starts the display at the second byte of the input. Numbers having a leading minus (`-') sign or no explicit sign are relative to the end of the input, for example, ``-n 2'' displays the last two lines of the input. The default starting loca- tion is ``-n 10'', or the last 10 lines of the input.
The options are as follows:
:
Ah! The argument is -n (you press “q” to exit the manual btw):
啊! 参数为-n (按“ q”退出手册btw):
bash-3.2$ tail -n 1 /usr/share/dict/words Zyzzogeton
I have no idea how to pronounce “Zyzzogeton”, but we can get the computer to do it using the say command. We just pipe the output of tail into the input of say using the pipe character (|):
我不知道如何发音“ Zyzzogeton”,但我们可以使用say命令让计算机来完成它。 我们只是使用竖线字符(|)将tail的输出通过管道输入到say的输入中:
bash-3.2$ tail -n 1 /usr/share/dict/words | say ["Zyzzogeton" comes from the speakers]
Neat! We can even have multiple pipes. We can pipe cat into tail into say and get the same result:
整齐! 我们甚至可以有多个管道。 我们可以将cat 尾巴 说出来,并得到相同的结果:
bash-3.2$ cat /usr/share/dict/words | tail -n 1 | say ["Zyzzogeton" comes from the speakers]
Now if we wanted to get a random word, we could get all the words up to a random point and then get the last word of that. We can do that with head and tail:
现在,如果我们想得到一个随机单词,我们可以将所有单词都取到一个随机点,然后得到该单词的最后一个单词。 我们可以用头和尾做到这一点:
bash-3.2$ cat /usr/share/dict/words | head -n $RANDOM | tail -n 1 | say ["atmological" comes from the speakers]
cat reads files from your hard drive, but we can use curl to read files from the internet. Here’s a url for a file that contains the full works of shakespeare:
cat会从您的硬盘驱动器读取文件,但是我们可以使用curl来从Internet读取文件。 这是包含莎士比亚全部作品的文件的url:
bash-3.2$ curl -s http://ocw.mit.edu/ans7870/6/6.006/s08/lecturenotes/files/t8.shakespeare.txt [skip a few thousand lines] Would yet again betray the fore-betrayed, And new pervert a reconciled maid.'
THE END
<<THIS ELECTRONIC VERSION OF THE COMPLETE WORKS OF WILLIAM SHAKESPEARE IS COPYRIGHT 1990-1993 BY WORLD LIBRARY, INC., AND IS PROVIDED BY PROJECT GUTENBERG ETEXT OF ILLINOIS BENEDICTINE COLLEGE WITH PERMISSION. ELECTRONIC AND MACHINE READABLE COPIES MAY BE DISTRIBUTED SO LONG AS SUCH COPIES (1) ARE FOR YOUR OR OTHERS PERSONAL USE ONLY, AND (2) ARE NOT DISTRIBUTED OR USED COMMERCIALLY. PROHIBITED COMMERCIAL DISTRIBUTION INCLUDES BY ANY SERVICE THAT CHARGES FOR DOWNLOAD TIME OR FOR MEMBERSHIP.>>
End of this Etext of The Complete Works of William Shakespeare
If we used this curl as an input to our random word pipes, we can get the computer to quote us random lines of Shakespeare!
如果我们将此卷曲用作随机单词管道的输入,则可以使计算机引用莎士比亚的随机行!
bash-3.2$ curl -s http://ocw.mit.edu/ans7870/6/6.006/s08/lecturenotes/files/t8.shakespeare.txt | head -n $RANDOM | tail -n 1 | say ["The sister to my wife, this gentlewoman" comes from the speakers]
We can achieve quite a lot with only a few commands. This philosophy of having small reusable programs that can be combined together has lasted for a long time, much like lego bricks. By combining the right ones, you can make quite an impressive program!
仅需几个命令,我们就可以实现很多目标。 具有可以组合在一起的小型可重用程序的哲学已经持续了很长时间,就像乐高积木一样。 通过组合正确的程序,您可以制作出令人印象深刻的程序!
翻译自: https://www.freecodecamp.org/news/the-command-line-1fdbc692b3bf/
python简史
相关文章:

4- flutter - Widget
Widget Flutter 中的view 就是widget 1 无状态和有状态的Widget StateslessWidgets 适用于用户界面不依赖于用户的信息的时候 StatesfulWidgets 有状态的,例如HTTP 网络请求或者用户交互之后收到数据动态表更新UI 这就是一个无状态的Widget Text("we like…

第一讲SQL命令的DDL和DML操作讲解
知识点: 一、sql命令DDL(结构化操作) 二、sql命令DML操作(增删改查) 1.sql命令DDL(结构化操作) 1.1表添加字段: alter table 表名 add 列定义 如: alter table Student add email varchar(128); 1.2 修改字段ÿ…
基于Tkinter利用python实现颜色空间转换程序
主要基于colorsys实现,例子是从hls转换到rgb,假设要换颜色空间非常easy仅仅须要改动一个函数 用到了Scale和Canvas组件 代码例如以下: from Tkinter import * import colorsys #操作后的响应函数 def update(* args):colorr,g,b colorsys.hl…

react 时刻表插件_React“啊哈”的时刻
react 时刻表插件As a teacher, one of my main goals is to maximize people’s “aha” moments.作为一名老师,我的主要目标之一是最大限度地利用人们的“哈哈”时刻。 An “aha” moment is a moment of sudden insight or clarity, where the subject starts t…

同样在JavaScript中
ES6有三个内置决定一些设施x和一些y是“相同的”。 它们是:平等或“双等于”(),严格平等或平等“三重”(),Object.is。 (注意,Object.is在ES6补充道。 等于两倍和三倍等于存在ES6之前,和他们的行为没有改变。) 概述 演示,下面是三个同样使用的比较: x y x y Object。是(x,…

5-flutter 布局和列表
布局和列表 类型作用特点Container只有一个子 Widget。默认充满,包含了padding、margin、color、宽高、decoration 等配置。Padding只有一个子 Widget。只用于设置Padding,常用于嵌套child,给child设置padding。Center只有一个子 Widget。只…

shell awk实战
一、文本处理 1、按行提取关键字频次(如取第5列) awk BEGIN{FS"|"} {a[$5]1;} END {for(i in a) print i ":" a[i];} OPT.ForumLogicNewServer_action_20161107.log | sort -nrk 2 -t : 2、日志用户每分钟访问量统计 这里我们统计日…

pix怎么抚养另一只猫_在工作和抚养两个孩子的同时,我如何在一年内获得第二学位并获得了5个开发人员认证...
pix怎么抚养另一只猫“The standard pace is for chumps. The system is designed so anyone can keep up. If you’re more driven than ‘just anyone’ — you can do so much more than anyone expects. And this applies to ALL of life — not just school.” — Derek S…

Wireshark网络抓包(三)——网络协议
一、ARP协议 ARP(Address Resolution Protocol)地址解析协议,将IP地址解析成MAC地址。 IP地址在OSI模型第三层,MAC地址在OSI第二层,彼此不直接通信; 在通过以太网发生IP数据包时,先封装第三层&a…

实现Java中的ArrayList
最近深受轮子哥影响,觉得造一些轮子应该会对自己的技术功底有一定的帮助,就决定先从简单的容器开始实现。废话不多说,就先实现一个Java中的ArrayList。 ArrayList是我们在Java中使用非常多的一个类,它是顺序表的数组实现ÿ…

6-flutter 状态管理
1 StatelessWidget 不需要状态改变的widget,它没有要管理的内部状态。 Text,CircleAvator 都是其子类 其传递的参数别final 修饰,不可变的 无状态的widget build 方法在以下三种情况下进行调用 当widget 插入到数中去当widget 父级更改配置的时候当…

大二上学数据结构和操作系统_毕业后的工作比上学要重要得多。 这是数据。...
大二上学数据结构和操作系统by Aline Lerner通过艾琳勒纳(Aline Lerner) 毕业后的工作比上学要重要得多。 这是数据。 (What you do after you graduate matters way more than where you went to school. Here’s the data.) The first blog post I published that got any r…

关于C#中编译器保证变量必须初始化规则猜想
现在两种情况: 第一种情况: using System; namespace Wrox {public class Program{static void Main(string[] args){int index; if(true){ index 100; } Console.WriteLine(index); Cons…

Bootstrap table表格
Bootstrap table 使用类 Class"table" 既可让table美化样式 table 相关的Class 隔行换色 : table-striped 鼠标悬停效果: table-hover 表格的边框 : table-bordered 垂直居中 : vertical-align 表头颜色:c…

flutter报错Could not connect to lockdownd, error code -
关于 flutter 报错信息解决方案 第一步: cmdshiftg 前往 /var/db 文件夹,找到lockdown文件夹,修改读写权限 第二步 : 打开命令行,依次执行 brew update brew uninstall --ignore-dependencies libimobiledevice brew uninstall…

k8s aws 部署_如何在短短30分钟内使用CircleCI设置到AWS S3的持续部署
k8s aws 部署by Adam Watt通过亚当瓦特 如何在短短30分钟内使用CircleCI设置到AWS S3的持续部署 (How to setup Continuous Deployment to AWS S3 using CircleCI in just 30 minutes) Continuous Deployment might seem complicated at first, but don’t be intimidated. In…

SharePoint 2010 单点登录
SharePoint2010单点登录 1.进入管理中心》应用程序管理 2.找到 Secure Store Service 应用程序代理 3.然后就是新建了 5.输入网站集管理员 6.这个时候SharePoint就知道你需要给OA这个系统做单点登录了。 7.下一步就是我们要把我们进OA系统的帐号密码告诉SharePoint,…
Java IO流学习总结三:缓冲流-BufferedInputStream、BufferedOutputStream
Java IO流学习总结三:缓冲流-BufferedInputStream、BufferedOutputStream 转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/54894451 本文出自【赵彦军的博客】 InputStream |__FilterInputStream|__BufferedInputStream 首先抛出一个…

7-flutter Navigator 和Route
Route 和 Navigator 用于页面之间的跳转 一 Navigator 的 push 和 pop 用于页面之间的跳转 创建MaterialApp时可以指定routes参数,该参数是一个映射路由名称和构造器的Map 跳转的时候 使用 push 跳回的时候使用 pop import package:flutter/cupertino.dart; im…

小规模网络数据公开数据_大规模的在线公开课程曾经是100%免费的。 但是他们没有那样做。...
小规模网络数据公开数据I took one of the first Massive Open Online Courses (MOOCs) in 2011. Back then, everything was 100% free: the videos, the assignments, and the certificates. But in 2017, you can’t find this sort of free learning experience anymore.我…

swift -charts框架雷达图
参考资料 import UIKit import Chartsclass ViewController: UIViewController {let activities ["力量", "敏捷", "生命", "智力", "魔法"]override func viewDidLoad() {super.viewDidLoad()// Do any additional setup…

vector容器总结.xml
1 清空所有元素m_itemVector.clear(); 2 遍历vector<ITEM_CHECK>::iterator iterm_itemVector.begin(); for(i0;iter!m_itemVector.end();iter,i) { if(iter->flag-1) { break; } iter->flag1; } vector<ITEM_CHECK>::iterator iterm_itemVector.b…

Syncthing源码解析 - 第三方库
1,AudriusButkevicius/cli 网址:https://github.com/AudriusButkevicius/cli 2,bkaradzic/go-lz4 网址:https://github.com/bkaradzic/go-lz4 3,calmh 备注:这位是Syncthing项目创立者和最主要的开发者&…

安全工程师2017年真题_以下是2017年全球软件工程师的平均薪水
安全工程师2017年真题And here are those same salaries adjusted to San Francisco’s cost of living:以下是根据旧金山的生活费用调整后的相同工资: As you can see, cost of living is an important consideration. Also, you don’t need to move to San Fran…

测试思想 什么是软件测试(摘录)
什么是软件测试(摘录) by:授客 QQ:1033553122 IEEE 标准的定义:使用人工或自动的手段来运行或测定某个系统的过程,其目的在于检验;它是否满足规定的需求或是弄清预期结果与实际结果之间的差别。对软件测试还有一些不同的定义。 G.J.Myers给出的定义:“程…

8-flutter 异步和线程
线程和异步的UI 1 异步的使用 Dart 有一个单线程执行模型,支持Isolate(一种在另外一种线程运行dart的方法),一个事件循环和异步编程。 可以使用async / await 来做网络请求不会挂起UI 使用http 导入 import ‘dart:io’; import ‘dart:c…

前端页面紫红色_谷歌正在开发一种神秘的新型移动操作系统,称为紫红色
前端页面紫红色Google seems to be building a replacement for Android called Fuchsia. Yesterday, they revealed what their new Armadillo user interface looks like (see photo above, courtesy of Ars Technica).谷歌似乎正在建立一个名为Fuchsia的 Android替代产品。 …

iOS UIButton 文字图片上下左右布局
例如文字在左 图片在右,iOS 9 之后一句话搞定 backBtn.semanticContentAttribute UISemanticContentAttributeForceRightToLeft;按钮标题居左实现 dateBtn.contentHorizontalAlignment UIControlContentHorizontalAlignmentLeft; dateBtn.contentEdgeInsets UIEdgeInsetsMak…

linux xampp eclipse xdebug 无法进入断点
一、xampp 版本 1.8.3-5 xampp安装后会自动集成xdebug,目录一般为 /opt/lampp/lib/php/extensions/***-debug-***目录 关于php 与php.ini路径 php程序路径为:/opt/lampp/bin/ php.ini配置文件路径为:/opt/lampp/etc/ 1、配置文件一般在/opt/lampp/etc/ph…

sliva数据库简介--转载
sliva rRNA数据库(http://www.arb-silva.de/)用来检查和比对RNA序列,既可以针对16S/18S,SSU,也可以针对23S/28S, LSU,包括了Bacteria, Archaea and Eukarya。同时也是ARB的官方指定数据库。 LSU: Large subunit (23S/2…