From 138c3216c9b925983f38ed7526975fd2b5d6a9ad Mon Sep 17 00:00:00 2001 From: cycoe Date: Sat, 24 Nov 2018 19:03:08 +0800 Subject: [PATCH 001/135] translating by cycoe --- sources/tech/20180518 How to Manage Fonts in Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180518 How to Manage Fonts in Linux.md b/sources/tech/20180518 How to Manage Fonts in Linux.md index 0faca7fa17..84aa907886 100644 --- a/sources/tech/20180518 How to Manage Fonts in Linux.md +++ b/sources/tech/20180518 How to Manage Fonts in Linux.md @@ -1,3 +1,5 @@ +translating by cycoe +cycoe 翻译中 How to Manage Fonts in Linux ====== From a405a77971bc5b4ed97a1d7a100224d80f939a65 Mon Sep 17 00:00:00 2001 From: cycoe Date: Sat, 24 Nov 2018 20:03:37 +0800 Subject: [PATCH 002/135] partial translated --- .../20180518 How to Manage Fonts in Linux.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sources/tech/20180518 How to Manage Fonts in Linux.md b/sources/tech/20180518 How to Manage Fonts in Linux.md index 84aa907886..80889b87ac 100644 --- a/sources/tech/20180518 How to Manage Fonts in Linux.md +++ b/sources/tech/20180518 How to Manage Fonts in Linux.md @@ -1,51 +1,51 @@ translating by cycoe cycoe 翻译中 -How to Manage Fonts in Linux +如何在 Linux 上管理字体 ====== ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_main.jpg?itok=qcJks7-c) -Not only do I write technical documentation, I write novels. And because I’m comfortable with tools like GIMP, I also create my own book covers (and do graphic design for a few clients). That artistic endeavor depends upon a lot of pieces falling into place, including fonts. +我不仅写技术文档,还写小说。并且因为我对 GIMP 等工具感到满意,所以我也(译者注:此处应指使用 GIMP)创建了自己的书籍封面(并为少数客户做了图形设计)。艺术创作取决于很多东西,包括字体。 -Although font rendering has come a long way over the past few years, it continues to be an issue in Linux. If you compare the look of the same fonts on Linux vs. macOS, the difference is stark. This is especially true when you’re staring at a screen all day. But even though the rendering of fonts has yet to find perfection in Linux, one thing that the open source platform does well is allow users to easily manage their fonts. From selecting, adding, scaling, and adjusting, you can work with fonts fairly easily in Linux. +虽然字体渲染已经在过去的几年里取得了长足进步,但它在 Linux 平台上仍是个问题。如果你在 Linux 和 macOS 平台上比较相同字体的外观,差别是显而易见的,尤其是你要盯着屏幕一整天的时候。虽然在 Linux 平台上尚未找到完美的字体渲染方案,开源平台做得好的一件事是允许用户轻松地管理他们的字体。通过选择、添加、缩放和调整,你可以在 Linux 平台上相当轻松地使用字体。 -Here, I’ll share some of the tips I’ve depended on over the years to help extend my “font-ability” in Linux. These tips will especially help those who undertake artistic endeavors on the open source platform. Because there are so many desktop interfaces available for Linux (each of which deal with fonts in a different way), when a desktop environment becomes central to the management of fonts, I’ll be focusing primarily on GNOME and KDE. +此处,我将分享一些这些年来我赖于在 Linux 上帮助我扩展“字体能力”的技巧。这些技巧将对那些在开源平台上进行艺术创作的人有特别的帮助。因为 Linux 平台上有非常多可用的桌面界面(每种界面以不同的方式处理字体),因此当桌面环境成为字体管理的中心时,我将主要聚焦在 GNOME 和 KDE 上。 -With that said, let’s get to work. +话虽如此,让我们开始吧。 -### Adding new fonts +### 添加新字体 -For the longest time, I have been a collector of fonts. Some might say I have a bit of an obsession. And since my early days of using Linux, I’ve always used the same process for adding fonts to my desktops. There are two ways to do this: +在相当长的一段时间里,我都是一个字体收藏家,甚至有些人会说我有些痴迷。从我使用 Linux 的早期开始,我就总是用相同的方法向我的桌面添加字体。有两种方法可以做到这一点: - * Make the fonts available on a per-user basis. + * 使字体针对每个用户可用; - * Make the fonts available system-wide. + * 使字体在系统范围内可用。 -Because my desktops never have other users (besides myself), I only ever work with fonts on a per-user basis. However, I will show you how to do both. First, let’s see how to add fonts on a per-user basis. The first thing you must do is find fonts. Both True Type Fonts (TTF) and Open Type Fonts (OTF) can be added. I add fonts manually. Do this is, I create a new hidden directory in ~/ called ~/.fonts. This can be done with the command: +因为我的桌面从没有其他用户(除了我自己),我只使用了每个用户的字体设置。然而,我会向你演示如何完成这两种设置。首先,让我们来看一下如何向每个用户添加新字体。你首先要做的是找到字体文件,真实类型字体(TTF)和开源类型字体(OTF)都可以被添加。我选择手动添加字体,也就是说,我在 ~/ 目录下新建了一个名为 ~/.fonts 的隐藏目录。该操作可由以下命令完成: ``` mkdir ~/.fonts ``` -With that folder created, I then move all of my TTF and OTF files into the directory. That’s it. Every font you add into that directory will now be available for use to your installed apps. But remember, those fonts will only be available to that one user. +当此文件夹新建完成,我将所有 TTF 和 OTF 字体文件移动到此文件夹中。也就是说,你在此文件夹中添加的所有字体都可以在已安装的应用中使用了。但是要记住,这些字体只会对这一个用户可用。 -If you want to make that collection of fonts available to all, here’s what you do: +如果你想要使这个字体集合对所有用户可用,你可以如下操作: - 1. Open up a terminal window. + 1. 打开一个终端窗口; - 2. Change into the directory housing all of your fonts. + 2. 切换路径到包含你所有字体的目录中; - 3. Copy all of those fonts with the commands sudo cp *.ttf *.TTF /usr/share/fonts/truetype/ and sudo cp *.otf *.OTF /usr/share/fonts/opentype + 3. 使用 `sudo cp *.ttf *.TTF /usr/share/fonts/truetype/` 和 `sudo cp *.otf *.OTF /usr/share/fonts/opentype` 命令拷贝所有字体。 -The next time a user logs in, they’ll have access to all those glorious fonts. +当下次用户登录时,他们就将可以使用所有这些漂亮的字体。 -### GUI Font Managers +### 图形界面字体管理 There are a few ways to manage your fonts in Linux, via GUI. How it’s done will depend on your desktop environment. Let’s examine KDE first. With the KDE that ships with Kubuntu 18.04, you’ll find a Font Management tool pre-installed. Open that tool and you can easily add, remove, enable, and disable fonts (as well as get information about all of the installed fonts. This tool also makes it easy for you to add and remove fonts for personal and system-wide use. Let’s say you want to add a particular font for personal usage. To do this, download your font and then open up the Font Management tool. In this tool (Figure 1), click on Personal Fonts and then click the + Add button. From 09ed1f33f7e8914e1cc5c89dc6e0ab2a398aa29d Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 1 Dec 2018 20:53:10 +0800 Subject: [PATCH 003/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Emacs=20#2:=20Int?= =?UTF-8?q?roducing=20org-mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20180228 Emacs -2- Introducing org-mode.md | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 sources/tech/20180228 Emacs -2- Introducing org-mode.md diff --git a/sources/tech/20180228 Emacs -2- Introducing org-mode.md b/sources/tech/20180228 Emacs -2- Introducing org-mode.md new file mode 100644 index 0000000000..4345986973 --- /dev/null +++ b/sources/tech/20180228 Emacs -2- Introducing org-mode.md @@ -0,0 +1,180 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Emacs #2: Introducing org-mode) +[#]: via: (https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode) +[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen) +[#]: url: ( ) + +Emacs #2: Introducing org-mode +====== + +In [my first post in my series on Emacs][1], I described returning to Emacs after over a decade of vim, and org-mode being the reason why. + +I really am astounded at the usefulness, and simplicity, of org-mode. It is really a killer app. + +**So what exactly is org-mode?** + +I wrote yesterday: + +> It’s an information organization platform. Its website says “Your life in plain text: Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system.” + +That’s true, but doesn’t quite capture it. org-mode is a toolkit for you to organize things. It has reasonable out-of-the-box defaults, but it’s designed throughout for you to customize. + +To highlight a few things: + + * **Maintaining TODO lists** : items can be scattered across org-mode files, contain attachments, have tags, deadlines, schedules. There is a convenient “agenda” view to show you what needs to be done. Items can repeat. + * **Authoring documents** : org-mode has special features for generating HTML, LaTeX, slides (with LaTeX beamer), and all sorts of other formats. It also supports direct evaluation of code in-buffer and literate programming in virtually any Emacs-supported language. If you want to bend your mind on this stuff, read [this article on literate devops][2]. The [entire Worg website][3] +is made with org-mode. + * **Keeping notes** : yep, it can do that too. With full-text search, cross-referencing by file (as a wiki), by UUID, and even into other systems (into mu4e by Message-ID, into ERC logs, etc, etc.) + + + +**Getting started** + +I highly recommend watching [Carsten Dominik’s excellent Google Talk on org-mode][4]. It is an excellent introduction. + +org-mode is included with Emacs, but you’ll often want a more recent version. Debian users can `apt-get install org-mode`, or it comes with the Emacs packaging system; `M-x package-install RET org-mode RET` may do it for you. + +Now, you’ll probably want to start with the org-mode compact guide’s [introduction section][5], noting in particular to set the keybindings mentioned in the [activation section][6]. + +**A good tutorial…** + +I’ve linked to a number of excellent tutorials and introductory items; this post is not going to serve as a tutorial. There are two good videos linked at the end of this post, in particular. + +**Some of my configuration** + +I’ll document some of my configuration here, and go into a bit of what it does. This isn’t necessarily because you’ll want to copy all of this verbatim — but just to give you a bit of an idea of some of what can be configured, an idea of what to look up in the manual, and maybe a reference for “now how do I do that?” + +First, I set up Emacs to work in UTF-8 by default. +``` +(prefer-coding-system 'utf-8) (set-language-environment "UTF-8") +``` + +org-mode can follow URLs. By default, it opens in Firefox, but I use Chromium. +``` +(setq browse-url-browser-function 'browse-url-chromium) +``` + +I set the basic key bindings as documented in the Guide, plus configure the M-RET behavior. + +``` +(global-set-key "\C-cl" 'org-store-link) +(global-set-key "\C-ca" 'org-agenda) +(global-set-key "\C-cc" 'org-capture) +(global-set-key "\C-cb" 'org-iswitchb) + +(setq org-M-RET-may-split-line nil) +``` + + +**Configuration: Capturing** + +I can press `C-c c` from anywhere in Emacs. It will [capture something for me][7], and include a link back to whatever I was working on. + +You can define [capture templates][8] to set how this will work. I am going to keep two journal files for general notes about meetings, phone calls, etc. One for personal, one for work items. If I press `C-c c j`, then it will capture a personal item. The %a in all of these includes the link to where I was (or a link I had stored with `C-c l`). + +``` +(setq org-default-notes-file "~/org/tasks.org") +(setq org-capture-templates + '( + ("t" "Todo" entry (file+headline "inbox.org" "Tasks") + "* TODO %?\n %i\n %u\n %a") + ("n" "Note/Data" entry (file+headline "inbox.org" "Notes/Data") + "* %? \n %i\n %u\n %a") + ("j" "Journal" entry (file+datetree "~/org/journal.org") + "* %?\nEntered on %U\n %i\n %a") + ("J" "Work-Journal" entry (file+datetree "~/org/wjournal.org") + "* %?\nEntered on %U\n %i\n %a") + )) +(setq org-irc-link-to-logs t) +``` + +I like to link by UUIDs, which lets me move things between files without breaking locations. This helps generate UUIDs when I ask Org to store a link target for future insertion. + +``` +(require 'org-id) +(setq org-id-link-to-org-use-id 'create-if-interactive) +``` + +**Configuration: agenda views** + +I like my week to start on a Sunday, and for org to note the time when I mark something as done. + +``` +(setq org-log-done 'time) +(setq org-agenda-start-on-weekday 0) +``` + +**Configuration: files and refiling** + +Here I tell it what files to use in the agenda, and to add a few more to the plain text search. I like to keep a general inbox (from which I can move, or “refile”, content), and then separate tasks, journal, and knowledge base for personal and work items. + +``` + (setq org-agenda-files (list "~/org/inbox.org" + "~/org/email.org" + "~/org/tasks.org" + "~/org/wtasks.org" + "~/org/journal.org" + "~/org/wjournal.org" + "~/org/kb.org" + "~/org/wkb.org" + )) + (setq org-agenda-text-search-extra-files + (list "~/org/someday.org" + "~/org/config.org" + )) + + (setq org-refile-targets '((nil :maxlevel . 2) + (org-agenda-files :maxlevel . 2) + ("~/org/someday.org" :maxlevel . 2) + ("~/org/templates.org" :maxlevel . 2) + ) + ) +(setq org-outline-path-complete-in-steps nil) ; Refile in a single go +(setq org-refile-use-outline-path 'file) +``` + +**Configuration: Appearance** + +I like a pretty screen. After you’ve gotten used to org a bit, you might try this. + +``` +(require 'org-bullets) +(add-hook 'org-mode-hook + (lambda () + (org-bullets-mode t))) +(setq org-ellipsis "⤵") +``` + +**Coming up next…** + +This hopefully showed a few things that org-mode can do. Coming up next, I’ll cover how to customize TODO keywords and tags, archiving old tasks, forwarding emails to org-mode, and using git to synchronize between machines. + +You can also see a [list of all articles in this series][9]. + + + +-------------------------------------------------------------------------------- + +via: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode + +作者:[John Goerzen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://changelog.complete.org/archives/author/jgoerzen +[b]: https://github.com/lujun9972 +[1]: https://changelog.complete.org/archives/9861-emacs-1-ditching-a-bunch-of-stuff-and-moving-to-emacs-and-org-mode +[2]: http://www.howardism.org/Technical/Emacs/literate-devops.html +[3]: https://orgmode.org/worg/ +[4]: https://www.youtube.com/watch?v=oJTwQvgfgMM +[5]: https://orgmode.org/guide/Introduction.html#Introduction +[6]: https://orgmode.org/guide/Activation.html#Activation +[7]: https://orgmode.org/guide/Capture.html#Capture +[8]: https://orgmode.org/guide/Capture-templates.html#Capture-templates +[9]: https://changelog.complete.org/archives/tag/emacs2018 From 952145206f868b8257d07ee9e76d5291d6e780d5 Mon Sep 17 00:00:00 2001 From: darksun Date: Sat, 1 Dec 2018 20:54:22 +0800 Subject: [PATCH 004/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Emacs=20#3:=20Mor?= =?UTF-8?q?e=20on=20org-mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180302 Emacs -3- More on org-mode.md | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 sources/tech/20180302 Emacs -3- More on org-mode.md diff --git a/sources/tech/20180302 Emacs -3- More on org-mode.md b/sources/tech/20180302 Emacs -3- More on org-mode.md new file mode 100644 index 0000000000..f81c299541 --- /dev/null +++ b/sources/tech/20180302 Emacs -3- More on org-mode.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Emacs #3: More on org-mode) +[#]: via: (https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode) +[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen) +[#]: url: ( ) + +Emacs #3: More on org-mode +====== + +This is third in [a series on Emacs and org-mode][1]. + +**Todo tracking and keywords** + +When using org-mode to [track your TODOs][2], it can have multiple states. You can press `C-c C-t` for a quick shift between states. I have set this: + +``` +(setq org-todo-keywords '( + (sequence "TODO(t!)" "NEXT(n!)" "STARTED(a!)" "WAIT(w@/!)" "OTHERS(o!)" "|" "DONE(d)" "CANCELLED(c)") +)) +``` + +Here, I set up 5 states that are for a task that is not yet done: TODO, NEXT, STARTED, WAIT, and OTHERS. Each has a single-character shortcut (t, n, a, etc). The states after the pipe symbol are ones that are considered “done”. I have two: DONE (for things that I have done) and CANCELED (for things that I haven’t done, but for whatever reason, won’t). + +The exclamation mark means to log the time when an item was changed to a state. I don’t add this to the done states because those are already logged anyhow. The @ sign means to prompt for a reason; so when switching to WAIT, org-mode will ask me why and add this to the note. + +Here’s an example of an entry that has had some state changes: + +``` +** DONE This is a test + CLOSED: [2018-03-02 Fri 03:05] + + - State "DONE" from "WAIT" [2018-03-02 Fri 03:05] + - State "WAIT" from "TODO" [2018-03-02 Fri 03:05] \\ + waiting for pigs to fly + - State "TODO" from "NEXT" [2018-03-02 Fri 03:05] + - State "NEXT" from "TODO" [2018-03-02 Fri 03:05] +``` + +Here, the most recent items are on top. + +**Agenda mode, schedules, and deadlines** + +When you’re in a todo item, C-c C-s or C-c C-d can set a schedule or a deadline for it, respectively. These show up in agenda mode. The difference is in intent and presentation. A schedule is something that you expect to work on at around a time, while a deadline is something that is due at a specific time. By default, the agenda view will start warning you about deadline items in advance. + +And while we’re at it, the [agenda view][3] will show you the items that you have coming up, offers a nice way to search for items based on plain text or tags, and handles bulk manipulation of items even across multiple files. I covered setting the files for agenda mode in [part 2][4] of this series. + +**Tags** + +Of course org-mode has [tags][5]. You can quickly set them with C-c C-q. + +You can set shortcuts for tags you might like to use often. Perhaps something like this: + +``` +(setq org-tag-persistent-alist +'(("@phone" . ?p) +("@computer" . ?c) +("@websurfing" . ?w) +("@errands" . ?e) +("@outdoors" . ?o) +("MIT" . ?m) +("BIGROCK" . ?b) +("CONTACTS" . ?C) +("INBOX" . ?i) +)) +``` + +You can also add tags to this list on a per-file basis, and also set tags for something on a per-file basis. I use that for my inbox.org and email.org files to set an INBOX tag. I can then review all items tagged INBOX from the agenda view each day, and the simple act of refiling them into other files will cause them to lost the INBOX tag. + +**Refiling** + +“Refiling” is moving things around, either within a file or elsewhere. It has completion using your headlines. `C-c C-w` does this. I like these settings: + +``` +(setq org-outline-path-complete-in-steps nil) ; Refile in a single go +(setq org-refile-use-outline-path 'file) +``` + +**Archiving** + +After awhile, you’ll get your files all cluttered with things that are done. org-mode has an [archive][6] feature to move things out of your main .org files and into some other files for future reference. If you have your org files in git or something, you may wish to delete these other files since you’d have things in history anyhow, but I find them handy for grepping and searching. + +I periodically want to go through and archive everything in my files. Based on a [stackoverflow discussion][7], I have this code: + +``` +(defun org-archive-done-tasks () + (interactive) + (org-map-entries + (lambda () + (org-archive-subtree) + (setq org-map-continue-from (outline-previous-heading))) + "/DONE" 'file) + (org-map-entries + (lambda () + (org-archive-subtree) + (setq org-map-continue-from (outline-previous-heading))) + "/CANCELLED" 'file) +) +``` + +This is based on [a particular answer][8] — see the comments there for some additional hints. Now you can run `M-x org-archive-done-tasks` and everything in the current file marked DONE or CANCELED will be pulled out into a different file. + +**Up next** + +I’ll wrap up org-mode with a discussion of automatically receiving emails into org, and syncing org between machines. + + + +-------------------------------------------------------------------------------- + +via: https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode + +作者:[John Goerzen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://changelog.complete.org/archives/author/jgoerzen +[b]: https://github.com/lujun9972 +[1]: https://changelog.complete.org/archives/tag/emacs2018 +[2]: https://orgmode.org/guide/TODO-Items.html#TODO-Items +[3]: https://orgmode.org/guide/Agenda-Views.html#Agenda-Views +[4]: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode +[5]: https://orgmode.org/guide/Tags.html#Tags +[6]: https://orgmode.org/guide/Archiving.html#Archiving +[7]: https://stackoverflow.com/questions/6997387/how-to-archive-all-the-done-tasks-using-a-single-command +[8]: https://stackoverflow.com/a/27043756 From e95b8c7eda44e613aeb0f0fe58738e939822c0eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 1 Dec 2018 21:17:20 +0800 Subject: [PATCH 005/135] PRF:20181026 Directing traffic- Demystifying internet-scale load balancing.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @belitex 翻译的很好 --- ...ystifying internet-scale load balancing.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/talk/20181026 Directing traffic- Demystifying internet-scale load balancing.md b/translated/talk/20181026 Directing traffic- Demystifying internet-scale load balancing.md index e3b26f4a29..11065c49e0 100644 --- a/translated/talk/20181026 Directing traffic- Demystifying internet-scale load balancing.md +++ b/translated/talk/20181026 Directing traffic- Demystifying internet-scale load balancing.md @@ -1,15 +1,15 @@ 流量引导:网络世界的负载均衡解密 ====== -均衡网络流量的常用技术,它们的优势和利弊权衡。 +> 均衡网络流量的常用技术,它们的优势和利弊权衡。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/traffic-light-go.png?itok=nC_851ys) 大型的多站点互联网系统,包括内容分发网络(CDN)和云服务提供商,用一些方法来均衡来访的流量。这篇文章我们讲一下常见的流量均衡设计,包括它们的技术手段和利弊权衡。 -如果你很早就用云计算技术来提供服务的话,你可能在单台云服务器上搭建 web 服务,分配一个 IP 地址,然后配置一个给人读的域名(DNS)指向这个 IP 地址,再将 IP 地址通过边界网关协议(BGP)宣告出去,BGP 是在不同网络之间交换路由信息的标准方式。 +早期的云计算服务提供商,可以提供单一一台客户 Web 服务器,分配一个 IP 地址,然后用一个便于人读的域名配置一个 DNS 记录指向这个 IP 地址,再将 IP 地址通过边界网关协议(BGP)宣告出去,BGP 是在不同网络之间交换路由信息的标准方式。 -这本身并不是负载均衡,但是在冗余的多条网络路径中,很可能是有流量分发的,而且利用网络技术让流量绕过不可用的网络,从而提高了可用性(也引起了[非对称路由][1]的现象)。 +这本身并不是负载均衡,但是能在冗余的多条网络路径中进行流量分发,而且可以利用网络技术让流量绕过不可用的网络,从而提高了可用性(也引起了[非对称路由][1]的现象)。 ### 简单的 DNS 负载均衡 @@ -25,9 +25,9 @@ ![Layer 4 load balancers balance connections across webservers.][5] -四层负载均衡器能够均衡用户和两台 web 服务器的连接 +*四层负载均衡器能够均衡用户和两台 web 服务器的连接* -四层均衡器将网络流量均衡地引导至后端服务器。通常这是基于对 IP 数据包的五元组做散列(数学函数)来完成的,五元组包括:源地址,源端口,目的地址,目的端口,协议(比如 TCP 或 UDP)。这种方法是快速和高效的(还维持了 TCP 的基本属性),而且不需要均衡器维持每个连接的状态。(更多信息请阅读[谷歌发表的 Maglev 论文][6],这篇论文详细讨论了四层软件负载均衡器的实现细节。) +四层均衡器将网络流量均衡地引导至后端服务器。通常这是基于对 IP 数据包的五元组做散列(数学函数)来完成的,五元组包括:源地址、源端口、目的地址、目的端口、协议(比如 TCP 或 UDP)。这种方法是快速和高效的(还维持了 TCP 的基本属性),而且不需要均衡器维持每个连接的状态。(更多信息请阅读[谷歌发表的 Maglev 论文][6],这篇论文详细讨论了四层软件负载均衡器的实现细节。) 四层均衡器可以对后端服务做健康检查,只把流量分发到健康的机器上。和使用 DNS 做负载均衡不同的是,在某个后端 web 服务故障的时候,它可以很快地把流量重新分发到其他机器上,虽然故障机器的已有连接会被重置。 @@ -35,29 +35,29 @@ ### 扩展到多站点 -系统规模在持续增长。你的客户希望能一直使用服务,即使数据中心发生故障的时候。所以你建设了一个新的数据中心,独立部署了一套服务和四层负载均衡器集群,仍然使用同样的 VIP。DNS 的设置不变。 +系统规模在持续增长。你的客户希望能一直使用服务,即使是数据中心发生故障的时候。所以你建设了一个新的数据中心,另外独立部署了一套服务和四层负载均衡器集群,仍然使用同样的 VIP。DNS 的设置不变。 两个站点的边缘路由器都把自己的地址空间宣告出去,包括 VIP 地址。发往该 VIP 的请求可能到达任何一个站点,取决于用户和系统之间的网络是如何连接的,以及各个网络的路由策略是如何配置的。这就是泛播。大部分时候这种机制可以很好的工作。如果一个站点出问题了,你可以停止通过 BGP 宣告 VIP 地址,客户的请求就会迅速地转移到另外一个站点去。 ![Serving from multiple sites using anycast][8] -多个站点使用泛播提供服务 +*多个站点使用泛播提供服务* 这种设置有一些问题。最大的问题是,不能控制请求流向哪个站点,或者限制某个站点的流量。也没有一个明确的方式把用户的请求转到距离他最近的站点(为了降低网络延迟),不过,网络协议和路由选路配置在大部分情况下应该能把用户请求路由到最近的站点。 -### 控制多站点系统中的入方向请求 +### 控制多站点系统中的入站请求 为了维持稳定性,需要能够控制每个站点的流量大小。要实现这种控制,可以给每个站点分配不同的 VIP 地址,然后用简单的或者有权重的 DNS [轮询][9]来做负载均衡。 ![Serving from multiple sites using a primary VIP][11] -多站点提供服务,每个站点使用一个主 VIP,另外一个站点作为备份。基于能感知地理位置的 DNS。 +*多站点提供服务,每个站点使用一个主 VIP,另外一个站点作为备份。基于能感知地理位置的 DNS。* 现在有两个问题。 -第一,使用 DNS 均衡意味着会有被缓存的记录,如果你要快速重定向流量的话就麻烦了。 +第一、使用 DNS 均衡意味着会有被缓存的记录,如果你要快速重定向流量的话就麻烦了。 -第二,用户每次做新的 DNS 查询,都可能连上任意一个站点,可能不是距离最近的。如果你的服务运行在分布广泛的很多站点上,用户会感受到响应时间有明显的变化,取决于用户和提供服务的站点之间有多大的网络延迟。 +第二、用户每次做新的 DNS 查询,都可能连上任意一个站点,可能不是距离最近的。如果你的服务运行在分布广泛的很多站点上,用户会感受到响应时间有明显的变化,取决于用户和提供服务的站点之间有多大的网络延迟。 让每个站点都配置上其他所有站点的 VIP 地址,并宣告出去(因此也会包含故障的站点),这样可以解决第一个问题。有一些网络上的小技巧,比如备份站点宣告路由时,不像主站点使用那么具体的目的地址,这样可以保证每个 VIP 的主站点只要可用就会优先提供服务。这是通过 BGP 来实现的,所以我们应该可以看到,流量在 BGP 更新后的一两分钟内就开始转移了。 @@ -69,13 +69,13 @@ 虽然四层负载均衡可以高效地在多个 web 服务器之间分发流量,但是它们只针对源地址、目标地址、协议和端口来操作,请求的内容是什么就不得而知了,所以很多高级功能在四层负载均衡上实现不了。而七层(L7)负载均衡知道请求的内容和结构,所以能做更多的事情。 -七层负载均衡可以实现缓存,限速,错误注入,做负载均衡时可以感知到请求的代价(有些请求需要服务器花更多的时间去处理)。 +七层负载均衡可以实现缓存、限速、错误注入,做负载均衡时可以感知到请求的代价(有些请求需要服务器花更多的时间去处理)。 -七层负载均衡还可以基于请求的属性(比如 HTTP cookies)来分发流量,可以终结 SSL 连接,还可以帮助防御应用层的拒绝服务(DoS)攻击。规模大的 L7 负载均衡的缺点是成本——处理请求需要更多的计算,而且每个活跃的请求都占用一些系统资源。在一个或者多个 L7 均衡器前面运行 L4 均衡器集群,对扩展规模有帮助。 +七层负载均衡还可以基于请求的属性(比如 HTTP cookies)来分发流量,可以终结 SSL 连接,还可以帮助防御应用层的拒绝服务(DoS)攻击。规模大的 L7 负载均衡的缺点是成本 —— 处理请求需要更多的计算,而且每个活跃的请求都占用一些系统资源。在一个或者多个 L7 均衡器前面运行 L4 均衡器集群,对扩展规模有帮助。 ### 结论 -负载均衡是一个复杂的难题。除了上面说过的策略,还有不同的[负载均衡算法][13],用来实现负载均衡器的高可用技术,客户端负载均衡技术,以及最近兴起的服务网络等等。 +负载均衡是一个复杂的难题。除了上面说过的策略,还有不同的[负载均衡算法][13],用来实现负载均衡器的高可用技术、客户端负载均衡技术,以及最近兴起的服务网络等等。 核心的负载均衡模式随着云计算的发展而不断发展,而且,随着大型 web 服务商致力于让负载均衡技术更可控和更灵活,这项技术会持续发展下去。 @@ -86,7 +86,7 @@ via: https://opensource.com/article/18/10/internet-scale-load-balancing 作者:[Laura Nolan][a] 选题:[lujun9972][b] 译者:[BeliteX](https://github.com/belitex) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9978d8ef99af7ac6ebb72352c9bccf3641f2f9d9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 1 Dec 2018 21:17:47 +0800 Subject: [PATCH 006/135] PUB:20181026 Directing traffic- Demystifying internet-scale load balancing.md @belitex https://linux.cn/article-10299-1.html --- ...recting traffic- Demystifying internet-scale load balancing.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20181026 Directing traffic- Demystifying internet-scale load balancing.md (100%) diff --git a/translated/talk/20181026 Directing traffic- Demystifying internet-scale load balancing.md b/published/20181026 Directing traffic- Demystifying internet-scale load balancing.md similarity index 100% rename from translated/talk/20181026 Directing traffic- Demystifying internet-scale load balancing.md rename to published/20181026 Directing traffic- Demystifying internet-scale load balancing.md From 5d7da6c6c0830f36b39782aaf7c66c65c3925510 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 1 Dec 2018 22:08:52 +0800 Subject: [PATCH 007/135] PRF:20180831 Publishing Markdown to HTML with MDwiki.md @geekpi --- ...0831 Publishing Markdown to HTML with MDwiki.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/translated/tech/20180831 Publishing Markdown to HTML with MDwiki.md b/translated/tech/20180831 Publishing Markdown to HTML with MDwiki.md index 65b3c67c3f..74fc082352 100644 --- a/translated/tech/20180831 Publishing Markdown to HTML with MDwiki.md +++ b/translated/tech/20180831 Publishing Markdown to HTML with MDwiki.md @@ -1,23 +1,24 @@ 使用 MDwiki 将 Markdown 发布成 HTML ====== +> 用这个有用工具从 Markdown 文件创建一个基础的网站。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o) -有很多理由喜欢 Markdown,这是一门简单的语言,有易于学习的语法,它可以与任何文本编辑器一起使用。使用像 [Pandoc][1] 这样的工具,你可以将 Markdown 文本转换为[各种流行格式][2],包括 HTML。你还可以在 Web 服务器中自动执行转换过程。由 TimoDörr 创建的名为 [MDwiki][3]的 HTML5 和 JavaScript 应用可以将一堆 Markdown 文件在浏览器请求它们时转换为网站。MDwiki 网站包含一个操作指南和其他信息可帮助你入门: +有很多理由喜欢 Markdown,这是一门简单的语言,有易于学习的语法,它可以与任何文本编辑器一起使用。使用像 [Pandoc][1] 这样的工具,你可以将 Markdown 文本转换为[各种流行格式][2],包括 HTML。你还可以在 Web 服务器中自动执行转换过程。由 TimoDörr 创建的名为 [MDwiki][3] 的 HTML5 和 JavaScript 应用可以将一堆 Markdown 文件在浏览器请求它们时转换为网站。MDwiki 网站包含一个操作指南和其他信息可帮助你入门: ![MDwiki site getting started][5] -Mdwiki 网站的样子。 +*Mdwiki 网站的样子。* 在 Web 服务器内部,基本的 MDwiki 站点如下所示: ![MDwiki site inside web server][7] -该站点的 web 服务器文件夹的样子 +*该站点的 web 服务器文件夹的样子* 我将此项目的 MDwiki HTML 文件重命名为 `START.HTML`。还有一个处理导航的 Markdown 文件和一个 JSON 文件来保存一些配置设置。其他的都是网站内容。 -虽然整个网站设计被 MDwiki 固定了,但内容、样式和页面数量却没有。你可以在 [MDwiki 站点][8]查看由 MDwiki 生成的一系列不同站点。公平地说,MDwiki 网站缺乏网页设计师可以实现的视觉吸引力 - 但它们是功能性的,用户应该平衡其简单的外观与创建和编辑它们的速度和简易性。 +虽然整个网站设计被 MDwiki 固定了,但内容、样式和页面数量却没有。你可以在 [MDwiki 站点][8]查看由 MDwiki 生成的一系列不同站点。公平地说,MDwiki 网站缺乏网页设计师可以实现的视觉吸引力 —— 但它们是功能性的,用户应该平衡其简单的外观与创建和编辑它们的速度和简易性。 Markdown 有不同的风格,可以针对不同的特定目的扩展稳定的核心功能。MDwiki 使用 GitHub 风格 [Markdown][9],它为流行的编程语言添加了格式化代码块和语法高亮等功能,使其非常适合生成程序文档和教程。 @@ -29,13 +30,14 @@ MDwiki 的默认配色方案并非适用于所有项目,但你可以将其替 ![MDwiki screen with Bootswatch Superhero theme][12] -MDwiki 页面使用 Bootswatch Superhero 主题 +*MDwiki 页面使用 Bootswatch Superhero 主题* MDwiki、Markdown 文件和静态图像可以用于许多目的。但是,你有时可能希望包含 JavaScript 幻灯片或反馈表单。Markdown 文件可以包含 HTML 代码,但将 Markdown 与 HTML 混合会让人感到困惑。一种解决方案是在单独的 HTML 文件中创建所需的功能,并将其显示在带有 iframe 标记的 Markdown 文件中。我从 [Twine Cookbook][13] 知道了这个想法,它是 Twine 交互式小说引擎的支持站点。Twine Cookbook 实际上并没有使用 MDwiki,但结合 Markdown 和 iframe 标签开辟了广泛的创作可能性。 这是一个例子: 此 HTML 将显示由 Markdown 文件中的 Twine 交互式小说引擎创建的 HTML 页面。 + ``` ``` @@ -53,7 +55,7 @@ via: https://opensource.com/article/18/8/markdown-html-publishing 作者:[Peter Cheer][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 216b11c0e80114bb790b513f1c03b34ca0b9d8c4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 1 Dec 2018 22:09:23 +0800 Subject: [PATCH 008/135] PUB:20180831 Publishing Markdown to HTML with MDwiki.md @geekpi https://linux.cn/article-10300-1.html --- .../20180831 Publishing Markdown to HTML with MDwiki.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180831 Publishing Markdown to HTML with MDwiki.md (100%) diff --git a/translated/tech/20180831 Publishing Markdown to HTML with MDwiki.md b/published/20180831 Publishing Markdown to HTML with MDwiki.md similarity index 100% rename from translated/tech/20180831 Publishing Markdown to HTML with MDwiki.md rename to published/20180831 Publishing Markdown to HTML with MDwiki.md From 74a6ff0d45f51bd6db71d00e2035d1aaca3a90db Mon Sep 17 00:00:00 2001 From: oneforalone Date: Sun, 2 Dec 2018 00:41:05 +0800 Subject: [PATCH 009/135] translated by oneforalone --- .../tech/20171111 A CEOs Guide to Emacs.md | 279 ------------------ .../tech/20171111 A CEOs Guide to Emacs.md | 278 +++++++++++++++++ 2 files changed, 278 insertions(+), 279 deletions(-) delete mode 100644 sources/tech/20171111 A CEOs Guide to Emacs.md create mode 100644 translated/tech/20171111 A CEOs Guide to Emacs.md diff --git a/sources/tech/20171111 A CEOs Guide to Emacs.md b/sources/tech/20171111 A CEOs Guide to Emacs.md deleted file mode 100644 index 54b0d30238..0000000000 --- a/sources/tech/20171111 A CEOs Guide to Emacs.md +++ /dev/null @@ -1,279 +0,0 @@ -[#]:translator:(oneforalone) -A CEO's Guide to Emacs -============================================================ - -Years—no, decades—ago, I lived in Emacs. I wrote code and documents, managed email and calendar, and shelled all in the editor/OS. I was quite happy. Years went by and I moved to newer, shinier things. As a result, I forgot how to do tasks as basic as efficiently navigating files without a mouse. About three months ago, noticing just how much of my time was spent switching between applications and computers, I decided to give Emacs another try. It was a good decision for several reasons that will be covered in this post. Covered too are `.emacs` and Dropbox tips so that you can set up a good, movable environment. - -For those who haven't used Emacs, it's something you'll likely hate, but may love. It's sort of a Rube Goldberg machine the size of a house that, at first glance, performs all the functions of a toaster. That hardly sounds like an endorsement, but the key phrase is "at first glance." Once you grok Emacs, you realize that it's a thermonuclear toaster that can also serve as the engine for... well, just about anything you want to do with text. When you think about how much your computing life revolves around text, this is a rather bold statement. Bold, but true. - -Perhaps more importantly to me though, it's the one application I've ever used that makes me feel like I really own it instead of casting me as an anonymous "user" whose wallet is cleverly targeted by product marketing departments in fancy offices somewhere near [Soma][30] or Redmond. Modern productivity and authoring applications (e.g., Pages or IDEs) are like carbon fiber racing bikes. They come kitted out very nicely and fully assembled. Emacs is like a box of classic [Campagnolo][31] parts and a beautiful lugged steel frame that's missing one crank arm and a brake lever that you have to find in some tiny subculture on the Internet. The first one is faster and complete. The second is a source of endless joy or annoyance depending on your personality—and will last until your dying day. I'm the sort of person who feels equal joy at finding an old stash of Campy parts or tweaking my editor with eLisp. YMMV. - -![1933 steel bicycle](https://blog.fugue.co/assets/images/bicycle.jpg) -A 1933 steel bicycle that I still ride. Check out this comparison of frame tubes: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]. - -This may give the impression that Emacs is anachronistic or old-fashioned. It's not. It's powerful and timeless, but demands that you patiently understand it on its terms. The terms are pretty far off the beaten path and seem odd, but there is a logic to them that is both compelling and charming. To me, Emacs feels like the future rather than the past. Just as the lugged steel frame will be useful and comfortable in decades to come and the carbon fiber wunderbike will be in a landfill, having shattered on impact, so will Emacs persist as a useful tool when the latest trendy app is long forgotten. - -If the notion of building your own personal working environment by editing Lisp code and having that fits-like-a-glove environment follow you to any computer is appealing to you, you may really like Emacs. If you like the new and shiny and want to get straight to work without much investment of time and mental cycles, it's likely not for you. I don't write code any more (other than Ludwig and Emacs Lisp), but many of the engineers at Fugue use Emacs to good effect. I'd say our engineers are about 30% Emacs, 40% IDEs, and 30% Vim users. But, this post is about Emacs for CEOs and other [Pointy-Haired Bosses][32] (PHB)[1][7] (and, hey, anyone who’s curious), so I'm going to explain and/or rationalize why I love it and how I use it. I also hope to provide you with enough detail that you can have a successful experience with it, without hours of Googling. - -### Lasting Advantages - -The long-term advantages that come with using Emacs just make life easier. The net gain makes the initial lift entirely worthwhile. Consider these: - -### No More Context Switching - -Org Mode alone is worth investing some serious time in, but if you are like me, you are usually working on a dozen or so documents—from blog posts to lists of what you need to do for a conference to employee reviews. In the modern world of computing, this generally means using several applications, all of which have distracting user interfaces and different ways to store, sort, and search. The result is that you need to constantly switch mental contexts and remember minutiae. I hate context switching because it is an imposition put on me due to a broken interface model[2][8] and I hate having to remember things my computer should remember for me in any rational world. In providing a single environment, Emacs is even more powerful for the PHB than the programmer, since programmers tend to spend a greater percentage of their day in a single application. Switching mental contexts has a higher cost than is often apparent. OS and application vendors have tarted up interfaces to distract us from this reality. If you’re technical, having access to a powerful [language interpreter][33] in a single keyboard shortcut (`M-:`) is especially useful.[3][9] - -Many applications can be full screened all day and used to edit text. Emacs is singular because it is both an editor and a Lisp interpreter. In essence, you have a Turing complete machine a keystroke or two away at all times, while you go about your business. If you know a little or a lot about programming, you'll recognize that this means you can do  _anything_  in Emacs. The full power of your computer is available to you in near real time while you work, once you have the commands in memory. You won't want to re-create Excel in eLisp, but most things you might do in Excel are smaller in scope and easy to accomplish in a line or two of code. If I need to crunch numbers, I'm more likely to jump over to the scratch buffer and write a little code than open a spreadsheet. Even if I have an email to write that isn't a one-liner, I'll usually just write it in Emacs and paste it into my email client. Why context switch when you can just flow? You might start with a simple calculation or two, but, over time, anything you need computed can be added with relative ease to Emacs. This is perhaps unique in applications that also provide rich features for creating things for other humans. Remember those magical terminals in Isaac Asimov's books? Emacs is the closest thing I've encountered to them.[4][10] I no longer decide what app to use for this or that thing. Instead, I just work. There is real power and efficiency to having a great tool and committing to it. - -### Creating Things in Peace and Quiet - -What’s the end result of having the best text editing features I've ever found? Having a community of people making all manner of useful additions? Having the full power of Lisp a keychord away? It’s that I use Emacs for all my creative work, aside from making music or images. - -I have a dual monitor set up at my desk. One of them is in portrait mode with Emacs full screened all day long. The other one has web browsers for researching and reading; it usually has a terminal open as well. I keep my calendar, email, etc., on another desktop in OS X, which is hidden while I'm in Emacs, and I keep all notifications turned off. This allows me to actually concentrate on what I'm doing. I've found eliminating distractions to be almost impossible in the more modern UI applications due to their efforts to be helpful and easy to use. I don't need to be constantly reminded how to do operations I've done tens of thousands of times, but I do need a nice, clean white sheet of paper to be thoughtful. Maybe I'm just bad at living in noisy environments due to age and abuse, but I’d suggest it’s worth a try for anyone. See what it's like to have some actual peace and quiet in your computing environment. Of course, lots of apps now have modes that hide the interface and, thankfully, both Apple and Microsoft now have meaningful full-screen modes. But, no other application is powerful enough to “live in” for most things. Unless you are writing code all day or perhaps working on a very long document like a book, you're still going to face the noise of other apps. Also, most modern applications seem simultaneously patronizing and lacking in functionality and usability.[5][11] The only applications I dislike more than office apps are the online versions. - -![1933 steel bicycle](https://blog.fugue.co/assets/images/desktop.jpg) -My desktop arrangement. Emacs on the left. - -But what about communicating? The difference between creating and communicating is substantial. I'm much more productive at both when I set aside distinct time for each. We use Slack at Fugue, which is both wonderful and hellish. I keep it on a messaging desktop alongside my calendar and email, so that, while I'm actually making things, I'm blissfully unaware of all the chatter in the world. It takes just one Slackstorm or an email from a VC or Board Director to immediately throw me out of my work. But, most things can usually wait an hour or two. - -### Taking Everything with You and Keeping It Forever - -The third reason I find Emacs more advantageous than other environments is that it's easy to take all your stuff with you. By this, I mean that, rather than having a plethora of apps interacting and syncing in their own ways, all you need is one or two directories syncing via Dropbox or the like. Then, you can have all your work follow you anywhere in the environment you have crafted to suit your purposes. I do this across OS X, Windows, and sometimes Linux. It's dead simple and reliable. I've found this capability to be so useful that I dread dealing with Pages, GDocs, Office, or other kinds of files and applications that force me back into finding stuff somewhere on the filesystem or in the cloud. - -The limiting factor in keeping things forever on a computer is file format. Assuming that humans have now solved the problem of storage [6][12] for good, the issue we face over time is whether we can continue to access the information we've created. Text files are the most long-lived format for computing. You easily can open a text file from 1970 in Emacs. That’s not so true for Office applications. Text files are also nice and small—radically smaller than Office application data files. As a digital pack rat and as someone who makes lots of little notes as things pop into my head, having a simple, light, permanent collection of stuff that is always available is important to me. - -If you’re feeling ready to give Emacs a try, read on! The sections that follow don’t take the place of a full tutorial, but will have you operational by the time you finish reading. - -### Learning To Ride Emacs - A Technical Setup - -The price of all this power and mental peace and quiet is that you have a steep learning curve with Emacs and it does everything differently than you're used to. At first, this will make you feel like you’re wasting time on an archaic and strange application that the modern world passed by. It’s a bit like learning to ride a bicycle[7][13]if you've only driven cars. - -### Which Emacs? - -I use the plain vanilla Emacs from GNU for OS X and Windows. You can get the OS X version at [][34][http://emacsformacosx.com/][35] and the Windows version at [][36][http://www.gnu.org/software/emacs/][37]. There are a bunch of other versions out there, especially for the Mac, but I've found the learning curve for doing powerful stuff (which involves Lisp and lots of modes) to be much lower with the real deal. So download it, and we can get started![8][14] - -### First, You'll Need To Learn How To Navigate - -I use the Emacs conventions for keys and combinations in this document. These are 'C' for control, 'M' for meta (which is usually mapped to Alt or Option), and the hyphen for holding down the keys in combination. So `C-h t` means to hold down control and type h, then release control and type t. This is the command for bringing up the tutorial, which you should go ahead and do. - -Don't use the arrow keys or the mouse. They work, but you should give yourself a week of using the native navigation commands in Emacs. Once you have them committed to muscle memory, you'll likely enjoy them and miss them badly everywhere else you go. The Emacs tutorial does a pretty good job of walking you through them, but I'll summarize so you don't need to read the whole thing. The boring stuff is that, instead of arrows, you use `C-b` for back, `C-f` for forward, `C-p` for previous (up), and `C-n` for next (down). You may be thinking "why in the world would I do that, when I have perfectly good arrow keys?" There are several reasons. First, you don't have to move your hands from the typing position, and the forward and back keys used with Alt (or Meta in Emacspeak) navigate a word at a time. This is more handy than is obvious. The third good reason is that, if you want to repeat a command, you can precede it with a number. I often use this when editing documents by estimating how many words I need to go back or lines up or down and doing something like `C-9 C-p` or `M-5 M-b`. The other really important navigation commands are based on `a` for the beginning of a thing and `e` for the end of a thing. Using `C-a|e` are on lines, and using `M-a|e`, are on sentences. For the sentence commands to work properly, you'll need to double space after periods, which simultaneously provides a useful feature and takes a shibboleth of [opinion][38] off the mental table. If you need to export the document to a single space [publication environment][39], you can write a macro in moments to do so. - -It genuinely is worth going through the tutorial that ships with Emacs. I'll cover a few important commands for the truly impatient, but the tutorial is gold. Reminder: `C-h t` for the tutorial. - -### Learn To Copy and Paste - -You can put Emacs into `CUA` mode, which will work in familiar ways, but the native Emacs way is pretty great and plenty easy once you learn it. You mark regions (like selecting) by using Shift with the navigation commands. So `C-F` selects one character forward from the cursor, etc. You copy with `M-w`, you cut with `C-w`, and you paste with `C-y`. These are actually called killing and yanking, but it's very similar to cut and paste. There is magic under the hood here in the kill ring, but for now, just worry about cut, copy, and paste. If you start fumbling around at this point, `C-x u` is undo... - -### Next, Learn Ido Mode - -Trust me. Ido makes working with files much easier. You don't generally use a separate Finder|Explorer window to work with files in Emacs. Instead you use the editor's commands to create, open, and save files. This is a bit of a pain without Ido, so I recommend installing it before learning the other way. Ido comes with Emacs beginning with version 22, but you'll want to make some tweaks to your `.emacs` file so that it is always used. This is a good excuse to get your environment set up. - -Most features in Emacs come in modes. To install any given mode, you'll need to do two things. Well, at first you'll need to do a few extra things, but these only need to be done once, and thereafter only two things. So the extra things are that you'll need a single place to put all your eLisp files and you'll need to tell Emacs where that place is. I suggest you make a single directory in, say, Dropbox that is your Emacs home. Inside this, you'll want to create an `.emacs` file and an `.emacs.d` directory. Inside the `.emacs.d`, make a directory called `lisp`. So you should have: - -``` -home -| -+.emacs -| --.emacs.d - | - -lisp -``` - -You'll put the `.el` files for things like modes into the `home/.emacs.d/lisp`directory, and you'll point to that in your `.emacs` like so: - -`(add-to-list 'load-path "~/.emacs.d/lisp/")` - -Ido Mode comes with Emacs, so you won't need to put an `.el` file into your Lisp directory for this, but you'll be adding other stuff soon that will go in there. - -### Symlinks are Your Friend - -But wait, that says that `.emacs` and `.emacs.d` are in your home directory, and we put them in some dumb folder in Dropbox! Correct. This is how you make it easy to have your environment anywhere you go. Keep everything in Dropbox and make symbolic links to `.emacs`, `.emacs.d`, and your main document directories in `~`. On OS X, this is super easy with the `ln -s` command, but on Windows this is a pain. Fortunately, Emacs provides an easy alternative to symlinking on Windows, the HOME environment variable. Go into Environment Variables in Windows (as of Windows 10, you can just hit the Windows key and type "Environment Variables" to find this with search, which is the best part of Windows 10), and make a HOME environment variable in your account that points to the Dropbox folder you made for Emacs. If you want to make it easy to navigate to local files that aren't in Dropbox, you may instead want to make a symbolic link to the Dropbox Emacs home in your actual home directory. - -So now you've done all the jiggery-pokery needed to get any machine pointed to your Emacs setup and files. If you get a new computer or use someone else's for an hour or a day, you get your entire work environment. This seems a little difficult the first time you do it, but it's about a ten minute (at most) operation once you know what you're doing. - -But we were configuring Ido... - -`C-x` `C-f` and type `~/.emacs RET RET` to create your `.emacs` file. Add these lines to it: - -``` -;; set up ido mode -(require `ido) -(setq ido-enable-flex-matching t) -(setq ido-everywhere t) -(ido-mode 1) -``` - -With the `.emacs` buffer open, do an `M-x evaluate-buffer` command, and you'll either get an error if you munged something or you'll get Ido. Ido changes how the minibuffer works when doing file operations. There is great documentation on it, but I'll point out a few tips. Use the `~/` effectively; you can just type `~/` at any point in the minibuffer and it'll jump back to home. Implicit in this is that you should have most of your stuff a short hop off your home. I use `~/org` for all my non-code stuff and `~/code` for code. Once you’re in the right directory, you'll often have a collection of files with different extensions, especially if you use Org Mode and publish from it. You can type period and the extension you want no matter where you are in the file name and Ido will limit the choices to files with that extension. For example, I'm writing this blog post in Org Mode, so the main file is: - -`~/org/blog/emacs.org` - -I also occasionally push it out to HTML using Org Mode publishing, so I've got an `emacs.html` file in the same directory. When I want to open the Org file, I will type: - -`C-x C-f ~/o[RET]/bl[RET].or[RET]` - -The [RET]s are me hitting return for auto completion for Ido Mode. So, that’s 12 characters typed and, if you're used to it, a  _lot_  less time than opening Finder|Explorer and clicking around. Ido Mode is plenty useful, but really is a utility mode for operating Emacs. Let's explore some modes that are useful for getting work done. - -### Fonts and Styles - -I recommend getting the excellent input family of typefaces for use in Emacs. They are customizable with different braces, zeroes, and other characters. You can build in extra line spacing into the font files themselves. I recommend a 1.5X line spacing and using their excellent proportional fonts for code and data. I use Input Serif for my writing, which has a funky but modern feel. You can find them on [http://input.fontbureau.com/][40] where you can customize to your preferences. You can manually set the fonts using menus in Emacs, but this puts code into your `.emacs`file and, if you use multiple devices, you may find you want some different settings. I've set up my `.emacs` to look for the machine I'm using by name and configure the screen appropriately. The code for this is: - -``` -;; set up fonts for different OSes. OSX toggles to full screen. -(setq myfont "InputSerif") -(cond -((string-equal system-name "Sampo.local") - (set-face-attribute 'default nil :font myfont :height 144) - (toggle-frame-fullscreen)) -((string-equal system-name "Morpheus.local") - (set-face-attribute 'default nil :font myfont :height 144)) -((string-equal system-name "ILMARINEN") - (set-face-attribute 'default nil :font myfont :height 106)) -((string-equal system-name "UKKO") - (set-face-attribute 'default nil :font myfont :height 104))) -``` - -You should replace the `system-name` values with what you get when you evaluate `(system-name)` in your copy of Emacs. Note that on Sampo (my MacBook), I also set Emacs to full screen. I'd like to do this on Windows as well, but Windows and Emacs don't really love each other and it always ends up in some wonky state when I try this. Instead, I just fullscreen it manually after launch. - -I also recommend getting rid of the awful toolbar that Emacs got sometime in the 90s when the cool thing to do was to have toolbars in your application. I also got rid of some other "chrome" so that I have a simple, productive interface. Add these to your `.emacs` file to get rid of the toolbar and scroll bars, but to keep your menu available (on OS X, it'll be hidden unless you mouse to the top of the screen anyway): - -``` -(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) -(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) -(if (fboundp 'menu-bar-mode) (menu-bar-mode 1)) -``` - -### Org Mode - -I pretty much live in Org Mode. It is my go-to environment for authoring documents, keeping notes, making to-do lists and 90% of everything else I do. Org was originally conceived as a combination note-taking and to-do list utility by a fellow who is a laptop-in-meetings sort. I am against use of laptops in meetings and don't do it myself, so my use cases are a little different than his. For me, Org is primarily a way to handle all manner of content within a structure. There are heads and subheads, etc., in Org Mode, and they function like an outline. Org allows you to expand or hide the contents of the tree and also to rearrange the tree. This fits how I think very nicely and I find it to be just a pleasure to use in this way. - -Org Mode also has a lot of little things that make life pleasant. For example, the footnote handling is excellent and the LaTeX/PDF output is great. Org has the ability to generate agendas based on the to-do's in all your documents and a nice way to relate them to dates/times. I don't use this for any sort of external commitments, which are handled on a shared calendar, but for creating things and keeping track of what I need to create in the future, it's invaluable. Installing it is as easy as adding the `org-mode.el` to your Lisp directory and adding these lines to your `.emacs`, if you want it to indent based on tree location and to open documents fully expanded: - -``` -;; set up org mode -(setq org-startup-indented t) -(setq org-startup-folded "showall") -(setq org-directory "~/org") -``` - -The last line is there so that Org knows where to look for files to include in agendas and some other things. I keep Org right in my home directory, i.e., a symlink to the directory that lives in Dropbox, as described earlier. - -I have a `stuff.org` file that is always open in a buffer. I use it like a notepad. Org makes it easy to extract things like TODOs and stuff with deadlines. It's especially useful when you can inline Lisp code and evaluate it whenever you need. Having code with content is super handy. Again, you have access to the actual computer with Emacs, and this is a liberation. - -#### Publishing with Org Mode - -I care about the appearance and formatting of my documents. I started my career as a designer, and I think information can and should be presented clearly and beautifully. Org has great support for generating PDFs via LaTeX, which has a bit of its own learning curve, but doing simple things is pretty easy. - -If you want to use fonts and styles other than the typical LaTeX ones, you've got a few things to do. First, you'll want XeLaTeX so you can use normal system fonts rather than LaTeX specific fonts. Next, you'll want to add this to `.emacs`: - -``` -(setq org-latex-pdf-process - '("xelatex -interaction nonstopmode %f" - "xelatex -interaction nonstopmode %f")) -``` - -I put this right at the end of my Org section of `.emacs` to keep things tidy. This will allow you to use more formatting options when publishing from Org. For example, I often use: - -``` -#+LaTeX_HEADER: \usepackage{fontspec} -#+LATEX_HEADER: \setmonofont[Scale=0.9]{Input Mono} -#+LATEX_HEADER: \setromanfont{Maison Neue} -#+LATEX_HEADER: \linespread{1.5} -#+LATEX_HEADER: \usepackage[margin=1.25in]{geometry} - -#+TITLE: Document Title Here -``` - -These simply go somewhere in your `.org` file. Our corporate font for body copy is Maison Neue, but you can put whatever is appropriate here. I strongly discourage the use of Maison Neue. It’s a terrible font and no one should ever use it. - -This file is an example of PDF output using these settings. This is what out-of-the-box LaTeX always looks like. It's fine I suppose, but the fonts are boring and a little odd. Also, if you use the standard format, people will assume they are reading something that is or pretends to be an academic paper. You've been warned. - -### Ace Jump Mode - -This is more of a gem than a major feature, but you want it. It works a bit like Jef Raskin's Leap feature from days gone by.[9][15] The way it works is you type `C-c` `C-SPC`and then type the first letter of the word you want to jump to. It highlights all occurrences of words with that initial character, replacing it with a letter of the alphabet. You simply type the letter of the alphabet for the location you want and your cursor jumps to it. I find myself using this as often as the more typical nav keys or search. Download the `.el` to your Lisp directory and put this in your `.emacs`: - -``` -;; set up ace-jump-mode -(add-to-list 'load-path "which-folder-ace-jump-mode-file-in/") -(require 'ace-jump-mode) -(define-key global-map (kbd "C-c C-SPC" ) 'ace-jump-mode) -``` - -### More Later - -That's enough for one post—this may get you somewhere you'd like to be. I'd love to hear about your uses for Emacs aside from programming (or for programming!) and whether this was useful at all. There are likely some boneheaded PHBisms in how I use Emacs, and if you want to point them out, I'd appreciate it. I'll probably write some updates over time to introduce additional features or modes. I'll certainly show you how to use Fugue with Emacs and Ludwig-mode as we evolve it into something more useful than code highlighting. Send your thoughts to [@fugueHQ][41] on Twitter. - -* * * - -#### Footnotes - -1. [^][16] If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. - -2. [^][17] [][18][http://archive.wired.com/wired/archive/2.08/tufte.html][19] - -3. [^][20] I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. - -4. [^][21] The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. - -5. [^][22] Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. - -6. [^][23] AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. - -7. [^][24] By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. - -8. [^][25] This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. - -9. [^][26] Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] - --------------------------------------------------------------------------------- - -via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html - -作者:[Josh Stella ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://blog.fugue.co/authors/josh.html -[1]:https://blog.fugue.co/2013-10-16-vpc-on-aws-part3.html -[2]:https://blog.fugue.co/2013-10-02-vpc-on-aws-part2.html -[3]:http://ww2.fugue.co/2017-05-25_OS_AR_GartnerCoolVendor2017_01-LP-Registration.html -[4]:https://blog.fugue.co/authors/josh.html -[5]:https://twitter.com/joshstella -[6]:https://www.youtube.com/watch?v=khJQgRLKMU0 -[7]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#phb -[8]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#tufte -[9]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#interpreter -[10]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#eww -[11]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#usability -[12]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#s3 -[13]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#bicycles -[14]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#nottutorial -[15]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#canoncat -[16]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#phbOrigin -[17]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#tufteOrigin -[18]:http://archive.wired.com/wired/archive/2.08/tufte.html -[19]:http://archive.wired.com/wired/archive/2.08/tufte.html -[20]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#interpreterOrigin -[21]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#ewwOrigin -[22]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#usabilityOrigin -[23]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#s3Origin -[24]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#bicyclesOrigin -[25]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#nottutorialOrigin -[26]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#canoncatOrigin -[27]:https://youtu.be/o_TlE_U_X3c?t=19s -[28]:https://youtu.be/o_TlE_U_X3c?t=19s -[29]:https://blog.fugue.co/authors/josh.html -[30]:http://www.huffingtonpost.com/zachary-ehren/soma-isnt-a-drug-san-fran_b_987841.html -[31]:http://www.campagnolo.com/US/en -[32]:http://www.businessinsider.com/best-pointy-haired-boss-moments-from-dilbert-2013-10 -[33]:http://www.webopedia.com/TERM/I/interpreter.html -[34]:http://emacsformacosx.com/ -[35]:http://emacsformacosx.com/ -[36]:http://www.gnu.org/software/emacs/ -[37]:http://www.gnu.org/software/emacs/ -[38]:http://www.huffingtonpost.com/2015/05/29/two-spaces-after-period-debate_n_7455660.html -[39]:http://practicaltypography.com/one-space-between-sentences.html -[40]:http://input.fontbureau.com/ -[41]:https://twitter.com/fugueHQ diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md new file mode 100644 index 0000000000..5b25f37313 --- /dev/null +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -0,0 +1,278 @@ +一位 CEO 的 Emacs 指南 +============================================================ + +几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器或者是说操作系统,而且我还乐此不疲。多年过去了,我也转向了其他更新,更好的工具。结果,我已经忘了如何在不用鼠标的情况下来浏览文件。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是就决定再试一次 Emacs。这是个很正确的决定,原因有以下几个。其中包括了 `.emacs` 和 Dropbox 的技巧,可以让你建立一个良好的,可移植的环境。 + +对于那先还没用过 Emacs 的人来说,你可能会讨厌它,但也可能喜欢上它。它有点像一个房子大小的 Rube Goldberg 机器,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键短语是“乍一看”。一旦你了解了Emacs,你就会意识到它其实是一种可以作为发动机的热核烤面包机。好吧,你想对文字做什么都可以。当考虑到计算寿命在很大程度上与文本有关时,这是一个相当大胆的声明,真的很大胆。 + +也许对我来说更重要的是,它是我曾经使用过的一个应用程序,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30] 或 Redmond 附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如文件或 `IDE`)就像碳纤维赛车,他们装备得很好,也很完整。而Emacs 就像一盒经典的 [Campagnolo][31] 零件和一个漂亮的拖钢框架,缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。第二点就是它会给你带来无尽的快乐或烦恼,这取决于你自己,而且会一直持续到你生命的最后一天。我是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时同样感到高兴的人,具体情况因人而异。 + +![1933 steel bicycle](https://blog.fugue.co/assets/images/bicycle.jpg) +一辆我还在骑的1933年产的钢制自行车。你可以从查看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]. + +这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。他的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这。 + +如果通过编辑 `Lisp` 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 `Ludwig` 和 `Emacs Lisp`),但是 `Fugue` 的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs, 40% 用 `IDE` 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32](PHB[1][7])的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 + +### 最后的优点 + +使用 Emacs 带来的长期优势是让生活更轻松。与最后的收获相比,最开始的付出完全值得。想想这些: + +### 无需上下文切换 + +`Org` 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议需要做什么的清单,再到员工评论。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些应用程序都有不同的用户界面,保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住细节。我讨厌上下文切换,因为它是一种强加到我身上的方式,原因是破坏了接口模型[2][8],并且我讨厌记住计算机的命令,这本该是计算机要记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更有用,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比通常看起来的要高。操作系统和应用程序供应商已经构建了各种接口,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[3][9]。 + +许多应用程序可以全天全屏并用于编辑文本。Emacs 是惟一的,因为它既是编辑器也是 `Emacs Lisp` 解释器。从本质上说,你工作时只要用电脑上的一两个键就能完成。如果你对编程略知一二,就能发现这一位置你可以在 Emacs 中做 _任何事情_。一旦你在内存中有了这些命令,你的电脑就可以在你工作时几乎实时地为你提供高效的运转。你不会想用 `Emacs Lisp` 来重建 Excel,只要用简单的一两行代码就能实现 Excel 中大多数的功能。如果我需要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是我有一封多行的邮件要写,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的计算开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得 Isaac Asimov 书中那些神奇的终端吗[4][10]? Emacs 是我所遇到的最接近他们的东西。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 + +### 在安静中创造事情 + +拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?拥有 `Lisp` 键盘的全部功能?这就是我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 + +我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等保存在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序努力提供帮助并使其易于使用。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[5][11]。比其 office 应用程序,我更讨厌在线版的应用程序。 + +![1933 steel bicycle](https://blog.fugue.co/assets/images/desktop.jpg) +我的桌面布局, Emacs 在左边 + +但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间时,我的效率会更高。在 `Fugue` 中使用了 `Slack`,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。仅仅是风投或董事会董事的一次懈怠,或一封电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 + +### 带上一切,并保留着 + +第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 `Dropbox` 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何地方,任何环境下工作了,因为你已经精心制作了适合目的套件了。我在 OS X,Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理页面、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 + +永久存储在计算机上的限制是文件格式。假设人类已经解决了存储[6][12]的问题,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最持久的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于办公应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 + +如果你准备尝试 Emacs,请继续阅读!下面的部分不会取代完整的教程,但是在完成阅读时,就可以操作了。 + +### 学会驾驭 Emacs —— 一个专业的配置 + +所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像现代世界已经过去了。这有点像你只开过车,却要你去学骑自行车[7][13]。 + +### 该选哪个 Emacs + +我用的是 GNU 中 OS X 和 Windows 的通用版本的 Emacs。你可以在 [][34][http://emacsformacos.com/][35] 获取 OS X 版本,在[][36][http://www.gnu.org/software/emacs/][37]获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(包括 `Lisp` 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[8][14]! + +### 首先,学会浏览 + +在本文中,我将约定 Emacs 中的键和组合。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组快捷键会指向一个教程,这是你首先要做的一件事。 + +不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以您不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后移动一个单词。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向前多少个单词或向上或线下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其他真正重要的浏览命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中的[希伯列][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 + +Emacs 附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 + +### 学会复制和粘贴 + +你可以叫 Emacs 设为 `CUA` 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 这样的浏览命令来标记区域(如选择)。所以 `C-F` 是选中管标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除和召回,但它非常类似于剪切和粘贴。在删除的环中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你在这开始摸索, `C-x u` 是撤销。 + +### 下一步,学会用 `Ido` 模式 + +相信我,`Ido` 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独分开的查找或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 `Ido` 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 `Ido` 是 Emacs 的 22 版时开发出来的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 + +Emacs 中的大多数功能都表现在模式上。要安装制定的模式,需要做两件事。嗯,一开始你需要做一些额外的事情,但这些只需要做一次,然后再做这两件事。那么,额外的事情是你需要一个单独的位置来放置所有 `Emacs Lisp` 文件,并且你需要告诉 Emacs 这个位置在哪。我建议你在 Dropbox 上创建一个单独的目录,那是你 Emacs 主目录。在这里,你需要创建一个 `.emacs` 文件和 `.emacs.d` 目录。在 `.emacs.d` 目录下,创建一个 `lisp` 的目录。就像这样: + +``` +home +| ++.emacs +| +-.emacs.d + | + -lisp +``` + +你可以将那些像模式的 `.el` 文件放到 `home/.emacs.d/lis` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: + +`(add-to-list 'load-path "~/.emacs.d/lisp/")` + +`Ido` 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. + +### 符号链接是你的好伙伴 + +等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把他们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并链接到 `.emacs` 和 `.emacs.d`,以及主目录 `~`。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的一部分了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件家的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 + +至此,你已经完成了在任意机器上指向 Emacs 配置和配置文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就得到了你的整个工作环境。第一次做这个似乎有点困难,但是一旦你知道你在做什么,就只需要10分钟(最多)。 + +但我们现在是在配置 `Ido`…… + +按下 `C-x` `C-f` 然后输入 `~/.emacs RET RET` 来创建 `.emacs` 文件,将下面几行添加进去: + +``` +;; set up ido mode +(require `ido) +(setq ido-enable-flex-matching t) +(setq ido-everywhere t) +(ido-mode 1) +``` + +在 `.emacs` 窗口开着的时候,执行 `M-x evaluate-buffer` 命令。如果某处弄错了的话,将得到一个错误,或者你将得到 `Ido`。`Ido` 改变了在 `minibuffer` 中操作文件操方式。有一篇比较好的文档,但是我也会指出一些技巧。有效地使用 `~/`;你可以在 `minibuffer` 的任何地方输入 `~/`,它就会跳转到主目录。这就意味着,你应该让你的大部分东西就近的放在主目录下。我用 `~/org` 目录来保存所有非代码的东西,用 `~/code` 保存代码。一旦你进入到正确的目录,通常会拥有一组具有不同扩展名的文件,特别是当你使用 `Org` 模式并从中发布的话。你可以输入 `period` 和想要的扩展名,无论你的在文件名的什么位置,`Ido` 都会将选择限制在具有该扩展名的文件中。例如,我在 `Org` 模式下写这篇博客,所以该文件是: + +`~/org/blog/emacs.org` + +我偶尔也会用 `Org` 模式发布成 HTML 格式,所以我将在同一目录下得到 `emacs.html` 文件。当我想打开 `Org` 文件时,我会输入: + +`C-x C-f ~/o[RET]/bl[RET].or[RET]` + +其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开查找或文件资源管理器再用鼠标点要节省 _很_ 多时间。 `Ido` 模式很有用, 这真的是操作 Emacs 的一种实用的模式。下面让我们去探索一些其他对完成工作很有帮助的模式吧。 + +### 字体及风格 + +我推荐在 Emacs 中使用很棒的字体系列。它们可以使用不同的括号、0和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1\.5 倍的行间距,并在代码和数据中使用它们适应比例的字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我我将我的 `.emacs` 设置位根据使用的机器的名称,并配置适当的屏幕机字体。代码如下: + +``` +;; set up fonts for different OSes. OSX toggles to full screen. +(setq myfont "InputSerif") +(cond +((string-equal system-name "Sampo.local") + (set-face-attribute 'default nil :font myfont :height 144) + (toggle-frame-fullscreen)) +((string-equal system-name "Morpheus.local") + (set-face-attribute 'default nil :font myfont :height 144)) +((string-equal system-name "ILMARINEN") + (set-face-attribute 'default nil :font myfont :height 106)) +((string-equal system-name "UKKO") + (set-face-attribute 'default nil :font myfont :height 104))) +``` + +您应该将你的 Emacs 副本中 `system-name` 的值替换成你使用命令 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个,但是 Windows 和 Emacs 并不真正喜欢对方,当我尝试这个时,它总是不稳定。相反,我只是在启动后手动全屏。 + +我还建议去掉 Emacs 中在 90 年代获得的难看的工具栏,当时最酷的事情是在应用程序中使用工具栏。我还去掉了一些其他的 `chrome`,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中,来去掉工具栏和滚动条,但要保留菜单 (在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): + +``` +(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) +(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) +(if (fboundp 'menu-bar-mode) (menu-bar-mode 1)) +``` + +### Org 模式 + +我基本上 `Org` 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。`Org` 最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,`Org` 主要是一种处理结构中内容的方式。在 `Org` 模式中有标题和副标题等,它们的作用就像一个大纲。`Org` 允许你展开或隐藏文本内容,还可以重新排列文本。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 + +`Org` 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,`LaTeX/PDF` 输出也很好。`Org` 能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下,然后再在你的 `.emacs` 文件中添加如下代码,如果你想要它基于文档的结构进行缩进并在打开时全部展开的话: + +``` +;; set up org mode +(setq org-startup-indented t) +(setq org-startup-folded "showall") +(setq org-directory "~/org") +``` + +最后一行是让 `Org` 知道在哪里查找要包含在议程和其他事情中的文件。我把 `Org` 保存在我的主目录中,也就是说,像前面介绍的一样,它是 Dropbox 目录的一个符号链接。 + +我有一个总是在缓冲区中打开的 `stuff.org` 文件。我把它当作记事本。`Org` 使得提取待办事项和有期限的事情变得很容易。当你在内联 `Lisp` 代码并在需要计算它时,它特别有用。拥有包含内容的代码非常方便。同样,你可以使用 Emacs 访问实际的计算机,这是一种解放。 + +#### 用 `Org` 模式进行发布 + +我关心的是文档的外观和格式。我我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。`Org` 对将 `LaTeX` 生成 PDF 支持的很好, `LaTeX` 有自己的学习曲线,但是做简单的事情非常简单。 + +如果你想使用字体和样式,而不是典型的 `LaTeX` 字体和样式,你需要做些事。首先,你要用到 `XeLaTeX`,这样就可以使用普通的系统字体,而不是 `LaTeX` 的特殊字体。接下来,您需要将一下代码添加到 `.emacs` 中: + +``` +(setq org-latex-pdf-process + '("xelatex -interaction nonstopmode %f" + "xelatex -interaction nonstopmode %f")) +``` + +我把这个放在 `.emacs` 中 `Org` 配置部分的末尾来保持整洁。这让你在从 `Org` 发布时使用更多格式化选项。例如,我经常使用: + +``` +#+LaTeX_HEADER: \usepackage{fontspec} +#+LATEX_HEADER: \setmonofont[Scale=0.9]{Input Mono} +#+LATEX_HEADER: \setromanfont{Maison Neue} +#+LATEX_HEADER: \linespread{1.5} +#+LATEX_HEADER: \usepackage[margin=1.25in]{geometry} + +#+TITLE: Document Title Here +``` + +这些都可以在你的 `.org` 文件中找到。我们的公司规定的正文字体是 `Maison Neue`,但你也可以在这写上任何适当的东西。我强烈反对使用 `Maison Neue`。它是一种糟糕的字体,任何人都不应该使用它。 + +这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 `LaTeX` 一样。在我看来这还不错,但是字体很无聊,而且有点奇怪。此外,如果你使用标准格式,人们会认为他们正在阅读的东西是或假装是一篇学术论文。别怪我没提醒你。 + +### `Ace Jump` 模式 + +如果你想使用的话,这是个辅助而不是主要功能。它的工作原理有点像 Jef Raskin 的 `Leap` 功能[9][15]。 按下 `C-c` `C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `Lisp` 目录下,并在 `.emacs` 文件添加如下代码: + +``` +;; set up ace-jump-mode +(add-to-list 'load-path "which-folder-ace-jump-mode-file-in/") +(require 'ace-jump-mode) +(define-key global-map (kbd "C-c C-SPC" ) 'ace-jump-mode) +``` + +### 更多 + +这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除编程(或编程)之外你对 Emacs 的使用,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来引入其他特性或模式。我很确定我将会向你展示如何在 Emacs 和 `Ludwig` 模式下使用 `Fugue`,因为我会将它发展成比代码突出显示更有用的东西。把你的想法发到 [@fugueHQ][41] 上。 + +* * * + +#### 附注 + +1. [^][16] If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. + +2. [^][17] [][18][http://archive.wired.com/wired/archive/2.08/tufte.html][19] + +3. [^][20] I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. + +4. [^][21] The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. + +5. [^][22] Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. + +6. [^][23] AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. + +7. [^][24] By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. + +8. [^][25] This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. + +9. [^][26] Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] + +-------------------------------------------------------------------------------- + +via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html + +作者:[Josh Stella ][a] +译者:[oneforalone](https://github.com/oneforalone) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://blog.fugue.co/authors/josh.html +[1]:https://blog.fugue.co/2013-10-16-vpc-on-aws-part3.html +[2]:https://blog.fugue.co/2013-10-02-vpc-on-aws-part2.html +[3]:http://ww2.fugue.co/2017-05-25_OS_AR_GartnerCoolVendor2017_01-LP-Registration.html +[4]:https://blog.fugue.co/authors/josh.html +[5]:https://twitter.com/joshstella +[6]:https://www.youtube.com/watch?v=khJQgRLKMU0 +[7]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#phb +[8]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#tufte +[9]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#interpreter +[10]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#eww +[11]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#usability +[12]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#s3 +[13]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#bicycles +[14]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#nottutorial +[15]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#canoncat +[16]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#phbOrigin +[17]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#tufteOrigin +[18]:http://archive.wired.com/wired/archive/2.08/tufte.html +[19]:http://archive.wired.com/wired/archive/2.08/tufte.html +[20]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#interpreterOrigin +[21]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#ewwOrigin +[22]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#usabilityOrigin +[23]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#s3Origin +[24]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#bicyclesOrigin +[25]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#nottutorialOrigin +[26]:https://blog.fugue.co/2015-11-11-guide-to-emacs.html?utm_source=wanqu.co&utm_campaign=Wanqu+Daily&utm_medium=website#canoncatOrigin +[27]:https://youtu.be/o_TlE_U_X3c?t=19s +[28]:https://youtu.be/o_TlE_U_X3c?t=19s +[29]:https://blog.fugue.co/authors/josh.html +[30]:http://www.huffingtonpost.com/zachary-ehren/soma-isnt-a-drug-san-fran_b_987841.html +[31]:http://www.campagnolo.com/US/en +[32]:http://www.businessinsider.com/best-pointy-haired-boss-moments-from-dilbert-2013-10 +[33]:http://www.webopedia.com/TERM/I/interpreter.html +[34]:http://emacsformacosx.com/ +[35]:http://emacsformacosx.com/ +[36]:http://www.gnu.org/software/emacs/ +[37]:http://www.gnu.org/software/emacs/ +[38]:http://www.huffingtonpost.com/2015/05/29/two-spaces-after-period-debate_n_7455660.html +[39]:http://practicaltypography.com/one-space-between-sentences.html +[40]:http://input.fontbureau.com/ +[41]:https://twitter.com/fugueHQ From a9d660005ed8f4ae3bae397e80667538695b9fdc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 2 Dec 2018 09:38:03 +0800 Subject: [PATCH 010/135] PRF:20180806 Systemd Timers- Three Use Cases.md @StdioA --- ...0180806 Systemd Timers- Three Use Cases.md | 70 ++++++++++--------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/translated/tech/20180806 Systemd Timers- Three Use Cases.md b/translated/tech/20180806 Systemd Timers- Three Use Cases.md index 01564d1034..50ae0c0a09 100644 --- a/translated/tech/20180806 Systemd Timers- Three Use Cases.md +++ b/translated/tech/20180806 Systemd Timers- Three Use Cases.md @@ -1,13 +1,16 @@ -Systemd 定时器: 三种使用场景 +Systemd 定时器:三种使用场景 ====== +> 继续 systemd 教程,这些特殊的例子可以展示给你如何更好的利用 systemd 定时器单元。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/timer-analogue-1078057.jpg?itok=IKS4TrkE) -在这个 systemd 系列教程中,我们[已经在某种程度上讨论了 systemd 定时器单元][1]。不过,在我们开始讨论 socket 之前,我们先来看三个例子,这些例子展示了如何最佳化利用这些单元。 +在这个 systemd 系列教程中,我们[已经在某种程度上讨论了 systemd 定时器单元][1]。不过,在我们开始讨论 sockets 之前,我们先来看三个例子,这些例子展示了如何最佳化利用这些单元。 -### 简单的类 _cron_ 行为 +### 简单的类 cron 行为 + +我每周都要去收集 [Debian popcon 数据][2],如果每次都能在同一时间收集更好,这样我就能看到某些应用程序的下载趋势。这是一个可以使用 cron 任务来完成的典型事例,但 systemd 定时器同样能做到: -我每周都要去收集 [Debian popcon 数据][2],如果每次都能在同一时间收集更好,这样我就能看到某些应用程序的下载趋势。这是一个可以使用 _cron_ 任务来完成的典型事例,但 systemd 定时器同样能做到: ``` # 类 cron 的 popcon.timer @@ -20,14 +23,14 @@ Unit= popcon.service [Install] WantedBy= basic.target - ``` -实际的 _popcon.service_ 会执行一个常规的 _wget_ 任务,并没有什么特别之处。这里的新内容是 `OnCalendar=` 指令。这个指令可以让你在一个特定日期的特定时刻来运行某个服务。在这个例子中,`Thu` 表示“_在周四运行_”,`*-*-*` 表示“_具体年份、月份和日期无关紧要_”,这些可以翻译成“不管年月日,只在每周四运行”。 +实际的 `popcon.service` 会执行一个常规的 `wget` 任务,并没有什么特别之处。这里的新内容是 `OnCalendar=` 指令。这个指令可以让你在一个特定日期的特定时刻来运行某个服务。在这个例子中,`Thu` 表示 “在周四运行”,`*-*-*` 表示“具体年份、月份和日期无关紧要”,这些可以翻译成 “不管年月日,只在每周四运行”。 这样,你就设置了这个服务的运行时间。我选择在欧洲中部夏令时区的上午 5:30 左右运行,那个时候服务器不是很忙。 -如果你的服务器关闭了,而且刚好错过了每周的截止时间,你还可以在同一个计时器中使用像 _anacron_ 一样的功能。 +如果你的服务器关闭了,而且刚好错过了每周的截止时间,你还可以在同一个计时器中使用像 anacron 一样的功能。 + ``` # 具备类似 anacron 功能的 popcon.timer @@ -41,26 +44,26 @@ Persistent=true [Install] WantedBy=basic.target - ``` -当你将 `Persistent=` 指令设为真值时,它会告诉 systemd,如果服务器在本该它运行的时候关闭了,那么在启动后就要立刻运行服务。这意味着,如果机器在周四凌晨停机了(比如说维护),一旦它再次启动后,_popcon.service_ 将会立刻执行。在这之后,它的运行时间将会回到例行性的每周四早上 5:32. +当你将 `Persistent=` 指令设为真值时,它会告诉 systemd,如果服务器在本该它运行的时候关闭了,那么在启动后就要立刻运行服务。这意味着,如果机器在周四凌晨停机了(比如说维护),一旦它再次启动后,`popcon.service` 将会立刻执行。在这之后,它的运行时间将会回到例行性的每周四早上 5:32. -到目前为止,就是这么直白。 +到目前为止,就是这么简单直白。 ### 延迟执行 但是,我们提升一个档次,来“改进”这个[基于 systemd 的监控系统][3]。你应该记得,当你接入摄像头的时候,系统就会开始拍照。假设你并不希望它在你安装摄像头的时候拍下你的脸。你希望将拍照服务的启动时间向后推迟一两分钟,这样你就有时间接入摄像头,然后走到画框外面。 为了完成这件事,首先你要更改 Udev 规则,将它指向一个定时器: -``` -ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", -ATTRS{idProduct}=="e207", TAG+="systemd", ENV{SYSTEMD_WANTS}="picchanged.timer", -SYMLINK+="mywebcam", MODE="0666" +``` +ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", +ATTRS{idProduct}=="e207", TAG+="systemd", ENV{SYSTEMD_WANTS}="picchanged.timer", +SYMLINK+="mywebcam", MODE="0666" ``` 这个定时器看起来像这样: + ``` # picchanged.timer @@ -73,10 +76,9 @@ Unit= picchanged.path [Install] WantedBy= basic.target - ``` -在你接入摄像头后,Udev 规则被触发,它会调用定时器。这个定时器启动后会等上一分钟(`OnActiveSec= 1 m`),然后运行 _picchanged.path_,它会[监视主图片的变化][4]。_picchanged.path_ 还会负责接触 _webcan.service_,这个实际用来拍照的服务。 +在你接入摄像头后,Udev 规则被触发,它会调用定时器。这个定时器启动后会等上一分钟(`OnActiveSec= 1 m`),然后运行 `picchanged.path`,它会[监视主图片的变化][4]。`picchanged.path` 还会负责接触 `webcan.service`,这个实际用来拍照的服务。 ### 在每天的特定时刻启停 Minetest 服务器 @@ -85,6 +87,7 @@ WantedBy= basic.target 你有个为你的孩子设置的 Minetest 服务。不过,你还想要假装关心一下他们的教育和成长,要让他们做作业和家务活。所以你要确保 Minetest 只在每天晚上的一段时间内可用,比如五点到七点。 这个跟之前的“_在特定时间启动服务_”不太一样。写个定时器在下午五点启动服务很简单…: + ``` # minetest.timer @@ -97,12 +100,12 @@ Unit= minetest.service [Install] WantedBy= basic.target - ``` …可是编写一个对应的定时器,让它在特定时刻关闭服务,则需要更大剂量的横向思维。 我们从最明显的东西开始 —— 设置定时器: + ``` # stopminetest.timer @@ -115,16 +118,16 @@ Unit= stopminetest.service [Install] WantedBy= basic.target - ``` -这里棘手的部分是如何去告诉 _stopminetest.service_ 去 —— 你知道的 —— 停止 Minetest. 我们无法从 _minetest.service_ 中传递 Minetest 服务器的 PID. 而且 systemd 的单元词汇表中也没有明显的命令来停止或禁用正在运行的服务。 +这里棘手的部分是如何去告诉 `stopminetest.service` 去 —— 你知道的 —— 停止 Minetest. 我们无法从 `minetest.service` 中传递 Minetest 服务器的 PID. 而且 systemd 的单元词汇表中也没有明显的命令来停止或禁用正在运行的服务。 -我们的诀窍是使用 systemd 的 `Conflicts=` 指令。它和 systemd 的 `Wants=` 指令类似,不过它所做的事情_正相反_。如果你有一个 _b.service_ 单元,其中包含一个 `Wants=a.service` 指令,在这个单元启动时,如果 _a.service_ 没有运行,则 _b.service_ 会运行它。同样,如果你的 _b.service_ 单元中有一行写着 `Conflicts= a.service`,那么在 _b.service_ 启动时,systemd 会停止 _a.service_. +我们的诀窍是使用 systemd 的 `Conflicts=` 指令。它和 systemd 的 `Wants=` 指令类似,不过它所做的事情_正相反_。如果你有一个 `b.service` 单元,其中包含一个 `Wants=a.service` 指令,在这个单元启动时,如果 `a.service` 没有运行,则 `b.service` 会运行它。同样,如果你的 `b.service` 单元中有一行写着 `Conflicts= a.service`,那么在 `b.service` 启动时,systemd 会停止 `a.service`. 这种机制用于两个服务在尝试同时控制同一资源时会发生冲突的场景,例如当两个服务要同时访问打印机的时候。通过在首选服务中设置 `Conflicts=`,你就可以确保它会覆盖掉最不重要的服务。 -不过,你会在一个稍微不同的场景中来使用 `Conflicts=`. 你将使用 `Conflicts=` 来干净地关闭 _minetest.service_: +不过,你会在一个稍微不同的场景中来使用 `Conflicts=`. 你将使用 `Conflicts=` 来干净地关闭 `minetest.service`: + ``` # stopminetest.service @@ -135,12 +138,12 @@ Conflicts= minetest.service [Service] Type= oneshot ExecStart= /bin/echo "Closing down minetest.service" - ``` -_stopminetest.service_ 并不会做特别的东西。事实上,它什么都不会做。不过因为它包含那行 `Conflicts=`,所以在它启动时,systemd 会关掉 _minetest.service_. +`stopminetest.service` 并不会做特别的东西。事实上,它什么都不会做。不过因为它包含那行 `Conflicts=`,所以在它启动时,systemd 会关掉 `minetest.service`. 在你完美的 Minetest 设置中,还有最后一点涟漪:你下班晚了,错过了服务器的开机时间,可当你开机的时候游戏时间还没结束,这该怎么办?`Persistent=` 指令(如上所述)在错过开始时间后仍然可以运行服务,但这个方案还是不行。如果你在早上十一点把服务器打开,它就会启动 Minetest,而这不是你想要的。你真正需要的是一个确保 systemd 只在晚上五到七点启动 Minetest 的方法: + ``` # minetest.timer @@ -153,12 +156,12 @@ Unit= minetest.service [Install] WantedBy= basic.target - ``` -`OnCalendar= *-*-* 17..19:*:00` 这一行有两个有趣的地方:(1) `17..19` 并不是一个时间点,而是一个时间段,在这个场景中是 17 到 19 点;以及,(2) 分钟字段中的 `*` 表示服务每分钟都要运行。因此,你会把它读做 “_在下午五到七点间的每分钟,运行 minetest.service_” +`OnCalendar= *-*-* 17..19:*:00` 这一行有两个有趣的地方:(1) `17..19` 并不是一个时间点,而是一个时间段,在这个场景中是 17 到 19 点;以及,(2) 分钟字段中的 `*` 表示服务每分钟都要运行。因此,你会把它读做 “在下午五到七点间的每分钟,运行 minetest.service” + +不过还有一个问题:一旦 `minetest.service` 启动并运行,你会希望 `minetest.timer` 不要再次尝试运行它。你可以在 `minetest.service` 中包含一条 `Conflicts=` 指令: -不过还有一个问题:一旦 _minetest.service_ 启动并运行,你会希望 _minetest.timer_ 不要再次尝试运行它。你可以在 _minetest.service_ 中包含一条 `Conflicts=` 指令: ``` # minetest.service @@ -175,19 +178,18 @@ ExecStop= /bin/kill -2 $MAINPID [Install] WantedBy= multi-user.targe - ``` -上面的 `Conflicts=` 指令会保证在 _minstest.service_ 成功运行后,_minetest.timer_ 就会立即停止。 +上面的 `Conflicts=` 指令会保证在 `minstest.service` 成功运行后,`minetest.timer` 就会立即停止。 + +现在,启用并启动 `minetest.timer`: -现在,启用并启动 _minetest.timer_: ``` systemctl enable minetest.timer systemctl start minetest.timer - ``` -而且,如果你在六点钟启动了服务器,_minetest.timer_ 会启用;到了五到七点,_minetest.timer_ 每分钟都会尝试启动 _minetest.service_. 不过,一旦 _minetest.service_ 开始运行,systemd 会停止 _minetest.timer_,因为它会与 _minetest.service_“冲突”,从而避免计时器在服务已经运行的情况下还会不断尝试启动服务。 +而且,如果你在六点钟启动了服务器,`minetest.timer` 会启用;到了五到七点,`minetest.timer` 每分钟都会尝试启动 `minetest.service`。不过,一旦 `minetest.service` 开始运行,systemd 会停止 `minetest.timer`,因为它会与 `minetest.service` “冲突”,从而避免计时器在服务已经运行的情况下还会不断尝试启动服务。 在首先启动某个服务时杀死启动它的计时器,这么做有点反直觉,但它是有效的。 @@ -197,7 +199,7 @@ systemctl start minetest.timer 但是,这个系列文章的目的不是为任何具体问题提供最佳解决方案。它的目的是为了尽可能多地使用 systemd 来解决问题,甚至会到荒唐的程度。它的目的是展示大量的例子,来说明如何利用不同类型的单位及其包含的指令。我们的读者,也就是你,可以从这篇文章中找到所有这些的可实践范例。 -尽管如此,我们还有一件事要做:下回中,我们会关注 _sockets_ 和 _targets_,然后我们将完成对 systemd 单元的介绍。 +尽管如此,我们还有一件事要做:下回中,我们会关注 sockets 和 targets,然后我们将完成对 systemd 单元的介绍。 你可以在 Linux 基金会和 edX 中,通过免费的 [Linux 介绍][5]课程中,学到更多关于 Linux 的知识。 @@ -208,12 +210,12 @@ via: https://www.linux.com/blog/intro-to-linux/2018/8/systemd-timers-two-use-cas 作者:[Paul Brown][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[StdioA](https://github.com/StdioA) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/intro-to-linux/2018/7/setting-timer-systemd-linux +[1]:https://linux.cn/article-10182-1.html [2]:https://popcon.debian.org/ [3]:https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting-change [4]:https://www.linux.com/blog/learn/intro-to-linux/2018/6/systemd-services-monitoring-files-and-directories From 81b04eb1b7f0a304284f13fbd77fd35e207f8de7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 2 Dec 2018 09:38:29 +0800 Subject: [PATCH 011/135] PUB:20180806 Systemd Timers- Three Use Cases.md @StdioA https://linux.cn/article-10301-1.html --- .../20180806 Systemd Timers- Three Use Cases.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180806 Systemd Timers- Three Use Cases.md (100%) diff --git a/translated/tech/20180806 Systemd Timers- Three Use Cases.md b/published/20180806 Systemd Timers- Three Use Cases.md similarity index 100% rename from translated/tech/20180806 Systemd Timers- Three Use Cases.md rename to published/20180806 Systemd Timers- Three Use Cases.md From 11554cbf01e89656baa17ddfdbb60048f7c8c892 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 2 Dec 2018 10:12:52 +0800 Subject: [PATCH 012/135] PRF:20181106 How to partition and format a drive on Linux.md @Jamskr --- ...o partition and format a drive on Linux.md | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/translated/tech/20181106 How to partition and format a drive on Linux.md b/translated/tech/20181106 How to partition and format a drive on Linux.md index 038d0b1b5c..a8421f2dc1 100644 --- a/translated/tech/20181106 How to partition and format a drive on Linux.md +++ b/translated/tech/20181106 How to partition and format a drive on Linux.md @@ -1,6 +1,7 @@ 如何在 Linux 上对驱动器进行分区和格式化 ====== -这里有所有你想知道的关于设置存储器而又不敢问的一切。 + +> 这里有所有你想知道的关于设置存储器而又不敢问的一切。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/hard_drives.png?itok=gOJt8RV3) @@ -10,27 +11,26 @@ ### 什么是块设备? -硬盘驱动器通常被称为“块设备”,因为硬盘驱动器以固定大小的块进行读写。这就可以区分硬盘驱动器和其它可能插入到您计算机的一些设备,如打印机,游戏手柄,麦克风,或相机。一个简单的方法用来列出连接到你 Linux 系统上的块设备就是使用 `lsblk` (list block devices)命令: +硬盘驱动器通常被称为“块设备”,因为硬盘驱动器以固定大小的块进行读写。这就可以区分硬盘驱动器和其它可能插入到您计算机的一些设备,如打印机、游戏手柄、麦克风,或相机。一个简单的方法用来列出连接到你 Linux 系统上的块设备就是使用 `lsblk` (list block devices)命令: ``` -$ lsblk -NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT -sda                    8:0    0 238.5G  0 disk   -├─sda1                 8:1    0     1G  0 part  /boot -└─sda2                 8:2    0 237.5G  0 part   -  └─luks-e2bb...e9f8 253:0    0 237.5G  0 crypt -        ├─fedora-root    253:1    0    50G  0 lvm   / -        ├─fedora-swap    253:2    0   5.8G  0 lvm   [SWAP] -        └─fedora-home    253:3    0 181.7G  0 lvm   /home -sdb                   8:16    1  14.6G  0 disk   -└─sdb1                8:17    1  14.6G  0 part +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +sda 8:0 0 238.5G 0 disk +├─sda1 8:1 0 1G 0 part /boot +└─sda2 8:2 0 237.5G 0 part + └─luks-e2bb...e9f8 253:0 0 237.5G 0 crypt + ├─fedora-root 253:1 0 50G 0 lvm / + ├─fedora-swap 253:2 0 5.8G 0 lvm [SWAP] + └─fedora-home 253:3 0 181.7G 0 lvm /home +sdb 8:16 1 14.6G 0 disk +└─sdb1 8:17 1 14.6G 0 part ``` -最左列是设备标识符,每个都是以 `sd` 开头,并以一个字母结尾,字母从 `a` 开始。每个块设备上的分区分配一个数字,从 1 开始。例如,第一个设备上的第二个分区用 `sda2` 表示。如果你不确定到底是哪个分区,那也不要紧,只需接着往下读。 +最左列是设备标识符,每个都是以 `sd` 开头,并以一个字母结尾,字母从 `a` 开始。每个块设备上的分区分配一个数字,从 `1` 开始。例如,第一个设备上的第二个分区用 `sda2` 表示。如果你不确定到底是哪个分区,那也不要紧,只需接着往下读。 `lsblk` 命令是无损的,仅仅用于检测,所以你可以放心的使用而不用担心破坏你驱动器上的数据。 -### 使用 `dmesg` 进行测试 +### 使用 dmesg 进行测试 如果你有疑问,你可以通过在 `dmesg` 命令的最后几行查看驱动器的卷标,这个命令显示了操作系统最近的日志(比如说插入或移除一个驱动器)。一句话,如果你想确认你插入的设备是不是 `/dev/sdc` ,那么,把设备插到你的计算机上,然后运行这个 `dmesg` 命令: @@ -40,20 +40,20 @@ $ sudo dmesg | tail 显示中列出的最新的驱动器就是你刚刚插入的那个。如果你拔掉它,并再运行这个命令一次,你可以看到,这个设备已经被移除。如果你再插上它再运行命令,这个设备又会出现在那里。换句话说,你可以监控内核对驱动器的识别。 -### 解理文件系统 +### 理解文件系统 如果你只需要设备卷标,那么你的工作就完成了。但是如果你的目的是想创建一个可用的驱动器,那你还必须给这个驱动器做一个文件系统。 -如果你还不知道什么是文件系统,那么通过了解当没有文件系统时会发生什么,可能会更容易理解这个概念。如果你有多余的设备驱动器,并且上面没有什么重要的数据资料,你可以跟着做一下下面的这个实验。否则,请不要尝试,因为根据设计,这个肯定会删除您的资料。 +如果你还不知道什么是文件系统,那么通过了解当没有文件系统时会发生什么可能会更容易理解这个概念。如果你有多余的设备驱动器,并且上面没有什么重要的数据资料,你可以跟着做一下下面的这个实验。否则,请不要尝试,因为根据其设计目的,这个肯定会删除您的资料。 -当一个驱动器没有文件系统时也是可以使用的。一旦你已经肯定,正解识别了一个驱动器,并且已经确定上面没有任何重要的资料,那就可以把它插到你的计算机上——但是不要挂载它,如果它被自动挂载上了,那就请手动卸载掉它。 +当一个驱动器没有文件系统时也是可以使用的。一旦你已经肯定,正确识别了一个驱动器,并且已经确定上面没有任何重要的资料,那就可以把它插到你的计算机上 —— 但是不要挂载它,如果它被自动挂载上了,那就请手动卸载掉它。 ``` $ su - # umount /dev/sdx{,1} ``` -为了防止灾难性的复制-粘贴错误,下面的例子将使用不太可能出现的 `sdx` 来作为驱动器的卷标。 +为了防止灾难性的复制 —— 粘贴错误,下面的例子将使用不太可能出现的 `sdx` 来作为驱动器的卷标。 现在,这个驱动器已经被卸载了,尝试使用下面的命令: @@ -70,7 +70,7 @@ $ su - hello world ``` -这看起来工作得很好,但是想象一下如果 "hello world" 这个短语是一个文件,如果你想要用这种方法写入一个新的文件,则必须: +这看起来工作得很好,但是想象一下如果 “hello world” 这个短语是一个文件,如果你想要用这种方法写入一个新的文件,则必须: 1. 知道第 1 行已经存在一个文件了 2. 知道已经存在的文件只占用了 1 行 @@ -105,7 +105,7 @@ this is a second file 分区是硬盘驱动器的一种边界,用来告诉文件系统它可以占用哪些空间。举例来说,你有一个 4GB 的 USB 驱动器,你可以只分一个分区占用一个驱动器 (4GB),或两个分区,每个 2GB (又或者是一个 1GB,一个 3GB,只要你愿意),或者三个不同的尺寸大小,等等。这种组合将是无穷无尽的。 -假设你的驱动器是 4GB,你可以 GNU `parted` 命令来创建一个大的分区。 +假设你的驱动器是 4GB,你可以使用 GNU `parted` 命令来创建一个大的分区。 ``` # parted /dev/sdx --align opt mklabel msdos 0 4G @@ -113,11 +113,11 @@ this is a second file 按 `parted` 命令的要求,首先指定了驱动器的路径。 -`\--align` 选项让 `parted` 命令自动选择一个最佳的开始点和结束点。 +`--align` 选项让 `parted` 命令自动选择一个最佳的开始点和结束点。 `mklabel` 命令在驱动器上创建了一个分区表 (称为磁盘卷标)。这个例子使用了 msdos 磁盘卷标,因为它是一个非常兼容和流行的卷标,虽然 gpt 正变得越来越普遍。 -最后定义了分区所需的起点和终点。因为使用了 `\--align opt` 标志,所以 `parted` 将根据需要调整大小以优化驱动器的性能,但这些数字仍然可以做为参考。 +最后定义了分区所需的起点和终点。因为使用了 `--align opt` 标志,所以 `parted` 将根据需要调整大小以优化驱动器的性能,但这些数字仍然可以做为参考。 接下来,创建实际的分区。如果你开始点和结束点的选择并不是最优的, `parted` 会向您发出警告并让您做出调整。 @@ -135,7 +135,7 @@ Ignore/Cancel? C                                           我们有很多文件系统可以使用。有些是开源和免费的,另外的一些并不是。一些公司拒绝支持开源文件系统,所以他们的用户无法使用开源的文件系统读取,而开源的用户也无法在不对其进行逆向工程的情况下从封闭的文件系统中读取。 -尽管有这种特殊的情况存在,还是仍然有很多操作系统可以使用,选择哪个取决于驱动器的用途。如果你希望你的驱动器兼容多个系统,那么你唯一的选择是 exFAT 文件系统。然而微软尚未向任何开源内核提交 exFAT 的代码,因此你可能必须在软件包管理器中安装 exFAT 支持,但是 Windows 和 MacOS 都支持 exFAT 文件系统。 +尽管有这种特殊的情况存在,还是仍然有很多文件系统可以使用,选择哪个取决于驱动器的用途。如果你希望你的驱动器兼容多个系统,那么你唯一的选择是 exFAT 文件系统。然而微软尚未向任何开源内核提交 exFAT 的代码,因此你可能必须在软件包管理器中安装 exFAT 支持,但是 Windows 和 MacOS 都支持 exFAT 文件系统。 一旦你安装了 exFAT 支持,你可以在驱动器上你创建好的分区中创建一个 exFAT 文件系统。 @@ -155,31 +155,31 @@ Linux 中常见的文件系统是 [ext4][1]。但对于便携式的设备来说 ### 使用桌面工具 -很高兴知道了在只有一个 Linux shell的时候,如何操作和处理你的块设备,但是,有时候你仅仅是想让一个驱动器可用,而不需要进行那么多的检测。 GNOME 的 KDE 的开发者们提供了这样的一些优秀的工具让这个过程变得简单。 +很高兴知道了在只有一个 Linux shell 的时候如何操作和处理你的块设备,但是,有时候你仅仅是想让一个驱动器可用,而不需要进行那么多的检测。 GNOME 的 KDE 的开发者们提供了这样的一些优秀的工具让这个过程变得简单。 [GNOME 磁盘][2] 和 [KDE 分区管理器][3] 是一个图形化的工具,为本文到目前为止提到的一切提供了一个一体化的解决方案。启动其中的任何一个,来查看所有连接的设备(在左侧列表中),创建和调整分区大小,和创建文件系统。 ![KDE 分区管理器][5] -KDE 分区管理器 +*KDE 分区管理器* 可以预见的是,GNOME 版本会比 KDE 版本更加简单,因此,我将使用复杂的版本进行演示——如果你愿意动手的话,很容易弄清楚 GNOME 磁盘工具的使用。 启动 KDE 分区管理工具,然后输入你的 root 密码。 -在最左边的一列,选择你想要格式化的驱动器。如果你的驱动器并没有列出来,确认下是否已经插好,然后选择 Tools > Refresh devices (或使用键盘上的 F5 键)。 +在最左边的一列,选择你想要格式化的驱动器。如果你的驱动器并没有列出来,确认下是否已经插好,然后选择 “Tools > Refresh devices” (或使用键盘上的 F5 键)。 -除非你想销毁驱动器已经存在的分区表,否则请勿继续。选择好驱动器后,单击顶部工具栏中的 New Partition Table 。系统会提示你为该分区选择一个卷标: gpt 或 msdos 。前者更加灵活可以处理更大的驱动器,而后者像很多微软的技术一样,是占据大量市场份额的事实上的标准。 +除非你想销毁驱动器已经存在的分区表,否则请勿继续。选择好驱动器后,单击顶部工具栏中的 “New Partition Table” 。系统会提示你为该分区选择一种卷标:gpt 或 msdos 。前者更加灵活可以处理更大的驱动器,而后者像很多微软的技术一样,是占据大量市场份额的事实上的标准。 -现在您有了一个新的分区表,在右侧的面板中右键单击你的设备,然后选择 New 来创建新的分区,按照提示设置分区的类型和大小。此操作包括了分区步骤和创建文件系统。 +现在您有了一个新的分区表,在右侧的面板中右键单击你的设备,然后选择 “New” 来创建新的分区,按照提示设置分区的类型和大小。此操作包括了分区步骤和创建文件系统。 ![创建一个新分区][7] -创建一个新分区 +*创建一个新分区* -要将更改应用于你的驱动器,单击窗口左上角的 Apply 按钮。 +要将更改应用于你的驱动器,单击窗口左上角的 “Apply” 按钮。 -### 硬盘驱动器, 容易驱动 +### 硬盘驱动器,轻松驱动 在 Linux 上处理硬盘驱动器很容易,甚至如果你理解硬盘驱动器的语言就更容易了。自从切换到 Linux 系统以来,我已经能够以任何我想要的方式来处理我的硬盘驱动器了。由于 Linux 在处理存储提供的透明性,因此恢复数据也变得更加容易了。 @@ -198,7 +198,7 @@ via: https://opensource.com/article/18/11/partition-format-drive-linux 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[Jamskr](https://github.com/Jamskr) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 63ef8c2d15d5c4d713a786efb3c7ea6156d1bbf4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 2 Dec 2018 10:13:17 +0800 Subject: [PATCH 013/135] PUB:20181106 How to partition and format a drive on Linux.md @Jamskr https://linux.cn/article-10302-1.html --- .../20181106 How to partition and format a drive on Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181106 How to partition and format a drive on Linux.md (100%) diff --git a/translated/tech/20181106 How to partition and format a drive on Linux.md b/published/20181106 How to partition and format a drive on Linux.md similarity index 100% rename from translated/tech/20181106 How to partition and format a drive on Linux.md rename to published/20181106 How to partition and format a drive on Linux.md From 95e82cbff8c70821a05b052dfb0bfd6075cdbd11 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Sun, 2 Dec 2018 21:54:41 +0800 Subject: [PATCH 014/135] translated over translated over --- ...ew approach to security instrumentation.md | 78 +++++++++---------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/sources/talk/20180412 A new approach to security instrumentation.md b/sources/talk/20180412 A new approach to security instrumentation.md index 0a6a98c0f2..c177e8f5fe 100644 --- a/sources/talk/20180412 A new approach to security instrumentation.md +++ b/sources/talk/20180412 A new approach to security instrumentation.md @@ -1,76 +1,74 @@ -Translating by hopefully2333 - -A new approach to security instrumentation +一种新的用于安全检测的方法 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) -How many of us have ever uttered the following phrase: “I hope this works!”? +我们当中有多少人曾说出过下面这句话:“我希望这能起到作用!”? -Without a doubt, most of us have, likely more than once. It’s not a phrase that inspires confidence, as it reveals doubts about our abilities or the functionality of whatever we are testing. Unfortunately, this very phrase defines our traditional security model all too well. We operate based on the assumption and the hope that the controls we put in place—from vulnerability scanning on web applications to anti-virus on endpoints—prevent malicious actors and software from entering our systems and damaging or stealing our information. +毫无疑问,我们中的大多数人可能都不止一次地说过这句话。这句话不是用来激发信心的,相反它揭示了我们对自身能力和当前正在测试功能的怀疑。不幸的是,这句话非常好地描述了我们传统的安全模型。我们的运营基于这样的假设,并希望我们实施的控制措施——从 web 应用的漏扫到终端上的杀毒软件——防止恶意的病毒和软件进入我们的系统,损坏或偷取我们的信息。 -Penetration testing took a step to combat relying on assumptions by actively trying to break into the network, inject malicious code into a web application, or spread “malware” by sending out phishing emails. Composed of finding and poking holes in our different security layers, pen testing fails to account for situations in which holes are actively opened. In security experimentation, we intentionally create chaos in the form of controlled, simulated incident behavior to objectively instrument our ability to detect and deter these types of activities. +渗透测试通过积极地尝试侵入网络、向 web 应用注入恶意代码或者通过发送钓鱼邮件来传播病毒等等这些步骤来避免我们对假设的依赖。由于我们在不同的安全层面上来发现和渗透漏洞,手动测试无法解决漏洞被主动打开的情况。在安全实验中,我们故意在受控的情形下创造混乱,模拟事故的情形,来客观地检测我们检测、阻止这类问题的能力。 -> “Security experimentation provides a methodology for the experimentation of the security of distributed systems to build confidence in the ability to withstand malicious conditions.” +> “安全实验为分布式系统的安全性实验提供了一种方法,以建立对抗恶意攻击的能力的信心。” -When it comes to security and complex distributed systems, a common adage in the chaos engineering community reiterates that “hope is not an effective strategy.” How often do we proactively instrument what we have designed or built to determine if the controls are failing? Most organizations do not discover that their security controls are failing until a security incident results from that failure. We believe that “Security incidents are not detective measures” and “Hope is not an effective strategy” should be the mantras of IT professionals operating effective security practices. +在分布式系统的安全性和复杂性方面,需要反复地重申混沌工程界的一句名言,“希望不是一种有效的策略”。我们多久会主动测试一次我们设计或构建的系统,来确定我们是否已失去对它的控制?大多数组织都不会发现他们的安全控制措施失效了,直到安全事件的发生。我们相信“安全事件不是侦察措施”,而且“希望不要出事也不是一个有效的策略”应该是 IT 专业人士执行有效安全实践的口号。 -The industry has traditionally emphasized preventative security measures and defense-in-depth, whereas our mission is to drive new knowledge and insights into the security toolchain through detective experimentation. With so much focus on the preventative mechanisms, we rarely attempt beyond one-time or annual pen testing requirements to validate whether or not those controls are performing as designed. +工业在传统上强调预防性的安全措施和纵深防御,但我们的任务是通过侦探实验来驱动对安全工具链新的知识和见解。因为过于专注于预防机制,我们很少尝试一次以上地或者年度性地手动测试要求的安全措施,来验证这些控件是否按设计的那样执行。 -With all of these constantly changing, stateless variables in modern distributed systems, it becomes next to impossible for humans to adequately understand how their systems behave, as this can change from moment to moment. One way to approach this problem is through robust systematic instrumentation and monitoring. For instrumentation in security, you can break down the domain into two primary buckets: **testing** , and what we call **experimentation**. Testing is the validation or assessment of a previously known outcome. In plain terms, we know what we are looking for before we go looking for it. On the other hand, experimentation seeks to derive new insights and information that was previously unknown. While testing is an important practice for mature security teams, the following example should help further illuminate the differences between the two, as well as provide a more tangible depiction of the added value of experimentation. +随着现代分布式系统中的无状态变量的不断改变,人们很难充分理解他们的系统的行为,因为会随时变化。解决这个问题的一种途径是通过强大的系统性的设备进行检测,对于安全性检测,你可以将这个问题分成两个主要方面,测试,和我们称之为实验的部分。测试是对我们已知部分的验证和评估,简单来说,就是我们在开始找之前,要先弄清楚我们在找什么。另一方面,实验是去寻找获得我们之前并不清楚的见解和知识。虽然测试对于一个成熟的安全团队来说是一项重要实践,但以下示例会有助于进一步地阐述两者之间的差异,并对实验的附加价值提供一个更为贴切的描述。 -### Example scenario: Craft beer delivery +### 示例场景:精酿啤酒 -Consider a simple web service or web application that takes orders for craft beer deliveries. +思考一个用于接收精酿啤酒订单的 web 服务或者 web 应用。 -This is a critical service for this craft beer delivery company, whose orders come in from its customers' mobile devices, the web, and via its API from restaurants that serve its craft beer. This critical service runs in the company's AWS EC2 environment and is considered by the company to be secure. The company passed its PCI compliance with flying colors last year and annually performs third-party penetration tests, so it assumes that its systems are secure. +这是这家精酿啤酒运输公司的一项重要服务,这些订单来自客户的移动设备,网页,和通过为这家公司精酿啤酒提供服务的餐厅的 API。这项重要服务运行在 AWS EC2 环境上,并且公司认为它是安全的。这家公司去年成功地通过了 PCI 规则,并且每年都会请第三方进行渗透测试,所以公司认为这个系统是安全的。 -This company also prides itself on its DevOps and continuous delivery practices by deploying sometimes twice in the same day. +这家公司有时一天两次部署来进行 DevOps 和持续交付工作,公司为其感到自豪。 -After learning about chaos engineering and security experimentation, the company's development teams want to determine, on a continuous basis, how resilient and effective its security systems are to real-world events, and furthermore, to ensure that they are not introducing new problems into the system that the security controls are not able to detect. +在了解了混沌工程和安全实验方面的东西后,该公司的开发团队希望能确定,在一个连续不断的基础上,他们的安全系统对真实世界事件的有效性和快速恢复性怎么样。与此同时,确保他们不会把安全控件不能检测到的新问题引入到系统中。 -The team wants to start small by evaluating port security and firewall configurations for their ability to detect, block, and alert on misconfigured changes to the port configurations on their EC2 security groups. +该团队希望能小规模地通过评估端口安全和防火墙设置来让他们能够检测、阻止和警告他们 EC2 安全组上端口设置的错误配置更改。 - * The team begins by performing a summary of their assumptions about the normal state. - * Develops a hypothesis for port security in their EC2 instances - * Selects and configures the YAML file for the Unauthorized Port Change experiment. - * This configuration would designate the objects to randomly select from for targeting, as well as the port ranges and number of ports that should be changed. - * The team also configures when to run the experiment and shrinks the scope of its blast radius to ensure minimal business impact. - * For this first test, the team has chosen to run the experiment in their stage environments and run a single run of the test. - * In true Game Day style, the team has elected a Master of Disaster to run the experiment during a predefined two-hour window. During that window of time, the Master of Disaster will execute the experiment on one of the EC2 Instance Security Groups. - * Once the Game Day has finished, the team begins to conduct a thorough, blameless post-mortem exercise where the focus is on the results of the experiment against the steady state and the original hypothesis. The questions would be something similar to the following: + * 该团队首先对他们正常状态下的假设进行总结。 + * 在 EC2 实例里为端口安全进行一个假设。 + * 为未认证的端口改变实验选择和配置 YAML 文件。 + * 该配置会从已选择的目标中随机指定对象,同时端口的范围和数量也会被改变。 + * 团队还会设置进行实验的时间并缩小爆破攻击的范围,来确保对业务的影响最小。 + * 对于第一次测试,团队选择在他们的测试环境中运行实验并运行一个单独的测试。 + * 在真实的游戏日风格里,团队在预先计划好的两个小时的窗口期内,选择灾难大师来运行实验。在那段窗口期内,灾难大师会在 EC2 实例安全组中的一个上执行这次实验。 + * 一旦游戏日结束,团队就会开始进行一个彻底的、无可指责的事后练习。它的重点在于针对稳定状态和原始假设的实验结果。问题会类似于下面这些: -### Post-mortem questions +### 事后验证问题 - * Did the firewall detect the unauthorized port change? - * If the change was detected, was it blocked? - * Did the firewall report log useful information to the log aggregation tool? - * Did the SIEM throw an alert on the unauthorized change? - * If the firewall did not detect the change, did the configuration management tool discover the change? - * Did the configuration management tool report good information to the log aggregation tool? - * Did the SIEM finally correlate an alert? - * If the SIEM threw an alert, did the Security Operations Center get the alert? - * Was the SOC analyst who got the alert able to take action on the alert, or was necessary information missing? - * If the SOC alert determined the alert to be credible, was Security Incident Response able to conduct triage activities easily from the data? + * 防火墙是否检测到未经授权的端口更改? + * 如果更改被检测到,更改是否会被阻止? + * 防火墙是否会将有用的日志信息记录到日志聚合工具中? + * SIEM 是否会对未经授权的更改发出警告? + * 如果防火墙没有检测到未经授权的更改,那么配置的管理工具是否发现了这次更改? + * 配置管理工具是否向日志聚合工具报告了完善的信息? + * SIEM 最后是否进行了关联报警? + * 如果 SIEM 发出了警报,安全运营中心是否能收到这个警报? + * 获得警报的 SOC 分析师是否能对警报采取措施,还是缺少必要的信息? + * 如果 SOC 确定警报是真实的,那么安全事件响应是否能简单地从数据中进行分类活动? -The acknowledgment and anticipation of failure in our systems have already begun unraveling our assumptions about how our systems work. Our mission is to take what we have learned and apply it more broadly to begin to truly address security weaknesses proactively, going beyond the reactive processes that currently dominate traditional security models. +我们系统中对失败的承认和预期已经开始揭示我们对系统工作的假设。我们的使命是利用我们所学到的,并更加广泛地应用它。以此来真正主动地解决安全问题,来超越当前传统主流的被动处理问题的安全模型。 -As we continue to explore this new domain, we will be sure to post our findings. For those interested in learning more about the research or getting involved, please feel free to contact [Aaron Rinehart][1] or [Grayson Brewer][2]. +随着我们继续在这个新领域内进行探索,我们一定会发布我们的研究成果。如果您有兴趣想了解更多有关研究的信息或是想参与进来,请随时联系 Aaron Rinehart 或者 Grayson Brewer。 -Special thanks to Samuel Roden for the insights and thoughts provided in this article. +特别感谢 Samuel Roden 对本文提供的见解和想法。 -**[See our related story,[Is the term DevSecOps necessary?][3]]** +**[看我们相关的文章,是否需要 DevSecOps 这个词?][3]]** -------------------------------------------------------------------------------- via: https://opensource.com/article/18/4/new-approach-security-instrumentation 作者:[Aaron Rinehart][a] -译者:[译者ID](https://github.com/译者ID) +译者:[hopefully2333](https://github.com/hopefully2333) 校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) From ffca28df5eacd66ed80ab5ad123d6380b475aac0 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Sun, 2 Dec 2018 21:59:10 +0800 Subject: [PATCH 015/135] translated over translated over --- .../talk/20180412 A new approach to security instrumentation.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20180412 A new approach to security instrumentation.md (100%) diff --git a/sources/talk/20180412 A new approach to security instrumentation.md b/translated/talk/20180412 A new approach to security instrumentation.md similarity index 100% rename from sources/talk/20180412 A new approach to security instrumentation.md rename to translated/talk/20180412 A new approach to security instrumentation.md From 7e7d04bac3ab353bcb9f1a5b6fd2a19ed348ba58 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 2 Dec 2018 22:11:28 +0800 Subject: [PATCH 016/135] PRF:20181107 Automate a web browser with Selenium.md @geekpi --- ...07 Automate a web browser with Selenium.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181107 Automate a web browser with Selenium.md b/translated/tech/20181107 Automate a web browser with Selenium.md index 0e0f821ce4..2cf197cb18 100644 --- a/translated/tech/20181107 Automate a web browser with Selenium.md +++ b/translated/tech/20181107 Automate a web browser with Selenium.md @@ -1,36 +1,35 @@ 使用 Selenium 自动化 Web 浏览器 ====== + ![](https://fedoramagazine.org/wp-content/uploads/2018/10/selenium-816x345.jpg) -[Selenium][1] 是浏览器自动化的绝佳工具。使用 Selenium IDE,你可以录制命令序列(如单击、拖动和输入),验证结果并最终存储此自动化测试供日后使用。这非常适合在浏览器中进行积极开发。但是当你想要将这些测试与 CI/CD 流集成时,是时候使用 Selenium WebDriver 了。 +[Selenium][1] 是浏览器自动化的绝佳工具。使用 Selenium IDE,你可以录制命令序列(如单击、拖动和输入),验证结果并最终存储此自动化测试供日后使用。这非常适合在浏览器中进行活跃开发。但是当你想要将这些测试与 CI/CD 流集成时,是时候使用 Selenium WebDriver 了。 WebDriver 公开了一个绑定了许多编程语言的 API,它允许你将浏览器测试与其他测试集成。这篇文章向你展示了如何在容器中运行 WebDriver 并将其与 Python 程序一起使用。 ### 使用 Podman 运行 Selenium -Podman是下面例子的容器运行时。有关如何开始使用 Podman 的信息,请参见[此前文章][2]。 +Podman 是下面例子的容器运行时。有关如何开始使用 Podman 的信息,请参见[此前文章][2]。 此例使用了 Selenium 的独立容器,其中包含 WebDriver 服务器和浏览器本身。要在后台启动服务器容器,请运行以下命令: ``` -$ podman run -d --network host --privileged --name server \ - docker.io/selenium/standalone-firefox +$ podman run -d --network host --privileged --name server docker.io/selenium/standalone-firefox ``` -当你使用特权标志和主机网络运行容器时,你可以稍后从在 Python 中连接到此容器。你不需要使用 sudo。 +当你使用特权标志和主机网络运行容器时,你可以稍后从在 Python 中连接到此容器。你不需要使用 `sudo`。 ### 在 Python 中使用 Selenium 现在你可以提供一个使用此服务器的简单程序。这个程序很小,但应该会让你知道可以做什么: ``` -from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities server ="http://127.0.0.1:4444/wd/hub" driver = webdriver.Remote(command_executor=server, - desired_capabilities=DesiredCapabilities.FIREFOX) + desired_capabilities=DesiredCapabilities.FIREFOX) print("Loading page...") driver.get("https://fedoramagazine.org/") @@ -77,7 +76,7 @@ Done. 上面的示例程序是最小的,也许没那么有用。但这仅仅是最表面的东西!查看 [Selenium][3] 和 [Python 绑定][4] 的文档。在那里,你将找到有关如何在页面中查找元素、处理弹出窗口或填写表单的示例。拖放也是可能的,当然还有等待事件。 -在实现一些不错的测试后,你可能希望将它们包含在 CI/CD pipeline 中。幸运的是,这是相当直接的,因为一切都是容器化的。 +在实现一些不错的测试后,你可能希望将它们包含在 CI/CD 流程中。幸运的是,这是相当直接的,因为一切都是容器化的。 你可能也有兴趣设置 [grid][5] 来并行运行测试。这不仅有助于加快速度,还允许你同时测试多个不同的浏览器。 @@ -108,14 +107,14 @@ via: https://fedoramagazine.org/automate-web-browser-selenium/ 作者:[Lennart Jern][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://fedoramagazine.org/author/lennartj/ [b]: https://github.com/lujun9972 [1]: https://www.seleniumhq.org/ -[2]: https://fedoramagazine.org/running-containers-with-podman/ +[2]: https://linux.cn/article-10156-1.html [3]: https://www.seleniumhq.org/docs/ [4]: https://selenium-python.readthedocs.io [5]: https://www.seleniumhq.org/docs/07_selenium_grid.jsp From a08b47ecd01e400bf6f5b6bd528c4ab2d447ec29 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 2 Dec 2018 22:11:59 +0800 Subject: [PATCH 017/135] PUB:20181107 Automate a web browser with Selenium.md @geekpi https://linux.cn/article-10303-1.html --- .../20181107 Automate a web browser with Selenium.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181107 Automate a web browser with Selenium.md (100%) diff --git a/translated/tech/20181107 Automate a web browser with Selenium.md b/published/20181107 Automate a web browser with Selenium.md similarity index 100% rename from translated/tech/20181107 Automate a web browser with Selenium.md rename to published/20181107 Automate a web browser with Selenium.md From 68a73864f57d8bb3a1dbd384b96f5b905f4d9f92 Mon Sep 17 00:00:00 2001 From: Valonia Kim <34000495+Valoniakim@users.noreply.github.com> Date: Sun, 2 Dec 2018 22:42:35 +0800 Subject: [PATCH 018/135] Delete 20180104 How Creative Commons benefits artists and big business.md --- ...mmons benefits artists and big business.md | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 sources/talk/20180104 How Creative Commons benefits artists and big business.md diff --git a/sources/talk/20180104 How Creative Commons benefits artists and big business.md b/sources/talk/20180104 How Creative Commons benefits artists and big business.md deleted file mode 100644 index b3bba7686e..0000000000 --- a/sources/talk/20180104 How Creative Commons benefits artists and big business.md +++ /dev/null @@ -1,61 +0,0 @@ -translating by valonia - -How Creative Commons benefits artists and big business -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/CreativeCommons_ideas_520x292_1112JS.png?itok=otei0vKb) - -I attended film school, and later I taught at a film school, and even later I worked at a major film studio. There was a common thread through all these different angles of the creative industry: creators need content. Interestingly, one movement kept providing the solution, and that was free culture, or, as it has been formalized, Creative Commons. - -### Showpieces and demos - -Like anything else in life, creativity requires practice. I luckily stumbled into open source early in my experience with computers, through an article in a trade magazine about render farms. I didn't yet understand what "open source" meant, but I knew that the tools labeled open source were the only tools that provided me reliable access to the technology I wanted to explore. The same has been true for the Creative Commons content that I use. Creative Commons provides artists an entire studio full of artistic resources. - -When I was teaching in film and needed sample footage for students to edit, overdub, foley, grade, or score, I always had what I needed from films like Jim Munroe's independent masterpiece [Infest Wisely][1] or from the Creative Commons content on [Vimeo][2]. These provide realistic footage, spanning the whole spectrum from indie productions to expensive, high-quality crane (actually drone, usually) shots. - -For experimentalist art, the possibilities are truly endless. Creative Commons provides a wealth of stock footage to integrate into video art, video DJ mixes, and whatever else a visual pioneer dreams up. - -Before Creative Commons, the only ways to get experience with real-world footage were either to use footage that former students or professors generated, assuming you were at a university, or to use copyrighted footage despite the restrictions. - -### It's all about the bottom line - -There's a more business-centric use for all of this, as well. When working deep in the render farms of a large computer company, I was tasked with performing render tests on some hardware that was under the threat of being discontinued. For this job, I used the assets of [Big Buck Bunny][3] because not just the movie itself, but also its components, are free to use and share. If it hadn't been for this short film, I could not have done my tests until I'd acquired realistic assets, which would likely never have happened because computer companies are busy places that don't typically employ a team of 3D artists to compose a scene on call. - -It struck me that, much like open source itself, Creative Commons is already propping up big companies in ways no one really thinks about. The use of Creative Commons in a company may or may not make or break the daily process, but it's filling gaps and making people's jobs and workflows move smoothly. I don't think anyone's accounting for this benefit in their books, but Creative Commons content is everywhere. - -I've even seen Blender open movies, like [Sintel][4], as the demo films playing on the latest television screens when a TV resolution exceeds what is currently available on standard media. - -### Raw materials - -Artists need raw materials. A painter needs paint, brushes, and a canvas. Sculptors need clay and modeling tools. And digital content creators need digital content, whether it's clipart or sound effects or ready-made sprites for a video game. - -The digital medium has bestowed upon one individual creator the power to apparently make works of art that should take a group of people to complete. The reality is, though, that most of us like to think big. We want to make projects that look and sound good. We want big worlds, intense stories, evocative works, but we don't have the time or the variety of skills to make it all happen. - -It's here that Creative Commons saves the day, yet again, with the little bits and pieces of free art that abound on sites like [Freesound.org][5], [Openclipart.org][6], [OpenGameArt.org][7], and many, many more. Artists are able, through the Commons, to use raw material that they could not have produced themselves to produce works they couldn't otherwise make alone. - -Possibly even more significantly, though, is the fact that your raw material that you put up on the internet for reuse can bring you, without any further investment, into amazing works of art that you'd never dream of producing yourself. I have contributed to countless musical albums and video games with sound clips I've added to the Commons. Sometimes the artist notifies me, others I find on my own, and probably even more exist than I know about. I've seen icons that I've drawn pop up in software projects that I never knew existed. I've seen articles I've written for [Opensource.com][8] published elsewhere, and things I've written in the bibliographies of thesis projects, white papers, and reference materials. - -### Free culture is culture - -"Free culture" is a redundant term that shouldn't be part of our vocabulary. Culture, conceptually, is an organic process. It's the way a society develops and grows, from one person to another. It's about the interactions and the ideas that people share. It's a unique product of the modern world that culture is not free by default. - -If you want to combat that, and prefer to share your culture with your fellow human beings across the globe, support Creative Commons by contributing to it, using it, and supporting those who do. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/creative-commons-real-world - -作者:[Seth Kenlon][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/seth -[1]:http://infestwisely.com -[2]:https://vimeo.com/creativecommons -[3]:https://peach.blender.org/ -[4]:https://durian.blender.org/ -[5]:http://freesound.org -[6]:http://openclipart.org -[7]:http://opengameart.org -[8]:https://opensource.com/ From 77cf2ffd05e0e94bb977cec6a37ff98c7512c5e6 Mon Sep 17 00:00:00 2001 From: Valonia Kim <34000495+Valoniakim@users.noreply.github.com> Date: Sun, 2 Dec 2018 22:46:34 +0800 Subject: [PATCH 019/135] Translated --- ...mmons benefits artists and big business.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 translated/talk/20180104 How Creative Commons benefits artists and big business.md diff --git a/translated/talk/20180104 How Creative Commons benefits artists and big business.md b/translated/talk/20180104 How Creative Commons benefits artists and big business.md new file mode 100644 index 0000000000..5cfda766f5 --- /dev/null +++ b/translated/talk/20180104 How Creative Commons benefits artists and big business.md @@ -0,0 +1,59 @@ +知识共享是怎样造福艺术家和大企业的 +====== +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/CreativeCommons_ideas_520x292_1112JS.png?itok=otei0vKb) + +我毕业于电影学院,毕业后在一所电影学校教书,之后进入一家主流电影工作室,我一直在从事电影相关的工作。创造业的方方面面面临着同一个问题:创造者需要原材料。有趣的是,自由文化运动提出了解决方案,具体来说是在自由文化运动中出现的知识共享组织。 + +###知识共享能够为我们提供展示片段和小样 + +和其他事情一样,创造力也需要反复练习。幸运的是,在我刚开始接触电脑时,就在一本渲染工场的专业杂志中接触到了开源这个存在。当时我并不理解所谓的“开源”是什么,但我知道只有开源工具能帮助我在领域内稳定发展。对我来说,知识共享也是如此。知识共享可以为艺术家们提供充满丰富艺术资源的工作室。 + +我在电影学院任教时,经常需要给学生们准备练习编辑、录音、拟音、分级、评分的脚本。在 Jim Munroe 的独立作品 [Infest Wisely][1] 中和 [Vimeo][2] 上的知识共享里我总能找到我想要的。这些写实的脚本覆盖内容十分广泛,从独立影院出品到昂贵的高质的升降镜头(一般都会用无人机代替)都有。 + +对实验艺术来说,确有无尽可能。知识共享提供了丰富的底片材料,这些材料可以用来整合,混剪等等,可以满足一位视觉先锋能够想到的任何用途。 + +在接触知识共享之前,如果我想要使用写实脚本,我只能用之前的学生和老师拍摄的或者直接使用版权库里的脚本,但这些都有很多局限性。 + +###坚守版权的底线很重要 + +知识共享同样能够创造经济效益。在某大型计算机公司的渲染工场工作时,我负责在某些硬件设施上测试渲染的运行情况,而这个测试时刻面临着被搁置的风险。做这些测试时,我用的都是[大雄兔][3]的资源,因为这个电影和它的组件都是可以免费使用和分享的。如果没有这个小短片,在接触写实资源之前我都没法完成我的实验,因为对于一个计算机公司来说,雇佣一只3D艺术家来应召布景是不太现实的。 + +令我震惊的是,与开源类似,知识共享已经用我们难以想象的方式支撑起了大公司。知识共享的使用或有或无地影响着公司的日常程序,但它填补了不足,让工作流程顺利进行。我没见到谁在他们的书中将流畅工作归功于知识共享的应用,但它确实无处不在。 + +我也见过一些开放版权的电影,比如[辛特尔][4],在最近的电视节目中播放了它的短片,那时的电视比现在的网络媒体要火得多。 + +###知识共享可以提供大量原材料 + +艺术家需要原材料。画家需要颜料,画笔和画布。雕塑家需要陶土和工具。数字内容编辑师需要数字内容,无论它是剪贴画还是音效或者是电子游戏里的成品精灵。 + +数字媒介赋予了人们超能力,让一个人就能完成需要一组人员才能完成的工作。事实上,我们大部分都好高骛远。我们想做高大上的项目,想让我们的成果不论是视觉上还是听觉上都无与伦比。我们想塑造的是宏大的世界,紧张的情节,能引起共鸣的作品,但我们所拥有的时间精力和技能与之都不匹配,达不到想要的效果。 + +是知识共享再一次拯救了我们,用 [Freesound.org][5], [Openclipart.org][6], [OpenGameArt.org][7] 等等网站上那些细小的开放版权艺术材料。通过知识共享,艺术家可以使用各种他们自己没办法创造的原材料,来完成他们原本完不成的工作。 + +最神奇的是,不用自己投资,你放在网上给大家使用的原材料就能变成精美的作品,而这是你从没想过的。我在知识共享上面分享了很多音乐素材,它们现在用于无数的专辑和电子游戏里。有些人用了我的材料会通知我,有些是我自己发现的,所以这些材料的应用可能比我知道的还有多得多。有时我会偶然看到我亲手画的标志出现在我从没听说过的软件里。我见到过我为[开源网站][8]写的文章在别处发表,有的是论文的参考文献,白皮书或者参考资料中。 + +###知识共享所代表的自由文化也是一种文化 + +“自由文化”这个说法过于累赘,文化,从概念上来说,是一个有机的整体。在这种文化中社会逐渐成长发展,从一个人到另一个。它是人与人之间的互动和思想交流。自由文化是自由缺失的现代世界里的特殊产物。 + +如果你也想对这样的局限进行反抗,想把你的思想、作品,你自己的文化分享给全世界的人,那么就来和我们一起,使用知识共享吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/creative-commons-real-world + +作者:[Seth Kenlon][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/seth +[1]:http://infestwisely.com +[2]:https://vimeo.com/creativecommons +[3]:https://peach.blender.org/ +[4]:https://durian.blender.org/ +[5]:http://freesound.org +[6]:http://openclipart.org +[7]:http://opengameart.org +[8]:https://opensource.com/ From c64678da8cf603849c644de85f9c10b8effb8ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Sun, 2 Dec 2018 23:37:09 +0800 Subject: [PATCH 020/135] =?UTF-8?q?20111221=2030=20Best=20Sources=20For=20?= =?UTF-8?q?Linux=20-=20-BSD=20-=20Unix=20Documentation=20On=20the=20Web.md?= =?UTF-8?q?=20translated=20over=EF=BC=81=20(#11453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Delete 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md --- ... - -BSD - Unix Documentation On the Web.md | 464 ----------------- ... - -BSD - Unix Documentation On the Web.md | 470 ++++++++++++++++++ 2 files changed, 470 insertions(+), 464 deletions(-) delete mode 100644 sources/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md create mode 100644 translated/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md diff --git a/sources/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md b/sources/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md deleted file mode 100644 index 06154bdb9c..0000000000 --- a/sources/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md +++ /dev/null @@ -1,464 +0,0 @@ -ScarboroughCoral translating! - - -30 Best Sources For Linux / *BSD / Unix Documentation On the Web -====== - - - -Man pages are written by sys-admin and developers for IT techs, and are intended more as a reference than as a how to. Man pages are very useful for people who are already familiar with Linux, Unix, and BSD operating systems. Use man pages when you just need to know the syntax for particular commands or configuration file, but they are not helpful for new Linux users. Man pages are not good for learning something new for the first time. Here are thirty best documentation sites on the web for learning Linux and Unix like operating systems. - -![Dennis Ritchie and Ken Thompson working with UNIX PDP11][1] - -Please note that BSD manpages are usually better as compare to Linux. - -## #1: Red Hat Enterprise Linux - -![Red hat Enterprise Linux Docs][2] - -RHEL is developed by Red Hat and targeted toward the commercial market. It has one of the best documentations covering basis of RHEL to advanced topics like security, SELinux, virtualization, directory server, clustering, JBOSS, HPC, and much more. Red Hat documentation has been translated into twenty-two languages and is available in multi-page HTML, single-page HTML, PDF, and EPUB formats. The good news is you can use the same documentation for CentOS or Scientific Linux (community enterprise distros). All of these documents ship with the OS, so if you don't have a network connection, then you have them there as well. The RHEL docs **covers everything from installation to configuring clusters**. The only downside is you need to be a paid customer. This is perfect for an enterprise company. - - 1. RHEL Documentation: [in HTML/PDF format][3] - 2. Support forums: Only available to Red Hat customer portal to submit a support case. - - - -### A Note About CentOS Wiki and Forums - -![Centos Linux Wiki][4] - -CentOS (Community ENTerprise Operating System) is a free rebuild of source packages freely available from a RHEL. It provides truly reliable, free enterprise Linux for personal and other usage. You will get RHEL stability without the cost of certification and support. CentOS wiki divided into Howtos, Tips & Tricks, and much more at the following locations: - - 1. [Documentation Wiki][87] - 2. [Support forum][88] - -## #2: Arch Wiki and Forums - -![Arch Linux wiki and tutorials][5] - -Arch Linux is an independently developed, Linux operating system and it comes with pretty good documentation in form of wiki based site. It is developed collaboratively by a community of Arch users, allowing any user to add and edit content. The articles are divided into various categories like [networking][6], optimization, package management, system administration, X window system, and getting & installing Arch Linux. The official [forums][7] are useful for solving many issues. It has total 40k+ registered users with over 1 million posts. The wiki contains some **general information that can also apply in other Linux distros**. - - 1. Arch community Documentation: [Wiki format][8] - 2. Support forums: [Yes][7] - - - -## #3: Gentoo Linux Wiki and Forums - -![Gentoo Linux Handbook and Wiki][9] - -Gentoo Linux is based on the Portage package management system. The Gentoo user compiles the source code locally according to their chosen configuration. The majority of users have configurations and sets of installed programs which are unique to themselves. The Gentoo give you some explanation about the Gentoo Linux and answer most of your questions regarding installations, packages, networking, and much more. Gentoo has **very helpful forum** with over one hundred thirty-four thousand plus users who have posted a total of 5442416 articles. - - 1. Gentoo community documentation: [Handbook][10] and [Wiki format][11] - 2. Support forums: [Yes][12] - 3. User-supplied documentation available at [gentoo-wiki.com][13] - - - -## #4: Ubuntu Wiki and Documentation - -Ubuntu is one of the leading desktop and laptop distro. The official documentation developed and maintained by the Ubuntu Documentation Project. You can access a wealth of information including a getting started Guide. The best part is information contained herein may also work with other Debian-based systems. You will also find the community documentation for Ubuntu created by its users. This is a reference for Ubuntu-related 'Howtos, Tips, Tricks, and Hacks'. Ubuntu Linux has one of the biggest Linux communities on the web. It offers help to the both new and experienced users. - -![Ubuntu Linux Wiki and Forums][14] - - 1. Ubuntu community documentation: [wiki format][15]. - 2. Ubuntu official documentation: [wiki format][16]. - 3. Support forums: [Yes][17]. - - - -## #5: IBM Developer Works - -IBM developer works offers technical resources for Linux programmers and system administrators. It contains hundreds of articles, tutorials, and tips to help developers with Linux programming and application development, as well as Linux system administration. - -![IBM: Technical for Linux programmers and system administrators][18] - - 1. IBM Developer Works Documentation: [HTML format][19] - 2. Support forums: [Yes][20]. - - - -## #6: FreeBSD Documentation and Handbook - -The FreeBSD handbook is created by the FreeBSD Documentation Project. It describes the installation, administration and day-to-day use of the FreeBSD OS. BSD manpages are usually better as compare to GNU/Linux man pages. The FreeBSD **comes with all the documents** with upto date man pages. The FreeBSD Handbook **covers everything**. The handbook contains some general Unix information that can also apply in other Linux distros. The official FreeBSD forums also provides helps whenever you will get stuck with problems. - -![Freebsd Documentation][21] - - 1. FreeBSD Documentation: [HTML/PDF format][90] - 2. Support forums: [Yes][91]. - - -## #7: Bash Hackers Wiki - -![Bash hackers wiki for bash users][22] -This is an excellent resource for bash user. The bash hackers wiki is intended to hold documentations of any kind about the GNU Bash. The main motivation was to provide human-readable documentation and information to not force users to read every bit of the Bash manpage - which is hard sometimes. The wiki is divided into various sections such as - scripting and general information, howtos, coding style, bash syntax, and much more. - - 1. Bash hackers [wiki][23] in wiki format - - - -## #8: Bash FAQ - -![Bash FAQ: Answers to frequently asked questions about GNU/BASH][24] -A wiki designed for new bash users. It has good collections to frequently asked questions on channel #bash on the freenode IRC network. These answers are contributed by the regular members of the channel. Don't forget to check out common mistakes made by Bash programmers, in [BashPitfalls][25] section. The answers given in this FAQ may be slanted toward Bash, or they may be slanted toward the lowest common denominator Bourne shell, depending on who wrote the answer. In most cases, an effort is made to provide both a portable (Bourne) and an efficient (Bash, where appropriate) answer. - - 1. Bash FAQ [in wiki ][26] format. - - - -## #9: Howtoforge - Linux Tutorials - -![Howtoforge][27] - -Fellow blogger Falko has some great stuff over at How-To Forge. The site provides Linux tutorials about various topic including its famous "The Perfect Server" series. The site is divided into various topics such as web-server, Linux distros, DNS servers, Virtualization, High-availability, Email and anti-spam, FTP servers, programming topics, and much more. The site is also available in German language. - - 1. Howtoforge [in html][28] format. - 2. Support forums: Yes - - - -## #10: OpenBSD FAQ and Documentation - -![OpenBSD Documenation][29] - -OpenBSD is another Unix-like computer operating system based on Berkeley Software Distribution (BSD). It was forked from NetBSD by project. The OpenBSD is well known for the **quality code, documentation** , uncompromising position on software licensing, with strong focus on security. The documenation is divided into various topics such as - installations, package management, firewall setup, user management, networking, disk / RAID management and much more. - - 1. OpenBSD [in html][30] format. - 2. Support forums: No, but [mail lists][31] are available. - - - -## #11: Calomel - Open Source Research and Reference - -This amazing site dedicated to documenting open source software, and programs with special focus on OpenBSD. This is one of the cleanest and easy to to navigate website, with focus on the quality content. The site is divided into various server topic such as DNS, OpeBSD, security, web-server, Samba file server, various tools, and much more. - -![Open Source Research and Reference Documentation][32] - - 1. Calomel Org [in html][33] format. - 2. Support forums: No - - - -## #12: Slackware Book Project - -![Slackware Linux Book and Documentation ][34] -Slackware Linux was my first distro. It was one of the earliest distro based on the Linux kernel and is the oldest currently being maintained. The distro is targeted towards power users with strong focus on stability. Slackware is one of few the most "Unix-like" Linux distribution. The official slackware book is designed to get you started with the Slackware Linux operating system. It's not meant to cover every single aspect of the distribution, but rather to show what it is capable of and give you a basic working knowledge of the system. The book is divided into various topics such as Installation, Network & System Configuration, System administration, Package management, and much more. - - 1. Slackware [Linux books in html][35], pdf, and other format. - 2. Support forums: Yes - - - -## #13: The Linux Documentation Project (TLDP) - -![Linux Learning Site and Documentation ][36] - -The Linux Documentation Project is working towards developing free, high quality documentation for the Linux operating system. The site is created and maintained by volunteers. The site is divided into subject-specific help, longer and in-depth guide books, and much more. I recommend [this document][37] which is both a tutorial and a reference on shell scripting with Bash. The [single list][38] of HOWTOs is also a good starting point for new users. - - 1. The Linux [documentation project][39] available in multiple formats. - 2. Support forums: No - - - -## #14: Linux Home Networking - -![Linux Home Networking ][40] - -Linux home networking is another good resource for learning Linux. This site covers topics needed for Linux software certification exams, such as the RHCE, and many computer training courses. The site is divided into various topics such as networking, samba file server, wirless networking, web-server, and much more. - - 1. Linux [home networking][41] available in html and PDF (with small fee) formats. - 2. Support forums: Yes - - - -## #15: Linux Action Show - -![Linux Podcast ][42] - -Linux Action Show ("LAS") is a podcast about Linux. The show is hosted by Bryan Lunduke, Allan Jude, and Chris Fisher. It covers the latest news in the FOSS world. The show reviews various apps and Linux distros. Sometime an interview with a major personal in the open source world is posted on the show. - - 1. Linux [action show][43] available in audio/video format. - 2. Support forums: Yes - - - -## #16: Commandlinefu - -Commandlinefu lists various shell commands that you may find interesting and useful. All commands can be commented on, discussed and voted up or down. Ths is an awesome resource for all Unix command line users. Don't forget to checkout all [top voted][44] commands here. - -![The best Unix / Linux Commands By Commandlinefu][45] - - 1. [Commandlinefu][46] available in html format. - 2. Support forums: No - - - -## #17: Debian Administration Tips and Resources - -This site covers topics, tips, and tutorial only related to Debian GNU/Linux. It contain interesting and useful information related to the System Administration. You can contribute an article, tip, or question here. Don't forget to checkout [top articles][47] posted in the hall of fame section. -![Debian Linux Adminstration: Tips and Tutorial For Sys Admin][48] - - 1. Debian [administration][49] available in html format. - 2. Support forums: No - - - -## #18: Catonmat - Sed, Awk, Perl Tutorials - -![Sed, Awk, Perl Tutorials][50] - -This site run by a fellow blogger Peteris Krumins. The main focus is on command line and Unix programming topics such as sed, perl, awk, and others. Don't forget to check out [introduction to sed][51], sed [one liner][52] explained, the definitive [guide][53] to Bash Command line history, and [awk][54] liner explained. - - 1. [catonmat][55] available in html format. - 2. Support forums: No - - - -## #19: Debian GNU/Linux Documentation and Wiki - -![Debian Linux Tutorials and Wiki][56] - -Debian is another Linux based operating system that primarily uses software released under the GNU General Public. Debian is well known for strict adherence to the philosophies of Unix and free software. It is also one of popular and influential Linux distribution. It is also used as a base for many other distributions such as Ubuntu and others. The Debian project provides its users with proper documentation in an easily accessible form. The site is divided into wiki, installation guide, faqs, and support forum. - - 1. Debian GNU/Linux [documentation][57] available in html and other format. - 2. Debian GNU/Linux [wiki][58] - 3. Support forums: [Yes][59] - - - -## #20: Linux Sea - -The book "Linux Sea" offers a gentle yet technical (from end-user perspective) introduction to the Linux operating system, using Gentoo Linux as the example Linux distribution. It does not nor will it ever talk about the history of the Linux kernel or Linux distributions or dive into details that are less interesting for Linux users. - - 1. Linux [sea][60] available in html format. - 2. Support forums: No - - - -## #21: Oreilly Commons - -![Oreilly Free Linux / Unix / Php / Javascript / Ubuntu Books][61] - -The oreilly publishing house has posted quite a few titles in wiki format for all. The purpose of this site is to provide content to communities that would like to create, reference, use, modify, update and revise material from O'Reilly or other sources. The site includes books about Ubuntu, Php, Spamassassin, Linux, and much more all for free. - - 1. Oreilly [commons][62] available in wiki format. - 2. Support forums: No - - - -## #22: Ubuntu Pocket Guide - -![Ubuntu Book For New Users][63] - -This book is written by Keir Thomas. This guide/book is a good read for everyday Ubuntu user. The purpose of this book is to introduce you to the Ubuntu operating system, and the philosophy that underpins it. You can download a pdf version from the official site or order a print version using Amazon. - - 1. Ubuntu [pocket guide][64] available in pdf and print formats. - 2. Support forums: No - - - -## #23: Linux: Rute User's Tutorial and Exposition - -![GNU/LINUX system administration book][65] - -This book covers GNU/LINUX system administration, for popular distributions like RedHat and Debian, as a tutorial for new users and a reference for advanced administrators. It aims to give concise, thorough explanations and practical examples of each aspect of a UNIX system. Anyone who wants a comprehensive text on (what is commercially called) LINUX need look no further-there is little that is not covered here. - - 1. Linux: [Rute User's Tutorial and Exposition][66] available in print and html formats. - 2. Support forums: No - - - -## #24: Advanced Linux Programming - -![Advanced Linux Programming][67] - -This book is intended for the programmer already familiar with the C programming language. It take a tutorial approach and teach the most important concepts and power features of the GNU/Linux system in application programs. If you're a developer already experienced with programming for the GNU/Linux system, are experienced with another UNIX-like system and are interested in developing GNU/Linux software, or want to make the transition for a non-UNIX environment and are already familiar with the general principles of writing good software, this book is for you. In addition, you will find that this book is equally applicable to C and C++ programming. - - 1. Advanced [Linux programming][68] available in print and pdf formats. - 2. Support forums: No - - - -## #25: LPI 101 Course Notes - -![Linux Professional Institute Certification Books][69] - -LPIC-1/2/3 levels are certification for Linux administrators. This site provides training manuals for LPI 101 and 102 exams. These are licenced under the GNU Free Documentation Licence (FDL). This course material is based on the objectives for the Linux Professionals Institutea€™s LPI 101 and 102 examination. The course is intended to provide you with the skills required for operating and administering Linux systems. - - 1. Download LPI [training manuals][70] in pdf format. - 2. Support forums: No - - - -## #26: FOSS Manuals - -FLOSS Manuals is a collection of manuals about free and open source software together with the tools used to create them and the community that uses those tools. They include authors, editors, artists, software developers, activists, and many others. There are manuals that explain how to install and use a range of free and open source softwares, about how to do things (like design or stay safe online) with open source software, and manuals about free culture services that use or support free software and formats. You will find manuals about software such as VLC, [Linux video editing][71], Linux, OLPC / SUGAR, GRAPHICS, and much more. - -![FLOSS Manuals is a collection of manuals about free and open source software][72] - - 1. You can browse [FOSS manuals][73] in wiki format. - 2. Support forums: No - - - -## #27: Linux Starter Pack - -![The Linux Starter Pack][74] - -New to the wonderful world of Linux? Looking for an easy way to get started? You can download 130-page guide and get to grips with the OS. This will show you how to install Linux onto your PC, navigate around the desktop, master the most popular Linux programs and fix any problems that may arise. - - 1. Download [Linux starter][75] pack in pdf format. - 2. Support forums: No - - - -## #28: Linux.com - The Source of Linux Info - -Linux.com is a product of the Linux Foundation. The side provides news, guides, tutorials and other information about Linux by harnessing the power of Linux users worldwide to inform, collaborate and connect on all matters Linux. - - 1. Visit [Linux.com][76] online. - 2. Support forums: Yes - - - -## #29: LWN - -LWN is a site with an emphasis on free software and software for Linux and other Unix-like operating systems. It consists of a weekly issue, separate stories which are published most days, and threaded discussion attached to every story. The site provide comprehensive coverage of development, legal, commercial, and security issues related to Linux and FOSS. - - 1. Visit [lwn.net][77] online. - 2. Support forums: No - - - -## #30: Mac OS X Related sites - -A quick links to Max OS X related sites: - - * [Mac OS X Hints][78] - This site is dedicated to the Apple's Mac OS X unix operating systems. It has tons of tips, tricks and tutorial about Bash, and OS X - * [Mac OS development library][79] - Apple has good collection related to OS X development. Don't forget to checkout [bash shell scripting primer][80]. - * [Apple kbase][81] - This is like RHN kbase. It provides guides and troublshooting tips for all apple products including OS X. - - - -## #30: NetBSD - -NetBSD is another free open source operating system based upon the Berkeley Software Distribution (BSD) Unix operating system. The NetBSD project is primarily focused on high quality design, stability and performance of the system. Due to its portability and Berkeley-style license, NetBSD is often used in embedded systems. This site provides links to the official NetBSD documentation and also links to various external documents. - - 1. View [netbsd][82] documentation online in html / pdf format. - 2. Support forums: No - - - -## Your Turn: - -This is my personal list and it is not absolutely definitive, so if you've got your own favorite Unix/Linux specific site, share in the comments below. - -// Image credit: [Flickr photo][83] by PanelSwitchman. Some links are suggested by user on our facebook fan page. - -// For those who celebrate, Merry Christmas! For everyone else, enjoy the weekend. - -## About the author - -The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on [Twitter][84], [Facebook][85], [Google+][86]. - --------------------------------------------------------------------------------- - -via: https://www.cyberciti.biz/tips/linux-unix-bsd-documentations.html - -作者:[Vivek Gite][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.cyberciti.biz -[1]:https://www.cyberciti.biz/media/new/tips/2011/12/unix-pdp11.jpg "Dennis Ritchie and Ken Thompson working with UNIX PDP11" -[2]:https://www.cyberciti.biz/media/new/tips/2011/12/redhat-enterprise-linux-docs-150x150.png "Red hat Enterprise Linux Docs" -[3]:https://access.redhat.com/documentation/en-us/ -[4]:https://www.cyberciti.biz/media/new/tips/2011/12/centos-linux-wiki-150x150.png "Centos Linux Wiki, Support, Documents" -[5]:https://www.cyberciti.biz/media/new/tips/2011/12/arch-linux-wiki-150x150.png "Arch Linux wiki and tutorials " -[6]:https://wiki.archlinux.org/index.php/Category:Networking_%28English%29 -[7]:https://bbs.archlinux.org/ -[8]:https://wiki.archlinux.org/ -[9]:https://www.cyberciti.biz/media/new/tips/2011/12/gentoo-linux-wiki1-150x150.png "Gentoo Linux Handbook and Wiki" -[10]:http://www.gentoo.org/doc/en/handbook/ -[11]:https://wiki.gentoo.org -[12]:https://forums.gentoo.org/ -[13]:http://gentoo-wiki.com -[14]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-linux-wiki.png "Ubuntu Linux Wiki and Forums" -[15]:https://help.ubuntu.com/community -[16]:https://help.ubuntu.com/ -[17]:https://ubuntuforums.org/ -[18]:https://www.cyberciti.biz/media/new/tips/2011/12/ibm-devel.png "IBM: Technical for Linux programmers and system administrators" -[19]:https://www.ibm.com/developerworks/learn/linux/index.html -[20]:https://www.ibm.com/developerworks/community/forums/html/public?lang=en -[21]:https://www.cyberciti.biz/media/new/tips/2011/12/freebsd-docs.png "Freebsd Documentation" -[22]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-hackers-wiki-150x150.png "Bash hackers wiki for bash users" -[23]:http://wiki.bash-hackers.org/doku.php -[24]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-faq-150x150.png "Bash FAQ: Answers to frequently asked questions about GNU/BASH" -[25]:http://mywiki.wooledge.org/BashPitfalls -[26]:https://mywiki.wooledge.org/BashFAQ -[27]:https://www.cyberciti.biz/media/new/tips/2011/12/howtoforge-150x150.png "Howtoforge tutorials" -[28]:https://howtoforge.com/ -[29]:https://www.cyberciti.biz/media/new/tips/2011/12/openbsd-faq-150x150.png "OpenBSD Documenation" -[30]:https://www.openbsd.org/faq/index.html -[31]:https://www.openbsd.org/mail.html -[32]:https://www.cyberciti.biz/media/new/tips/2011/12/calomel_org.png "Open Source Research and Reference Documentation" -[33]:https://calomel.org -[34]:https://www.cyberciti.biz/media/new/tips/2011/12/slackware-linux-book-150x150.png "Slackware Linux Book and Documentation " -[35]:http://www.slackbook.org/ -[36]:https://www.cyberciti.biz/media/new/tips/2011/12/tldp-150x150.png "Linux Learning Site and Documentation " -[37]:http://tldp.org/LDP/abs/html/index.html -[38]:http://tldp.org/HOWTO/HOWTO-INDEX/howtos.html -[39]:http://tldp.org/ -[40]:https://www.cyberciti.biz/media/new/tips/2011/12/linuxhomenetworking-150x150.png "Linux Home Networking " -[41]:http://www.linuxhomenetworking.com/ -[42]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-action-show-150x150.png "Linux Podcast " -[43]:http://www.jupiterbroadcasting.com/show/linuxactionshow/ -[44]:https://www.commandlinefu.com/commands/browse/sort-by-votes -[45]:https://www.cyberciti.biz/media/new/tips/2011/12/commandlinefu.png "The best Unix / Linux Commands " -[46]:https://commandlinefu.com/ -[47]:https://www.debian-administration.org/hof -[48]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-admin.png "Debian Linux Adminstration: Tips and Tutorial For Sys Admin" -[49]:https://www.debian-administration.org/ -[50]:https://www.cyberciti.biz/media/new/tips/2011/12/catonmat-150x150.png "Sed, Awk, Perl Tutorials" -[51]:http://www.catonmat.net/blog/worlds-best-introduction-to-sed/ -[52]:https://www.catonmat.net/blog/sed-one-liners-explained-part-one/ -[53]:https://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/ -[54]:https://www.catonmat.net/blog/awk-one-liners-explained-part-one/ -[55]:https://catonmat.net/ -[56]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-wiki-150x150.png "Debian Linux Tutorials and Wiki" -[57]:https://www.debian.org/doc/ -[58]:https://wiki.debian.org/ -[59]:https://www.debian.org/support -[60]:http://swift.siphos.be/linux_sea/ -[61]:https://www.cyberciti.biz/media/new/tips/2011/12/orelly-150x150.png "Oreilly Free Linux / Unix / Php / Javascript / Ubuntu Books" -[62]:http://commons.oreilly.com/wiki/index.php/O%27Reilly_Commons -[63]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-guide-150x150.png "Ubuntu Book For New Users" -[64]:http://ubuntupocketguide.com/ -[65]:https://www.cyberciti.biz/media/new/tips/2011/12/rute-150x150.png "GNU/LINUX system administration free book" -[66]:https://web.archive.org/web/20160204213406/http://rute.2038bug.com/rute.html.gz -[67]:https://www.cyberciti.biz/media/new/tips/2011/12/advanced-linux-programming-150x150.png "Download Advanced Linux Programming PDF version" -[68]:https://github.com/MentorEmbedded/advancedlinuxprogramming -[69]:https://www.cyberciti.biz/media/new/tips/2011/12/lpic-150x150.png "Download Linux Professional Institute Certification PDF Book" -[70]:http://academy.delmar.edu/Courses/ITSC1358/eBooks/LPI-101.LinuxTrainingCourseNotes.pdf -[71]://www.cyberciti.biz/faq/top5-linux-video-editing-system-software/ -[72]:https://www.cyberciti.biz/media/new/tips/2011/12/floss-manuals.png "Download manuals about free and open source software" -[73]:https://flossmanuals.net/ -[74]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-starter-150x150.png "New to Linux? Start Linux starter book [ PDF version ]" -[75]:http://www.tuxradar.com/linuxstarterpack -[76]:https://linux.com -[77]:https://lwn.net/ -[78]:http://hints.macworld.com/ -[79]:https://developer.apple.com/library/mac/navigation/ -[80]:https://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html -[81]:https://support.apple.com/kb/index?page=search&locale=en_US&q= -[82]:https://www.netbsd.org/docs/ -[83]:https://www.flickr.com/photos/9479603@N02/3311745151/in/set-72157614479572582/ -[84]:https://twitter.com/nixcraft -[85]:https://facebook.com/nixcraft -[86]:https://plus.google.com/+CybercitiBiz -[87]:https://wiki.centos.org/ -[88]:https://www.centos.org/forums/ -[90]: https://www.freebsd.org/docs.html -[91]: https://forums.freebsd.org/ diff --git a/translated/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md b/translated/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md new file mode 100644 index 0000000000..22306952cc --- /dev/null +++ b/translated/tech/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md @@ -0,0 +1,470 @@ +学习Linux/\*BSD/Unix操作系统的30个最佳在线文档 +====== + + +手册页是由系统管理员和IT技术开发人员写的,更多的是为了作为参考而不是教你如何使用。手册页对于已经熟悉使用Linux、Unix和BSD操作系统的人来说是非常有用的。如果你仅仅需要知道某个命令或者某个配置文件的格式那么你可以使用手册页,但是手册页对于linux新手来说并没有太大的帮助。想要通过使用手册页来学习一些新东西不是一个好的选择。这里有将提供30个学习Linux和Unix操作系统的最佳在线网页文档。 + +![Dennis Ritchie and Ken Thompson working with UNIX PDP11][1] + +需要知道的是,相对于Linux,BSD的手册页更好。 + +## #1: Red Hat Enterprise Linux + +![Red hat Enterprise Linux Docs][2] + +RHEL是由红帽公司开发的商业市场导向的的Linux发行版。红帽的文档是最好的文档之一,涵盖RHEL的基础到一些高级主题比如安全、安全增强式Linux、虚拟化、目录服务器、服务器集群、JBOSS应用程序服务器、高可用性集群等。红帽的文档已经被翻译成22种语言,发布成多页面HTML、单页面HTML、PDF、EPUB等文件格式。比较好的一点是你可以对于Centos和Scientific Linux(社区企业发行版)使用相同的文档。这些文档随操作系统一起下载提供,也就是说当你没有网络的时候,你也可以使用他们。RHEL的文档**涵盖从安装到配置器群的所有内容**。唯一的缺点是你需要成为付费用户。当然这对于企业公司来说是一件完美的事。 + + 1. RHEL 文档: [HTML/PDF格式][3] + 2. 支持论坛: 只能通过红帽公司的用户网站提交支持案例。 + + + +### 关于CentOS Wiki和论坛的说明 + +![Centos Linux Wiki][4] + +CentOS(社区企业操作系统)是由RHEL免费提供的源包免费重建的。它为个人电脑或其他用途提供了可靠的、免费的企业级Linux。你可以不用任何支持和认证费用获取RHEL的稳定版。CentOS的wiki分为如何使用、技巧还有更多的信息请访问下方链接: + + 1. [文档 wiki][87] + 2. [论坛支持][88] + +## #2: Arch的 Wiki 和 论坛 + +![Arch Linux wiki 和 教程][5] + +Arch linux 是一个独立开发的 Linux 操作系统,它有基于wiki网站形式的非常不错的文档。它是由Arch社区的一些用户共同协作开发出来的,并且允许任何用户添加或修改内容。这些文档教程被分为几类比如说[网络][6]、优化、软件包管理、系统管理、X window 系统还有获取安装 Arch 。它的[官方论坛][7]在解决许多问题的时候也非常有用。他有总共4万多个注册用户、超过1百万次提交。 wiki 包含一些 **其他Linux发行版也适用的通用信息**。 + + 1. Arch 社区文档: [Wiki][8] + 2. 是否支持论坛: [是][7] + +## #3: Gentoo Linux Wiki 和 论坛 + +![Gentoo Linux 手册 和 Wiki][9] + +Gentoo Linux 基于portage包管理系统。Gentoo Linux 用户根据他们选择的配置在本地编译源代码。多数 Gentoo Linux 用户都会定制自己独有的程序集。 Gentoo Linux 的文档会给你一些有关Gento Linux操作系统的说明和一些有关安装、软件包、网络和其他等主要出现的问题的解决方法。Gentoo有对你来说 **非常有用的论坛**,论坛中有超过13万4千的用户,总共有5442416次文章提交。 + + 1. Gentoo 社区文档: [手册][10] and [Wiki][11] + 2. 是否支持论坛: [是][12] + 3. 用户提供的文档可以在 [gentoo-wiki.com][13] 查看 + + + +## #4: Ubuntu Wiki 和 文档 + +Ubuntu 是领先的台式机和笔记本电脑发行版之一。官方文档由 Ubuntu 文档工程开发维护。你可以在从官方文档中查看大量的信息,比如如何开始使用Ubuntu的教程。这些信息中最好的一部分是和基于 Debian 的系统共同工作。你可能会找到由Ubuntu的用户们创建的社区文档,其中是有关Ubuntu的使用教程和技巧等。Ubuntu Linux 是有着网络上最大的Linux社区的操作系统。 + +![Ubuntu Linux Wiki 和 论坛][14] + + 1. Ubuntu 社区文档: [wiki][15]. + 2. Ubuntu 官方文档: [wiki][16]. + 3. 是否支持论坛: [是][17]. + + + +## #5: IBM开发者项目 + +IBM开发者项目为 Linux 程序员和系统管理员提供技术资源,其中包含数以百计的文章、教程和技巧来协助 Linux 程序员的编程工作和应用开发还有系统管理员的日常工作。 + +![IBM: Linux 程序员和系统管理员用到的技术][18] + + 1. IBM 开发者项目文档: [HTML格式][19] + 2. 是否支持论坛: [是][20]. + + + +## #6: FreeBSD 文档和手册 + +FreeBSD 的手册是由 FreeBSD 文档工程所创建的,介绍 FreeBSD 操作系统的安装、管理和一些日常使用技巧等内容。FreeBSD 的手册页通常比GNU Linux 的手册页要好一点。FreeBSD **附带有全部最新手册页的文档**。 FreeBSD 手册涵盖任何你想要的内容。手册包含一些通用 Unix 资料,这些资料同样适用于其他的 Linux 发行版。FreeBSD 官方论坛会在你遇到棘手问题时给予帮助。 + +![Freebsd Documentation][21] + + 1. FreeBSD 文档: [HTML/PDF 格式][90] + 2. 是否支持论坛: [是][91]. + + +## #7: Bash 用户的 Wiki + +![Bash 用户的 wiki][22] + +这是一个对于 bash 使用者来说非常好的资源。Bash 使用者的 wiki 是为了归纳所有类型的 GNU Bash 文档。这个项目的动力是为了提供可阅读的文档和资料来避免用户被迫一点一点阅读 Bash 的手册,有时候这是非常麻烦的。Bash 用户 Wiki 分为各个类,比如说脚本和通用资料、如何使用、代码风格、bash 命令格式和其他。 + + 1. Bash 用户教程 [wiki][23] (wiki 格式) + + + +## #8: Bash 常见问题 + +![Bash 常见问题: 一些有关 GNU/BASH 常见问题的解决方法][24] + +这是一个为bash新手设计的一个wiki。在IRC网络的 #bash 频道里有比较常见的问题集合的解决方法,这些解决方法是由频道的常规成员提供。当你遇到问题的时候不要忘了在[BashPitfalls][25]模块检索查找答案。这些常见问题的解决方法可能会倾向于Bash,或者偏向于最低标准的Bourne Shell,这决定于是谁给出的答案。大多数情况会尽力提供方便的(Bourne)和高效的(Bash,在适当情况下)的两类答案。 + + 1. Bash 常见问题 [wiki][26] 格式. + + + +## #9: 如何锻造技术 - Linux 教程 + +![如何锻造技术][27] + + +博客作者 Falko 在如何锻造技术文档上有一些非常不错的东西。这个网站提供 Linux 关于各种各样主题的教程,比如说其作为最佳服务器系列,网站将主题分为几类,比如说 web 服务器、linux 发行版、DNS 服务器、虚拟化、高可用性、电子邮件和反垃圾邮件、FTP 服务器、编程主题还有一些其他的内容。这个网站也支持德语。 + + + 1. 如何锻造技术 [html][28] 格式. + 2. 是否支持论坛: 是 + + + +## #10: OpenBSD 常见问题和文档 + +![OpenBSD 文档][29] + +OpenBSD 是另一个类Unix 计算机操作系统,它是基于伯克利软件包的。OpenBSD 是来由 NetBSD 项目分支而来。OpenBSD 因高质量的代码和文档而著名,对软件许可协议有着坚定的立场,并且强烈关注安全问题。OpenBSD 的文档分为多个主题类别,比如说安装、包管理、防火墙设置、用户管理、网络、磁盘和磁盘阵列管理等。 + + 1. OpenBSD [html][30] 格式. + 2. 是否支持论坛: 否, 但是可以通过 [邮件列表][31] 来咨询. + + + +## #11: Calomel -开源研究和参考文档 + + +这个极好的网站是专门作为开源软件和那些特别专注于 OpenBSD 的软件的文档来使用的。这是最简洁的引导网站之一,专注于高质量的内容。网站内容分为多个类,比如说 DNS、OpenBSD、安全、web 服务器、Samba 文件服务器、各种工具等。 + +![开源研究和参考文档][32] + + 1. Calomel 官网 [html][33] 格式. + 2. 是否支持论坛: 否 + + + +## #12: Slackware 书籍项目 + +![Slackware Linux 手册和文档 ][34] + +Slackware Linux 是我的第一个 Linux 发行版。Slackware 是基于 Linux 内核的最早的发行版之一,也是当前正在维护的最古老的 Linux 发行版。 这个发行版面向专注于稳定性的高级用户。 Slackware 也是很少有的的类Unix的 Linux 发行版之一。官方 slackware 手册是为了让用户快速开始了解 Slackware 操作系统的使用方法而设计的。 这不是说它将包含发行版的每一个方面,而是为了说明它的实用性和给使用者一些有关系统的基础工作使用方法。手册分为多个主题,比如说安装、网络和系统配置、系统管理、包管理等。 + + 1. Slackware [Linux 手册 html][35], pdf, 和 其他 格式. + 2. 是否支持论坛: 是 + + + +## #13: Linux 文档工程 (TLDP) + +![Linux 学习网站和文档][36] + +Linux 文档工程旨在给 Linux 操作系统提供自由开发、高质量文档。网站是由志愿者创建和维护的。网站分为具体主题的帮助、由浅入深的指南等。在此我想推荐一个非常好的[文档][37],这个文档既是一个教程也是一个 shell 脚本编程的参考文档,对于新用户来说[使用方法列表][38]也是一个不错的开始。 + + 1. Linux [文档工程][39] 支持多种查阅格式. + 2. 是否支持论坛: 否 + + + +## #14: Linux Home Networking + +![Linux Home Networking][40] + +Linux Home Networking 是学习 linux 的另一个比较好的资源,这个网站包含了 Linux 软件认证考试的内容比如 RHCE,还有一些计算机培训课程。网站包含了许多主题,比如说网络、Samba 文件服务器、无线网络、web 服务器等。 + + 1. Linux [home networking][41] 可通过 html 格式和 PDF(部分免费)格式查阅. + 2. 是否支持论坛: 是 + + + +## #15: Linux Action Show + +![Linux 播客][42] + +Linux Action Show ("LAS") 是一个关于 Linux 的资源播放平台。这个网站是由 Bryan Lunduke, Allan Jude, 和 Chris Fisher 共同发布的。它包含了 FOSS 的最新消息。网站内容主要是评论一些应用程序和 Linux 发行版。有时候也会发布一些和开源项目著名人物的采访视频。 + + 1. Linux [action show][43] 支持音频和视频格式. + 2. 是否支持论坛: 是 + + + +## #16: Commandlinefu + +Commandlinefu 列出了各个 shell 命令,这些命令可能会让你感到十分有趣和有用。对于所有命令都可以评论、讨论和投票(支持或反对)。对于所有 Unix 命令行用户来说是一个极好的资源。不要忘了查看[最佳命令][44] + +![Commandlinefu 的最优 Unix / Linux 命令][45] + + 1. [Commandlinefu][46] 支持 html 格式. + 2. 是否支持论坛: 否 + + + +## #17: Debian 管理技巧和资源 + +这个网站包含一些只和 Debian GNU/Linux 相关的主题、技巧和教程,特别是关于系统管理的有趣和有用的信息。你可以在上面贡献文章、建议和问题。提交了之后不要忘记查看[最佳文章列表][47]里有没有你的文章。 + +![Debian Linux 管理: 系统管理员技巧和教程][48] + + 1. Debian [系统管理][49] 支持 html 格式. + 2. 是否支持论坛s: 否 + + + +## #18: Catonmat - Sed 流编辑器, Awk 文本处理工具, Perl 语言教程 + +![Sed 流编辑器, Awk 文本处理工具, Perl 语言教程][50] + +这个网站是由博客作者 Peteris Krumins 维护的。主要关注命令行和 Unix 编程主题,比如说 sed 流编辑器、perl 语言、AWK 文本处理工具等。不要忘了查看 [sed 介绍][51]、sed [one liner][52] 的含义解释,还有命令行历史的[权威指南][53]和 [awk][54]的解释。 + + 1. [catonmat][55] 支持html格式. + 2. 是否支持论坛: 否 + + + +## #19: Debian GNU/Linux 文档和 Wiki + +![Debian Linux 教程和 Wiki][56] + +Debian 是另外一个基于 Linux 的操作系统,主要使用 GNU 发布的软件。Debian 因严格坚持 Unix 和自由软件的理念而著名,它也是很受欢迎并且有一定影响力的 Linux 发行版本之一。 Ubuntu 等发行版本都是基于 Debian 的。Debian 项目提供给用户一种易于访问的形式的特有文档。这个网站分为 Wiki、安装指导、常见问题、支持论坛几个模块。 + + 1. Debian GNU/Linux [文档][57] 支持 html 和其他格式访问. + 2. Debian GNU/Linux [wiki][58] + 3. 是否支持论坛: [是][59] + + + +## #20: Linux Sea + +Linux Sea 这本书提供了比较通俗易懂但充满技术(从最终用户角度来看)的 Linux 操作系统的介绍,使用 Gentoo Linux 作为例子。它既没有谈论Linux内核或Linux发行版的历史,也没有谈到 Linux 用户不那么感兴趣的细节。 + + 1. Linux [sea][60] 支持 html 格式访问. + 2. 是否支持论坛: 否 + + + +## #21: Oreilly Commons + +![免费 Linux / Unix / Php / Javascript / Ubuntu 学习笔记][61] + +Oreilly 出版社发布了不少 wiki 格式的文章。这个网站主要是为了给那些喜欢创作、参考、使用、修改、更新和修订 OReilly上面或者其他来源的材料的社区提供资料。这个网站包含关于 Ubuntu、PHP、Spamassassin、Linux 等的免费书籍。 + + 1. Oreilly [commons][62] 支持 Wiki 格式. + 2. 是否支持论坛: 否 + + + +## #22: Ubuntu 袖珍指南 + +![Ubuntu 新手书籍][63] + +这本书的作者是 Keir Thomas。这本指南或者说是书籍对于所有 ubuntu 用户来说都值得一读。这本书旨在向用户介绍 Ubuntu 操作系统和支撑的理念。你可以从官网下载这本书的 PDF 版本,也可以在亚马逊买印刷版。 + + 1. Ubuntu [pocket guide][64] 支持 PDF 和印刷版本. + 2. 是否支持论坛: 否 + + + +## #23: Linux: Rute User's Tutorial and Exposition + +![GNU/LINUX system administration book][65] + + +这本书讲述了 GNU/LINUX 系统管理,主要是对主流的发布版本比如红帽和 Debian 的说明,作为新用户的教程和高级管理员的参考。这本书旨在给出 Unix 系统的每个面的简明彻底的解释和实践性的例子。想要全面了解LINUX的人都不需要再看了 - 这里没有涉及的内容。 + + 1. Linux: [Rute User's Tutorial and Exposition][66] 支持印刷版和 html 格式. + 2. 是否支持论坛: 否 + + + +## #24: 高级 Linux 编程 + +![高级 Linux 编程][67] + +这本书是写给那些已经熟悉了C语言编程的程序员的。这本书采取一种教程式的方式来讲述大多数在 GNU/Linux 系统应用编程中重要的概念和功能特性。如果你是一个已经对 GNU/Linux 系统编程有一定经验的开发者,或者是对其他类Unix系统编程有一定经验的开发者,或者对 GNU/Linux 软件开发有兴趣,或者想要从非Unix系统环境转换到 Unix 平台并且已经熟悉了优秀软件的开发原则,那你很适合读这本书。另外,你会发现这本书同样适合于 C 和 C++编程。 + + 1. [高级 Linux 编程][68] 支持印刷版和 PDF 格式. + 2. 是否支持论坛: 否 + + + +## #25: LPI 101 Course Notes + +![Linux 国际专业协会认证书籍][69] + +LPIC 1、2、3级是用于 Linux 系统管理员认证的。这个网站提供了 LPI 101 和 LPI 102 的测试训练。这些是根据 GNU自有文档协议 发布的。这些课程材料基于Linux 国际专业协会的 LPI 101 和 102 考试的目的。这个课程是为了提供给你一些必备的 Linux 系统的操作和管理的技能。 + + + 1. 下载 LPI [训练手册][70] 支持 PDF 格式. + 2. 是否支持论坛: 否 + + + +## #26: FOSS 手册 + +FLOSS手册是一系列关于免费和开源软件以及用于创建它们的工具和使用这些工具的社区的手册。社区的成员包含作者、编辑、设计师、软件开发者、积极分子等。这些手册中说明了怎样安装使用一些免费开源软件,如何操作(比如设计和维持在线安全)开源软件,这其中也包含如何使用或支持免费软件和格式的免费文化服务的手册。你也会发现关于一些像 VLC, [Linux video editing][71], Linux, OLPC / SUGAR, GRAPHICS 等软件的手册。 + +![FLOSS Manuals is a collection of manuals about free and open source software][72] + + 1. 你可以浏览 [FOSS 手册][73] 支持 Wiki 格式. + 2. 是否支持论坛: 否 + + + +## #27: Linux 入门包 + +![Linux 入门包][74] + +刚接触 Linux 这个美好世界?想找一个简单的入门方式?你可以下载一个130页的指南来掌握系统。这个指南会向你展示如何在你的个人电脑上安装 Linux,如何浏览桌面,掌握最主流行的 Linux 程序和修复可能出现的问题的方法。 + + 1. 下载 [Linux 入门包][75] 支持 PDF 格式. + 2. 是否支持论坛: f否 + + + +## #28: Linux.com - Linux 信息来源 + +Linux.com 是Linux基金会的一个产品。这个网站上提供一些新闻、指南、教程和一些关于Linux的其他信息。利用全球 Linux 用户的力量来通知、写作、连接 Linux 的事务。 + + 1. 在线访问 [Linux.com][76] . + 2. 是否支持论坛: 是 + + + +## #29: LWN + +LWN 是一个注重Linux和其他类Unix操作系统免费软件的网站。这个网站有周刊、每日小故事碎片和对小故事线索的讨论。该网站提供有关Linux和FOSS相关的开发,法律,商业和安全问题的全面报道。 + + 1. 在线访问 [lwn.net][77]. + 2. 是否支持论坛: 否 + + + +## #30: Mac OS X 相关网站 + +与Mac OS X相关网站的快速链接: + + * [Mac OS X 提示][78] - 这个网站专用于苹果的 Mac OS X Unix 操作系统。网站有很多有关 Bash 和 Mac OS X 的使用建议、技巧和教程 + + * [Mac OS 开发库][79] - 苹果拥有和 OS X 开发相关的优秀系列。不要忘了看一看 [bash shell 脚本入门][80]. + + * [Apple 知识库][81] - 这个有点像红帽网络公司的知识库。这个网站提供了所有苹果产品包括 OS X 相关的指南和故障报修建议。 + + + +## #30: NetBSD + +NetBSD 是另一个基于伯克利软件包 Unix 操作系统的免费开源操作系统。NetBSD 项目专注于系统的高质量设计、稳定性和性能。由于 NetBSD 的可移植性和伯克利类的协议,NetBSD 常用于嵌入式系统。这个网站提供了一些 NetBSD 官方文档和各种第三方文档 的链接。 + + 1. 在线访问 [netbsd][82] 文档,支持 html、PDF 格式. + 2. 是否支持论坛: 否 + + + +## 你要做的事: + +这是我的个人列表,这可能并不完全是权威的,因此如果你有你自己喜欢的独特 Unix/Linux 网站,可以在下方参与评论分享。 + +// 图片来源: [Flickr photo][83] by PanelSwitchman. 一些连接是用户在我们的Facebook粉丝页面上建议添加的。 + +// 对于那些庆祝的人,圣诞快乐! 对于其他人来说,享受周末。 + +## 关于作者 + + +作者是nixCraft的创建者和经验丰富的系统管理员以及Linux操作系统/ Unix shell脚本的培训师。他曾与全球客户及各行各业合作,包括IT,教育,国防和空间研究以及一些非营利部门。可以关注作者的[Twitter][84], [Facebook][85], [Google+][86]。 + +-------------------------------------------------------------------------------- + +来源: https://www.cyberciti.biz/tips/linux-unix-bsd-documentations.html + +作者:[Vivek Gite][a] +译者:[ScarboroughCoral](https://github.com/ScarboroughCoral) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.cyberciti.biz +[1]:https://www.cyberciti.biz/media/new/tips/2011/12/unix-pdp11.jpg "Dennis Ritchie and Ken Thompson working with UNIX PDP11" +[2]:https://www.cyberciti.biz/media/new/tips/2011/12/redhat-enterprise-linux-docs-150x150.png "Red hat Enterprise Linux Docs" +[3]:https://access.redhat.com/documentation/en-us/ +[4]:https://www.cyberciti.biz/media/new/tips/2011/12/centos-linux-wiki-150x150.png "Centos Linux Wiki, Support, Documents" +[5]:https://www.cyberciti.biz/media/new/tips/2011/12/arch-linux-wiki-150x150.png "Arch Linux wiki and tutorials " +[6]:https://wiki.archlinux.org/index.php/Category:Networking_%28English%29 +[7]:https://bbs.archlinux.org/ +[8]:https://wiki.archlinux.org/ +[9]:https://www.cyberciti.biz/media/new/tips/2011/12/gentoo-linux-wiki1-150x150.png "Gentoo Linux Handbook and Wiki" +[10]:http://www.gentoo.org/doc/en/handbook/ +[11]:https://wiki.gentoo.org +[12]:https://forums.gentoo.org/ +[13]:http://gentoo-wiki.com +[14]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-linux-wiki.png "Ubuntu Linux Wiki and Forums" +[15]:https://help.ubuntu.com/community +[16]:https://help.ubuntu.com/ +[17]:https://ubuntuforums.org/ +[18]:https://www.cyberciti.biz/media/new/tips/2011/12/ibm-devel.png "IBM: Technical for Linux programmers and system administrators" +[19]:https://www.ibm.com/developerworks/learn/linux/index.html +[20]:https://www.ibm.com/developerworks/community/forums/html/public?lang=en +[21]:https://www.cyberciti.biz/media/new/tips/2011/12/freebsd-docs.png "Freebsd Documentation" +[22]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-hackers-wiki-150x150.png "Bash hackers wiki for bash users" +[23]:http://wiki.bash-hackers.org/doku.php +[24]:https://www.cyberciti.biz/media/new/tips/2011/12/bash-faq-150x150.png "Bash FAQ: Answers to frequently asked questions about GNU/BASH" +[25]:http://mywiki.wooledge.org/BashPitfalls +[26]:https://mywiki.wooledge.org/BashFAQ +[27]:https://www.cyberciti.biz/media/new/tips/2011/12/howtoforge-150x150.png "Howtoforge tutorials" +[28]:https://howtoforge.com/ +[29]:https://www.cyberciti.biz/media/new/tips/2011/12/openbsd-faq-150x150.png "OpenBSD Documenation" +[30]:https://www.openbsd.org/faq/index.html +[31]:https://www.openbsd.org/mail.html +[32]:https://www.cyberciti.biz/media/new/tips/2011/12/calomel_org.png "Open Source Research and Reference Documentation" +[33]:https://calomel.org +[34]:https://www.cyberciti.biz/media/new/tips/2011/12/slackware-linux-book-150x150.png "Slackware Linux Book and Documentation " +[35]:http://www.slackbook.org/ +[36]:https://www.cyberciti.biz/media/new/tips/2011/12/tldp-150x150.png "Linux Learning Site and Documentation " +[37]:http://tldp.org/LDP/abs/html/index.html +[38]:http://tldp.org/HOWTO/HOWTO-INDEX/howtos.html +[39]:http://tldp.org/ +[40]:https://www.cyberciti.biz/media/new/tips/2011/12/linuxhomenetworking-150x150.png "Linux Home Networking " +[41]:http://www.linuxhomenetworking.com/ +[42]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-action-show-150x150.png "Linux Podcast " +[43]:http://www.jupiterbroadcasting.com/show/linuxactionshow/ +[44]:https://www.commandlinefu.com/commands/browse/sort-by-votes +[45]:https://www.cyberciti.biz/media/new/tips/2011/12/commandlinefu.png "The best Unix / Linux Commands " +[46]:https://commandlinefu.com/ +[47]:https://www.debian-administration.org/hof +[48]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-admin.png "Debian Linux Adminstration: Tips and Tutorial For Sys Admin" +[49]:https://www.debian-administration.org/ +[50]:https://www.cyberciti.biz/media/new/tips/2011/12/catonmat-150x150.png "Sed, Awk, Perl Tutorials" +[51]:http://www.catonmat.net/blog/worlds-best-introduction-to-sed/ +[52]:https://www.catonmat.net/blog/sed-one-liners-explained-part-one/ +[53]:https://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/ +[54]:https://www.catonmat.net/blog/awk-one-liners-explained-part-one/ +[55]:https://catonmat.net/ +[56]:https://www.cyberciti.biz/media/new/tips/2011/12/debian-wiki-150x150.png "Debian Linux Tutorials and Wiki" +[57]:https://www.debian.org/doc/ +[58]:https://wiki.debian.org/ +[59]:https://www.debian.org/support +[60]:http://swift.siphos.be/linux_sea/ +[61]:https://www.cyberciti.biz/media/new/tips/2011/12/orelly-150x150.png "Oreilly Free Linux / Unix / Php / Javascript / Ubuntu Books" +[62]:http://commons.oreilly.com/wiki/index.php/O%27Reilly_Commons +[63]:https://www.cyberciti.biz/media/new/tips/2011/12/ubuntu-guide-150x150.png "Ubuntu Book For New Users" +[64]:http://ubuntupocketguide.com/ +[65]:https://www.cyberciti.biz/media/new/tips/2011/12/rute-150x150.png "GNU/LINUX system administration free book" +[66]:https://web.archive.org/web/20160204213406/http://rute.2038bug.com/rute.html.gz +[67]:https://www.cyberciti.biz/media/new/tips/2011/12/advanced-linux-programming-150x150.png "Download Advanced Linux Programming PDF version" +[68]:https://github.com/MentorEmbedded/advancedlinuxprogramming +[69]:https://www.cyberciti.biz/media/new/tips/2011/12/lpic-150x150.png "Download Linux Professional Institute Certification PDF Book" +[70]:http://academy.delmar.edu/Courses/ITSC1358/eBooks/LPI-101.LinuxTrainingCourseNotes.pdf +[71]://www.cyberciti.biz/faq/top5-linux-video-editing-system-software/ +[72]:https://www.cyberciti.biz/media/new/tips/2011/12/floss-manuals.png "Download manuals about free and open source software" +[73]:https://flossmanuals.net/ +[74]:https://www.cyberciti.biz/media/new/tips/2011/12/linux-starter-150x150.png "New to Linux? Start Linux starter book [ PDF version ]" +[75]:http://www.tuxradar.com/linuxstarterpack +[76]:https://linux.com +[77]:https://lwn.net/ +[78]:http://hints.macworld.com/ +[79]:https://developer.apple.com/library/mac/navigation/ +[80]:https://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html +[81]:https://support.apple.com/kb/index?page=search&locale=en_US&q= +[82]:https://www.netbsd.org/docs/ +[83]:https://www.flickr.com/photos/9479603@N02/3311745151/in/set-72157614479572582/ +[84]:https://twitter.com/nixcraft +[85]:https://facebook.com/nixcraft +[86]:https://plus.google.com/+CybercitiBiz +[87]:https://wiki.centos.org/ +[88]:https://www.centos.org/forums/ +[90]: https://www.freebsd.org/docs.html +[91]: https://forums.freebsd.org/ From 7a3bbb180ebfd3f236fb5b7aee4d007bc893d38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Mon, 3 Dec 2018 00:16:10 +0800 Subject: [PATCH 021/135] Top 30 OpenStack Interview Questions and Answers : ScarboroughCoral translating! (#11454) * Create 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Delete 20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md * Update 20181107 Top 30 OpenStack Interview Questions and Answers.md --- ...0181107 Top 30 OpenStack Interview Questions and Answers.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md b/sources/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md index e00fc5452b..dc5411f1fa 100644 --- a/sources/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md +++ b/sources/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md @@ -1,3 +1,6 @@ +ScarboroughCoral translating! + + Top 30 OpenStack Interview Questions and Answers ====== Now a days most of the firms are trying to migrate their IT infrastructure and Telco Infra into private cloud i.e OpenStack. If you planning to give interviews on Openstack admin profile, then below list of interview questions might help you to crack the interview. From f43d4adc31cebaf36deddc16a7ee1e3068e524a9 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Sun, 2 Dec 2018 17:00:20 +0000 Subject: [PATCH 022/135] Revert "Update 20170921 The Rise and Rise of JSON.md" This reverts commit 3b8aea8f79b0fbbedd7b80f39c434bbbffc628ae. --- sources/talk/20170921 The Rise and Rise of JSON.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md index 4f09aa1ddf..84a594c89a 100644 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ b/sources/talk/20170921 The Rise and Rise of JSON.md @@ -1,5 +1,3 @@ -thecyanbird translating - The Rise and Rise of JSON ====== JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format. From 3facfbddd9b45bb7a95e37bdbf10a007280ae5a9 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Sun, 2 Dec 2018 17:00:32 +0000 Subject: [PATCH 023/135] Revert "Update 20181004 4 Must-Have Tools for Monitoring Linux.md" This reverts commit 4c8731f559e616a58040363fb7300533d5af24e3. --- sources/tech/20181004 4 Must-Have Tools for Monitoring Linux.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/tech/20181004 4 Must-Have Tools for Monitoring Linux.md b/sources/tech/20181004 4 Must-Have Tools for Monitoring Linux.md index 987809aa0d..beb3bab797 100644 --- a/sources/tech/20181004 4 Must-Have Tools for Monitoring Linux.md +++ b/sources/tech/20181004 4 Must-Have Tools for Monitoring Linux.md @@ -1,5 +1,3 @@ -### translating by way-ww - 4 Must-Have Tools for Monitoring Linux ====== From ebb71757db053166c23ae9c481d34c16c5e2954a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 3 Dec 2018 08:54:43 +0800 Subject: [PATCH 024/135] translated --- ...efox extensions to protect your privacy.md | 56 ----------------- ...efox extensions to protect your privacy.md | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 56 deletions(-) delete mode 100644 sources/tech/20180709 5 Firefox extensions to protect your privacy.md create mode 100644 translated/tech/20180709 5 Firefox extensions to protect your privacy.md diff --git a/sources/tech/20180709 5 Firefox extensions to protect your privacy.md b/sources/tech/20180709 5 Firefox extensions to protect your privacy.md deleted file mode 100644 index 821769aa2c..0000000000 --- a/sources/tech/20180709 5 Firefox extensions to protect your privacy.md +++ /dev/null @@ -1,56 +0,0 @@ -translating---geekpi - -5 Firefox extensions to protect your privacy -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/biz_cinderblock_cloud_yellowhat.jpg?itok=sJdlsYTF) - -In the wake of the Cambridge Analytica story, I took a hard look at how far I had let Facebook penetrate my online presence. As I'm generally concerned about single points of failure (or compromise), I am not one to use social logins. I use a password manager and create unique logins for every site (and you should, too). - -What I was most perturbed about was the pervasive intrusion Facebook was having on my digital life. I uninstalled the Facebook mobile app almost immediately after diving into the Cambridge Analytica story. I also [disconnected all apps, games, and websites][1] from Facebook. Yes, this will change your experience on Facebook, but it will also protect your privacy. As a veteran with friends spread out across the globe, maintaining the social connectivity of Facebook is important to me. - -I went about the task of scrutinizing other services as well. I checked Google, Twitter, GitHub, and more for any unused connected applications. But I know that's not enough. I need my browser to be proactive in preventing behavior that violates my privacy. I began the task of figuring out how best to do that. Sure, I can lock down a browser, but I need to make the sites and tools I use work while trying to keep them from leaking data. - -Following are five tools that will protect your privacy while using your browser. The first three extensions are available for Firefox and Chrome, while the latter two are only available for Firefox. - -### Privacy Badger - -[Privacy Badger][2] has been my go-to extension for quite some time. Do other content or ad blockers do a better job? Maybe. The problem with a lot of content blockers is that they are "pay for play." Meaning they have "partners" that get whitelisted for a fee. That is the antithesis of why content blockers exist. Privacy Badger is made by the Electronic Frontier Foundation (EFF), a nonprofit entity with a donation-based business model. Privacy Badger promises to learn from your browsing habits and requires minimal tuning. For example, I have only had to whitelist a handful of sites. Privacy Badger also allows granular controls of exactly which trackers are enabled on what sites. It's my #1, must-install extension, no matter the browser. - -### DuckDuckGo Privacy Essentials - -The search engine DuckDuckGo has typically been privacy-conscious. [DuckDuckGo Privacy Essentials][3] works across major mobile devices and browsers. It's unique in the sense that it grades sites based on the settings you give them. For example, Facebook gets a D, even with Privacy Protection enabled. Meanwhile, [chrisshort.net][4] gets a B with Privacy Protection enabled and a C with it disabled. If you're not keen on EFF or Privacy Badger for whatever reason, I would recommend DuckDuckGo Privacy Essentials (choose one, not both, as they essentially do the same thing). - -### HTTPS Everywhere - -[HTTPS Everywhere][5] is another extension from the EFF. According to HTTPS Everywhere, "Many sites on the web offer some limited support for encryption over HTTPS, but make it difficult to use. For instance, they may default to unencrypted HTTP or fill encrypted pages with links that go back to the unencrypted site. The HTTPS Everywhere extension fixes these problems by using clever technology to rewrite requests to these sites to HTTPS." While a lot of sites and browsers are getting better about implementing HTTPS, there are a lot of sites that still need help. HTTPS Everywhere will try its best to make sure your traffic is encrypted. - -### NoScript Security Suite - -[NoScript Security Suite][6] is not for the faint of heart. While the Firefox-only extension "allows JavaScript, Java, Flash, and other plugins to be executed only by trusted websites of your choice," it doesn't do a great job at figuring out what your choices are. But, make no mistake, a surefire way to prevent leaking data is not executing code that could leak it. NoScript enables that via its "whitelist-based preemptive script blocking." This means you will need to build the whitelist as you go for sites not already on it. Note that NoScript is only available for Firefox. - -### Facebook Container - -[Facebook Container][7] makes Firefox the only browser where I will use Facebook. "Facebook Container works by isolating your Facebook identity into a separate container that makes it harder for Facebook to track your visits to other websites with third-party cookies." This means Facebook cannot snoop on activity happening elsewhere in your browser. Suddenly those creepy ads will stop appearing so frequently (assuming you uninstalled the Facebook app from your mobile devices). Using Facebook in an isolated space will prevent any additional collection of data. Remember, you've given Facebook data already, and Facebook Container can't prevent that data from being shared. - -These are my go-to extensions for browser privacy. What are yours? Please share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/firefox-extensions-protect-privacy - -作者:[Chris Short][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/chrisshort -[1]:https://www.facebook.com/help/211829542181913 -[2]:https://www.eff.org/privacybadger -[3]:https://duckduckgo.com/app -[4]:https://chrisshort.net -[5]:https://www.eff.org/https-everywhere -[6]:https://noscript.net/ -[7]:https://addons.mozilla.org/en-US/firefox/addon/facebook-container/ diff --git a/translated/tech/20180709 5 Firefox extensions to protect your privacy.md b/translated/tech/20180709 5 Firefox extensions to protect your privacy.md new file mode 100644 index 0000000000..972228d9e5 --- /dev/null +++ b/translated/tech/20180709 5 Firefox extensions to protect your privacy.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (5 Firefox extensions to protect your privacy) +[#]: via: (https://opensource.com/article/18/7/firefox-extensions-protect-privacy) +[#]: author: ([Chris Short](https://opensource.com/users/chrisshort) +[#]: url: ( ) + +5 个保护你隐私的 Firefox 扩展 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/biz_cinderblock_cloud_yellowhat.jpg?itok=sJdlsYTF) + +在剑桥分析公司这件事后,我仔细研究了我让 Facebook 渗透到我的网络生活的程度。由于我一般担心单点故障,我不是一个使用社交登录的人。我使用密码管理器为每个站点创建唯一的登录(你也应该这样做)。 + +我最担心的 Facebook 对我的数字生活的普遍侵扰。在深入了解剑桥分析公司这件事后,我几乎立即卸载了 Facebook 的移动程序。我还从 Facebook [取消连接了所有应用、游戏和网站][1]。是的,这将改变你在 Facebook 上的体验,但它也将保护您的隐私。作为一名有遍布全球朋友的人,保持 Facebook 的社交连接对我来说非常重要。 + +我还仔细审查了其他服务。我检查了 Google、Twitter、GitHub 以及任何未使用的连接应用。但我知道这还不够。我需要我的浏览器主动防止侵犯我隐私的行为。我开始研究如何做到最好。当然,我可以锁定浏览器,但是我需要使我用的网站和工具正常使用,同时试图防止它们泄露数据。 + +以下是五种可在使用浏览器时保护你隐私的工具。前三个扩展可用于 Firefox 和 Chrome,而后两个仅适用于 Firefox。 + +### Privacy Badger + +我已经使用 [Privacy Badger][2] 有一段时间了。其他内容或广告拦截器做得更好吗?也许。很多内容拦截器的问题在于它们“付费显示”。这意味着他们有收费的“合作伙伴”白名单。这就站在了为什么存在内容拦截器的对立面。Privacy Badger 是由电子前沿基金会 (EFF) 制作的,这是一家以捐赠为基础的商业模式的非营利实体。Privacy Badger 承诺从你的浏览习惯中学习,并且很少需要调整。例如,我只需将一些网站列入白名单。Privacy Badger 允许精确控制在哪些站点上启用哪些跟踪器。这是我的第一个无论在哪个浏览器必须安装的扩展。 + +### DuckDuckGo Privacy Essentials + +搜索引擎 DuckDuckGo 通常有隐私意识。[DuckDuckGo Privacy Essentials][3] 适用于主流的移动设备和浏览器。它的独特之处在于它根据你提供的设置对网站进行评分。例如,即使启用了隐私保护,Facebook 也会获得 D。同时,[chrisshort.net][4] 在启用隐私保护时获得 B 和禁用时获得 C。如果你因任何原因不喜欢于 EFF 或 Privacy Badger,我会推荐 DuckDuckGo Privacy Essentials(选择一个,而不是两个,因为它们基本上做同样的事情)。 + +### HTTPS Everywhere + +[HTTPS Everywhere][5] 是 EFF 的另一个扩展。根据 HTTPS Everywhere 的说法,“网络上的许多网站都通过 HTTPS 提供一些有限的加密支持,但使它难以使用。例如,它们可能默认为未加密的 HTTP 或在加密的页面里面使用返回到未加密站点的链接。HTTPS Everywhere 扩展通过使用聪明的技术将对这些站点的请求重写为 HTTPS 来解决这些问题。“虽然许多网站和浏览器在实施 HTTPS 方面越来越好,但仍有很多网站仍需要帮助。HTTPS Everywhere 将尽力确保你的流量已加密。 + +### NoScript Security Suite + +[NoScript Security Suite][6] 不适合胆小的人。虽然这个 Firefox 独有扩展“允许 JavaScript、Java、Flash 和其他插件只能由你选择的受信任网站执行”,但它并不能很好地确定你的选择。但是,毫无疑问,防止泄漏数据的可靠方法是不执行可能会泄露数据的代码。NoScript 通过其“基于白名单的抢占式脚本阻止”实现了这一点。这意味着你需要为尚未加入白名单的网站构建白名单。请注意,NoScript 仅适用于 Firefox。 + +### Facebook Container + +Facebook Container][7] 使 Firefox 成为我在使用 Facebook 时的唯一浏览器。 “Facebook Container 的工作原理是将你的 Facebook 身份隔离到一个单独的容器中,这使得 Facebook 更难以使用第三方 Cookie 跟踪你访问其他网站。” 这意味着 Facebook 无法窥探浏览器中其他地方发生的活动。 突然间,这些令人毛骨悚然的广告将停止频繁出现(假设你在移动设备上卸载了 Facebook 应用)。 在隔离的空间中使用 Facebook 将阻止任何额外的数据收集。 请记住,你已经提供了 Facebook 数据,而 Facebook Container 无法阻止这些数据被共享。 + +这些是我浏览器隐私的首选扩展。 你的是什么? 请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/firefox-extensions-protect-privacy + +作者:[Chris Short][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/chrisshort +[1]:https://www.facebook.com/help/211829542181913 +[2]:https://www.eff.org/privacybadger +[3]:https://duckduckgo.com/app +[4]:https://chrisshort.net +[5]:https://www.eff.org/https-everywhere +[6]:https://noscript.net/ +[7]:https://addons.mozilla.org/en-US/firefox/addon/facebook-container/ \ No newline at end of file From e11f61086461575433ad1111a600d6a80ee0fd92 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 3 Dec 2018 09:00:48 +0800 Subject: [PATCH 025/135] translatng --- .../tech/20181128 Standalone web applications with GNOME Web.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181128 Standalone web applications with GNOME Web.md b/sources/tech/20181128 Standalone web applications with GNOME Web.md index 4dd635f8b2..eda28159de 100644 --- a/sources/tech/20181128 Standalone web applications with GNOME Web.md +++ b/sources/tech/20181128 Standalone web applications with GNOME Web.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Standalone web applications with GNOME Web) From 5560d8c073d7b32c8aca4c91f77aed421fb5cad0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 10:07:18 +0800 Subject: [PATCH 026/135] PRF:20181004 Archiving web sites.md @fuowang --- .../tech/20181004 Archiving web sites.md | 63 +++++++++---------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/translated/tech/20181004 Archiving web sites.md b/translated/tech/20181004 Archiving web sites.md index cca9ce3a09..04890b0cba 100644 --- a/translated/tech/20181004 Archiving web sites.md +++ b/translated/tech/20181004 Archiving web sites.md @@ -1,72 +1,69 @@ -存档网站 +对网站进行归档 ====== -我最近深入研究了网站存档,因为有些朋友担心遇到糟糕的系统管理或恶意入侵时失去对在线托管的工作的控制。这使得网站存档成为任意系统管理员工具箱中的重要工具。事实证明,有些网站比其他网站更难存档。本文介绍了对传统网站进行存档的过程,并阐述在面对最新流行的单页面应用程序的现代网站时,它有哪些不足。 +我最近深入研究了网站归档,因为有些朋友担心遇到糟糕的系统管理或恶意删除时失去对放在网上的内容的控制权。这使得网站归档成为系统管理员工具箱中的重要工具。事实证明,有些网站比其他网站更难归档。本文介绍了对传统网站进行归档的过程,并阐述在面对最新流行单页面应用程序(SPA)的现代网站时,它有哪些不足。 ### 转换为简单网站 -手动开发 HTML 网站的日子早已不复存在。现在的网站是动态的,并使用最新的 JavaScript,PHP 或 Python 框架即时构建。结果,这些网站更加脆弱:数据库崩溃,升级出错或者未修复的漏洞都可能使数据丢失。在我以前是一名 Web 开发人员时,我不得不接受客户希望网站基本上可以永久工作的想法。这种期望与 web 开发“快速行动和破除陈规”的理念不相符。在这方面,使用 [Drupal][2] 内容管理系统(CMS)尤其具有挑战性,因为重大更新会破坏与第三方模块的兼容性,这意味着客户很少承担的起高昂的升级成本。解决方案是将这些网站存档:以实时动态的网站为基础,将其转换为任何 web 服务器可以永久服务的纯 HTML 文件。此过程对你自己的动态网站非常有用,也适用于你想保护但无法控制的第三方网站。 +手动编码 HTML 网站的日子早已不复存在。现在的网站是动态的,并使用最新的 JavaScript、PHP 或 Python 框架即时构建。结果,这些网站更加脆弱:数据库崩溃、升级出错或者未修复的漏洞都可能使数据丢失。在我以前是一名 Web 开发人员时,我不得不接受客户这样的想法:希望网站基本上可以永久工作。这种期望与 web 开发“快速行动和破除陈规”的理念不相符。在这方面,使用 [Drupal][2] 内容管理系统(CMS)尤其具有挑战性,因为重大更新会破坏与第三方模块的兼容性,这意味着客户很少承担的起高昂的升级成本。解决方案是将这些网站归档:以实时动态的网站为基础,将其转换为任何 web 服务器可以永久服务的纯 HTML 文件。此过程对你自己的动态网站非常有用,也适用于你想保护但无法控制的第三方网站。 -对于简单的静态网站,古老的 [Wget][3] 程序就可以胜任。然而,镜像保存一个完整页面的方法,虽然复杂但很固定: +对于简单的静态网站,古老的 [Wget][3] 程序就可以胜任。然而镜像保存一个完整网站的命令却是错综复杂的: ``` - $ nice wget --mirror --execute robots=off --no-verbose --convert-links \ - --backup-converted --page-requisites --adjust-extension \ - --base=./ --directory-prefix=./ --span-hosts \ - --domains=www.example.com,example.com http://www.example.com/ - +$ nice wget --mirror --execute robots=off --no-verbose --convert-links \ + --backup-converted --page-requisites --adjust-extension \ + --base=./ --directory-prefix=./ --span-hosts \ + --domains=www.example.com,example.com http://www.example.com/ ``` -以上命令下载了网页的内容,但也抓取了指定域名中的所有内容。在对你喜欢的网站执行此操作之前,请考虑此类抓取可能对网站产生的影响。上面的命令故意忽略了 `robots.txt` 规则,就像现在[档案管理者的习惯做法][4],并尽可能快的存档网站。大多数抓取工具都可以选择点击暂停并限制带宽使用,以避免使网站瘫痪。 +以上命令下载了网页的内容,也抓取了指定域名中的所有内容。在对你喜欢的网站执行此操作之前,请考虑此类抓取可能对网站产生的影响。上面的命令故意忽略了 `robots.txt` 规则,就像现在[归档者的习惯做法][4],并以尽可能快的速度归档网站。大多数抓取工具都可以选择在两次抓取间暂停并限制带宽使用,以避免使网站瘫痪。 -上面的命令还将获取 “page requisites(译者注:单页面所需的所有元素)”,像样式表(CSS),图像和脚本等。下载的页面内容将会被修改,以便链接也指向本地副本。任意 web 服务器均可托管生成的文件集,从而生成原始网站的静态副本。 +上面的命令还将获取 “页面所需(LCTT 译注:单页面所需的所有元素)”,如样式表(CSS)、图像和脚本等。下载的页面内容将会被修改,以便链接也指向本地副本。任何 web 服务器均可托管生成的文件集,从而生成原始网站的静态副本。 -以上所述是事情一切顺利的时候。任意使用过计算机的人都知道事情的进展很少如计划那样;各种各样的事情可以使程序以有趣的方式脱离正规。比如,在网站上有一个日历块很流行。内容管理系统会动态生成这些内容,这会使爬虫程序陷入死循环以尝试检索所有页面。灵巧的存档者可以使用正则表达式(例如 Wget 有一个 `--reject-regex` 选项)来忽略有问题的资源。如果可以访问网站的管理界面,另一个方法是禁用日历、登录表单、评论表单和其他动态区域。一旦网站变成静态的,(那些动态区域)也肯定会停止工作,因此从原始网站中移除这些杂乱的东西也不是全无意义。 +以上所述是事情一切顺利的时候。任何使用过计算机的人都知道事情的进展很少如计划那样;各种各样的事情可以使程序以有趣的方式脱离正轨。比如,在网站上有一段时间很流行日历块。内容管理系统会动态生成这些内容,这会使爬虫程序陷入死循环以尝试检索所有页面。灵巧的归档者可以使用正则表达式(例如 Wget 有一个 `--reject-regex` 选项)来忽略有问题的资源。如果可以访问网站的管理界面,另一个方法是禁用日历、登录表单、评论表单和其他动态区域。一旦网站变成静态的,(那些动态区域)也肯定会停止工作,因此从原始网站中移除这些杂乱的东西也不是全无意义。 -### JavaScript 的厄运 +### JavaScript 噩梦 -很不幸,有些网站不仅仅是纯 HTML 文件构建的。比如,在单页面网站中,web 浏览器通过执行一个小的 JavaScript 程序来构建内容。像 Wget 这样的简单用户代理将难以重建这些网站的有意义的静态副本,因为它根本不支持 JavaScript。理论上,网站应该使用[渐进增强][5]技术,在不使用 JavaScript 的情况下提供内容和实现功能,但这些指示很少被遵循,因为使用 [NoScript][6] 或 [uMatrix][7] 等插件的人都很确定。 +很不幸,有些网站不仅仅是纯 HTML 文件构建的。比如,在单页面网站中,web 浏览器通过执行一个小的 JavaScript 程序来构建内容。像 Wget 这样的简单用户代理将难以重建这些网站的有意义的静态副本,因为它根本不支持 JavaScript。理论上,网站应该使用[渐进增强][5]技术,在不使用 JavaScript 的情况下提供内容和实现功能,但这些指引很少被人遵循 —— 使用过 [NoScript][6] 或 [uMatrix][7] 等插件的人都知道。 -传统的存档方法有时是最愚蠢的方式,会导致失败。在尝试为一个本地报纸网站([pamplemousse.ca][8])创建备份时,我发现 WordPress 在末尾包含 JavaScript,且添加了查询字符串(例如:`?ver=1.12.4`)。这会使提供存档服务的 web 服务器不能正确进行内容类型检测,因为其靠文件扩展名来发送正确的 `Content-Type` 头部信息。在 web 浏览器加载此类存档时,这些脚本将无法加载,导致动态网站受损。 +传统的归档方法有时会以最愚蠢的方式失败。在尝试为一个本地报纸网站([pamplemousse.ca][8])创建备份时,我发现 WordPress 在包含 的 JavaScript 末尾添加了查询字符串(例如:`?ver=1.12.4`)。这会使提供归档服务的 web 服务器不能正确进行内容类型检测,因为其靠文件扩展名来发送正确的 `Content-Type` 头部信息。在 web 浏览器加载此类归档时,这些脚本会加载失败,导致动态网站受损。 -随着 web 向使用浏览器作为虚拟机执行任意代码转化,依赖于纯 HTML 文件解析的存档方法也需要随之适应。这个问题的解决方案是在抓取时记录(以及重现)服务器提供的 HTTP 头部信息,实际上专业的档案管理者就使用这种方法。 +随着 web 向使用浏览器作为执行任意代码的虚拟机转化,依赖于纯 HTML 文件解析的归档方法也需要随之适应。这个问题的解决方案是在抓取时记录(以及重现)服务器提供的 HTTP 头部信息,实际上专业的归档者就使用这种方法。 -### 创建和显示 WARC 文件Creating and displaying WARC files +### 创建和显示 WARC 文件 -在 [Internet Archive][9] 网站,Brewster Kahle 和 Mike Burner 在 1996 年设计了 [ARC][10] (用于 "ARChive")文件格式,以提供一种聚合档案工作产生的百万个小文件的方法。该格式最终标准化为 WARC(“Web ARChive”)[规范][11],并在 2009 年作为 ISO 标准发布,2017 年修订。标准化工作由[国际互联网保护联盟][12](IIPC)领导,据维基百科称,这是一个“为共同保护未来互联网内容而建立的图书馆和国际组织”;它有美国国会图书馆和互联网档案馆等成员。后者内部在其基于 Java 的 [Heritrix crawler][13](译者注:一种爬虫程序)上使用 WARC 格式。 +在 [互联网档案馆][9]Internet Archive 网站,Brewster Kahle 和 Mike Burner 在 1996 年设计了 [ARC][10] (即 “ARChive”)文件格式,以提供一种聚合其归档工作所产生的百万个小文件的方法。该格式最终标准化为 WARC(“Web ARChive”)[规范][11],并在 2009 年作为 ISO 标准发布,2017 年修订。标准化工作由[国际互联网保护联盟][12]International Internet Preservation Consortium(IIPC)领导,据维基百科称,这是一个“*为了协调为未来而保护互联网内容的努力而成立的国际图书馆组织和其他组织*”;它的成员包括美国国会图书馆US Library of Congress和互联网档案馆等。后者在其基于 Java 的 [Heritrix crawler][13](LCTT 译注:一种爬虫程序)内部使用了 WARC 格式。 -WARC 在单个压缩文件中聚合了多种资源,像 HTTP 头部信息,文件内容,以及其他元数据。方便的是实际上 Wget 提供了 `--warc` 参数来支持 WARC 格式。不幸的是 web 浏览器不能直接显示 WARC 文件,所以为了访问存档文件,一个查看器或某些格式转换是很有必要的。我所发现的最简单的查看器是 [pywb][14],它以 Python 包的形式运行一个简单的 web 服务器提供一个像网站时光倒流机网站的界面,来浏览 WARC 文件的内容。执行以下命令将会在 `http://localhost:8080/` 地址显示 WARC 文件的内容: +WARC 在单个压缩文件中聚合了多种资源,像 HTTP 头部信息、文件内容,以及其他元数据。方便的是,Wget 实际上提供了 `--warc` 参数来支持 WARC 格式。不幸的是,web 浏览器不能直接显示 WARC 文件,所以为了访问归档文件,一个查看器或某些格式转换是很有必要的。我所发现的最简单的查看器是 [pywb][14],它以 Python 包的形式运行一个简单的 web 服务器提供一个像“时光倒流机网站Wayback Machine”的界面,来浏览 WARC 文件的内容。执行以下命令将会在 `http://localhost:8080/` 地址显示 WARC 文件的内容: ``` - $ pip install pywb - $ wb-manager init example - $ wb-manager add example crawl.warc.gz - $ wayback - +$ pip install pywb +$ wb-manager init example +$ wb-manager add example crawl.warc.gz +$ wayback ``` 顺便说一句,这个工具是由 [Webrecorder][15] 服务提供者建立的,Webrecoder 服务可以使用 web 浏览器保存动态页面的内容。 -很不幸,pywb 无法加载 Wget 生成的 WARC 文件,因为它[遵循][16][不一致的 1.0 规范][17],[1.1 规范修复了此问题][17]。就算 Wget 或 pywb 修复了这些问题,Wget 生成的 WARC 文件对我的使用来说不够可靠,所以我找了其他的替代品。引起我注意的爬虫程序简称 [crawl][19]。以下是它的调用方式: +很不幸,pywb 无法加载 Wget 生成的 WARC 文件,因为它[遵循][16]的 [1.0 规范不一致][17],[1.1 规范修复了此问题][17]。就算 Wget 或 pywb 修复了这些问题,Wget 生成的 WARC 文件对我的使用来说不够可靠,所以我找了其他的替代品。引起我注意的爬虫程序简称 [crawl][19]。以下是它的调用方式: ``` - $ crawl https://example.com/ - +$ crawl https://example.com/ ``` -(它的 README 文件说“非常简单”。)该程序确实支持一些命令行参数选项,但大多数默认值都是最佳的:它会从其他域获取页面需求(除非使用 `-exclude-related` 参数),但肯定不会递归出域。默认情况下,它会与远程站点建立十个并发连接,这个值可以使用 `-c` 参数更改。但是,最重要的是,生成的 WARC 文件可以使用 pywb 完美加载。 +(它的 README 文件说“非常简单”。)该程序支持一些命令行参数选项,但大多数默认值都是最佳的:它会从其他域获取页面所需(除非使用 `-exclude-related` 参数),但肯定不会递归出域。默认情况下,它会与远程站点建立十个并发连接,这个值可以使用 `-c` 参数更改。但是,最重要的是,生成的 WARC 文件可以使用 pywb 完美加载。 ### 未来的工作和替代方案 -这里还有更多有关使用 WARC 文件的[资源][20]。特别要提的是,这里有一个专门用来存档网站的 Wget 的直接替代品,叫做 [Wpull][21]。它实验性地支持了 [PhantomJS][22] 和 [youtube-dl][23] 的集成,即允许分别下载更复杂的 JavaScript 页面以及流媒体。该程序是一个叫做 [ArchiveBot][24] 的复杂档案工具的基础,ArchiveBot 被那些在 [ArchiveTeam][25] 的“零散离群的档案管理者、程序员、作家以及演说家”使用,他们致力于“在历史永远丢失之前保存他们”。集成 PhantomJS 好像并没有如团队期望的那样良好工作,所以 ArchiveTeam 也用其他的低等工具来镜像保存更复杂的网站。例如,[snscrape][26] 将抓取社交媒体配置文件以生成要发送到 ArchiveBot 的页面列表。团队使用的另一个工具是 [crocoite][27],它在 Chrome 浏览器下以无头文件信息的模式来存档 JavaScript 较多的网站。 +这里还有更多有关使用 WARC 文件的[资源][20]。特别要提的是,这里有一个专门用来归档网站的 Wget 的直接替代品,叫做 [Wpull][21]。它实验性地支持了 [PhantomJS][22] 和 [youtube-dl][23] 的集成,即允许分别下载更复杂的 JavaScript 页面以及流媒体。该程序是一个叫做 [ArchiveBot][24] 的复杂归档工具的基础,ArchiveBot 被那些在 [ArchiveTeam][25] 的“*零散离群的归档者、程序员、作家以及演说家*”使用,他们致力于“*在历史永远丢失之前保存它们*”。集成 PhantomJS 好像并没有如团队期望的那样良好工作,所以 ArchiveTeam 也用其它零散的工具来镜像保存更复杂的网站。例如,[snscrape][26] 将抓取一个社交媒体配置文件以生成要发送到 ArchiveBot 的页面列表。该团队使用的另一个工具是 [crocoite][27],它使用无头模式的 Chrome 浏览器来归档 JavaScript 较多的网站。 -如果没有提到称做“网站复制者”的 [HTTrack][28] 项目,那么这篇文章算不上完整。工作方式和 Wget 相似,HTTrack 可以对远程站点创建一个本地的副本,但是不幸的是它不支持输出 WRAC 文件。对于不熟悉命令行的小白用户来说,它在人机交互方面显得更有价值。 +如果没有提到称做“网站复制者”的 [HTTrack][28] 项目,那么这篇文章算不上完整。它工作方式和 Wget 相似,HTTrack 可以对远程站点创建一个本地的副本,但是不幸的是它不支持输出 WRAC 文件。对于不熟悉命令行的小白用户来说,它在人机交互方面显得更有价值。 同样,在我的研究中,我发现了叫做 [Wget2][29] 的 Wget 的完全重制版本,它支持多线程操作,这可能使它比前身更快。和 Wget 相比,它[舍弃了一些功能][30],但是最值得注意的是拒绝模式、WARC 输出以及 FTP 支持,并增加了 RSS、DNS 缓存以及改进的 TLS 支持。 -最后,我个人对这些工具的愿景是将他们与现有的书签系统集成起来。目前我在 [Wallabag][31] 中保留了一些有趣的链接,这是一种自托管式的“稍后阅读”服务,意在成为 [Pocket][32](现在由 Mozilla 拥有)的免费替代品。但是 Wallabag 在设计上只保留了文章的“可读”副本,而不是一个完整的拷贝。在某些情况下,“可读版本”实际上[不可读][33],并且 Wallabag 有时[无法解析文章][34]。恰恰相反,像 [bookmark-archiver][35] 或 [reminiscence][36] 这样其他的工具会保存页面的屏幕截图以及完整的 HTML 文件,但遗憾的是,它没有 WRAC 文件所以没有办法更可信的重现网页内容。 +最后,我个人对这些工具的愿景是将它们与我现有的书签系统集成起来。目前我在 [Wallabag][31] 中保留了一些有趣的链接,这是一种自托管式的“稍后阅读”服务,意在成为 [Pocket][32](现在由 Mozilla 拥有)的免费替代品。但是 Wallabag 在设计上只保留了文章的“可读”副本,而不是一个完整的拷贝。在某些情况下,“可读版本”实际上[不可读][33],并且 Wallabag 有时[无法解析文章][34]。恰恰相反,像 [bookmark-archiver][35] 或 [reminiscence][36] 这样其他的工具会保存页面的屏幕截图以及完整的 HTML 文件,但遗憾的是,它没有 WRAC 文件所以没有办法更可信的重现网页内容。 -我所经历的有关镜像保存和存档的悲剧就是死数据。幸运的是,业余档案管理者可以利用工具将有趣的内容保存到网上。对于那些不想麻烦的人来说,互联网档案馆依然要留在这里,并且存档团队显然[正在为互联网档案馆本身做备份][37]。 +我所经历的有关镜像保存和归档的悲剧就是死数据。幸运的是,业余的归档者可以利用工具将有趣的内容保存到网上。对于那些不想麻烦的人来说,“互联网档案馆”看起来仍然在那里,并且 ArchiveTeam 显然[正在为互联网档案馆本身做备份][37]。 -------------------------------------------------------------------------------- @@ -75,7 +72,7 @@ via: https://anarc.at/blog/2018-10-04-archiving-web-sites/ 作者:[Anarcat][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[fuowang](https://github.com/fuowang) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 396599a0476d9efe45ab779808d4b8652b3dddf0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 10:07:38 +0800 Subject: [PATCH 027/135] PUB:20181004 Archiving web sites.md @fuowang https://linux.cn/article-10304-1.html --- {translated/tech => published}/20181004 Archiving web sites.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181004 Archiving web sites.md (100%) diff --git a/translated/tech/20181004 Archiving web sites.md b/published/20181004 Archiving web sites.md similarity index 100% rename from translated/tech/20181004 Archiving web sites.md rename to published/20181004 Archiving web sites.md From e63c5436c86fe767d0cdaeadc5f5ede4bd519058 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 10:17:57 +0800 Subject: [PATCH 028/135] PRF:20181105 5 Easy Tips for Linux Web Browser Security.md @HankChow --- ...asy Tips for Linux Web Browser Security.md | 72 ++++++++----------- 1 file changed, 29 insertions(+), 43 deletions(-) diff --git a/translated/tech/20181105 5 Easy Tips for Linux Web Browser Security.md b/translated/tech/20181105 5 Easy Tips for Linux Web Browser Security.md index 6e7ea17a3a..97a608bda5 100644 --- a/translated/tech/20181105 5 Easy Tips for Linux Web Browser Security.md +++ b/translated/tech/20181105 5 Easy Tips for Linux Web Browser Security.md @@ -1,6 +1,8 @@ -提高 Linux 网络浏览器安全性的 5 个建议 +提高 Linux 的网络浏览器安全性的 5 个建议 ====== -![](https://www.linux.com/learn/intro-to-linux/2018/11/5-easy-tips-linux-web-browser-security) +> 这些简单的步骤可以大大提高您的在线安全性。 + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/cyber-security-20.jpg?itok=IkNDVnJr) 如果你使用 Linux 桌面但从来不使用网络浏览器,那你算得上是百里挑一。网络浏览器是绝大多数人最常用的工具之一,无论是工作、娱乐、看新闻、社交、理财,对网络浏览器的依赖都比本地应用要多得多。因此,我们需要知道如何使用网络浏览器才是安全的。一直以来都有不法的犯罪分子以及他们建立的网页试图窃取私密的信息。正是由于我们需要通过网络浏览器收发大量的敏感信息,安全性就更是至关重要。 @@ -8,17 +10,14 @@ ### 正确选择浏览器 -尽管我我提出的建议具有普适性,但是正确选择网络浏览器也是很必要的。网络浏览器的更新频率是它安全性的一个重要体现。网络浏览器会不断暴露出新的问题,因此版本越新的网络浏览器修复的问题就越多,也越安全。在主流的网络浏览器当中,2017 年版本更新的发布量排行榜如下: +尽管我提出的建议具有普适性,但是正确选择网络浏览器也是很必要的。网络浏览器的更新频率是它安全性的一个重要体现。网络浏览器会不断暴露出新的问题,因此版本越新的网络浏览器修复的问题就越多,也越安全。在主流的网络浏览器当中,2017 年版本更新的发布量排行榜如下: - 1. Chrome 发布了 8 个更新(Chromium 全年跟进发布了大量安全补丁)。 - 2. Firefox 发布了 7 个更新。 - 3. Edge 发布了 2 个更新。 - 4. Safari 发布了 1 个更新(苹果也会每年发布 5 到 6 个安全补丁)。 +1. Chrome 发布了 8 个更新(Chromium 全年跟进发布了大量安全补丁)。 +2. Firefox 发布了 7 个更新。 +3. Edge 发布了 2 个更新。 +4. Safari 发布了 1 个更新(苹果也会每年发布 5 到 6 个安全补丁)。 - - - -网络浏览器会经常发布更新,同时用户方面也要及时升级到最新的版本,否则毫无意义了。尽管大部分流行的 Linux 发行版都会自动更新网络浏览器到最新版本,但还是有一些 Linux 发行版不会自动进行更新,所以最好还是手动保持浏览器更新到最新版本。这就意味着你所使用的 Linux 发行版对应的标准软件库中存放的很可能就不是最新版本的网络浏览器,在这种情况下,你可以随时从网络浏览器开发者提供的最新版本下载页中进行下载安装。 +网络浏览器会经常发布更新,同时用户也要及时升级到最新的版本,否则毫无意义了。尽管大部分流行的 Linux 发行版都会自动更新网络浏览器到最新版本,但还是有一些 Linux 发行版不会自动进行更新,所以最好还是手动保持浏览器更新到最新版本。这就意味着你所使用的 Linux 发行版对应的标准软件库中存放的很可能就不是最新版本的网络浏览器,在这种情况下,你可以随时从网络浏览器开发者提供的最新版本下载页中进行下载安装。 如果你是一个勇于探索的人,你还可以尝试使用测试版或者每日构建daily build版的网络浏览器,不过,这些版本将伴随着不能稳定运行的可能性。在基于 Ubuntu 的发行版中,你可以使用到每日构建版的 Firefox,只需要执行以下命令添加所需的存储库: @@ -43,60 +42,47 @@ sudo apt-get install firefox ### 保护好密码 -有的人可能会认为,每次都需要重复输入密码,这样的操作太麻烦了。在 Firefox 中,如果你既想保护好自己的密码,又不想经常输入密码,就可以通过 Master Password 这一款内置的工具来实现你的需求。起用了这个工具之后,需要输入正确的主密码,才能后续使用保存在浏览器中的其它密码。你可以按照以下步骤进行操作: - - 1. 打开 Firefox。 - - 2. 点击菜单按钮。 - - 3. 点击“偏好设置”。 - - 4. 在偏好设置页面,点击“隐私与安全”。 - - 5. 在页面中勾选“使用主密码”选项(图 1)。 - - 6. 确认以后,输入新的主密码(图 2)。 - - 7. 重启 Firefox。 - - +有的人可能会认为,每次都需要重复输入密码,这样的操作太麻烦了。在 Firefox 中,如果你既想保护好自己的密码,又不想经常输入密码,就可以通过主密码Master Password这一款内置的工具来实现你的需求。起用了这个工具之后,需要输入正确的主密码,才能后续使用保存在浏览器中的其它密码。你可以按照以下步骤进行操作: +1. 打开 Firefox。 +2. 点击菜单按钮。 +3. 点击“偏好设置”。 +4. 在偏好设置页面,点击“隐私与安全”。 +5. 在页面中勾选“使用主密码”选项(图 1)。 +6. 确认以后,输入新的主密码(图 2)。 +7. 重启 Firefox。 ![Master Password][3] -图 1: Firefox 偏好设置页中的主密码设置。 +*图 1: Firefox 偏好设置页中的主密码设置。* ![Setting password][6] -图 2:在 Firefox 中设置主密码。 +*图 2:在 Firefox 中设置主密码。* ### 了解你使用的扩展和插件 大多数网络浏览器在保护隐私方面都有很多扩展,你可以根据自己的需求选择不同的扩展。而我自己则选择了一下这些扩展: - * [Firefox Multi-Account Containers][7] \- 允许将某些站点配置为在容器化选项卡中打开。 - * [Facebook Container][8] \- 始终在容器化选项卡中打开 Facebook(这个扩展需要 Firefox Multi-Account Containers)。 - * [Avast Online Security][9] \- 识别并拦截已知的钓鱼网站,并显示网站的安全评级(由超过 4 亿用户的 Avast 社区支持)。 - * [Mining Blocker][10] \- 拦截所有使用 CPU 的挖矿工具。 - * [PassFF][11] \- 通过集成 `pass` (一个 UNIX 密码管理器)以安全存储密码。 - * [Privacy Badger][12] \- 自动拦截网站跟踪。 - * [uBlock Origin][13] \- 拦截已知的网站跟踪。 - +* [Firefox Multi-Account Containers][7] —— 允许将某些站点配置为在容器化选项卡中打开。 +* [Facebook Container][8] —— 始终在容器化选项卡中打开 Facebook(这个扩展需要 Firefox Multi-Account Containers)。 +* [Avast Online Security][9] —— 识别并拦截已知的钓鱼网站,并显示网站的安全评级(由超过 4 亿用户的 Avast 社区支持)。 +* [Mining Blocker][10] —— 拦截所有使用 CPU 的挖矿工具。 +* [PassFF][11] —— 通过集成 `pass` (一个 UNIX 密码管理器)以安全存储密码。 +* [Privacy Badger][12] —— 自动拦截网站跟踪。 +* [uBlock Origin][13] —— 拦截已知的网站跟踪。 除此以外,以下这些浏览器还有很多安全方面的扩展: + [Firefox][2] - + [Chrome、Chromium,、Vivaldi][5] - + [Opera][14] - 但并非每一个网络浏览器都会向用户提供扩展或插件。例如 Midoria 就只有少量可以开启或关闭的内置插件(图 3),同时这些轻量级浏览器的第三方插件也相当缺乏。 ![Midori Browser][15] -图 3:Midori 浏览器的插件窗口。 +*图 3:Midori 浏览器的插件窗口。* ### 虚拟化 @@ -115,7 +101,7 @@ via: https://www.linux.com/learn/intro-to-linux/2018/11/5-easy-tips-linux-web-br 作者:[Jack Wallen][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cad41b59f218c55064fca2b999e29f4d707db987 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 10:18:19 +0800 Subject: [PATCH 029/135] PUB:20181105 5 Easy Tips for Linux Web Browser Security.md @HankChow https://linux.cn/article-10305-1.html --- .../20181105 5 Easy Tips for Linux Web Browser Security.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181105 5 Easy Tips for Linux Web Browser Security.md (100%) diff --git a/translated/tech/20181105 5 Easy Tips for Linux Web Browser Security.md b/published/20181105 5 Easy Tips for Linux Web Browser Security.md similarity index 100% rename from translated/tech/20181105 5 Easy Tips for Linux Web Browser Security.md rename to published/20181105 5 Easy Tips for Linux Web Browser Security.md From aa2af0ead6834c749899038ae5e09edf401b58f3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 10:27:17 +0800 Subject: [PATCH 030/135] PRF:20180525 How to Set Different Wallpaper for Each Monitor in Linux.md @geekpi --- ...ent Wallpaper for Each Monitor in Linux.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/translated/tech/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md b/translated/tech/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md index b0b698b764..358d8baf40 100644 --- a/translated/tech/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md +++ b/translated/tech/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md @@ -1,8 +1,9 @@ 如何在 Linux 中为每个屏幕设置不同的壁纸 ====== -**简介:如果你想在 Ubuntu 18.04 或任何其他 Linux 发行版上使用 GNOME、MATE 或 Budgie 桌面环境在多个显示器上显示不同的壁纸,这个小工具将帮助你实现这一点。** -多显示器设置通常会在 Linux 上出现多个问题,但我不打算在本文中讨论这些问题。我有一篇关于 Linux 上多显示器支持的文章。 +> 如果你想在 Ubuntu 18.04 或任何其他 Linux 发行版上使用 GNOME、MATE 或 Budgie 桌面环境在多个显示器上显示不同的壁纸,这个小工具将帮助你实现这一点。 + +多显示器设置通常会在 Linux 上出现多个问题,但我不打算在本文中讨论这些问题。我有另外一篇关于 Linux 上多显示器支持的文章。 如果你使用多台显示器,也许你想为每台显示器设置不同的壁纸。我不确定其他 Linux 发行版和桌面环境,但是 [GNOME 桌面][1] 的 Ubuntu 本身并不提供此功能。 @@ -18,11 +19,11 @@ #### 使用 FlatPak 在 Linux 上安装 HydraPaper -使用 [FlatPak][9] 可以轻松安装 HydraPaper。Ubuntu 18.04已 经提供对 FlatPaks 的支持,所以你需要做的就是下载应用文件并双击在 GNOME 软件中心中打开它。 +使用 [FlatPak][9] 可以轻松安装 HydraPaper。Ubuntu 18.04 已 经提供对 FlatPaks 的支持,所以你需要做的就是下载应用文件并双击在 GNOME 软件中心中打开它。 你可以参考这篇文章来了解如何在你的发行版[启用 FlatPak 支持][10]。启用 FlatPak 支持后,只需从 [FlatHub][11] 下载并安装即可。 -[Download HydraPaper][12] +- [下载 HydraPaper][12] #### 使用 HydraPaper 在不同的显示器上设置不同的背景 @@ -65,13 +66,13 @@ via: https://itsfoss.com/wallpaper-multi-monitor/ 作者:[Abhishek Prakash][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://itsfoss.com/author/abhishek/ [1]:https://www.gnome.org/ -[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/multi-monitor-wallpaper-setup-800x450.jpeg +[2]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/05/multi-monitor-wallpaper-setup.jpeg?w=800&ssl=1 [3]:https://github.com/GabMus/HydraPaper [4]:https://www.gtk.org/ [5]:https://itsfoss.com/gnome-tricks-ubuntu/ @@ -82,8 +83,8 @@ via: https://itsfoss.com/wallpaper-multi-monitor/ [10]:https://flatpak.org/setup/ [11]:https://flathub.org [12]:https://flathub.org/apps/details/org.gabmus.hydrapaper -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/different-wallpaper-each-monitor-hydrapaper-2-800x631.jpeg -[14]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/different-wallpaper-each-monitor-hydrapaper-1.jpeg -[15]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/different-wallpaper-each-monitor-hydrapaper-3.jpeg -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/05/hydra-paper-dual-monitor-800x450.jpeg -[17]:https://www.reddit.com/r/LinuxUsersGroup/ \ No newline at end of file +[13]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/05/different-wallpaper-each-monitor-hydrapaper-2.jpeg?w=800&ssl=1 +[14]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/05/different-wallpaper-each-monitor-hydrapaper-1.jpeg?w=799&ssl=1 +[15]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/05/different-wallpaper-each-monitor-hydrapaper-3.jpeg?w=799&ssl=1 +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/05/hydra-paper-dual-monitor.jpeg?w=800&ssl=1 +[17]:https://www.reddit.com/r/LinuxUsersGroup/ From a06739620ec615c0bfe708b97c171592baa44313 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 10:27:37 +0800 Subject: [PATCH 031/135] PUB:20180525 How to Set Different Wallpaper for Each Monitor in Linux.md @geekpi https://linux.cn/article-10306-1.html --- ...25 How to Set Different Wallpaper for Each Monitor in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md (100%) diff --git a/translated/tech/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md b/published/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md similarity index 100% rename from translated/tech/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md rename to published/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md From e4522baa1d392b71eb69320ea7a4261ae2990aba Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 3 Dec 2018 10:29:17 +0800 Subject: [PATCH 032/135] translatng (#11458) --- .../tech/20181128 Standalone web applications with GNOME Web.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181128 Standalone web applications with GNOME Web.md b/sources/tech/20181128 Standalone web applications with GNOME Web.md index 4dd635f8b2..eda28159de 100644 --- a/sources/tech/20181128 Standalone web applications with GNOME Web.md +++ b/sources/tech/20181128 Standalone web applications with GNOME Web.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Standalone web applications with GNOME Web) From 8c2f60a29312540190f9d03a474856e603e93f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 3 Dec 2018 10:46:50 +0800 Subject: [PATCH 033/135] Update 20180420 How To Remove Password From A PDF File in Linux.md start translation --- .../20180420 How To Remove Password From A PDF File in Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180420 How To Remove Password From A PDF File in Linux.md b/sources/tech/20180420 How To Remove Password From A PDF File in Linux.md index 0e4318c858..09ac06d6b0 100644 --- a/sources/tech/20180420 How To Remove Password From A PDF File in Linux.md +++ b/sources/tech/20180420 How To Remove Password From A PDF File in Linux.md @@ -1,3 +1,4 @@ +robsean translating How To Remove Password From A PDF File in Linux ====== From d5240fb4ce9cf94d9e1b920012db6a78bce415e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Mon, 3 Dec 2018 11:04:13 +0800 Subject: [PATCH 034/135] Create Top 30 OpenStack Interview Questions and Answers.md --- ...enStack Interview Questions and Answers.md | 327 ++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 translated/tech/Top 30 OpenStack Interview Questions and Answers.md diff --git a/translated/tech/Top 30 OpenStack Interview Questions and Answers.md b/translated/tech/Top 30 OpenStack Interview Questions and Answers.md new file mode 100644 index 0000000000..dc5411f1fa --- /dev/null +++ b/translated/tech/Top 30 OpenStack Interview Questions and Answers.md @@ -0,0 +1,327 @@ +ScarboroughCoral translating! + + +Top 30 OpenStack Interview Questions and Answers +====== +Now a days most of the firms are trying to migrate their IT infrastructure and Telco Infra into private cloud i.e OpenStack. If you planning to give interviews on Openstack admin profile, then below list of interview questions might help you to crack the interview. + +![](https://www.linuxtechi.com/wp-content/uploads/2018/11/OpenStack-Interview-Questions.jpg) + +### Q:1 Define OpenStack and its key components? + +Ans: It is a bundle of opensource software, which all in combine forms a provide cloud software known as OpenStack.OpenStack is known as Stack of Open source Software or Projects. + +Following are the key components of OpenStack + + * **Nova** – It handles the Virtual machines at compute level and performs other computing task at compute or hypervisor level. + * **Neutron** – It provides the networking functionality to VMs, Compute and Controller Nodes. + * **Keystone** – It provides the identity service for all cloud users and openstack services. In other words, we can say Keystone a method to provide access to cloud users and services. + * **Horizon** – It provides a GUI (Graphical User Interface), using the GUI Admin can all day to day operations task at ease. + * **Cinder** – It provides the block storage functionality, generally in OpenStack Cinder is integrated with Chef and ScaleIO to service block storage to Compute & Controller nodes. + * **Swift** – It provides the object storage functionality. Generally, Glance images are on object storage. External storage like ScaleIO can work as Object storage too and can easily be integrated with Glance Service. + * **Glance** – It provides Cloud image services, using glance admin used to upload and download cloud images. + * **Heat** – It provides an orchestration service or functionality. Using Heat admin can easily VMs as stack and based on requirements VMs in the stack can be scale-in and Scale-out + * **Ceilometer** – It provides the telemetry and billing services. + + + +### Q:2 What are services generally run on a controller node? + +Ans: Following services run on a controller node: + + * Identity Service ( KeyStone) + * Image Service ( Glance) + * Nova Services like Nova API, Nova Scheduler & Nova DB + * Block & Object Service + * Ceilometer Service + * MariaDB / MySQL and RabbitMQ Service + * Management services of Networking (Neutron) and Networking agents + * Orchestration Service (Heat) + + + +### Q:3 What are the services generally run on a Compute Node? + +Ans: Following services run on a compute node, + + * Nova-Compute + * Networking Services like OVS + + + +### Q:4 What is the default location of VMs on the Compute Nodes? + +Ans: VMs in the Compute node are stored at “ **/var/lib/nova/instances** ” + +### Q:5 What is default location of glance images? + +Ans: As the Glance service runs on a controller node, all the glance images are store under the folder “ **/var/lib/glance/images** ” on a controller node. + +Read More : [**How to Create and Delete Virtual Machine(VM) from Command line in OpenStack**][1] + +### Q:6 Tell me the command how to spin a VM from Command Line? + +Ans: We can easily spin a new VM using the following openstack command, + +``` +# openstack server create --flavor {flavor-name} --image {Image-Name-Or-Image-ID}  --nic net-id={Network-ID} --security-group {Security_Group_ID} –key-name {Keypair-Name} +``` + +### Q:7 How to list the network namespace of a tenant in OpenStack? + +Ans: Network namespace of a tenant can be listed using “ip net ns” command + +``` +~# ip netns list +qdhcp-a51635b1-d023-419a-93b5-39de47755d2d +haproxy +vrouter +``` + +### Q:8 How to execute command inside network namespace in openstack? + +Ans: Let’s assume we want to execute “ifconfig” command inside the network namespace “qdhcp-a51635b1-d023-419a-93b5-39de47755d2d”, then run the beneath command, + +Syntax : ip netns exec {network-space} + +``` +~# ip netns exec qdhcp-a51635b1-d023-419a-93b5-39de47755d2d "ifconfig" +``` + +### Q:9 How to upload and download a cloud image in Glance from command line? + +Ans: A Cloud image can be uploaded in glance from command using beneath openstack command, + +``` +~# openstack image create --disk-format qcow2 --container-format bare   --public --file {Name-Cloud-Image}.qcow2     +``` + +Use below openstack command to download a cloud image from command line, + +``` +~# glance image-download --file --progress  +``` + +### Q:10 How to reset error state of a VM into active in OpenStack env? + +Ans: There are some scenarios where some VMs went to error state and this error state can be changed into active state using below commands, + +``` +~# nova reset-state --active {Instance_id} +``` + +### Q:11 How to get list of available Floating IPs from command line? + +Ans: Available floating ips can be listed using the below command, + +``` +~]# openstack ip floating list | grep None | head -10 +``` + +### Q:12 How to provision a virtual machine in specific availability zone and compute Host? + +Ans: Let’s assume we want to provision a VM on the availability zone NonProduction in compute-02, use the beneath command to accomplish this, + +``` +~]# openstack server create --flavor m1.tiny --image cirros --nic net-id=e0be93b8-728b-4d4d-a272-7d672b2560a6 --security-group NonProd_SG  --key-name linuxtec --availability-zone NonProduction:compute-02  nonprod_testvm +``` + +### Q:13 How to get list of VMs which are provisioned on a specific Compute node? + +Ans: Let’s assume we want to list the vms which are provisioned on compute-0-19, use below + +Syntax: openstack server list –all-projects –long -c Name -c Host | grep -i {Compute-Node-Name} + +``` +~# openstack server list --all-projects --long -c Name -c Host | grep -i  compute-0-19 +``` + +### Q:14 How to view the console log of an openstack instance from command line? + +Ans: Console logs of an instance can be viewed from the command line using the following commands, + +First get the ID of an instance and then use the below command, + +``` +~# openstack console log show {Instance-id} +``` + +### Q:15 How to get console URL of an openstack instance? + +Ans: Console URL of an instance can be retrieved from command line using the below openstack command, + +``` +~# openstack console url show {Instance-id} +``` + +### Q:16 How to create a bootable cinder / block storage volume from command line? + +Ans: To Create a bootable cinder or block storage volume (assume 8 GB) , refer the below steps: + + * Get Image list using below + + + +``` +~# openstack image list | grep -i cirros +| 89254d46-a54b-4bc8-8e4d-658287c7ee92 | cirros  | active | +``` + + * Create bootable volume of size 8 GB using cirros image + + + +``` +~# cinder create --image-id 89254d46-a54b-4bc8-8e4d-658287c7ee92 --display-name cirros-bootable-vol  8 +``` + +### Q:17 How to list all projects or tenants that has been created in your opentstack? + +Ans: Projects or tenants list can be retrieved from the command using the below openstack command, + +``` +~# openstack project list --long +``` + +### Q:18 How to list the endpoints of openstack services? + +Ans: Openstack service endpoints are classified into three categories, + + * Public Endpoint + * Internal Endpoint + * Admin Endpoint + + + +Use below openstack command to view endpoints of each openstack service, + +``` +~# openstack catalog list +``` + +To list the endpoint of a specific service like keystone use below, + +``` +~# openstack catalog show keystone +``` + +Read More : [**Step by Step Instance Creation Flow in OpenStack**][2] + +### Q:19 In which order we should restart nova services on a controller node? + +Ans: Following order should be followed to restart the nova services on openstack controller node, + + * service nova-api restart + * service nova-cert restart + * service nova-conductor restart + * service nova-consoleauth restart + * service nova-scheduler restart + + + +### Q:20 Let’s assume DPDK ports are configured on compute node for data traffic, now how you will check the status of dpdk ports? + +Ans: As DPDK ports are configured via openvSwitch (OVS), use below commands to check the status, + +### Q:21 How to add new rules to the existing SG(Security Group) from command line in openstack? + +Ans: New rules to the existing SG in openstack can be added using the neutron command, + +``` +~# neutron security-group-rule-create --protocol   --port-range-min --port-range-max --direction  --remote-ip-prefix Security-Group-Name +``` + +### Q:22 How to view the OVS bridges configured on Controller and Compute Nodes? + +Ans: OVS bridges on Controller and Compute nodes can be viewed using below command, + +``` +~]# ovs-vsctl show +``` + +### Q:23 What is the role of Integration Bridge(br-int) on the Compute Node ? + +Ans: The integration bridge (br-int) performs VLAN tagging and untagging for the traffic coming from and to the instance running on the compute node. + +Packets leaving the n/w interface of an instance goes through the linux bridge (qbr) using the virtual interface qvo. The interface qvb is connected to the Linux Bridge & interface qvo is connected to integration bridge (br-int). The qvo port on integration bridge has an internal VLAN tag that gets appended to packet header when a packet reaches to the integration bridge. + +### Q:24 What is the role of Tunnel Bridge (br-tun) on the compute node? + +Ans: The tunnel bridge (br-tun) translates the VLAN tagged traffic from integration bridge to the tunnel ids using OpenFlow rules. + +br-tun (tunnel bridge) allows the communication between the instances on different networks. Tunneling helps to encapsulate the traffic travelling over insecure networks, br-tun supports two overlay networks i.e GRE and VXLAN + +### Q:25 What is the role of external OVS bridge (br-ex)? + +Ans: As the name suggests, this bridge forwards the traffic coming to and from the network to allow external access to instances. br-ex connects to the physical interface like eth2, so that floating IP traffic for tenants networks is received from the physical network and routed to the tenant network ports. + +### Q:26 What is function of OpenFlow rules in OpenStack Networking? + +Ans: OpenFlow rules is a mechanism that define how a packet will reach to destination starting from its source. OpenFlow rules resides in flow tables. The flow tables are part of OpenFlow switch. + +When a packet arrives to a switch, it is processed by the first flow table, if it doesn’t match any flow entries in the table then packet is dropped or forwarded to another table. + +### Q:27 How to display the information about a OpenFlow switch (like ports, no. of tables, no of buffer)? + +Ans: Let’s assume we want to display the information about OpenFlow switch (br-int), run the following command, + +``` +root@compute-0-15# ovs-ofctl show br-int +OFPT_FEATURES_REPLY (xid=0x2): dpid:0000fe981785c443 +n_tables:254, n_buffers:256 +capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP +actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_nw_tos mod_tp_src mod_tp_dst + 1(patch-tun): addr:3a:c6:4f:bd:3e:3b +     config:     0 +     state:      0 +     speed: 0 Mbps now, 0 Mbps max + 2(qvob35d2d65-f3): addr:b2:83:c4:0b:42:3a +     config:     0 +     state:      0 +     current:    10GB-FD COPPER +     speed: 10000 Mbps now, 0 Mbps max + ……………………………………… +``` + +### Q:28 How to display the entries for all the flows in a switch? + +Ans: Flows entries of a switch can be displayed using the command ‘ **ovs-ofctl dump-flows** ‘ + +Let’s assume we want to display flow entries of OVS integration bridge (br-int), + +### Q:29 What are Neutron Agents and how to list all neutron agents? + +Ans: OpenStack neutron server acts as the centralized controller, the actual network configurations are executed either on compute and network nodes. Neutron agents are software entities that carry out configuration changes on compute or network nodes. Neutron agents communicate with the main neutron service via Neuron API and message queue. + +Neutron agents can be listed using the following command, + +``` +~# openstack network agent list -c ‘Agent type’ -c Host -c Alive -c State +``` + +### Q:30 What is CPU pinning? + +Ans: CPU pinning refers to reserving the physical cores for specific virtual machine. It is also known as CPU isolation or processor affinity. The configuration is in two parts: + + * it ensures that virtual machine can only run on dedicated cores + * it also ensures that common host processes don’t run on those cores + + + +In other words we can say pinning is one to one mapping of a physical core to a guest vCPU. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/openstack-interview-questions-answers/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/create-delete-virtual-machine-command-line-openstack/ +[2]: https://www.linuxtechi.com/step-by-step-instance-creation-flow-in-openstack/ From 583ff266e3193f1a47782f163b9257ee85a89cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Mon, 3 Dec 2018 11:36:36 +0800 Subject: [PATCH 035/135] Rename Top 30 OpenStack Interview Questions and Answers.md to 20181107 Top 30 OpenStack Interview Questions and Answers.md --- ... 20181107 Top 30 OpenStack Interview Questions and Answers.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/tech/{Top 30 OpenStack Interview Questions and Answers.md => 20181107 Top 30 OpenStack Interview Questions and Answers.md} (100%) diff --git a/translated/tech/Top 30 OpenStack Interview Questions and Answers.md b/translated/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md similarity index 100% rename from translated/tech/Top 30 OpenStack Interview Questions and Answers.md rename to translated/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md From af147ec662663988b70981c7ef726627cf210224 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 14:16:02 +0800 Subject: [PATCH 036/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Some=20Alternativ?= =?UTF-8?q?es=20To=20=E2=80=98top=E2=80=99=20Command=20line=20Utility=20Yo?= =?UTF-8?q?u=20Might=20Want=20To=20Know?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...mmand line Utility You Might Want To Know.md | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md diff --git a/sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md b/sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md new file mode 100644 index 0000000000..6746a96201 --- /dev/null +++ b/sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md @@ -0,0 +1,344 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Some Alternatives To ‘top’ Command line Utility You Might Want To Know) +[#]: via: (https://www.ostechnix.com/some-alternatives-to-top-command-line-utility-you-might-want-to-know/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) +[#]: url: ( ) + +Some Alternatives To ‘top’ Command line Utility You Might Want To Know +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/11/Alternatives-To-Top-Command-720x340.png) + +Every now and then, I see a lot of open source programs, tools, and utilities are being added to GitHub and GitLab by developers across the world. Some of those programs are new and some of them are just alternative programs to the most popular and widely used existing Linux programs. In this tutorial, we are going to discuss about some good alternatives to [**‘top’**][1], the command line task manager program. Read on. + +### Alternatives To ‘top’ Command line Utility + +As of writing this guide, I am aware of the following 6 alternatives to Top program, namely: + + 1. Htop + 2. Vtop + 3. Gtop + 4. Gotop + 5. Ptop + 6. Hegemon + + + +I will keep updating this list if I come across any similar utilities in the days to come. Bookmark this guide if you’re interested to know about such utilities. + +#### 1\. Htop + +The **htop** is a popular, open source and cross-platform interactive process manager. It is my favorite system activity monitor tool. htop is an enhanced version of the classic top program. It is originally developed for Linux, but the developer extended its support to other Unix-like operating systems such as FreeBSD and Mac OS X. htop is free open source, and ncurses-based utility released under GPLv2. + +Compared to the classic top command, it has the following few advantages. + + * htop starts faster than top program. + * htop allows us to scroll horizontally and vertically to view all processes and full command lines. + * There is no need to type the PID to kill a process in htop. But in top, you need to type the PID to kill the process. + * There is no need to type PID to change the priority of a process, but in top command, you do. + * We can kill multiple processes at once in htop. + * In top program you are subject to a delay for each unassigned key you press. It is especially annoying when multi-key escape sequences are triggered by accident. + + + +**Installing htop** + +htop is available in the default repositories of most Linux distributions. + +On Arch-based systems, run the following command to install htop. + +``` +$ sudo pacman -S htop +``` + +On Debian-based systems: + +``` +$ sudo apt install htop +``` + +On RPM-based systems: + +``` +$ sudo dnf install htop +``` + +Or, + +``` +$ sudo yum install htop +``` + +On openSUSE: + +``` +$ sudo zypper in htop +``` + +**Usage** + +When you htop command without any arguments, you will see the following screen. + +``` +$ htop +``` +![](https://www.ostechnix.com/wp-content/uploads/2018/11/htop-command-1.png) + +As you can see, htop task manager shows total memory and swap usage, total number of tasks, system average load and system uptime on the top. On the bottom side, just like top command, it displays the list of processes in multiple columns. Each column displays details such as pid, user, priority, nice value, virtual memory usage, cpu usage, memory usage by each process etc. You can read about these parameters in the top command tutorial linked in the first paragraph. + +Unlike top command, htop allows you to perform each operation with a dedicated function key. Here is the list of shortcut keys to interact with htop. + + * **F1, h, ?** – Open help section. + * **F2, S(Shift+s)** – Go to the setup section, where you can configure the meters displayed at the top of the screen, set various display options, choose among color schemes, and select which columns are displayed, in which order etc. + * **F3, /** – Search the command lines of all the displayed processes. + * **F4, \** – Filter processes. Just type the part of the process name and you will see only the processes that matches the name. Press F4 again and hit ESC key to cancel filtering. + * **F5, t** – Switch between tree view and default view. Press + to view the sub-tree. + * **F6, <, >** – Sort the processes by PID, USER, PRIORITY, NICE value, CPU usage, MEMORY usage etc. + * **F7, ]** – Increase the selected process’s priority. + * **F8, [** – Decrease the selected process’s priority. + * **F9, k** – Kill the processes. Use the UP/DOWN arrows to choose the process and press F9 or k to kill it. + * **F10, q** – Exit htop. + + + +All shortcuts keys are given at the bottom of the htop interface. + +Please note that some of these function keys might be assigned to various Terminal operations. For example, when I hit the F2 key, it didn’t go to htop setup section. Instead it displayed the option to set the title to my Terminal window. In such cases, you might need to other keys given along with the function keys. + +Apart from the above mentioned keys, there are few more keys available to perform different functions. For example, + + * Press **‘u’** to show processes owned by a user. + * **Shift+m** will sort the processes by memory usage. + * **Shift+p** – Sort the processes by processor usage. + * **Shit+t** – Sort the processes by time. + * **CTRL+l** – Refresh screen. + + + +htop can do everything using the shortcut keys without having to mention any options when launching it. However, you can use some flags when starting it. + +For example, to start htop displaying only processes owned by given user, run: + +``` +$ htop -u +``` + +Change the Output Refresh Interval: + +``` +$ htop -d 10 +``` + +As you can see, htop usage is incredibly easier than the usage of top command. + +Refer htop man pages to know more about the available options and functionalities. + +``` +$ man htop +``` + +Also, refer the project home page and HitHub repository. + ++ [htop website](http://hisham.hm/htop/) ++ [htop GitHub Repository](https://github.com/hishamhm/htop) + +#### 2\. Vtop + +**Vtop** is yet another alternative to good-old top utility. It is a free and open source, command-line system activity monitor written in **NodeJS** and released under MIT. It uses unicode braille characters to draw CPU and Memory charts, helping you to visualize spikes. + +Make sure you have NodeJS installed on your system. If not installed yet, refer the following guide. + +Once node installed, run the following command to install Vtop. + +``` +$ npm install -g vtop +``` + +After installing Vtop, simply run vtop to start monitoring. + +``` +$ vtop +``` + +Sample output: + +![][3] + +As you can see, Vtop interface is little bit different than top and htop programs. It displays each details in a separate box layout. You will see all shortcuts keys to interact with Vtop at the bottom. + +Here is the list of shortcuts: + + * **dd** – Kill the processes. + * **UP** arrow or **k** – Move up. + * **DOWN** arrow or **j** – Move down. + * **Left** arrow or or **h** to – Zoom the graphs in. + * **Right** arrow or **l** – Zoom the graphs out. + * **g** – Jump to top of the process list. + * **SHIFT+g** – Jump to end of the process list. + * **c** – Sort processes by CPU usage. + * **m** – Sort processes by memory usage. + + + +For more details, refer the following Vtop resources. + ++ [Vtop website](http://parall.ax/vtop) ++ [Vtop GitHub Repository](https://github.com/MrRio/vtop) + + +#### 3\. Gtop + +Gtop is same as Vtop system activity monitor. It is also written in NodeJS and released under MIT license. + +To install it, run: + +``` +$ npm install gtop -g +``` + +Start gtop using command: + +``` +$ gtop +``` + +Sample output: + +![](https://www.ostechnix.com/wp-content/uploads/2018/11/gtop.png) + +I noticed Gtop interface is very nice. It showed each elements with different set of colors which is eye-pleasing. + +Keyboard shortcuts: + + * **p** – Sort processes by process Id. + * **c** – Sort processes by CPU usage. + * **m** – Sort processes by Memory usage. + * **q** or **ctrl+c** – Quit Gtop. + + + +For more details, visit Gtop GitHub page. + ++ [Gtop GitHub Repository](https://github.com/aksakalli/gtop) + + +#### 4\. Gotop + +As the name says, **Gotop** is a TUI graphical activity monitor, written in **Go** programming language. It is completely free, open source and inspired by **gtop** and **vtop** programs which we mentioned in the previous sections. We already have written about it a while ago. If you’re interested to learn about it, please visit the following link. + ++ [Gotop – Yet Another TUI Graphical Activity Monitor, Written In Go +](https://www.ostechnix.com/manage-python-packages-using-pip/) + +#### 5\. Ptop + +Some of you might not like programs written in NodeJS and Go. If you’re one of them, there is another process monitor program named **Ptop** , which is written in **Python** programming language. It is free, open source system activity monitor, released under MIT license. + +Ptop is compatible with both Python2.x and Python3.x, so you can easily install it using **Pip** , a package manager to install programs developed in Python. If you haven’t installed Pip yet, refer the following link. + ++ [How To Manage Python Packages Using Pip](https://www.ostechnix.com/manage-python-packages-using-pip/) + +After installing Pip, run the following command to install ptop. + +``` +$ pip install ptop +``` + +Or, you can compile from source as shown below. + +``` +$ git clone https://github.com/darxtrix/ptop +$ cd ptop/ +$ pip install -r requirements.txt # install requirements +$ sudo python setup.py install +``` + +To update Ptop, run: + +``` +$ pip install --upgrade ptop +``` + +Even if you don’t update, Ptop will prompt you if you’d like to update to the latest version when launch it for the first time. + +Now, let us run ptop and see what happens. + +``` +$ ptop +``` + +Here you go! +![](https://www.ostechnix.com/wp-content/uploads/2018/11/ptop-1.png) +Here is the list of shortcuts keys to interact with ptop: + + * **Ctrl+k** – Kill the process. + * **Ctrl+n** – Sort processes by memory usage. + * **Ctrl+t** – Sort processes by process lifetime. + * **Ctrl+r** – Reset the stats. + * **Ctrl+f** – Filter a specific process information. Just type process name and you will see its details only. + * **Ctrl+l** – View the information of a selected process. + * **g** – Go to the top of the process list. + * **Ctrl+q** – Quit Ptop. + + + +Ptop has a feature to change the theme. If you want a pretty output of Ptop, you could use any one of the available themes. Currently the following themes are supported: + + * colorful + * elegant + * simple + * dark + * light + + + +To set a theme, for example colorful, simply run: + +``` +$ ptop -t colorful +``` + +To view help section, use **-h** : + +``` +$ ptop -h +``` + +For more details, refer the project’s GitHub page. + ++ [Ptop Github Repository](https://github.com/darxtrix/ptop) + +#### 6\. Hegemon + +**Hegemon** is another system activity monitor application written in **Rust** programming language. If you’re fan of programs written in Rust, hegemon might be a good choice. We have published a brief review about Hegemon a while ago. Please visit the following link to know more about this tool. + +[Hegemon – A Modular System Monitor Application Written In Rust](https://www.ostechnix.com/hegemon-a-modular-system-monitor-application-written-in-rust/) + +### Conclusion + +You know now six alternatives to Top program. I won’t claim these programs are better than or best replacement for ‘top’ program. But it is always nice to know some alternatives. I use htop mostly to monitor the processes. Now is your turn. Have you used any tools listed here? Great! Which is your favorite tool and why? Please share your experience in the comment section below. + +More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/some-alternatives-to-top-command-line-utility-you-might-want-to-know/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/the-top-command-tutorial-with-examples-for-beginners/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2018/11/vtop.png From 2bb365f86a558e5f9b686aa61aa3d667a7ebff37 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 14:17:39 +0800 Subject: [PATCH 037/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Arch-Audit=20:=20?= =?UTF-8?q?A=20Tool=20To=20Check=20Vulnerable=20Packages=20In=20Arch=20Lin?= =?UTF-8?q?ux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Check Vulnerable Packages In Arch Linux.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md diff --git a/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md new file mode 100644 index 0000000000..7c626bb0b2 --- /dev/null +++ b/sources/tech/20181128 Arch-Audit - A Tool To Check Vulnerable Packages In Arch Linux.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux) +[#]: via: (https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/) +[#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) +[#]: url: ( ) + +Arch-Audit : A Tool To Check Vulnerable Packages In Arch Linux +====== + +We have to make the system up-to date to minimize the downtime and issues. + +It’s one of the routine task for Linux administrator to patch the system once in a month or 60 days once or 90 days at maximum. + +It would be sufficient schedule and we can’t do it this less than a month as it’s involve multiple activities and environments. + +Basically infrastructure comes with Test, Development, QA a.k.a Staging & Prod environments. + +Initially we will deploy the patches in the Test environment and corresponding team will be monitoring the system a week then they will give a status report like good or bad. + +If it’s success then we will move forward to other environments. If everything is good then finally we will patch production servers. + +Many of the organization has prepare to patch entire system. i mean full system update. It is a general patching schedule for a typical infrastructure. + +In some of the infrastructure they may have only production environment so, we should not prepare for the full system update instead we can go with security patch to make the system more stable and secure. + +Since Arch Linux and its derivatives distributions are fall under rolling release can be considered to be always up-to-date, as it uses the latest versions of software packages from the upstream. + +In some cases if you want to update security patch alone then you have to use arch-audit tool to identify and fix the security patches. + +### What is a Vulnerability? + +A vulnerability is a security weakness in a software program or hardware components (firmware). It’s a flaw that can leave it open to attack. + +To mitigate this we need to patch accordingly like for application/hardware it could be a code changes or config changes or parameter changes. + +### What is Arch-Audit Tool? + +[Arch-audit][1] is a tool like pkg-audit for Arch Linux system. It Uses data collected by the awesome Arch Security Team. It wont scan and find the vulnerable packages on your system like **yum –security check-update & yum updateinfo list available** and it will simply parse the page and display the results in terminal. So, it would show the accurate data. + +The Arch Security Team is a group of volunteers whose goal is to track security issues with Arch Linux packages. All issues are tracked on the Arch Linux security tracker. + +The team was formerly known as the Arch CVE Monitoring Team. The mission of the Arch Security Team is to contribute to the improvement of the security of Arch Linux. + +### How to Install arch-audit tool in Arch Linux + +The arch-audit tool is available in community repository so you can use the Pacman Package Manager to install it. + +``` +$ sudo pacman -S arch-audit +``` + +Run the `arch-audit` tool to find the open vulnerable packages on Arch based distributions. + +``` +$ arch-audit +Package cairo is affected by CVE-2017-7475. Low risk! +Package exiv2 is affected by CVE-2017-11592, CVE-2017-11591, CVE-2017-11553, CVE-2017-17725, CVE-2017-17724, CVE-2017-17723, CVE-2017-17722. Medium risk! +Package libtiff is affected by CVE-2018-18661, CVE-2018-18557, CVE-2017-9935, CVE-2017-11613. High risk!. Update to 4.0.10-1! +Package openssl is affected by CVE-2018-0735, CVE-2018-0734. Low risk! +Package openssl-1.0 is affected by CVE-2018-5407, CVE-2018-0734. Low risk! +Package patch is affected by CVE-2018-6952, CVE-2018-1000156. High risk!. Update to 2.7.6-7! +Package pcre is affected by CVE-2017-11164. Low risk! +Package systemd is affected by CVE-2018-6954, CVE-2018-15688, CVE-2018-15687, CVE-2018-15686. Critical risk!. Update to 239.300-1! +Package unzip is affected by CVE-2018-1000035. Medium risk! +Package webkit2gtk is affected by CVE-2018-4372. Critical risk!. Update to 2.22.4-1! +``` + +The above result shows the vulnerability risk status as well such as Low, Medium and Critical. + +To Show only vulnerable package names and their versions. + +``` +$ arch-audit -q +cairo +exiv2 +libtiff>=4.0.10-1 +openssl +openssl-1.0 +patch>=2.7.6-7 +pcre +systemd>=239.300-1 +unzip +webkit2gtk>=2.22.4-1 +``` + +To show only packages that have already been fixed. + +``` +$ arch-audit --upgradable --quiet +libtiff>=4.0.10-1 +patch>=2.7.6-7 +systemd>=239.300-1 +webkit2gtk>=2.22.4-1 +``` + +To cross check the above results, i’m going to test one of the package which is listed above in to confirm whether the vulnerability is still open or fixed it. Yes, it’s fixed and published the updated package in repository on yesterday. +![][3] + +To print only package names and associated CVEs alone. + +``` +$ arch-audit -uf "%n|%c" +libtiff|CVE-2018-18661,CVE-2018-18557,CVE-2017-9935,CVE-2017-11613 +patch|CVE-2018-6952,CVE-2018-1000156 +systemd|CVE-2018-6954,CVE-2018-15688,CVE-2018-15687,CVE-2018-15686 +webkit2gtk|CVE-2018-4372 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/arch-audit-a-tool-to-check-vulnerable-packages-in-arch-linux/ + +作者:[Prakash Subramanian][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/prakash/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/ilpianista/arch-audit +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2018/11/A-Tool-To-Check-Vulnerable-Packages-In-Arch-Linux.png From e714357fc16d43967f926bf26aed0b158cf9b8f4 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 14:19:31 +0800 Subject: [PATCH 038/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=204=20open=20source?= =?UTF-8?q?=20Markdown=20editors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20181129 4 open source Markdown editors.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20181129 4 open source Markdown editors.md diff --git a/sources/tech/20181129 4 open source Markdown editors.md b/sources/tech/20181129 4 open source Markdown editors.md new file mode 100644 index 0000000000..0ba4909885 --- /dev/null +++ b/sources/tech/20181129 4 open source Markdown editors.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (4 open source Markdown editors) +[#]: via: (https://opensource.com/article/18/11/markdown-editors) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) +[#]: url: ( ) + +4 open source Markdown editors +====== +If you're looking for an easy way to format Markdown text, these editors may fit your needs. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-docdish-typewriterkeys.png?itok=IeQWevaV) + +I do most of my writing in a text editor and format it with [Markdown][1]—articles, essays, blog posts, and much more. I'm not the only one, either. Not only do countless people write with Markdown, but there are also more than a few publishing tools built around it. + +Who'd have thought that a simple way to format web documents created by John Gruber and the late Aaron Schwartz would become so popular? + +While most of my writing takes place in a text editor, I can understand the appeal of a dedicated Markdown editor. You get quick access to formatting, you can easily convert your documents to other formats, and you can get an instant preview. + +If you're thinking about going Markdown and are looking for a dedicated editor, here are four open source options for your writing pleasure. + +### Ghostwriter + +[Ghostwriter][2] ranks in the top three of the dedicated Markdown editors I've used or tried. And I've used or tried a few! + +![](https://opensource.com/sites/default/files/uploads/markdown-editors_ghostwriter.png) + +As an editor, Ghostwriter is pretty much a blank canvas. Start typing and adding formatting by hand. If you don't want to do that, or are just learning Markdown and don't know what to add, you can select certain formatting from Ghostwriter's Format menu. + +Admittedly, it's just basic formatting—lists, character formatting, and indenting. You'll have to add headings, code, and the like by hand. But the Task List option is interesting. I know a few people who create their to-do lists in Markdown, and this option makes creating and maintaining one much easier. + +What sets Ghostwriter apart from other Markdown editors is its range of export options. You can choose the Markdown processor you want to use, including [Sundown][3], [Pandoc][4], or [Discount][5]. With a couple of clicks, you can convert what you're writing to HTML5, ODT, EPUB, LaTeX, PDF, or a Word document. + +### Abricotine + +If you like your Markdown editors simple, you'll like [Abricotine][6]. But don't let its simplicity fool you; Abricotine packs quite a punch. + +![](https://opensource.com/sites/default/files/uploads/markdown-editors_abricotine.png) + +Like any other editor, you can enter formatting by hand or use the Format or Insert menus. Abricotine also has a menu for inserting a [GitHub Flavored Markdown][7] table. There are 16 pre-packaged table formats, and you can add rows or columns as you need them. If the tables are looking a bit messy, you can pretty them up by pressing Ctrl+Shift+B. + +Abricotine can automatically display images, links, and math. You can turn all that off if you want to. The editor is, however, limited to exporting documents as HTML. + +### Mark Text + +Like Abricotine, [Mark Text][8] is a simple Markdown editor that might surprise you. It has a few features you might not expect and does quite a good job of handling documents formatted with Markdown. + +![](https://opensource.com/sites/default/files/uploads/markdown-editors_marktext.png) + +Mark Text stays out of your way. There are no menus or toolbars. You get to the commands and functions by clicking the stacked menu in the top-left corner of the editor window. It's just you and your words. + +The editor's default mode is a semi-WYSIWYG view, although you can change that to see the formatting code you've added to your writing. As for that formatting, Mark Text supports GitHub Flavored Markdown, so you can add tables and formatted blocks of code with syntax highlighting. In its default view, the editor displays any images in your document. + +While Mark Text lacks Ghostwriter's range of export options, you can save your files as HTML or PDF. The output doesn't look too bad, either. + +### Remarkable + +[Remarkable][9] lies somewhere between Ghostwriter and Abricotine or Mark Text. It has that two-paned interface, but with a slightly more modern look. And it has a few useful features. + +![](https://opensource.com/sites/default/files/uploads/markdown-editors_remarkable.png) + +The first thing you notice about Remarkable is its [Material Design][10]-inspired look and feel. It's not for everyone, and I'll be honest: It took me a little while to get used to it. Once you do, it's easy to use. + +You get quick access to formatting from the toolbar and the menus. You can also change the preview pane's style using one of 11 built-in Cascading Style Sheets or by creating one of your own. + +Remarkable's export options are limited—you can export your work only as HTML or PDF files. You can, however, copy an entire document or a selected portion as HTML, which you can paste into another document or editor. + +Do you have a favorite dedicated Markdown editor? Why not share it by leaving a comment? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/markdown-editors + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Markdown +[2]: https://wereturtle.github.io/ghostwriter/ +[3]: https://github.com/vmg/sundown +[4]: https://pandoc.org +[5]: https://www.pell.portland.or.us/~orc/Code/discount/ +[6]: http://abricotine.brrd.fr/ +[7]: https://guides.github.com/features/mastering-markdown/ +[8]: https://marktext.github.io/website/ +[9]: https://remarkableapp.github.io/ +[10]: https://en.wikipedia.org/wiki/Material_Design From 442f1354414e272a4ed4be6424143274abfb99e0 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 14:21:05 +0800 Subject: [PATCH 039/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=203=20emerging=20ti?= =?UTF-8?q?pping=20points=20in=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... emerging tipping points in open source.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/talk/20181130 3 emerging tipping points in open source.md diff --git a/sources/talk/20181130 3 emerging tipping points in open source.md b/sources/talk/20181130 3 emerging tipping points in open source.md new file mode 100644 index 0000000000..87761e7a5d --- /dev/null +++ b/sources/talk/20181130 3 emerging tipping points in open source.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (3 emerging tipping points in open source) +[#]: via: (https://opensource.com/article/18/11/3-new-tipping-points-open-source) +[#]: author: (Bilgin lbryam https://opensource.com/users/bibryam) +[#]: url: ( ) + +3 emerging tipping points in open source +====== +Understand the factors advancing the open source model's evolution. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/balance_tipping_seesaw_building.jpg?itok=Lu17pIYG) + +Over the last two decades, open source has been expanding into all aspects of technology—from software to [hardware][1]; from small, disruptive startups to large, boring enterprises; from open standards to open [patents][2]. + +As movements evolve, they reach tipping points—stages that move the model in new directions. Following are three things that I believe are now reaching a tipping point in open source. + +### Open for non-coders + +As the name suggests, the open source model has mainly been focused on the source code. On the surface, that's probably because open source communities are usually made up of developers working on the source code, and the tools used in open source projects, such as source control systems, issue trackers, mailing list names, chat channel names, etc., all assume that developers are the center of the universe. + +This has created big losses because it prevents creative people, designers, document writers, event organizers, community managers, lawyers, accountants, and many others from participating in open source communities. We need and want non-code contributors, but we don't have processes and tools to include them, means to measure their value, nor ways for their peers, the community, or their employers to reward their efforts. As a result, it has been a lose-lose for decades. We can see the implications in all the ugly websites, amateur logos, badly written and formatted documentation, disorganized events, etc., in open source projects. + +The good news is that we are getting signals that change is on the way: + + * [Linus Torvalds apologized][3] for his "bad behavior." While this wasn't specifically focused on non-coders, it symbolizes making open source a non-hostile place for less-technical contributors. + * The Cloud Native Computing Foundation (CNCF) introduced the [Non-Code Contributor's Guide][4]. In addition to showing the many ways people can contribute to open source projects, it also set a baseline for non-code contributions that other open source projects and foundations will end up following. + * The Apache Software Foundation (ASF) is working in the same direction. We've been holding long discussions, and we will have some concrete output very soon (note that is "ASF soon"). + + + +There is a little-known secret that is great news for non-coders and others new to open source: One of the easiest ways to be recognized as part of an established open source project is to do non-coding activities. Nowadays, with complex software stacks and tough competition, there is a pretty high bar for entering a project as a committer. Performing non-coding activities is less popular, and it opens a fast backdoor to open source communities. + +![](https://opensource.com/sites/default/files/uploads/opensource_funnels.png) + +### Macro acquisitions + +Open source may have started in the hacker community as a way of scratching developers' personal itches, but today it is the place where innovation happens. Even the world's largest software companies are transitioning to the model to continue dominating their market. + +Here are some good reasons enterprises have become so interested in contributing to open source: + + * It multiplies the company's investments through contributions. + * They can benefit from the most recent technology advances and avoid reinventing the wheel. + * It helps spread knowledge of their software and its broader adoption. + * It increases the developer base and hiring pool. + * Internal developers' skills grow by learning from top coders in the field. + * It builds a company's reputation—developers want to work for organizations they can boast about. + * It aids recruitment and retention—developers want to work on exciting projects that affect large groups of people. + * New companies and projects can start faster through the open source networking effect. + + + +Many enterprises are trying to shortcut the process by acquiring open source companies—which leads to even more open source adoption. Building an open source company takes many years of effort done out in the open. Hiring good developers who are willing to work in the open, building a community around a project, and creating a successful business model require delicate effort. Companies that manage to do this are very attractive for investment and acquisition, as they serve as a catalyst to turn the acquirer into an open source company at scale. The number of [successful open source companies][5] that is acquired seems to get bigger every day, and this trend is only getting stronger. + +### Micro-funding of open source software + +In addition to macro investments through acquisitions of open source companies, there has also been an increase in decentralized [micro-funding of self-sustaining][6] open source projects. + +On one end of the spectrum, there are open source projects that are maintained primarily by intrinsically motivated developers. On the other end, large companies are hiring developers to work on open source projects driven by company roadmaps and strategies. That leaves a large number of open source projects that are not exciting enough for accidental contributors nor on enterprise companies' radar. + +In recent years, there has been an increase in [platforms for funding and sustaining][7] these open source projects through bug bounties, micro-payments, recurring donations, one-time contributions, subscriptions, etc. These open source funding platforms allow individuals to take responsibility for open source sustainability in their own hands by paying maintainers directly. This enables people to contribute to the open source model through value transfer rather than code contributions. + +There are three basic channels for open source contributions: + + * Hobbyists contribute to open source projects because of intrinsic motivations rather than monetary value. + * Companies with open source business models (open core, SaaS, support, services, etc.) monetize open source projects directly with regular, planned, and centralized subsidization. + * Independent open source users provide irregular, micro, decentralized subsidization through [OSS funding][7] platforms. + + + +While hobbyists and hackers started the open source movement, it's turned into an enterprise monetization model. Having a model to sustain the remaining open source projects is welcome. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/3-new-tipping-points-open-source + +作者:[Bilgin lbryam][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bibryam +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/what-open-hardware +[2]: https://www.redhat.com/en/blog/red-hat-welcomes-milestone-addition-open-invention-network-microsoft-joins-safeguard-linux-patent-attacks +[3]: https://lkml.org/lkml/2018/9/16/167 +[4]: https://kubernetes.io/blog/2018/10/04/introducing-the-non-code-contributors-guide/ +[5]: http://oss.cash/ +[6]: https://opensource.com/article/18/8/open-source-tokenomics +[7]: http://oss.fund/ From feed64a1a54bf60626801c5b6e4477bf91cfdd25 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 14:23:16 +0800 Subject: [PATCH 040/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Bio-Linux:=20A=20?= =?UTF-8?q?stable,=20portable=20scientific=20research=20Linux=20distributi?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... scientific research Linux distribution.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/tech/20181127 Bio-Linux- A stable, portable scientific research Linux distribution.md diff --git a/sources/tech/20181127 Bio-Linux- A stable, portable scientific research Linux distribution.md b/sources/tech/20181127 Bio-Linux- A stable, portable scientific research Linux distribution.md new file mode 100644 index 0000000000..a38acec9da --- /dev/null +++ b/sources/tech/20181127 Bio-Linux- A stable, portable scientific research Linux distribution.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Bio-Linux: A stable, portable scientific research Linux distribution) +[#]: via: (https://opensource.com/article/18/11/bio-linux) +[#]: author: (Matt Calverley https://opensource.com/users/mattcalverley) +[#]: url: ( ) + +Bio-Linux: A stable, portable scientific research Linux distribution +====== +Linux distro's integrated software approach offers powerful bioinformatic data analysis with a familiar look and feel. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_science.png?itok=WDKARWGV) + +Bio-Linux was introduced and detailed in a [Nature Biotechnology paper in July 2006][1]. The distribution was a group effort by the Natural Environment Research Council in the UK. As the creators and authors point out, the analysis demands of high-throughput “-omic” (genomic, proteomic, metabolomic) science has necessitated the development of integrated computing solutions to analyze the resultant mountains of experimental data. + +From this need, Bio-Linux was born. The distribution, [according to its creators][2], serves as a “free bioinformatics workstation platform that can be installed on anything from a laptop to a large server.” The current distro version, Bio-Linux 8, is built on an Ubuntu 14.04 LTS base. Thus, the general look and feel of Bio-Linux is similar to that of Ubuntu. + +In my own work as a research immunologist, I can attest to both the need for and success of the integrated software approach in Bio-Linux's design and development. Bio-Linux functions as a true turnkey solution to data pipeline requirements of modern science. As the website mentions, Bio-Linux includes [more than 250 pre-installed software packages][3], many of which are specific to the requirements of bioinformatic data analysis. + +The power of this approach becomes immediately evident when you try to duplicate the software installation process under another operating system. Integrating all software components and installing all required dependencies is immensely time-consuming, and in some instances is not even possible outside of the Linux operating system. The Bio-Linux distro provides a portable, stable, integrated environment with pre-installed software sufficient to begin a vast array of bioinformatic analysis tasks. + +By now you’re probably saying, “I’m sold—how do I get this amazing distro?” + +I’m glad you asked. I'll start by saying that there is excellent documentation on the Bio-Linux website. This [documentation][4] covers both installation instructions and a very thorough overview of using the distro. + +The distro can be installed and run locally, run off a CD/DVD or USB, installed on a server, or run out of a virtual machine environment. To begin the installation process for local installation, [download the disk image or ISO][5] for the Bio-Linux distro. The disk image is a 3.3GB file, and depending on your internet download speed, this may be a good time to get a cup of coffee or take a nice nap. + +Once the ISO has been downloaded, the Bio-Linux developers recommend using [UNetBootin][6], a freely available cross-platform software package used to make bootable USBs. There is a link provided for UNetBootin on the Bio-Linux website. I can attest to the effectiveness of UNetBootin in both Mac and Linux operating systems. + +On Unix family operating systems (Mac OS and Linux), it is also possible to make a bootable USB from the command line using the `dd `command: + +``` +sudo umount “USB location” + +sudo dd bs=4M if=”ISO location” of =”USB location” conv=fdatasync +``` +Regardless of the method you use, this might be another good time for a coffee break. + +At this point in my installation, UNetBootin appeared to freeze at the `squashfs` file transfer during bootable USB creation. However, a quick check of the Ubuntu disks application confirmed that the file was still being written to the USB. In other words, be patient—it takes quite some time to make the bootable USB. + +Once you’ve had your coffee and you have a finished USB in hand, you are ready to use Bio-Linux. As the Bio-Linux website points out, if you are trying to use a bootable USB with a Mac computer (particularly newer hardware versions), you may not be able to boot from the USB. There are workarounds, but they involve configuring the system for dual boot. Likewise, on Windows-based machines, it may be necessary to make changes to the boot order and possibly the secure boot settings for the machine from within BIOS. + +From this point, how you use the distro is up to you. You can run the distro from the USB to test it. You can install the distro to your computer. You can even follow the instructions on the Bio-Linux website to make a VM instance of the distro or run it on a server. Regardless of how you use it, you have a high-powered bioinformatic data analysis workstation at your disposal. + +Maybe you have a professional need for such a workstation, but even if you never use Bio-Linux as a professional researcher, it could provide a great resource for biology teaching professionals at all levels to introduce students to modern bioinformatics principles. For the price of a laptop and a USB, every school can have an in silico teaching resource to complement classroom lessons in the “-omics” age. Your only limitations are your creativity and the performance of your hardware. + +### More on Linux + +As an open source operating system with strong community support, the Linux kernel shares many of the strengths common to other successful open source software endeavors. Linux tends to be both stable and amenable to customization. It is also fairly hardware-agnostic, capable of running alongside other operating systems on a wide array of hardware configurations. In fact, installing Linux is a common method of regaining usability from dated hardware that is incapable of running other modern operating systems. Linux is also highly portable and can be run from any bootable external storage device, such as a USB drive, without the need to permanently install the operating system. + +It is this combination of stability, customizability, and portability that initially drew me to Linux. Each Linux operating system variant is referred to as a distribution (or distro), and it seems as though there is a Linux distribution for every imaginable computing scenario or desire. The options can actually be rather intimidating, and I suspect they may often discourage people from trying Linux. + +“How many different distributions can there possibly be?” you might wonder. If you have a few minutes, or even a few hours, have a look at [DistroWatch.com][7]. As its name implies, this site is devoted to the cataloging of all things Linux distribution-related. For visual learners, there is an amazing [Linux family tree][8] that really puts it into perspective. + +While [entire books][9] are devoted to the topic of Linux distributions, the differences often depend on what software is included in the base installation, how the software is managed, and graphical differences affecting the “look and feel” of the distribution. Certainly, there are also subtleties of hardware compatibility, speed, and stability. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/bio-linux + +作者:[Matt Calverley][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mattcalverley +[b]: https://github.com/lujun9972 +[1]: https://www.nature.com/articles/nbt0706-801 +[2]: http://environmentalomics.org/bio-linux/ +[3]: http://environmentalomics.org/bio-linux-software-list/ +[4]: http://nebc.nerc.ac.uk/downloads/courses/Bio-Linux/bl8_latest.pdf +[5]: http://environmentalomics.org/bio-linux-download/ +[6]: https://unetbootin.github.io/ +[7]: https://distrowatch.com/ +[8]: https://distrowatch.com/images/other/distro-family-tree.png +[9]: https://www.amazon.com/Introducing-Linux-Distros-Dieguez-Castro/dp/1484213939 From 23ade6b1e360439b25b634dcc174bbfeaf0150b9 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 14:26:05 +0800 Subject: [PATCH 041/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20Minimal=20Web?= =?UTF-8?q?=20Browsers=20for=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...181105 5 Minimal Web Browsers for Linux.md | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 sources/tech/20181105 5 Minimal Web Browsers for Linux.md diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md new file mode 100644 index 0000000000..1fbc18aeae --- /dev/null +++ b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (5 Minimal Web Browsers for Linux) +[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) +[#]: url: ( ) + +5 Minimal Web Browsers for Linux +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) + +There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. + +The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. + +There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. + +Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. + +### GNOME Web + +GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. + +Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: + + * Simplicity - Feature bloat and user interface clutter are considered evil. + + * Standards compliance - No non-standard features will ever be introduced to the codebase. + + * Software freedom - Epiphany will always be released under a license that respects freedom. + + * Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6]. + + * Minimal preferences - Preferences are only added when they make sense and after careful consideration. + + * Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included). + + + + +GNOME Web is as clean and simple a web browser as you’ll find (Figure 1). + +![GNOME Web][8] + +Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user. + +[Used with permission][9] + +The GNOME Web manifesto reads: + +A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom. + +### Netsurf + +The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2). + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) + +Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another. + +For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard. + +### QupZilla + +If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more. +One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you. + +![QupZilla][13] + +Figure 3: The QupZilla preferences tool. + +[Used with permission][9] + +### Otter Browser + +Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as: + + * Passwords manager + + * Add-on manager + + * Content blocking + + * Spell checking + + * Customizable GUI + + * URL completion + + * Speed dial (Figure 4) + + * Bookmarks and various related features + + * Mouse gestures + + * User style sheets + + * Built-in Note tool + + +![Otter][15] + +Figure 4: The Otter Browser Speed Dial tab. + +[Used with permission][9] + +Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage. + +Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease. + +### Lynx + +Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver. + +![Lynx][19] + +Figure 5: The Lynx browser rendering the Linux.com page. + +[Used with permission][9] + +I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). + +### Plenty More Where This Came From + +There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not. + +Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.mozilla.org/en-US/firefox/new/ +[2]: https://www.chromium.org/ +[3]: https://vivaldi.com/ +[4]: https://www.google.com/chrome/ +[5]: https://www.merriam-webster.com/dictionary/epiphany +[6]: https://developer.gnome.org/hig/stable/ +[7]: /files/images/minimalbrowsers1jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) +[9]: /licenses/category/used-permission +[10]: https://www.netsurf-browser.org/ +[11]: https://qupzilla.com/ +[12]: /files/images/minimalbrowsers3jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) +[14]: /files/images/minimalbrowsers4jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) +[16]: https://sourceforge.net/projects/otter-browser/files/ +[17]: https://lynx.browser.org/ +[18]: /files/images/minimalbrowsers5jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) +[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From b0f7f3731d21e2e24149aacf2fa6c9371c504017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Mon, 3 Dec 2018 16:29:00 +0800 Subject: [PATCH 042/135] Update 20181107 Top 30 OpenStack Interview Questions and Answers.md --- ...enStack Interview Questions and Answers.md | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/translated/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md b/translated/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md index dc5411f1fa..7783fa2b83 100644 --- a/translated/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md +++ b/translated/tech/20181107 Top 30 OpenStack Interview Questions and Answers.md @@ -1,17 +1,18 @@ -ScarboroughCoral translating! - -Top 30 OpenStack Interview Questions and Answers +Openstack 面试问题和解答 TOP 30 ====== -Now a days most of the firms are trying to migrate their IT infrastructure and Telco Infra into private cloud i.e OpenStack. If you planning to give interviews on Openstack admin profile, then below list of interview questions might help you to crack the interview. + +现在,大多数公司都试图将它们的 IT 基础设施和 Telco Infra 迁移到私有云,即OpenStack。如果你打算面试 OpenStack 管理员这个岗位,那么下面列出的这些面试问题可能会帮助你通过面试。 ![](https://www.linuxtechi.com/wp-content/uploads/2018/11/OpenStack-Interview-Questions.jpg) -### Q:1 Define OpenStack and its key components? +### Q:1 说一下 OpenStack 和它的主要组件? Ans: It is a bundle of opensource software, which all in combine forms a provide cloud software known as OpenStack.OpenStack is known as Stack of Open source Software or Projects. -Following are the key components of OpenStack +OpenStack 是一系列开源软件,这些软件组成了一个提供云软件,也就是 OpenStack,被称为开源软件或项目栈。 + +下面是 OpenStack 的主要关键组件 * **Nova** – It handles the Virtual machines at compute level and performs other computing task at compute or hypervisor level. * **Neutron** – It provides the networking functionality to VMs, Compute and Controller Nodes. @@ -22,6 +23,16 @@ Following are the key components of OpenStack * **Glance** – It provides Cloud image services, using glance admin used to upload and download cloud images. * **Heat** – It provides an orchestration service or functionality. Using Heat admin can easily VMs as stack and based on requirements VMs in the stack can be scale-in and Scale-out * **Ceilometer** – It provides the telemetry and billing services. + + * **Nova** – + * **Neutron** – It provides the networking functionality to VMs, Compute and Controller Nodes. + * **Keystone** – It provides the identity service for all cloud users and openstack services. In other words, we can say Keystone a method to provide access to cloud users and services. + * **Horizon** – It provides a GUI (Graphical User Interface), using the GUI Admin can all day to day operations task at ease. + * **Cinder** – It provides the block storage functionality, generally in OpenStack Cinder is integrated with Chef and ScaleIO to service block storage to Compute & Controller nodes. + * **Swift** – It provides the object storage functionality. Generally, Glance images are on object storage. External storage like ScaleIO can work as Object storage too and can easily be integrated with Glance Service. + * **Glance** – It provides Cloud image services, using glance admin used to upload and download cloud images. + * **Heat** – It provides an orchestration service or functionality. Using Heat admin can easily VMs as stack and based on requirements VMs in the stack can be scale-in and Scale-out + * **Ceilometer** – It provides the telemetry and billing services. From ee2a2a73483aaeef80cf4366b252fd1a07aac2e2 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Mon, 3 Dec 2018 16:55:45 +0800 Subject: [PATCH 043/135] hankchow translating --- ...ives To ‘top- Command line Utility You Might Want To Know.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md b/sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md index 6746a96201..d3b73df7ed 100644 --- a/sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md +++ b/sources/tech/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (HankChow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Some Alternatives To ‘top’ Command line Utility You Might Want To Know) From aab4d9d21c459e8d98dfc9f9a5a41188ded9ec9d Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 18:32:24 +0800 Subject: [PATCH 044/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=209=20top=20tech-re?= =?UTF-8?q?cruiting=20mistakes=20to=20avoid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...9 top tech-recruiting mistakes to avoid.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/talk/20181129 9 top tech-recruiting mistakes to avoid.md diff --git a/sources/talk/20181129 9 top tech-recruiting mistakes to avoid.md b/sources/talk/20181129 9 top tech-recruiting mistakes to avoid.md new file mode 100644 index 0000000000..a1655508ef --- /dev/null +++ b/sources/talk/20181129 9 top tech-recruiting mistakes to avoid.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (9 top tech-recruiting mistakes to avoid) +[#]: via: (https://opensource.com/article/18/11/top-tech-recruiting-mistakes-avoid) +[#]: author: (Rikki Endsley https://opensource.com/users/rikki-endsley) +[#]: url: ( ) + +9 top tech-recruiting mistakes to avoid +====== +We round up common mistakes tech recruiters make and a few best practices to adopt instead. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/conversation-interview-mentor.png?itok=HjoOPcrB) + +Some of my best friends and colleagues are tech recruiters, and a bunch of my favorite humans are on the job hunt. With these fine folks in mind, I decided to help them connect by finding out what kinds of recruiting efforts stand out to potential hires. I reached out to my colleagues and contacts and asked them what they like (and hate) when it comes to recruiting, then I rounded up a list of top tech-recruiting mistakes to avoid and best practices to use instead. + +### 9 common tech recruiting mistakes to avoid + +Don’t even think about reaching out to a potential candidate without doing due diligence on their background, experience, and expertise. Not knowing what skills a recruit has and what kind of work they’ve done in the past instantly turns off job seekers. Recruiters who make it clear that they’ve done their homework signal that they aren’t planning to waste a candidate’s time and stand a better chance of piquing their interest from the beginning. Common recruiting mistakes also include: + +**1\. Sending form letters — or even worse, broken form letters.** + +Unless someone is job-seeking and not getting many offers, chances are your form letter won’t stand out or get much interest. And if your form letter is broken and has [NAME] where a candidate’s name should appear, forget about getting any qualified candidate responses. + +**2\. Blowing the salutation.** + +Be sure to spell the candidate’s name correctly, and typing “Mr.” or “Miss” in the greeting could be a big mistake. For example, I can’t tell you how many “Mr. Endsley” messages I get every month, and “Miss Endsley” won’t sit well with me, either. + +**3\. Not understanding what the recruit does.** + +Potential candidates can tell whether you’ve done your homework, dug through their LinkedIn profiles, and have a grasp of their backgrounds, experiences, and areas of interest. Reaching out to a UX designer about an engineering role won’t get you good results. + +**4\. Sending unsolicited contact requests.** + +Don’t send LinkedIn connection requests to people you don’t know. Just don’t do it. + +**5\. Being too general about the job position.** + +Kill the coy. Share as many details you can about the role, including any must-have and nice-to-have skills. Draw potential recruits a picture of what the work looks like to make qualified candidates take notice. + +**6\. Being too vague or mysterious about the team and company.** + +Tech professionals with in-demand skills and experience are being more selective about what kind of team dynamics they walk into and [organizational ethics][1]. Letting potential hires know right away what the team looks like (e.g., small vs. large, remote vs. on-site) and which company you represent can save everyone a lot of time. + +**7\. Having unrealistic or overly specific requirements.** + +Does the right candidate really need to be an expert in every technology and programming language and hold multiple degrees? Be clear about what skills a candidate needs vs. what skills might come in handy or can be acquired on the job. + +**8\. Getting too cutesy or culture-y in a description.** + +Not all of us consider office puppies, free booze, and ping pong to be job perks. If this is the messaging you lead with, you’re going to attract a pretty specific kind of applicant and quickly narrow down your list of potential candidates. + +Also [avoid terms][2] like “guys,” “rock star,” and “recent graduate,” which can translate to “women, minorities, and anyone over 25 need not apply.” Ouch. + +**9\. Asking for referrals to other potential candidates.** + +This is a no-win for recruiters. For example, I’m happy to recommend job seekers in my network for roles, but lots of other folks working in tech see this as lazy recruiting. The safest approach might be to ask a candidate later in the process, after you’ve developed a friendly working relationship and you've both agreed that this role doesn’t quite fit their interests or expertise. Then they might have other contacts in mind for it. + +### 6 best practices for tech recruiters + +**1\. Provide a sincere and personalized greeting.** + +A personalized greeting goes a long way. Let potential candidates know you understand their previous work experience, you’re familiar with what they do, and that you have an idea of what they want to be doing. +![](https://opensource.com/sites/default/files/pictures/pjf_1.jpg) + +**2\. Offer a transparent description of the team and the role.** + +Be as clear as you can when describing the team and the role. Using words like “rock star” or “fast-paced team” does nothing to help the potential candidate visualize what they’d be walking into. Is this a small team? Remote team? + +Being mysterious about the role won’t build intrigue, so opt for transparency. + +**3\. Give the company name.** + +Telling job candidates that the organization is a startup or a Fortune 500 company also won’t work as well being transparent about the organization from the beginning. How can anyone know whether they’re interested in a role if they don’t know which organization they’d be joining? + +**4\. Be persistent and specific.** + +In addition to providing the job description and company name, specifying the salary range and why you think the potential candidate is a good fit for the role stands out. Also consider specifying the work authorization and whether the organization provides visa sponsorships, relocation, and additional benefits beyond an hourly or annual salary. If you have a good feeling about a candidate who might not be a 100% technical fit with the job posting, let them know and open those lines of communication. + +**5\. Invite potential candidates to local recruiting events.** + +The event should provide brief presentations about the company, refreshments, and a networking opportunity. Here’s your chance to show off the culture (i.e., people) part of your organization in person. + +**6\. Maintain a relationship with potential recruits.** + +If you talk to a candidate who isn’t the right fit for a role, but who would be a great addition to your organization, keep the lines of communication open. If candidates have a good experience with a recruiter, they’ll also be more inclined to join the organization later or send other job seekers their way in the future. + +### Bonus advice for tech recruits + +Keep in mind that recruiters, like you, are just trying to do their jobs. If you're tired of hearing from recruiters and annoyed when they contact you, step back and get a little perspective. Although you might be in the fortunate spot of being happily employed and in-demand, not everyone else is. Grumbling about recruiters on social media is a great way to humble brag, but not the best way to show empathy for the job-seekers or win any friends. + +_Thank you to the many people who contributed to this article! What would you add to these lists? Let us know in the comments._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/top-tech-recruiting-mistakes-avoid + +作者:[Rikki Endsley][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rikki-endsley +[b]: https://github.com/lujun9972 +[1]: https://spectrum.ieee.org/view-from-the-valley/at-work/tech-careers/engineers-say-no-thanks-to-silicon-valley-recruiters-citing-ethical-concerns +[2]: https://www.theladders.com/career-advice/job-descriptions-driving-away-women From 28048299e4e3179e59c659c224dd95b332db4ed8 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 18:34:18 +0800 Subject: [PATCH 045/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Boxing=20yourself?= =?UTF-8?q?=20in=20on=20the=20Linux=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...g yourself in on the Linux command line.md | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 sources/tech/20181201 Boxing yourself in on the Linux command line.md diff --git a/sources/tech/20181201 Boxing yourself in on the Linux command line.md b/sources/tech/20181201 Boxing yourself in on the Linux command line.md new file mode 100644 index 0000000000..a61ff6f2a4 --- /dev/null +++ b/sources/tech/20181201 Boxing yourself in on the Linux command line.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Boxing yourself in on the Linux command line) +[#]: via: (https://opensource.com/article/18/12/linux-toy-boxes) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +Boxing yourself in on the Linux command line +====== +Learn how to use the boxes utility to draw shapes with characters at the Linux terminal and make your words stand out. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-boxes.png?itok=Rii6nT5P) + +It's the holiday season, and every Linux terminal user deserves a little gift. It doesn't matter whether you celebrate Christmas, another holiday, or nothing at all. So I'm gathering together a collection of 24 Linux command-line toys over the next few weeks for you to enjoy and share with your friends. Let's have a little fun and add a little joy to a month that, at least here in the northern hemisphere, can be a little bit cold and dreary. + +Chances are, there will be a few that you've heard of before. But, hopefully, we'll all have a chance to learn something new. (I know I did when doing some research to make sure I could make it to 24.) + +The first of our 24 Linux terminal toys is a program called boxes. Why start with boxes? Because it's going to be hard to wrap up all of our other command-line presents to you without it! + +On my Fedora machine, boxes wasn't installed by default, but it was in my normal repositories, so installing it was as simple as + +``` +$ sudo dnf install boxes -y +``` + +If you're on a different distribution, there's a good chance you'll find it in your default repositories as well. + +Boxes a utility I really wish I had in my high school and college computer science courses, where well-intentioned teachers insisted I provide very specific looking comment at the beginning of every source file, function, code block, etc. + +``` +/***************/ +/* Hello World */ +/***************/ +``` + +It turns out, once you add a few lines of text inside, formatting them can get, well, tedious. Enter boxes. Boxes is a simple utility for surrounding a block of text with an ASCII art-style box. It comes with defaults for source code commenting, as well as other options. + +It's really easy to use. Using pipes, I can push a short greeting into a box. + +``` +$ cat greeting.txt | boxes -d diamonds -a c +``` + +Which will give us the output as follows: + +``` +       /\          /\          /\ +    /\//\\/\    /\//\\/\    /\//\\/\ + /\//\\\///\\/\//\\\///\\/\//\\\///\\/\ +//\\\//\/\\///\\\//\/\\///\\\//\/\\///\\ +\\//\/                            \/\\// + \/                                  \/ + /\      I'm wishing you all a       /\ +//\\     joyous holiday season      //\\ +\\//     and a Happy Gnu Year!      \\// + \/                                  \/ + /\                                  /\ +//\\/\                            /\//\\ +\\///\\/\//\\\///\\/\//\\\///\\/\//\\\// + \/\\///\\\//\/\\///\\\//\/\\///\\\//\/ +    \/\\//\/    \/\\//\/    \/\\//\/ +       \/          \/          \/ +``` + +Or perhaps something more fun, like: + +``` +echo "I am a dog" | boxes -d dog -a c +``` + +Which will, unsurprisingly, give you the following: + +``` +          __   _,--="=--,_   __ +         /  \."    .-.    "./  \ +        /  ,/  _   : :   _  \/` \ +        \  `| /o\  :_:  /o\ |\__/ +         `-'| :="~` _ `~"=: | +            \`     (_)     `/ +     .-"-.   \      |      /   .-"-. +.---{     }--|  /,.-'-.,\  |--{     }---. + )  (_)_)_)  \_/`~-===-~`\_/  (_(_(_)  ( +(              I am a dog               ) + )                                     ( +'---------------------------------------' +``` + +Boxes comes with [lots of options][1] for padding, position, and even processing regular expressions. You can learn more about boxes on the [project's homepage][2], or head over to [GitHub][3] to download the source code or contribute your own box. In fact, if you're looking for an idea to submit, I've got an idea for you: why not a holiday present? + +``` +         _  _ +        /_\/_\ + _______\_\/_/_______ +|       ///\\\       | +|      ///  \\\      | +|                    | +|     "Happy pull    | +|       request!"    | +|____________________| +``` + +Boxes is open source under a GPLv2 license. + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Or check out tomorrow's command-line toy, [Drive a locomotive through your Linux terminal][4]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-boxes + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: http://boxes.thomasjensen.com/examples.html +[2]: https://boxes.thomasjensen.com/ +[3]: https://github.com/ascii-boxes/boxes +[4]: https://opensource.com/article/18/12/linux-toy-sl From 8256789025aaab7bbe1f677c2adbe26533926e75 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 18:35:34 +0800 Subject: [PATCH 046/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Drive=20a=20locom?= =?UTF-8?q?otive=20through=20your=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... locomotive through your Linux terminal.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/tech/20181202 Drive a locomotive through your Linux terminal.md diff --git a/sources/tech/20181202 Drive a locomotive through your Linux terminal.md b/sources/tech/20181202 Drive a locomotive through your Linux terminal.md new file mode 100644 index 0000000000..ccdcee63fd --- /dev/null +++ b/sources/tech/20181202 Drive a locomotive through your Linux terminal.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Drive a locomotive through your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-sl) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) +[#]: url: ( ) + +Drive a locomotive through your Linux terminal +====== +Using the sl command, you can train yourself to get on track with a fun command-line experience. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-sl.png?itok=WPTj0Ga9) + +It's December, and every Linux terminal user deserves a reward just for making through the year. So we're bringing you a sort of advent calendar of Linux command-line toys. What's a command-line toy? It might be a game, a pointless little time waster, or just something to bring you joy at the terminal. + +**sl** , which is short for steam locomotive. + +Today's Linux command-line toy is a suggestion from Opensource.com community moderator [Ben Cotton][1] . Ben suggested, which is short for steam locomotive. + +It's also, conveniently and not coincidentally, a common typo for the Linux **ls** command. Want to stop mistyping ls? Try installing **sl**. It's probably packaged for your default repos. For me, in Fedora, that means it was as simple to install as: + +``` +$ sudo dnf install sl -y +``` + +Now, just type **sl** to try it out. + +![](https://opensource.com/sites/default/files/uploads/linux-toy-sl-animated.gif) + +You may notice, as I did, that **Ctrl+C** doesn't derail your train, so you have to wait for the entire train to pass. That'll teach you to mistype **ls**! + +Want to check out the source to **sl**? It's over [on GitHub][2]. + +**sl** is also a great opportunity to share a personal PSA about open source licensing. While its [license][3] was "open source enough" to be packaged for my distribution, it's not technically an [OSI-approved][4] license. After the copyright line, the license reads simply: + +``` +Everyone is permitted to do anything on this program including copying, +modifying, and improving, unless you try to pretend that you wrote it. +i.e., the above copyright notice has to appear in all copies. +THE AUTHOR DISCLAIMS ANY RESPONSIBILITY WITH REGARD TO THIS SOFTWARE. +``` + +Unfortunately, when you chose a license that's not OSI-approved, you may accidentally be creating extra work for your users, as they must figure out whether your license will work for their situation. Do their corporate policies allow them to contribute? Can they even legally use the program? Does the license mesh with the license of another program they wish to integrate with it? + +Unless you're a lawyer (and perhaps, even if you are), navigating the space of non-standard licenses can be tricky. So if you're still looking for a New Year's Resolution, why not resolve to choose only OSI-approved licenses for any new projects you start in 2019. + +No disrespect to the creator, though. **sl** is still a great little command-line toy. + +Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. + +Check out yesterday's toy, [Box yourself in on the Linux command line][5], and check back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-sl + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/users/bcotton +[2]: https://github.com/mtoyoda/sl +[3]: https://github.com/mtoyoda/sl/blob/master/LICENSE +[4]: https://opensource.org/licenses +[5]: https://opensource.com/article/18/12/linux-toy-boxes From f992c196c919ea8397f1537fb33b0cf83f6c9aa3 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 3 Dec 2018 18:36:56 +0800 Subject: [PATCH 047/135] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Why=20giving=20ba?= =?UTF-8?q?ck=20is=20important=20to=20the=20DevOps=20culture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...back is important to the DevOps culture.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20181129 Why giving back is important to the DevOps culture.md diff --git a/sources/talk/20181129 Why giving back is important to the DevOps culture.md b/sources/talk/20181129 Why giving back is important to the DevOps culture.md new file mode 100644 index 0000000000..c01889130f --- /dev/null +++ b/sources/talk/20181129 Why giving back is important to the DevOps culture.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Why giving back is important to the DevOps culture) +[#]: via: (https://opensource.com/article/18/11/why-sharing-important-devops-culture) +[#]: author: (Matty Stratton https://opensource.com/users/mattstratton) +[#]: url: ( ) + +Why giving back is important to the DevOps culture +====== +Our habit of not sharing knowledge is doing us harm. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bubblehands_fromRHT_520_0612LL.png?itok=_iQ2dO3S) +In the DevOps [CALMS][1] model (which stands for Culture, Automation, Lean, Measurement, and Sharing), Sharing is often overlooked or misunderstood. While each element of CALMS is just as important as the others, sharing knowledge is something that we often neglect. + +### What happens if we don't share? + +[Jeff Smith][2], director of production operations at [Centro][3], tells this story: + +> A change to the level of granularity that gets stored in one of our reporting tables was made. The change increased the disk space usage on the database instance by 8x. Not only did this cause our existing database instance to rapidly fill up, but it also made operations question if the design pattern made sense. Because they weren't included in such an impactful change, all of the design decisions that went into the new process architecture were viewed as suspect and underwent a constant re-examination from ops. In a nutshell, a little bit of faith and trust was lost. + +The damage caused by eroding faith can't be understated. Collaboration is based on trust. Every time this trust is chipped away, energy is spent on questioning the validity of decisions made by others. + +### What are the benefits of sharing? + +Today's systems are incredibly complex. The days when one person could hold an entire infrastructure and system interdependencies in their head are long gone. Communicating across boundaries of expertise makes our entire organization more robust and resilient. + +Sharing isn't just about the technical data or access, though. "Inter-team communication should always start with the goal, not with one team's proposed solution to a problem," Jeff says. "When you start with a solution, the conversation veers in the wrong direction." + +[Emily Freeman][4], CloudOps advocate at [Microsoft][5] says "Collaboration is impossible without sharing information." She points out that having a "mental map" of the skills and knowledge of other teams "enables people to ask questions more efficiently and reduces the fear they're asking too many questions or look stupid." + +### How can we share better? + +"Sharing doesn't have to be a drum circle every Tuesday at 10:30am," Emily says. "It's openness and authenticity. It's removing the shadows from your organization and ensuring everyone is honest and forthright and accountable." + +At a minimum, there should be read-only access to logs, code, and after-incident reports for everyone. Before you cry "separation of concerns," please consider that the data that cannot be shared with everyone in the organization is a much smaller set than we usually think it is. It might require some additional effort to scrub and protect this small subset than to default to "nobody can see anything but their small part of it," but the benefits outweigh the effort. + +"If anyone's excluded, they aren't part of your team, no matter what the org chart says," Emily reminds us. + +It's more than the logs and the tooling, though. "The 'S' is often just seen as knowledge sharing, training, etc.," Jeff says. "But if it doesn't include the sharing of responsibility and ownership, it can be difficult to get your organization to that next level of productivity." + +### Why don't we share? + +There are many reasons that sharing information and knowledge isn't the default position for knowledge workers, but both Emily and Jeff agree it usually comes down to fear. + +"Teams may feel that only their circle is capable of performing a particular task with the zeal and delicacy it deserves," Jeff says. "So information gets siloed, access gets restricted, and gates get constructed. But that diminishes our responsibility to build safe systems, instead leaning on 'operator expertise' as a crutch." + +Emily agrees. "DevOps cultures never look to change the past," she says. "Instead, the companies that thrive at embracing the DevOps philosophy are realistic about where they are and work toward continuously improving their process so everyone on the team can thrive." + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/why-sharing-important-devops-culture + +作者:[Matty Stratton][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mattstratton +[b]: https://github.com/lujun9972 +[1]: https://whatis.techtarget.com/definition/CALMS +[2]: https://twitter.com/DarkAndNerdy +[3]: https://www.centro.net/ +[4]: https://twitter.com/editingemily +[5]: http://dev.azure.com/ From 2c6c053cd1d9812fd428512511b978c0b3261b0c Mon Sep 17 00:00:00 2001 From: runningwater Date: Mon, 3 Dec 2018 19:29:27 +0800 Subject: [PATCH 048/135] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...707 Version Control Before Git with CVS.md | 313 ----------------- ...707 Version Control Before Git with CVS.md | 316 ++++++++++++++++++ 2 files changed, 316 insertions(+), 313 deletions(-) delete mode 100644 sources/tech/20180707 Version Control Before Git with CVS.md create mode 100644 translated/tech/20180707 Version Control Before Git with CVS.md diff --git a/sources/tech/20180707 Version Control Before Git with CVS.md b/sources/tech/20180707 Version Control Before Git with CVS.md deleted file mode 100644 index 4c59a2cfc0..0000000000 --- a/sources/tech/20180707 Version Control Before Git with CVS.md +++ /dev/null @@ -1,313 +0,0 @@ -(translating by runningwater) -Version Control Before Git with CVS -====== -Github was launched in 2008. If your software engineering career, like mine, is no older than Github, then Git may be the only version control software you have ever used. While people sometimes grouse about its steep learning curve or unintuitive interface, Git has become everyone’s go-to for version control. In Stack Overflow’s 2015 developer survey, 69.3% of respondents used Git, almost twice as many as used the second-most-popular version control system, Subversion. After 2015, Stack Overflow stopped asking developers about the version control systems they use, perhaps because Git had become so popular that the question was uninteresting. - -Git itself is not much older than Github. Linus Torvalds released the first version of Git in 2005. Though today younger developers might have a hard time conceiving of a world where the term “version control software” didn’t more or less just mean Git, such a world existed not so long ago. There were lots of alternatives to choose from. Open source developers preferred Subversion, enterprises and video game companies used Perforce (some still do), while the Linux kernel project famously relied on a version control system called BitKeeper. - -Some of these systems, particularly BitKeeper, might feel familiar to a young Git user transported back in time. Most would not. BitKeeper aside, the version control systems that came before Git worked according to a fundamentally different paradigm. In a taxonomy offered by Eric Sink, author of Version Control by Example, Git is a third-generation version control system, while most of Git’s predecessors, the systems popular in the 1990s and early 2000s, are second-generation version control systems. Where third-generation version control systems are distributed, second-generation version control systems are centralized. You have almost certainly heard Git described as a “distributed” version control system before. I never quite understood the distributed/centralized distinction, at least not until I installed and experimented with a centralized second-generation version control system myself. - -The system I installed was CVS. CVS, short for Concurrent Versions System, was the very first second-generation version control system. It was also the most popular version control system for about a decade until it was replaced in 2000 by Subversion. Even then, Subversion was supposed to be “CVS but better,” which only underscores how dominant CVS had become throughout the 1990s. - -CVS was first developed in 1986 by a Dutch computer scientist named Dick Grune, who was looking for a way to collaborate with his students on a compiler project. CVS was initially little more than a collection of shell scripts wrapping RCS (Revision Control System), a first-generation version control system that Grune wanted to improve. RCS works according to a pessimistic locking model, meaning that no two programmers can work on a single file at once. In order to edit a file, you have to first ask RCS for an exclusive lock on the file, which you keep until you are finished editing. If someone else is already editing a file you need to edit, you have to wait. CVS improved on RCS and ushered in the second generation of version control systems by trading the pessimistic locking model for an optimistic one. Programmers could now edit the same file at the same time, merging their edits and resolving any conflicts later. (Brian Berliner, an engineer who later took over the CVS project, wrote a very readable [paper][1] about CVS’ innovations in 1990.) - -In that sense, CVS wasn’t all that different from Git, which also works according to an optimistic model. But that’s where the similarities end. In fact, when Linus Torvalds was developing Git, one of his guiding principles was WWCVSND, or “What Would CVS Not Do.” Whenever he was in doubt about a decision, he strove to choose the option that had not been chosen in the design of CVS. So even though CVS predates Git by over a decade, it influenced Git as a kind of negative template. - -I’ve really enjoyed playing around with CVS. I think there’s no better way to understand why Git’s distributed nature is such an improvement on what came before. So I invite you to come along with me on an exciting journey and spend the next ten minutes of your life learning about a piece of software nobody has used in the last decade. (See correction.) - -### Getting Started with CVS - -Instructions for installing CVS can be found on the [project’s homepage][2]. On MacOS, you can install CVS using Homebrew. - -Since CVS is centralized, it distinguishes between the client-side universe and the server-side universe in a way that something like Git does not. The distinction is not so pronounced that there are different executables. But in order to start using CVS, even on your own machine, you’ll have to set up the CVS backend. - -The CVS backend, the central store for all your code, is called the repository. Whereas in Git you would typically have a repository for every project, in CVS the repository holds all of your projects. There is one central repository for everything, though there are ways to work with only a project at a time. - -To create a local repository, you run the `init` command. You would do this somewhere global like your home directory. - -``` -$ cvs -d ~/sandbox init -``` - -CVS allows you to pass options to either the `cvs` command itself or to the `init` subcommand. Options that appear after the `cvs` command are global in nature, while options that appear after the subcommand are specific to the subcommand. In this case, the `-d` flag is global. Here it happens to tell CVS where we want to create our repository, but in general the `-d` flag points to the location of the repository we want to use for any given action. It can be tedious to supply the `-d` flag all the time, so the `CVSROOT` environment variable can be set instead. - -Since we’re working locally, we’ve just passed a path for our `-d` argument, but we could also have included a hostname. - -The command creates a directory called `sandbox` in your home directory. If you list the contents of `sandbox`, you’ll find that it contains another directory called `CVSROOT`. This directory, not to be confused with the environment variable, holds administrative files for the repository. - -Congratulations! You’ve just created your first CVS repository. - -### Checking In Code - -Let’s say that you’ve decided to keep a list of your favorite colors. You are an artistically inclined but extremely forgetful person. You type up your list of colors and save it as a file called `favorites.txt`: - -``` -blue -orange -green - -definitely not yellow -``` - -Let’s also assume that you’ve saved your file in a new directory called `colors`. Now you’d like to put your favorite color list under version control, because fifty years from now it will be interesting to look back and see how your tastes changed through time. - -In order to do that, you will have to import your directory as a new CVS project. You can do that using the `import` command: - -``` -$ cvs -d ~/sandbox import -m "" colors colors initial -N colors/favorites.txt - -No conflicts created by this import -``` - -Here we are specifying the location of our repository with the `-d` flag again. The remaining arguments are passed to the `import` subcommand. We have to provide a message, but here we don’t really need one, so we’ve left it blank. The next argument, `colors`, specifies the name of our new directory in the repository; here we’ve just used the same name as the directory we are in. The last two arguments specify the vendor tag and the release tag respectively. We’ll talk more about tags in a minute. - -You’ve just pulled your “colors” project into the CVS repository. There are a couple different ways to go about bringing code into CVS, but this is the method recommended by [Pragmatic Version Control Using CVS][3], the Pragmatic Programmer book about CVS. What makes this method a little awkward is that you then have to check out your work fresh, even though you’ve already got an existing `colors` directory. Instead of using that directory, you’re going to delete it and then check out the version that CVS already knows about: - -``` -$ cvs -d ~/sandbox co colors -cvs checkout: Updating colors -U colors/favorites.txt -``` - -This will create a new directory, also called `colors`. In this directory you will find your original `favorites.txt` file along with a directory called `CVS`. The `CVS` directory is basically CVS’ equivalent of the `.git` directory in every Git repository. - -### Making Changes - -Get ready for a trip. - -Just like Git, CVS has a `status` subcommand: - -``` -$ cvs status -cvs status: Examining . -=================================================================== -File: favorites.txt Status: Up-to-date - - Working revision: 1.1.1.1 2018-07-06 19:27:54 -0400 - Repository revision: 1.1.1.1 /Users/sinclairtarget/sandbox/colors/favorites.txt,v - Commit Identifier: fD7GYxt035GNg8JA - Sticky Tag: (none) - Sticky Date: (none) - Sticky Options: (none) -``` - -This is where things start to look alien. CVS doesn’t have commit objects. In the above, there is something called a “Commit Identifier,” but this might be only a relatively recent edition—no mention of a “Commit Identifier” appears in Pragmatic Version Control Using CVS, which was published in 2003. (The last update to CVS was released in 2008.) - -Whereas with Git you’d talk about the version of a file associated with commit `45de392`, in CVS files are versioned separately. The first version of your file is version 1.1, the next version is 1.2, and so on. When branches are involved, extra numbers are appended, so you might end up with something like the `1.1.1.1` above, which appears to be the default in our case even though we haven’t created any branches. - -If you were to run `cvs log` (equivalent to `git log`) in a project with lots of files and commits, you’d see an individual history for each file. You might have a file at version 1.2 and a file at version 1.14 in the same project. - -Let’s go ahead and make a change to version 1.1 of our `favorites.txt` file: - -``` - blue - orange - green -+cyan - - definitely not yellow -``` - -Once we’ve made the change, we can run `cvs diff` to see what CVS thinks we’ve done: - -``` -$ cvs diff -cvs diff: Diffing . -Index: favorites.txt -=================================================================== -RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v -retrieving revision 1.1.1.1 -diff -r1.1.1.1 favorites.txt -3a4 -> cyan -``` - -CVS recognizes that we added a new line containing the color “cyan” to the file. (Actually, it says we’ve made changes to the “RCS” file; you can see that CVS never fully escaped its original association with RCS.) The diff we are being shown is the diff between the copy of `favorites.txt` in our working directory and the 1.1.1.1 version stored in the repository. - -In order to update the version stored in the repository, we have to commit the change. In Git, this would be a multi-step process. We’d have to stage the change so that it appears in our index. Then we’d commit the change. Finally, to make the change visible to anyone else, we’d have to push the commit up to the origin repository. - -In CVS, all of these things happen when you run `cvs commit`. CVS just bundles up all the changes it can find and puts them in the repository: - -``` -$ cvs commit -m "Add cyan to favorites." -cvs commit: Examining . -/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt -new revision: 1.2; previous revision: 1.1 -``` - -I’m so used to Git that this strikes me as terrifying. Without an opportunity to stage changes, any old thing that you’ve touched in your working directory might end up as part of the public repository. Did you passive-aggressively rewrite a coworker’s poorly implemented function out of cathartic necessity, never intending for him to know? Too bad, he now thinks you’re a dick. You also can’t edit your commits before pushing them, since a commit is a push. Do you enjoy spending 40 minutes repeatedly running `git rebase -i` until your local commit history flows like the derivation of a mathematical proof? Sorry, you can’t do that here, and everyone is going to find out that you don’t actually write your tests first. - -But I also now understand why so many people find Git needlessly complicated. If `cvs commit` is what you were used to, then I’m sure staging and pushing changes would strike you as a pointless chore. - -When people talk about Git being a “distributed” system, this is primarily the difference they mean. In CVS, you can’t make commits locally. A commit is a submission of code to the central repository, so it’s not something you can do without a connection. All you’ve got locally is your working directory. In Git, you have a full-fledged local repository, so you can make commits all day long even while disconnected. And you can edit those commits, revert, branch, and cherry pick as much as you want, without anybody else having to know. - -Since commits were a bigger deal, CVS users often made them infrequently. Commits would contain as many changes as today we might expect to see in a ten-commit pull request. This was especially true if commits triggered a CI build and an automated test suite. - -If we now run `cvs status`, we can see that we have a new version of our file: - -``` -$ cvs status -cvs status: Examining . -=================================================================== -File: favorites.txt Status: Up-to-date - - Working revision: 1.2 2018-07-06 21:18:59 -0400 - Repository revision: 1.2 /Users/sinclairtarget/sandbox/colors/favorites.txt,v - Commit Identifier: pQx5ooyNk90wW8JA - Sticky Tag: (none) - Sticky Date: (none) - Sticky Options: (none) -``` - -### Merging - -As mentioned above, in CVS you can edit a file that someone else is already editing. That was CVS’ big improvement on RCS. What happens when you need to bring your changes back together? - -Let’s say that you have invited some friends to add their favorite colors to your list. While they are adding their colors, you decide that you no longer like the color green and remove it from the list. - -When you go to commit your changes, you might discover that CVS notices a problem: - -``` -$ cvs commit -m "Remove green" -cvs commit: Examining . -cvs commit: Up-to-date check failed for `favorites.txt' -cvs [commit aborted]: correct above errors first! -``` - -It looks like your friends committed their changes first. So your version of `favorites.txt` is not up-to-date with the version in the repository. If you run `cvs status`, you’ll see that your local copy of `favorites.txt` is version 1.2 with some local changes, but the repository version is 1.3: - -``` -$ cvs status -cvs status: Examining . -=================================================================== -File: favorites.txt Status: Needs Merge - - Working revision: 1.2 2018-07-07 10:42:43 -0400 - Repository revision: 1.3 /Users/sinclairtarget/sandbox/colors/favorites.txt,v - Commit Identifier: 2oZ6n0G13bDaldJA - Sticky Tag: (none) - Sticky Date: (none) - Sticky Options: (none) -``` - -You can run `cvs diff` to see exactly what the differences between 1.2 and 1.3 are: - -``` -$ cvs diff -r HEAD favorites.txt -Index: favorites.txt -=================================================================== -RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v -retrieving revision 1.3 -diff -r1.3 favorites.txt -3d2 -< green -7,10d5 -< -< pink -< hot pink -< bubblegum pink -``` - -It seems that our friends really like pink. In any case, they’ve edited a different part of the file than we have, so the changes are easy to merge. CVS can do that for us when we run `cvs update`, which is similar to `git pull`: - -``` -$ cvs update -cvs update: Updating . -RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v -retrieving revision 1.2 -retrieving revision 1.3 -Merging differences between 1.2 and 1.3 into favorites.txt -M favorites.txt -``` - -If you now take a look at `favorites.txt`, you’ll find that it has been modified to include the changes that your friends made to the file. Your changes are still there too. Now you are free to commit the file: - -``` -$ cvs commit -cvs commit: Examining . -/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt -new revision: 1.4; previous revision: 1.3 -``` - -The end result is what you’d get in Git by running `git pull --rebase`. Your changes have been added on top of your friends’ changes. There is no “merge commit.” - -Sometimes, changes to the same file might be incompatible. If your friends had changed “green” to “olive,” for example, that would have conflicted with your change removing “green” altogether. In the early days of CVS, this was exactly the kind of case that caused people to worry that CVS wasn’t safe; RCS’ pessimistic locking ensured that such a case could never arise. But CVS guarantees safety by making sure that nobody’s changes get overwritten automatically. You have to tell CVS which change you want to keep going forward, so when you run `cvs update`, CVS marks up the file with both changes in the same way that Git does when Git detects a merge conflict. You then have to manually edit the file and pick the change you want to keep. - -The interesting thing to note here is that merge conflicts have to be fixed before you can commit. This is another consequence of CVS’ centralized nature. In Git, you don’t have to worry about resolving merges until you push the commits you’ve got locally. - -Since CVS doesn’t have easily addressable commit objects, the only way to group a collection of changes is to mark a particular working directory state with a tag. - -Creating a tag is easy: - -``` -$ cvs tag VERSION_1_0 -cvs tag: Tagging . -T favorites.txt -``` - -You’ll later be able to return files to this state by running `cvs update` and passing the tag to the `-r` flag: - -``` -$ cvs update -r VERSION_1_0 -cvs update: Updating . -U favorites.txt -``` - -Because you need a tag to rewind to an earlier working directory state, CVS encourages a lot of preemptive tagging. Before major refactors, for example, you might create a `BEFORE_REFACTOR_01` tag that you could later use if the refactor went wrong. People also used tags if they wanted to generate project-wide diffs. Basically, all the things we routinely do today with commit hashes have to be anticipated and planned for with CVS, since you needed to have the tags available already. - -Branches can be created in CVS, sort of. Branches are just a special kind of tag: - -``` -$ cvs rtag -b TRY_EXPERIMENTAL_THING colors -cvs rtag: Tagging colors -``` - -That only creates the branch (in full view of everyone, by the way), so you still need to switch to it using `cvs update`: - -``` -$ cvs update -r TRY_EXPERIMENTAL_THING -``` - -The above commands switch onto the new branch in your current working directory, but Pragmatic Version Control Using CVS actually advises that you create a new directory to hold your new branch. Presumably its authors found switching directories easier than switching branches in CVS. - -Pragmatic Version Control Using CVS also advises against creating branches off of an existing branch. They recommend only creating branches off of the mainline branch, which in Git is known as `master`. In general, branching was considered an “advanced” CVS skill. In Git, you might start a new branch for almost any trivial reason, but in CVS branching was typically used only when really necessary, such as for releases. - -A branch could later be merged back into the mainline using `cvs update` and the `-j` flag: - -``` -$ cvs update -j TRY_EXPERIMENTAL_THING -``` - -### Thanks for the Commit Histories - -In 2007, Linus Torvalds gave [a talk][4] about Git at Google. Git was very new then, so the talk was basically an attempt to persuade a roomful of skeptical programmers that they should use Git, even though Git was so different from anything then available. If you haven’t already seen the talk, I highly encourage you to watch it. Linus is an entertaining speaker, even if he never fails to be his brash self. He does an excellent job of explaining why the distributed model of version control is better than the centralized one. A lot of his criticism is reserved for CVS in particular. - -Git is a [complex tool][5]. Learning it can be a frustrating experience. But I’m also continually amazed at the things that Git can do. In comparison, CVS is simple and straightforward, though often unable to do many of the operations we now take for granted. Going back and using CVS for a while is an excellent way to find yourself with a new appreciation for Git’s power and flexibility. It illustrates well why understanding the history of software development can be so beneficial—picking up and re-examining obsolete tools will teach you volumes about the why behind the tools we use today. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][6] on Twitter or subscribe to the [RSS feed][7] to make sure you know when a new post is out. - -#### Correction - -I’ve been told that there are many organizations, particularly risk-adverse organizations that do things like make medical device software, that still use CVS. Programmers in these organizations have developed little tricks for working around CVS’ limitations, such as making a new branch for almost every change to avoid committing directly to `HEAD`. (Thanks to Michael Kohne for pointing this out.) - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2018/07/07/cvs.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://docs.freebsd.org/44doc/psd/28.cvs/paper.pdf -[2]: https://www.nongnu.org/cvs/ -[3]: http://shop.oreilly.com/product/9780974514000.do -[4]: https://www.youtube.com/watch?v=4XpnKHJAok8 -[5]: https://xkcd.com/1597/ -[6]: https://twitter.com/TwoBitHistory -[7]: https://twobithistory.org/feed.xml diff --git a/translated/tech/20180707 Version Control Before Git with CVS.md b/translated/tech/20180707 Version Control Before Git with CVS.md new file mode 100644 index 0000000000..6532d65e7c --- /dev/null +++ b/translated/tech/20180707 Version Control Before Git with CVS.md @@ -0,0 +1,316 @@ +Git 之前使用 CVS 进行版本控制 +====== +Github 网站于 2008 年发布。如果你的软件工程师职业生涯跟我一样,也是晚于此时间的话,Git 可能是你用过的唯一版本控制软件。虽然其陡峭的学习曲线和不直观地用户界面时常会遭人抱怨,但不可否认的是, Git 已经成为人们学习版本控制的最佳选择。 2015 年,Stack Overflow 进行的开发者调查显示,69.3% 的被调查者在使用 Git,几乎是排名第二的 Subversion 版本控制系统使用者数量的两倍。2015 年之后,也许是因为 Git 太受欢迎了,大家对此话题不再感兴趣,所以 Stack Overflow 停止了关于开发人员使用版本控制系统软件的问卷调查。 + +Github 的发布时间距离 Git 自身发布时间很近。2005 年, Linus Torvalds 发布了 Git 的首个版本。现在的年经一代开发者可能很难想象“版本控制软件”生命周期所代表的世界并不仅仅只有 Git,虽然这样的世界诞生的时间并不长。除了 Git 外,还有很多可供选择。开源开发者较喜欢 Subversion,企业和视频游戏公司使用 Perforce (到如今有些仍在用),而 Linux 内核项目依赖于名为 BitKeeper 的版本控制系统。 + +其中一些系统,特别是 BitKeeper,会让年经一代的 Git 用户感觉很熟悉,上手也很快,但大多数相差很大。除了 BitKeeper,Git 之前的版本控制系统都是以不同的架构模型为基础运行的。作者 Eric Sink 在他的 [Version Control By Example][8] 一书中对版本控制进行了分类,按其说法,Git 属于第三代版本控制系统,而大多数 Git 的前身,即流行于二十世纪九零年代和二十一世纪早期的系统,都属于第二代版本控制系统。第三代版本控制系统是分布式的,第二代是集中式。你们以前大概都听过 Git 被描述为一款“分布式”版本控制系统。我一直都不明白分布式/集中式之间的区别,随后自己亲自安装了一款第二代的集中式版本控件系统,并做了相关实验,至少明白了一些。 + +我安装的版本系统是 CVS。CVS,即 `Concurrent Versions System` 的缩写,是最初的第二代版本控制系统。大约十年,它是最为流行的版本控制系统,直到 2000 年被 Subversion 所取代。即便如此,Subversion 被认为是 “CVS 但做的更好”,这更进一步突出了 CVS 在二十世纪九零年代的主导地位。 + +CVS 最早是由一位名叫 Dick Grune 的荷兰科学家在 1986 年间开发的,当时有一个编译器项目,他正在寻找一种能与其学生合作的方法。CVS 最初仅仅只是一个包装了 RCS(修订控制系统) 的 Shell 脚本集合,Grune 想改进这个第一代的版本控制系统。 RCS 是按悲观锁模式工作的,这意味着两个程序员不可以同时处理同一个文件。需要编辑一个文件话,首先得向 RCS 系统请求一个排它锁,锁定此文件直到完成编辑,如果你想编辑的文件有人正在编辑,你就必须等待。CVS 在 RCS 基础上改进,并把悲观锁模型替换成乐观锁模型,迎来了第二代版本控制系统的时代。现在,程序员可以同时编辑同一个文件、合并编辑部分,随后解决合并冲突问题。(后来接管 CVS 项目的工程师布莱恩·柏林(Brian Berliner)于 1990 年撰写了一篇关于 CVS 创新的非常易读的 [论文][1]。) + +从这个意义上来讲,CVS 与 Git 并无差异,因为 Git 也是运行于乐观锁模式的,但也仅仅只有此点相似。实际上,Linus Torvalds 开发 Git 时,他的一个指导原则是 WWCVSND,即 “What Would CVS +Not Do (CVS 不能做的).” 每当他做决策时,他都会力争选择那些在 CVS 设计里没有使用的功能选项。所以即使 CVS 要早于 Git 十多年,但它对 Git 的影响是为负数的。 + +我非常喜欢折腾 CVS。我认为要弄明白为什么 Git 的分布式特性是对以前的版本控制系统的较大改善的话,除了折腾 CVS 外,没有更好的办法。因此,我邀请您跟我一起来一段激动人心的旅程,并在接下来的十分钟内了解下这个近十年来无人使用的软件。(可以看看修正部分) + +### CVS 入门 + +CVS 的安装教程可以在其 [项目主页][2] 上找到。MacOS 系统的话,可以使用 Homebrew 安装。 + +由于 CVS 是集中式的,所以它有客户端和服务端之区分,这种模式 Git 是没有的。两端分别有不同的可执行文件,其区别不太明显。但要开始使用 CVS 的话,即使只在您的本地机器上使用,也必须设置 CVS 的服务后端。 + +CVS 的后端,即所有代码的中央存储区,被叫做存储库 (repository)。在 Git 中每一个项目都有一个存储库,而 CVS 中一个存储库就包含所有的项目。尽管有办法保证一次只能访问一个项目,但一个中央存储库包含所有东西是改变不了的。 + +要在本地创建存储库的话,请运行 `init` 命令。您可以像如下所示在家(home)目录创建,也可以在您本地的任何地方创建。 + +``` +$ cvs -d ~/sandbox init +``` + +CVS 允许您将选项传递给 `cvs` 命令本身或 `init` 子命令。出现在 `cvs` 命令之后的选项默认是全局的,而出现在子命令之后的是子命令特有选项。上面所示例子中,`-d` 标志是全局选项。在这儿是告诉 CVS 我们想要创建存储库路径在哪里,但通用的 `-d` 标志指的是我们想要使用的且已经存在的存储库位置。一直使用 `-d` 标志很单调乏味,所以可以设置 `CVSROOT` 环境变量来代替。 + +因为我们只是在本地操作,所以仅仅使用 `-d` 参考来传送路径就可以,但也可以包含个主机名。 + +此命令在您的家目录创建了一个名叫 `sandbox` 的目录。 如果您列出 `sandbox` 内容,会发现下面包含有 `CVSROOT` 的目录。请不要把此目录与我们的环境变量混淆,它保存存储库的管理文件。 + +恭喜! 您刚刚创建了第一个 CVS 存储库。 + +### 检入代码 + +假设你决定留存下自己喜欢的颜色清单。因为您是一个有艺术倾向但很健忘的人,所以你键入颜色列表清单,并保存到一个叫 `favorites.txt` 的文件中: + +``` +blue +orange +green + +definitely not yellow +``` + +我们也假设您把文件保存到一个叫 `colors` 的目录中。现在你想要把喜欢的颜色列表清单置于版本控制之下,因为从现在起的五十年间会回顾下,随着时间的推移自己的品味怎么变化,这件事很有意思。 + +为此,您必须将您的目录导入为新的 CVS 项目。可以使用 `import` 命令: + +``` +$ cvs -d ~/sandbox import -m "" colors colors initial +N colors/favorites.txt + +No conflicts created by this import +``` + +这里我们再次使用 `-d` 标志来指定存储库的位置,其余的参数是传输给 `import ` 子命令的。必须要提供一条消息,但这儿没必要,所以留空。下一个参数 `colors`,指定了存储库中新目录的名字,这儿给的名字跟检入的目录名称一致。最后的两个参数分别指定了 vendor 标签和 release 标签。我们稍后就会谈论标签。 + +我们刚将 `colors` 项目拉入 CVS 存储库。将代引入 CVS 有很多种不同的方法,但这是 [Pragmatic Version Control Using CVS][3] 一书所推荐方法,这是一本关于 CVS 的程序员实用指导书籍。使用这种方法有点尴尬的就是你得重新检出 (check out) 工作项目,即使已经存在有 `colors` 此项目了。不要使用该目录,首先删除它,然后从 CVS 中检出刚才的版本,如下示: + +``` +$ cvs -d ~/sandbox co colors +cvs checkout: Updating colors +U colors/favorites.txt +``` + +这个过程会创建一个新的目录,也叫做 `colors`。此目录里会发现您的源文件 `favorites.txt`,还有一个叫 `CVS` 的目录。这个 `CVS` 目录基本上与 Git 存储库的 `.git` 目录等同。 + +### 做出改动 + +准备旅行。 + +和 Git 一样,CVS 也有 `status` 命令: + +``` +$ cvs status +cvs status: Examining . +=================================================================== +File: favorites.txt Status: Up-to-date + + Working revision: 1.1.1.1 2018-07-06 19:27:54 -0400 + Repository revision: 1.1.1.1 /Users/sinclairtarget/sandbox/colors/favorites.txt,v + Commit Identifier: fD7GYxt035GNg8JA + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none) +``` + +到这儿事情开始陌生起来了。CVS 没有提交对象这一概念。如上示,有一个叫 “提交标识符 Commit Identifier ” 的东西,但这可能是一个较新版本的标识,在 2003 年出版的《Pragmatic Version Control Using CVS》一书中并没有提到 “提交标识符” 这个概念。 (CVS 的最新版本于 2008 年发布的。) + +在 Git 中,我们所谈论某文件版本其实是在谈论如 `commit 45de392` 相关的东西,而 CVS 中文件是独立版本化的。文件的第一个版本为 1.1 版本,下一个是 1.2 版本,依此类推。涉及分支时,会在后面添加扩展数字。因此您会看到如上所示的 `1.1.1.1` 的内容,这就是示例的版本号,即使我们没有创建分支,似乎默认的会给加上。 + +一个项目中会有很多的文件和很多次的提交,如果您运行 `cvs log` 命令(等同于 `git log`),会看到每个文件提交历史信息。同一个项目中,有可能一个文件处于 1.2 版本,一个文件处于 1.14 版本。 + +继续,我们对 1.1 版本的 `favorites.txt` 文件做些修改: + +``` + blue + orange + green ++cyan + + definitely not yellow +``` + +修改完成,就可以运行 `cvs diff` 来看看 CVS 发生了什么: + +``` +$ cvs diff +cvs diff: Diffing . +Index: favorites.txt +=================================================================== +RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v +retrieving revision 1.1.1.1 +diff -r1.1.1.1 favorites.txt +3a4 +> cyan +``` + +CVS 识别出我们我在文件中添加了一个包含颜色 "cyan" 的新行。(实际上,它说我们已经对 “RCS” 文件进行了更改;你可以看到,CVS 底层使用的还是 RCS。) 此差异指的是当前工作目录中的 `favorites.txt` 副本与存储库中 1.1.1.1 版本的文件之间的差异。 + +为了更新存储库中的版本,我们必须提交更改。Git 中,这个操作要好几个步骤。首先,暂存此修改,使其在索引中出现,然后提交此修改,最后,为了使此修改让其他人可见,我们必须把此提交推送到源存储库中。 + +而 CVS 中,只需要运行 `cvs commit` 命令就搞定一切。CVS 会查找所有修改的东西,进行捆绑,然后把它们放到存储库中。 + +``` +$ cvs commit -m "Add cyan to favorites." +cvs commit: Examining . +/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt +new revision: 1.2; previous revision: 1.1 +``` + +我已经习惯了 Git, 所以这种操作会让我感到十分恐惧。因为没有变更暂存区的机制,工作目录下修改的一些老旧的东西都会一股脑给提交到公共存储库中。您有过因为不爽,私下里重写了某个同事不佳的功能实现,但仅仅只是自我宣泄一下并不想让他知道的时候吗?如果不小心提交上去了,就太糟糕了,他会认为你是个混蛋。在推送之前,你也不能修改提交过的东西了,因为提交就是推送。还是您愿意花费 40 分钟的时间来反复运行 `git rebase -i` 命令,以使得本地提交历史记录跟数学证明一样清晰严谨?很遗憾,CVS 里不支持,结果就是,大家都会看到您没有先写测试用例。 + +不过,到现在我终于理解了为什么那么多人都觉得 Git 没必要搞那么复杂。对那些早已经习惯直接 `cvs commit` 的人来说,进行暂存变更和推送变更操作确实是毫无意义的差事。 + +人们常谈论 Git 是一个 “分布式” 系统,其意思中分布式与非分布式的主要区别为:在 CVS 中,无法进行本地提交。一次提交操作就是向中央存储库提交代码,所以没有网络连接,刚无法执行此操作,获取到本地的只是您的工作目录;在 Git 中,会有一个完完全全的本地存储库,所以即使断网了也可以无间断执行提交操作。您还可以进行编辑提交内容、回退、分支和随心所欲的操作,且无人知晓。 + +虽然提交是个很大的话题,但 CVS 用户很少会关注。提交会包含很多的内容修改及今天我们盼望看到的十多次提交请求。还有很特别的,提交触发 CI 构建和触发自动测试程序等。 + +现在我们运行 `cvs status`,会看到产生了文件的新版本: + +``` +$ cvs status +cvs status: Examining . +=================================================================== +File: favorites.txt Status: Up-to-date + + Working revision: 1.2 2018-07-06 21:18:59 -0400 + Repository revision: 1.2 /Users/sinclairtarget/sandbox/colors/favorites.txt,v + Commit Identifier: pQx5ooyNk90wW8JA + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none) +``` + +### 合并 + +如上所述,在 CVS 中,你可以同时编辑其他人正在编辑的文件。这是 CVS 对 RCS 的重大改进。当需要将更改的部分重新组合在一起时会发生什么? + +假设您邀请了一些来将他们喜欢的颜色添加到您的列表中。在他们添加的时候,您确定了不再喜欢绿色,然后把它从列表中删除。 + +当你提交更新的时候,会发现 CVS 报出了个问题: + +``` +$ cvs commit -m "Remove green" +cvs commit: Examining . +cvs commit: Up-to-date check failed for `favorites.txt' +cvs [commit aborted]: correct above errors first! +``` + +好像是朋友们首先提交了更新。所以您的 `favorites.txt` 文件版本没有更新到存储库中的最新版本。此时运行 `cvs status` 就可以看到,本地的 `favorites.txt` 文件副本有一些变更且是 1.2 版本的而存储库上的版本号是 1.3,如下示: + +``` +$ cvs status +cvs status: Examining . +=================================================================== +File: favorites.txt Status: Needs Merge + + Working revision: 1.2 2018-07-07 10:42:43 -0400 + Repository revision: 1.3 /Users/sinclairtarget/sandbox/colors/favorites.txt,v + Commit Identifier: 2oZ6n0G13bDaldJA + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none) +``` + +你可以运行 `cvs diff` 来了解 1.2 版本与 1.3 版本的确切差异: + +``` +$ cvs diff -r HEAD favorites.txt +Index: favorites.txt +=================================================================== +RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v +retrieving revision 1.3 +diff -r1.3 favorites.txt +3d2 +< green +7,10d5 +< +< pink +< hot pink +< bubblegum pink +``` + +看来我们的朋友是真的喜欢粉红色,但好在他们编辑的是此文件的不同部分,所以很容易地合并此修改。跟 `git pull` 类似,只要运行 `cvs update` 命令,CVS 就可以为我们做合并操作,如下示: + +``` +$ cvs update +cvs update: Updating . +RCS file: /Users/sinclairtarget/sandbox/colors/favorites.txt,v +retrieving revision 1.2 +retrieving revision 1.3 +Merging differences between 1.2 and 1.3 into favorites.txt +M favorites.txt +``` + +此时查看 `favorites.txt` 文件内容的话,你会发现你的朋友对文件所做的更改已经包含进去了,你的修改也在里面。现在你可以自由的提交文件了,如下示: + +``` +$ cvs commit +cvs commit: Examining . +/Users/sinclairtarget/sandbox/colors/favorites.txt,v <-- favorites.txt +new revision: 1.4; previous revision: 1.3 +``` + +最终的结果就跟在 Git 中运行 `git pull --rebase` 一样。你的修改是添加在你朋友的修改之后的,所以没有 “合并提交” 这操作。 + +某些时候,对同一文件的修改可能导致冲突。例如,如果你的朋友把 “green” 修改成 “olive”,同时你完全删除 “green”,就会出现冲突。早期的时候,正是这种情况导致人们担心 CVS 不安全,而 RCS 的悲观锁机制可以确保此情况永不会发生。但 CVS 提供了一个安全保障机制,可以确保不会自动的覆盖任何人的修改。因此,当运行 `cvs update` 的时候,你必须告诉 CVS 想要做哪些修改才能继续下一步操作。CVS 会标记文件的所有变更,这跟 Git 检测到合并冲突时所做的方式一样,然后,你必须手工编辑文件,选择需要保留的变更进行合并。 + +这儿需要注意的有趣事情就是在进行提交之前必须修复并合并冲突。这是 CVS 集中式特性的另一个结果。而在 Git 里,在推送本地的提交内容之前,您都不用担心合并冲突问题。 + +由于 CVS 没有易于记录的提交对象,因此对变更集合进行分组的唯一方法就是对于特定的工作目录状态打个标记。 + +创建一个标记是很容易的: + +``` +$ cvs tag VERSION_1_0 +cvs tag: Tagging . +T favorites.txt +``` + +稍后,运行 `cvs update` 命令并把标签传输给 `-r` 标志就可以把文件恢复到此状态,如下示: + +``` +$ cvs update -r VERSION_1_0 +cvs update: Updating . +U favorites.txt +``` + +因为你需要一个标记来回退到早期的工作目录状态,所以 CVS 鼓励创建大量的抢占标记。例如,在重大的重构之前,你可以创建一个 `BEFORE_REFACTOR_01` 标记,如果重构出错,就可以使用此标记回退。你果想在项目范围上生成有差异的版本的话,也可以使用标记。基本上,我们使用 CVS 来管理的, 对于今天日常所做的所有事情都是预测性和计划性的,所以需要打上标记,以备回退修改。 + +可以在 CVS 中创建分支。分支只是一种特殊的标记,如下示: + +``` +$ cvs rtag -b TRY_EXPERIMENTAL_THING colors +cvs rtag: Tagging colors +``` + +(顺便提醒一下读者)这命令仅仅只是创建了分支,所以还需要使用 `cvs update` 命令来切换分支,如下示: + +``` +$ cvs update -r TRY_EXPERIMENTAL_THING +``` + +上面的命令就会把您的当前工作目录切换到新的分支,但《Pragmatic Version Control Using CVS》一书实际上是建议创建一个新的目录来间接替代新分支。估计,其作者发现在 CVS 里切换目录要比切换分支来得更简单吧。 + +此书也建议不要从现有分支创建分支,而只在主线分支,Git 中被叫做 `master`,上创建分支。一般来说,分支在 CVS 中主认为是 “高级” 技能。而在 Git 中,您几乎可以无理由的就创建新分支,但 CVS 中要在真正需要的时候才能创建,比如发布项目。 + +稍后可以使用 `cvs update` 和 `-j` 标志将分支合并回主线: + +``` +$ cvs update -j TRY_EXPERIMENTAL_THING +``` + +### 感谢历史上的贡献者 + +2007 年,Linus Torvalds 在 Google 进行了一场关于 Git 的 [演讲][4](译者注:需要梯子,国内用户可以访问 [腾讯视频][9])。当时 Git 是很新的东西,整场演讲基本上都是在说服满屋子都持有怀疑态度的程序员们,尽管 Git 是如此的与众不同,也应该使用 Git。如果没有看过这个视频的话,我强烈建议你去看看。Linus 是个有趣的演讲者,即使他有些傲慢。他非常出色地解释了为什么分布式的版本控制系统要比集中式的优秀。他的很多评论是直接针对 CVS 的。 + +Git 是一个 [相当复杂的工具][5]。学习起来是一个令人沮丧的经历,但也不断的给我惊喜,Git 还能做这样的事情。相比之下,CVS 简单明了,但是,许多我们认为理所当然的操作都做不了。想要对 Git 的强大功能和灵活性有全新的认识的话,就回过头来用用 CVS 吧,这是种很好的学习方式。这很好的诠释了为什么理解软件的开发历史可以让人受益匪浅。重拾过期淘汰的工具可以让我们理解今天所使用的工具后面所隐藏的哲理。 + +如果您喜欢此博文的话,每两周会有一次更新!请在 Twitter 上关注 [@TwoBitHistory][6] 或都通过 [RSS feed][7] 订阅,新博文出来会有通知。 + +#### 修正 + +有人告诉我,有很多组织企业,特别是像做医疗设备软件等这种规避风险类的企业,仍在使用 CVS。这些企业中的程序员通过使用一些小技巧来解决 CVS 的限制,例如为几乎每个更改创建一个新分支以避免直接提交给 `HEAD`。 (感谢 Michael Kohne 指出这一点。) + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2018/07/07/cvs.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[runningwater](https://github.com/runningwater) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://docs.freebsd.org/44doc/psd/28.cvs/paper.pdf +[2]: https://www.nongnu.org/cvs/ +[3]: http://shop.oreilly.com/product/9780974514000.do +[4]: https://www.youtube.com/watch?v=4XpnKHJAok8 +[5]: https://xkcd.com/1597/ +[6]: https://twitter.com/TwoBitHistory +[7]: https://twobithistory.org/feed.xml +[8]: https://ericsink.com/vcbe/index.html +[9]: https://v.qq.com/x/page/o0772kqh5iv.html From 2e85ad6ef7dcf2a6da5dc34c405cc1740b07946b Mon Sep 17 00:00:00 2001 From: oneforalone Date: Mon, 3 Dec 2018 20:31:28 +0800 Subject: [PATCH 049/135] translated by oneforalone --- ...20180228 Emacs -2- Introducing org-mode.md | 180 ------------------ ...20180228 Emacs -2- Introducing org-mode.md | 177 +++++++++++++++++ 2 files changed, 177 insertions(+), 180 deletions(-) delete mode 100644 sources/tech/20180228 Emacs -2- Introducing org-mode.md create mode 100644 translated/tech/20180228 Emacs -2- Introducing org-mode.md diff --git a/sources/tech/20180228 Emacs -2- Introducing org-mode.md b/sources/tech/20180228 Emacs -2- Introducing org-mode.md deleted file mode 100644 index 4345986973..0000000000 --- a/sources/tech/20180228 Emacs -2- Introducing org-mode.md +++ /dev/null @@ -1,180 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Emacs #2: Introducing org-mode) -[#]: via: (https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode) -[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen) -[#]: url: ( ) - -Emacs #2: Introducing org-mode -====== - -In [my first post in my series on Emacs][1], I described returning to Emacs after over a decade of vim, and org-mode being the reason why. - -I really am astounded at the usefulness, and simplicity, of org-mode. It is really a killer app. - -**So what exactly is org-mode?** - -I wrote yesterday: - -> It’s an information organization platform. Its website says “Your life in plain text: Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system.” - -That’s true, but doesn’t quite capture it. org-mode is a toolkit for you to organize things. It has reasonable out-of-the-box defaults, but it’s designed throughout for you to customize. - -To highlight a few things: - - * **Maintaining TODO lists** : items can be scattered across org-mode files, contain attachments, have tags, deadlines, schedules. There is a convenient “agenda” view to show you what needs to be done. Items can repeat. - * **Authoring documents** : org-mode has special features for generating HTML, LaTeX, slides (with LaTeX beamer), and all sorts of other formats. It also supports direct evaluation of code in-buffer and literate programming in virtually any Emacs-supported language. If you want to bend your mind on this stuff, read [this article on literate devops][2]. The [entire Worg website][3] -is made with org-mode. - * **Keeping notes** : yep, it can do that too. With full-text search, cross-referencing by file (as a wiki), by UUID, and even into other systems (into mu4e by Message-ID, into ERC logs, etc, etc.) - - - -**Getting started** - -I highly recommend watching [Carsten Dominik’s excellent Google Talk on org-mode][4]. It is an excellent introduction. - -org-mode is included with Emacs, but you’ll often want a more recent version. Debian users can `apt-get install org-mode`, or it comes with the Emacs packaging system; `M-x package-install RET org-mode RET` may do it for you. - -Now, you’ll probably want to start with the org-mode compact guide’s [introduction section][5], noting in particular to set the keybindings mentioned in the [activation section][6]. - -**A good tutorial…** - -I’ve linked to a number of excellent tutorials and introductory items; this post is not going to serve as a tutorial. There are two good videos linked at the end of this post, in particular. - -**Some of my configuration** - -I’ll document some of my configuration here, and go into a bit of what it does. This isn’t necessarily because you’ll want to copy all of this verbatim — but just to give you a bit of an idea of some of what can be configured, an idea of what to look up in the manual, and maybe a reference for “now how do I do that?” - -First, I set up Emacs to work in UTF-8 by default. -``` -(prefer-coding-system 'utf-8) (set-language-environment "UTF-8") -``` - -org-mode can follow URLs. By default, it opens in Firefox, but I use Chromium. -``` -(setq browse-url-browser-function 'browse-url-chromium) -``` - -I set the basic key bindings as documented in the Guide, plus configure the M-RET behavior. - -``` -(global-set-key "\C-cl" 'org-store-link) -(global-set-key "\C-ca" 'org-agenda) -(global-set-key "\C-cc" 'org-capture) -(global-set-key "\C-cb" 'org-iswitchb) - -(setq org-M-RET-may-split-line nil) -``` - - -**Configuration: Capturing** - -I can press `C-c c` from anywhere in Emacs. It will [capture something for me][7], and include a link back to whatever I was working on. - -You can define [capture templates][8] to set how this will work. I am going to keep two journal files for general notes about meetings, phone calls, etc. One for personal, one for work items. If I press `C-c c j`, then it will capture a personal item. The %a in all of these includes the link to where I was (or a link I had stored with `C-c l`). - -``` -(setq org-default-notes-file "~/org/tasks.org") -(setq org-capture-templates - '( - ("t" "Todo" entry (file+headline "inbox.org" "Tasks") - "* TODO %?\n %i\n %u\n %a") - ("n" "Note/Data" entry (file+headline "inbox.org" "Notes/Data") - "* %? \n %i\n %u\n %a") - ("j" "Journal" entry (file+datetree "~/org/journal.org") - "* %?\nEntered on %U\n %i\n %a") - ("J" "Work-Journal" entry (file+datetree "~/org/wjournal.org") - "* %?\nEntered on %U\n %i\n %a") - )) -(setq org-irc-link-to-logs t) -``` - -I like to link by UUIDs, which lets me move things between files without breaking locations. This helps generate UUIDs when I ask Org to store a link target for future insertion. - -``` -(require 'org-id) -(setq org-id-link-to-org-use-id 'create-if-interactive) -``` - -**Configuration: agenda views** - -I like my week to start on a Sunday, and for org to note the time when I mark something as done. - -``` -(setq org-log-done 'time) -(setq org-agenda-start-on-weekday 0) -``` - -**Configuration: files and refiling** - -Here I tell it what files to use in the agenda, and to add a few more to the plain text search. I like to keep a general inbox (from which I can move, or “refile”, content), and then separate tasks, journal, and knowledge base for personal and work items. - -``` - (setq org-agenda-files (list "~/org/inbox.org" - "~/org/email.org" - "~/org/tasks.org" - "~/org/wtasks.org" - "~/org/journal.org" - "~/org/wjournal.org" - "~/org/kb.org" - "~/org/wkb.org" - )) - (setq org-agenda-text-search-extra-files - (list "~/org/someday.org" - "~/org/config.org" - )) - - (setq org-refile-targets '((nil :maxlevel . 2) - (org-agenda-files :maxlevel . 2) - ("~/org/someday.org" :maxlevel . 2) - ("~/org/templates.org" :maxlevel . 2) - ) - ) -(setq org-outline-path-complete-in-steps nil) ; Refile in a single go -(setq org-refile-use-outline-path 'file) -``` - -**Configuration: Appearance** - -I like a pretty screen. After you’ve gotten used to org a bit, you might try this. - -``` -(require 'org-bullets) -(add-hook 'org-mode-hook - (lambda () - (org-bullets-mode t))) -(setq org-ellipsis "⤵") -``` - -**Coming up next…** - -This hopefully showed a few things that org-mode can do. Coming up next, I’ll cover how to customize TODO keywords and tags, archiving old tasks, forwarding emails to org-mode, and using git to synchronize between machines. - -You can also see a [list of all articles in this series][9]. - - - --------------------------------------------------------------------------------- - -via: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode - -作者:[John Goerzen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://changelog.complete.org/archives/author/jgoerzen -[b]: https://github.com/lujun9972 -[1]: https://changelog.complete.org/archives/9861-emacs-1-ditching-a-bunch-of-stuff-and-moving-to-emacs-and-org-mode -[2]: http://www.howardism.org/Technical/Emacs/literate-devops.html -[3]: https://orgmode.org/worg/ -[4]: https://www.youtube.com/watch?v=oJTwQvgfgMM -[5]: https://orgmode.org/guide/Introduction.html#Introduction -[6]: https://orgmode.org/guide/Activation.html#Activation -[7]: https://orgmode.org/guide/Capture.html#Capture -[8]: https://orgmode.org/guide/Capture-templates.html#Capture-templates -[9]: https://changelog.complete.org/archives/tag/emacs2018 diff --git a/translated/tech/20180228 Emacs -2- Introducing org-mode.md b/translated/tech/20180228 Emacs -2- Introducing org-mode.md new file mode 100644 index 0000000000..db22d1449c --- /dev/null +++ b/translated/tech/20180228 Emacs -2- Introducing org-mode.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: (oneforalone) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Emacs #2: Introducing org-mode) +[#]: via: (https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode) +[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen) +[#]: url: ( ) + +Emacs 系列(二):`Org` 模式介绍 +====== + +在我 Emacs 系列中的[第一片文章][1]里,我介绍了我在用了几十年的 vim 后转向了 Emacs,`Org` 模式就是我为什么这样做的原因。 + +`Org` 模式的精简和高效真的震惊了我,它真的是个“杀手”应用。 + +**所以,`Org`模式到底是什么呢?** + +这是我昨天写的: + +> 它是一个组织信息的平台,它的主页上这样写着:“一切都是纯文本:`Org` 模式用于记笔记、维护待办事项列表、计划项目和使用快速有效的纯文本系统编写文档。” + +这是事实,但并不是很准确。`Org` 模式是一个你用来组织事务的小工具。它有一些非常合理的默认设置,但也允许你自己定制。 + +主要突出在这几件事上: + + * **维护待办事项列表** : 项目可以分散在 `Org` 文件中,包含附件,有标签,截止日期,时间表。有一个方便的“日程”视图,显示需要做什么。项目也可以重复。 + * **编写文档** : `Org` 模式有个特殊的功能来生成 HTML、LaTeX、 幻灯片(用 LaTeX beamer)和其他所有的格式。它也支持直接在缓冲区中运行和编写几乎任何一种 Emacs 所支持的的语言。如果你想要深入了解这项功能的话,参阅[开发者文档][2]。官网给出的[文档][3]完全不对。 + * **记笔记** : 对,它也能做笔记。通过全文所搜,文件的交叉引用(类似 wiki),UUID,甚至可以与其他的系统进行交互(通过信息 ID 与 mu4e 交互, 通过 ERC 的日志等等……) + +**开始** + +我强烈建议去阅读 [Carsten Dominik 写的一篇很棒的关于 `Org` 模式的 Google 讲话][4]。那篇文章真的很赞。 + +Emacs 中自带了 `Org` 模式,但如果你想要个比较新的版本的话,Debian 用户可以使用命令 `apt-get install org-mode` 来更新,或者使用 Emacs 的包管理系统命令 `M-x package-install RET org-mode RET`。 + +现在,你可能需要阅读一下 `Org` 模式的精简版教程中的[导读部分][5],特别注意,你要设置下[启动部分][6]中提到的那些键的绑定。 + +**一份好的教程** + +我会给出一些好的教程和介绍的链接,但这篇文章不会是一篇教程。特别是在本文末尾,有两个很不错的视频链接。 + +**我的一些配置** + +我将在这里记录下一些我的配置并介绍它的作用。你没有必要每行每句将它拷贝到你的配置中——这只是一个参考,告诉你哪些可以配置,要怎么在手册中查找,或许只是一个“我现在该怎么做”的参考。 + +首先,我将 Emacs 的编码默认设置为 UTF-8。 +``` +(prefer-coding-system 'utf-8) (set-language-environment "UTF-8") +``` + +`Org` 模式中可以打开 URL。默认的,它会在 Firefox 中打开,但我喜欢用 Chromium。 +``` +(setq browse-url-browser-function 'browse-url-chromium) +``` + +我把基本的键的绑定和设为教程里的一样,再加上 `M-RET` 的操作的配置。 + +``` +(global-set-key "\C-cl" 'org-store-link) +(global-set-key "\C-ca" 'org-agenda) +(global-set-key "\C-cc" 'org-capture) +(global-set-key "\C-cb" 'org-iswitchb) + +(setq org-M-RET-may-split-line nil) +``` + + +**捕获配置** + +我可以在 Emacs 的任何模式中按 `C-c c`,按下后它就会[帮我捕获某些事][7],其中包括一个指向我正在处理事务的链接。 + +你可以通过定义[捕获模板][8]来配置它。我将保存两个日志文件,作为会议、电话等的通用记录。一个是私人用的,一个是办公用的。如果我按下 `C-c c j`,它就会帮我捕获为私人项. 下面包含 `%a` 的配置是表示我当前的位置(或是我使用 `C-c l` 保存的链接)的链接。 + +``` +(setq org-default-notes-file "~/org/tasks.org") +(setq org-capture-templates + '( + ("t" "Todo" entry (file+headline "inbox.org" "Tasks") + "* TODO %?\n %i\n %u\n %a") + ("n" "Note/Data" entry (file+headline "inbox.org" "Notes/Data") + "* %? \n %i\n %u\n %a") + ("j" "Journal" entry (file+datetree "~/org/journal.org") + "* %?\nEntered on %U\n %i\n %a") + ("J" "Work-Journal" entry (file+datetree "~/org/wjournal.org") + "* %?\nEntered on %U\n %i\n %a") + )) +(setq org-irc-link-to-logs t) +``` + +我喜欢通过 UUID 来建立链接,这让我在文件之间移动而不会破坏位置。当我要 `Org` 存储一个链接目标以便将来插入时,以下配置有助于生成 UUID。 + +``` +(require 'org-id) +(setq org-id-link-to-org-use-id 'create-if-interactive) +``` + +**议程配置** + +我喜欢将星期天作为一周的开始,当我将某件事标记为完成时,我也喜欢记下时间。 + +``` +(setq org-log-done 'time) +(setq org-agenda-start-on-weekday 0) +``` + +**文件归档配置** + +在这我将配置它, 让它知道在议程中该使用哪些文件,而且在纯文本的搜索中添加一点点小功能。我喜欢保留一个通用的文件夹(我可以从其中移动或“重新归档”内容),然后将个人和工作项的任务、日志和知识库分开。 + +``` + (setq org-agenda-files (list "~/org/inbox.org" + "~/org/email.org" + "~/org/tasks.org" + "~/org/wtasks.org" + "~/org/journal.org" + "~/org/wjournal.org" + "~/org/kb.org" + "~/org/wkb.org" + )) + (setq org-agenda-text-search-extra-files + (list "~/org/someday.org" + "~/org/config.org" + )) + + (setq org-refile-targets '((nil :maxlevel . 2) + (org-agenda-files :maxlevel . 2) + ("~/org/someday.org" :maxlevel . 2) + ("~/org/templates.org" :maxlevel . 2) + ) + ) +(setq org-outline-path-complete-in-steps nil) ; Refile in a single go +(setq org-refile-use-outline-path 'file) +``` + +**外观配置** + +我喜欢一个较漂亮的的屏幕。在你开始习惯 `Org` 之后,你可以试试这个。 + +``` +(require 'org-bullets) +(add-hook 'org-mode-hook + (lambda () + (org-bullets-mode t))) +(setq org-ellipsis "⤵") +``` + +**下一篇** + +希望这篇文章展示了 `Org` 模式的一些功能。接下来,我将介绍如何定制 `TODO` 关键字和标记、归档旧任务、将电子邮件转发到 `Org` 模式,以及如何使用 `git` 在不同电脑之间进行同步。 + +你也可以查看[本系列的所有文章列表][9]。 + + + +-------------------------------------------------------------------------------- + +via: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode + +作者:[John Goerzen][a] +选题:[lujun9972][b] +译者:[oneforalone](https://github.com/oneforalone) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://changelog.complete.org/archives/author/jgoerzen +[b]: https://github.com/lujun9972 +[1]: https://changelog.complete.org/archives/9861-emacs-1-ditching-a-bunch-of-stuff-and-moving-to-emacs-and-org-mode +[2]: http://www.howardism.org/Technical/Emacs/literate-devops.html +[3]: https://orgmode.org/worg/ +[4]: https://www.youtube.com/watch?v=oJTwQvgfgMM +[5]: https://orgmode.org/guide/Introduction.html#Introduction +[6]: https://orgmode.org/guide/Activation.html#Activation +[7]: https://orgmode.org/guide/Capture.html#Capture +[8]: https://orgmode.org/guide/Capture-templates.html#Capture-templates +[9]: https://changelog.complete.org/archives/tag/emacs2018 From d41309f6855b1d494d9fb78830016a8263aba32b Mon Sep 17 00:00:00 2001 From: oneforalone Date: Mon, 3 Dec 2018 22:39:12 +0800 Subject: [PATCH 050/135] translated by oneforalone --- .../20180302 Emacs -3- More on org-mode.md | 131 ------------------ .../20180302 Emacs -3- More on org-mode.md | 131 ++++++++++++++++++ 2 files changed, 131 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20180302 Emacs -3- More on org-mode.md create mode 100644 translated/tech/20180302 Emacs -3- More on org-mode.md diff --git a/sources/tech/20180302 Emacs -3- More on org-mode.md b/sources/tech/20180302 Emacs -3- More on org-mode.md deleted file mode 100644 index f81c299541..0000000000 --- a/sources/tech/20180302 Emacs -3- More on org-mode.md +++ /dev/null @@ -1,131 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Emacs #3: More on org-mode) -[#]: via: (https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode) -[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen) -[#]: url: ( ) - -Emacs #3: More on org-mode -====== - -This is third in [a series on Emacs and org-mode][1]. - -**Todo tracking and keywords** - -When using org-mode to [track your TODOs][2], it can have multiple states. You can press `C-c C-t` for a quick shift between states. I have set this: - -``` -(setq org-todo-keywords '( - (sequence "TODO(t!)" "NEXT(n!)" "STARTED(a!)" "WAIT(w@/!)" "OTHERS(o!)" "|" "DONE(d)" "CANCELLED(c)") -)) -``` - -Here, I set up 5 states that are for a task that is not yet done: TODO, NEXT, STARTED, WAIT, and OTHERS. Each has a single-character shortcut (t, n, a, etc). The states after the pipe symbol are ones that are considered “done”. I have two: DONE (for things that I have done) and CANCELED (for things that I haven’t done, but for whatever reason, won’t). - -The exclamation mark means to log the time when an item was changed to a state. I don’t add this to the done states because those are already logged anyhow. The @ sign means to prompt for a reason; so when switching to WAIT, org-mode will ask me why and add this to the note. - -Here’s an example of an entry that has had some state changes: - -``` -** DONE This is a test - CLOSED: [2018-03-02 Fri 03:05] - - - State "DONE" from "WAIT" [2018-03-02 Fri 03:05] - - State "WAIT" from "TODO" [2018-03-02 Fri 03:05] \\ - waiting for pigs to fly - - State "TODO" from "NEXT" [2018-03-02 Fri 03:05] - - State "NEXT" from "TODO" [2018-03-02 Fri 03:05] -``` - -Here, the most recent items are on top. - -**Agenda mode, schedules, and deadlines** - -When you’re in a todo item, C-c C-s or C-c C-d can set a schedule or a deadline for it, respectively. These show up in agenda mode. The difference is in intent and presentation. A schedule is something that you expect to work on at around a time, while a deadline is something that is due at a specific time. By default, the agenda view will start warning you about deadline items in advance. - -And while we’re at it, the [agenda view][3] will show you the items that you have coming up, offers a nice way to search for items based on plain text or tags, and handles bulk manipulation of items even across multiple files. I covered setting the files for agenda mode in [part 2][4] of this series. - -**Tags** - -Of course org-mode has [tags][5]. You can quickly set them with C-c C-q. - -You can set shortcuts for tags you might like to use often. Perhaps something like this: - -``` -(setq org-tag-persistent-alist -'(("@phone" . ?p) -("@computer" . ?c) -("@websurfing" . ?w) -("@errands" . ?e) -("@outdoors" . ?o) -("MIT" . ?m) -("BIGROCK" . ?b) -("CONTACTS" . ?C) -("INBOX" . ?i) -)) -``` - -You can also add tags to this list on a per-file basis, and also set tags for something on a per-file basis. I use that for my inbox.org and email.org files to set an INBOX tag. I can then review all items tagged INBOX from the agenda view each day, and the simple act of refiling them into other files will cause them to lost the INBOX tag. - -**Refiling** - -“Refiling” is moving things around, either within a file or elsewhere. It has completion using your headlines. `C-c C-w` does this. I like these settings: - -``` -(setq org-outline-path-complete-in-steps nil) ; Refile in a single go -(setq org-refile-use-outline-path 'file) -``` - -**Archiving** - -After awhile, you’ll get your files all cluttered with things that are done. org-mode has an [archive][6] feature to move things out of your main .org files and into some other files for future reference. If you have your org files in git or something, you may wish to delete these other files since you’d have things in history anyhow, but I find them handy for grepping and searching. - -I periodically want to go through and archive everything in my files. Based on a [stackoverflow discussion][7], I have this code: - -``` -(defun org-archive-done-tasks () - (interactive) - (org-map-entries - (lambda () - (org-archive-subtree) - (setq org-map-continue-from (outline-previous-heading))) - "/DONE" 'file) - (org-map-entries - (lambda () - (org-archive-subtree) - (setq org-map-continue-from (outline-previous-heading))) - "/CANCELLED" 'file) -) -``` - -This is based on [a particular answer][8] — see the comments there for some additional hints. Now you can run `M-x org-archive-done-tasks` and everything in the current file marked DONE or CANCELED will be pulled out into a different file. - -**Up next** - -I’ll wrap up org-mode with a discussion of automatically receiving emails into org, and syncing org between machines. - - - --------------------------------------------------------------------------------- - -via: https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode - -作者:[John Goerzen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://changelog.complete.org/archives/author/jgoerzen -[b]: https://github.com/lujun9972 -[1]: https://changelog.complete.org/archives/tag/emacs2018 -[2]: https://orgmode.org/guide/TODO-Items.html#TODO-Items -[3]: https://orgmode.org/guide/Agenda-Views.html#Agenda-Views -[4]: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode -[5]: https://orgmode.org/guide/Tags.html#Tags -[6]: https://orgmode.org/guide/Archiving.html#Archiving -[7]: https://stackoverflow.com/questions/6997387/how-to-archive-all-the-done-tasks-using-a-single-command -[8]: https://stackoverflow.com/a/27043756 diff --git a/translated/tech/20180302 Emacs -3- More on org-mode.md b/translated/tech/20180302 Emacs -3- More on org-mode.md new file mode 100644 index 0000000000..acfba8a1ed --- /dev/null +++ b/translated/tech/20180302 Emacs -3- More on org-mode.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (oneforalone) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Emacs #3: More on org-mode) +[#]: via: (https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode) +[#]: author: (John Goerzen http://changelog.complete.org/archives/author/jgoerzen) +[#]: url: ( ) + +Emacs 系列(三): `Org` 模式的补充 +====== + +这是 [Emacs 和 `Org` 模式系列][1]的第三篇。 + +**Todo 的跟进及关键字** + +当你使用 `Org` 模式来跟进的的 TODO 时,它有多种状态。你可以用 `C-c C-t` 来快速切换状态。我将它设为这样: + +``` +(setq org-todo-keywords '( + (sequence "TODO(t!)" "NEXT(n!)" "STARTED(a!)" "WAIT(w@/!)" "OTHERS(o!)" "|" "DONE(d)" "CANCELLED(c)") +)) +``` + +在这里,我设置了一个任务未完成的五种状态:`TODO`、`NEXT`、`STARTED`、`WAIT` 及 `OTHERS`。每一个状态都单个字的快捷键(t,n,a 等)。这些符号之后的状态被认为是“完成”的状态。我有两个“完成”状态:`DONE`(已经完成)及 `CANCELLED`(还没完成,但由于其它的原因无法完成)。 + +`!` 的含义是记录某项更改为状态的时间。我不把这个添加到完成的状态,是因为它们已经被记录了。`@` 符号表示带理由的提示,所以当切换到 `WAIT` 时,`Org` 会问我为什么,并将这个添加到笔记中。 + +以下是项目状态发生变化的例子: + +``` +** DONE This is a test + CLOSED: [2018-03-02 Fri 03:05] + + - State "DONE" from "WAIT" [2018-03-02 Fri 03:05] + - State "WAIT" from "TODO" [2018-03-02 Fri 03:05] \\ + waiting for pigs to fly + - State "TODO" from "NEXT" [2018-03-02 Fri 03:05] + - State "NEXT" from "TODO" [2018-03-02 Fri 03:05] +``` + +在这里,最新的项目在最上面。 + +**议程模式,日程及期限** + +当你处在一个待办项时,`C-c C-s` 或 `C-c C-d` 可以为其设置相应的日程或期限。这些都是在议程模式中的功能。区别在于意图和表现。日程是你希望在某个时候完成的事情,而期限是在某个特定的时间应该完成的事情。默认情况下,议程视图将在项目的截止日期前提醒你。 + +在此过程中,[议程视图][3]将显示即将出现的项目,提供了一种基于纯文本或标记搜索项目的方法,甚至可以进行跨多个文件处理项目的批量操作。我在本系列的[第 2 部分][4]中介绍了为议程模式配置。 + +**标签** + +`Org` 模式当然也支持标签了。你可以通过 `C-c C-q` 快速的建立标签。 + +你可能会想为一些常用的标签设置快捷键。就像这样: + +``` +(setq org-tag-persistent-alist +'(("@phone" . ?p) +("@computer" . ?c) +("@websurfing" . ?w) +("@errands" . ?e) +("@outdoors" . ?o) +("MIT" . ?m) +("BIGROCK" . ?b) +("CONTACTS" . ?C) +("INBOX" . ?i) +)) +``` + +你还可以根据每个文件向该列表添加标记,也可以根据每个文件为某些内容设置标记。我就在我的 `inbox.org` 和 `email.org` 文件中设置了一个 `INBOX` 的标签。然后我可以每天从日程视图中查看所有标记为 `INBOX` 的项目,像将它们重新归档到其他文件中的简单操作将让它们去掉 `INBOX` 标记。 + +**重新归档** + +“重新归档”就是在文件中或其他地方移动。它是使用标来题完成。`C-c C-w` 就是做这个的。我设置成这样: + +``` +(setq org-outline-path-complete-in-steps nil) ; Refile in a single go +(setq org-refile-use-outline-path 'file) +``` + +**归档分类** + +一段时间后,你的文件就会被已经完成的事情弄得乱七八糟。`Org` 模式有一个[归档][6]特性,可以将主 `.org` 文件移到其他文件中,以备将来参考。如果你在 `git` 或其他软件中 有 `Org` 文件,你可能希望删除这些其他文件,因为无论如何都会在历史中拥有这些文件,但是我发现它们对于 `grepping` 和搜索非常方便。 + +我会定期检查并归档文件中的所有内容。基于 [stackoverflow 的讨论][7],我有以下代码: + +``` +(defun org-archive-done-tasks () + (interactive) + (org-map-entries + (lambda () + (org-archive-subtree) + (setq org-map-continue-from (outline-previous-heading))) + "/DONE" 'file) + (org-map-entries + (lambda () + (org-archive-subtree) + (setq org-map-continue-from (outline-previous-heading))) + "/CANCELLED" 'file) +) +``` + +这基于[一个特定的答案][8]——你可以从评论那获得一些额外的提示。现在你可以运行 `M-x org-archive-done-tasks`,当前文件中所有标记为 `DONE` 或 `CANCELED` 的内容都将放到另一个文件中。 + +**下一篇** + +我将通过讨论在 `Org` 模式中自动接受邮件以及在不同的机子上同步来对 `Org` 模式进行总结。 + + + +-------------------------------------------------------------------------------- + +via: https://changelog.complete.org/archives/9877-emacs-3-more-on-org-mode + +作者:[John Goerzen][a] +选题:[lujun9972][b] +译者:[oneforalone](https://github.com/oneforalone) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://changelog.complete.org/archives/author/jgoerzen +[b]: https://github.com/lujun9972 +[1]: https://changelog.complete.org/archives/tag/emacs2018 +[2]: https://orgmode.org/guide/TODO-Items.html#TODO-Items +[3]: https://orgmode.org/guide/Agenda-Views.html#Agenda-Views +[4]: https://changelog.complete.org/archives/9865-emacs-2-introducing-org-mode +[5]: https://orgmode.org/guide/Tags.html#Tags +[6]: https://orgmode.org/guide/Archiving.html#Archiving +[7]: https://stackoverflow.com/questions/6997387/how-to-archive-all-the-done-tasks-using-a-single-command +[8]: https://stackoverflow.com/a/27043756 From 6d8250348cde2a5f3859ab01cea1405c28219c0e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 23:15:15 +0800 Subject: [PATCH 051/135] PRF:20181004 Lab 3- User Environments.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @qhwdw 你的质量是可靠的,没细致校对。 --- .../tech/20181004 Lab 3- User Environments.md | 478 +++++++++--------- 1 file changed, 228 insertions(+), 250 deletions(-) diff --git a/translated/tech/20181004 Lab 3- User Environments.md b/translated/tech/20181004 Lab 3- User Environments.md index 3d707bf99d..322c4e294c 100644 --- a/translated/tech/20181004 Lab 3- User Environments.md +++ b/translated/tech/20181004 Lab 3- User Environments.md @@ -1,89 +1,86 @@ -实验 3:用户环境 +Caffeinated 6.828:实验 3:用户环境 ====== -### 实验 3:用户环境 -#### 简介 +### 简介 在本实验中,你将要实现一个基本的内核功能,要求它能够保护运行的用户模式环境(即:进程)。你将去增强这个 JOS 内核,去配置数据结构以便于保持对用户环境的跟踪、创建一个单一用户环境、将程序镜像加载到用户环境中、并将它启动运行。你也要写出一些 JOS 内核的函数,用来处理任何用户环境生成的系统调用,以及处理由用户环境引进的各种异常。 -**注意:** 在本实验中,术语**_“环境”_** 和**_“进程”_** 是可互换的 —— 它们都表示同一个抽象概念,那就是允许你去运行的程序。我在介绍中使用术语**“环境”**而不是使用传统术语**“进程”**的目的是为了强调一点,那就是 JOS 的环境和 UNIX 的进程提供了不同的接口,并且它们的语义也不相同。 +**注意:** 在本实验中,术语**“环境”** 和**“进程”** 是可互换的 —— 它们都表示同一个抽象概念,那就是允许你去运行的程序。我在介绍中使用术语**“环境”**而不是使用传统术语**“进程”**的目的是为了强调一点,那就是 JOS 的环境和 UNIX 的进程提供了不同的接口,并且它们的语义也不相同。 -##### 预备知识 +#### 预备知识 使用 Git 去提交你自实验 2 以后的更改(如果有的话),获取课程仓库的最新版本,以及创建一个命名为 `lab3` 的本地分支,指向到我们的 lab3 分支上 `origin/lab3` : ``` - athena% cd ~/6.828/lab - athena% add git - athena% git commit -am 'changes to lab2 after handin' - Created commit 734fab7: changes to lab2 after handin - 4 files changed, 42 insertions(+), 9 deletions(-) - athena% git pull - Already up-to-date. - athena% git checkout -b lab3 origin/lab3 - Branch lab3 set up to track remote branch refs/remotes/origin/lab3. - Switched to a new branch "lab3" - athena% git merge lab2 - Merge made by recursive. - kern/pmap.c | 42 +++++++++++++++++++ - 1 files changed, 42 insertions(+), 0 deletions(-) - athena% +athena% cd ~/6.828/lab +athena% add git +athena% git commit -am 'changes to lab2 after handin' +Created commit 734fab7: changes to lab2 after handin + 4 files changed, 42 insertions(+), 9 deletions(-) +athena% git pull +Already up-to-date. +athena% git checkout -b lab3 origin/lab3 +Branch lab3 set up to track remote branch refs/remotes/origin/lab3. +Switched to a new branch "lab3" +athena% git merge lab2 +Merge made by recursive. + kern/pmap.c | 42 +++++++++++++++++++ + 1 files changed, 42 insertions(+), 0 deletions(-) +athena% ``` 实验 3 包含一些你将探索的新源文件: ```c -inc/ env.h Public definitions for user-mode environments - trap.h Public definitions for trap handling - syscall.h Public definitions for system calls from user environments to the kernel - lib.h Public definitions for the user-mode support library -kern/ env.h Kernel-private definitions for user-mode environments - env.c Kernel code implementing user-mode environments - trap.h Kernel-private trap handling definitions - trap.c Trap handling code - trapentry.S Assembly-language trap handler entry-points - syscall.h Kernel-private definitions for system call handling - syscall.c System call implementation code -lib/ Makefrag Makefile fragment to build user-mode library, obj/lib/libjos.a - entry.S Assembly-language entry-point for user environments - libmain.c User-mode library setup code called from entry.S - syscall.c User-mode system call stub functions - console.c User-mode implementations of putchar and getchar, providing console I/O - exit.c User-mode implementation of exit - panic.c User-mode implementation of panic -user/ * Various test programs to check kernel lab 3 code +inc/ env.h Public definitions for user-mode environments + trap.h Public definitions for trap handling + syscall.h Public definitions for system calls from user environments to the kernel + lib.h Public definitions for the user-mode support library +kern/ env.h Kernel-private definitions for user-mode environments + env.c Kernel code implementing user-mode environments + trap.h Kernel-private trap handling definitions + trap.c Trap handling code + trapentry.S Assembly-language trap handler entry-points + syscall.h Kernel-private definitions for system call handling + syscall.c System call implementation code +lib/ Makefrag Makefile fragment to build user-mode library, obj/lib/libjos.a + entry.S Assembly-language entry-point for user environments + libmain.c User-mode library setup code called from entry.S + syscall.c User-mode system call stub functions + console.c User-mode implementations of putchar and getchar, providing console I/O + exit.c User-mode implementation of exit + panic.c User-mode implementation of panic +user/ * Various test programs to check kernel lab 3 code ``` 另外,一些在实验 2 中的源文件在实验 3 中将被修改。如果想去查看有什么更改,可以运行: ``` - $ git diff lab2 - +$ git diff lab2 ``` 你也可以另外去看一下 [实验工具指南][1],它包含了与本实验有关的调试用户代码方面的信息。 -##### 实验要求 +#### 实验要求 本实验分为两部分:Part A 和 Part B。Part A 在本实验完成后一周内提交;你将要提交你的更改和完成的动手实验,在提交之前要确保你的代码通过了 Part A 的所有检查(如果你的代码未通过 Part B 的检查也可以提交)。只需要在第二周提交 Part B 的期限之前代码检查通过即可。 由于在实验 2 中,你需要做实验中描述的所有正则表达式练习,并且至少通过一个挑战(是指整个实验,不是每个部分)。写出详细的问题答案并张贴在实验中,以及一到两个段落的关于你如何解决你选择的挑战问题的详细描述,并将它放在一个名为 `answers-lab3.txt` 的文件中,并将这个文件放在你的 `lab` 目标的根目录下。(如果你做了多个问题挑战,你仅需要提交其中一个即可)不要忘记使用 `git add answers-lab3.txt` 提交这个文件。 -##### 行内汇编语言 +#### 行内汇编语言 -在本实验中你可能找到使用了 GCC 的行内汇编语言特性,虽然不使用它也可以完成实验。但至少你需要去理解这些行内汇编语言片段,这些汇编语言("`asm`" 语句)片段已经存在于提供给你的源代码中。你可以在课程 [参考资料][2] 的页面上找到 GCC 行内汇编语言有关的信息。 +在本实验中你可能发现使用了 GCC 的行内汇编语言特性,虽然不使用它也可以完成实验。但至少你需要去理解这些行内汇编语言片段,这些汇编语言(`asm` 语句)片段已经存在于提供给你的源代码中。你可以在课程 [参考资料][2] 的页面上找到 GCC 行内汇编语言有关的信息。 -#### Part A:用户环境和异常处理 +### Part A:用户环境和异常处理 新文件 `inc/env.h` 中包含了在 JOS 中关于用户环境的基本定义。现在就去阅读它。内核使用数据结构 `Env` 去保持对每个用户环境的跟踪。在本实验的开始,你将只创建一个环境,但你需要去设计 JOS 内核支持多环境;实验 4 将带来这个高级特性,允许用户环境去 `fork` 其它环境。 正如你在 `kern/env.c` 中所看到的,内核维护了与环境相关的三个全局变量: ``` - struct Env *envs = NULL; // All environments - struct Env *curenv = NULL; // The current env - static struct Env *env_free_list; // Free environment list - +struct Env *envs = NULL; // All environments +struct Env *curenv = NULL; // The current env +static struct Env *env_free_list; // Free environment list ``` 一旦 JOS 启动并运行,`envs` 指针指向到一个数组,即数据结构 `Env`,它保存了系统中全部的环境。在我们的设计中,JOS 内核将同时支持最大值为 `NENV` 个的活动的环境,虽然在一般情况下,任何给定时刻运行的环境很少。(`NENV` 是在 `inc/env.h` 中用 `#define` 定义的一个常量)一旦它被分配,对于每个 `NENV` 可能的环境,`envs` 数组将包含一个数据结构 `Env` 的单个实例。 @@ -92,38 +89,38 @@ JOS 内核在 `env_free_list` 上用数据结构 `Env` 保存了所有不活动 内核使用符号 `curenv` 来保持对任意给定时刻的 _当前正在运行的环境_ 进行跟踪。在系统引导期间,在第一个环境运行之前,`curenv` 被初始化为 `NULL`。 -##### 环境状态 +#### 环境状态 数据结构 `Env` 被定义在文件 `inc/env.h` 中,内容如下:(在后面的实验中将添加更多的字段): ```c - struct Env { - struct Trapframe env_tf; // Saved registers - struct Env *env_link; // Next free Env - envid_t env_id; // Unique environment identifier - envid_t env_parent_id; // env_id of this env's parent - enum EnvType env_type; // Indicates special system environments - unsigned env_status; // Status of the environment - uint32_t env_runs; // Number of times environment has run +struct Env { + struct Trapframe env_tf; // Saved registers + struct Env *env_link; // Next free Env + envid_t env_id; // Unique environment identifier + envid_t env_parent_id; // env_id of this env's parent + enum EnvType env_type; // Indicates special system environments + unsigned env_status; // Status of the environment + uint32_t env_runs; // Number of times environment has run - // Address space - pde_t *env_pgdir; // Kernel virtual address of page dir - }; + // Address space + pde_t *env_pgdir; // Kernel virtual address of page dir +}; ``` 以下是数据结构 `Env` 中的字段简介: - * **env_tf**: + * `env_tf`: 这个结构定义在 `inc/trap.h` 中,它用于在那个环境不运行时保持它保存在寄存器中的值,即:当内核或一个不同的环境在运行时。当从用户模式切换到内核模式时,内核将保存这些东西,以便于那个环境能够在稍后重新运行时回到中断运行的地方。 - * **env_link**: + * `env_link`: 这是一个链接,它链接到在 `env_free_list` 上的下一个 `Env` 上。`env_free_list` 指向到列表上第一个空闲的环境。 - * **env_id**: + * `env_id`: 内核在数据结构 `Env` 中保存了一个唯一标识当前环境的值(即:使用数组 `envs` 中的特定槽位)。在一个用户环境终止之后,内核可能给另外的环境重新分配相同的数据结构 `Env` —— 但是新的环境将有一个与已终止的旧的环境不同的 `env_id`,即便是新的环境在数组 `envs` 中复用了同一个槽位。 - * **env_parent_id**: + * `env_parent_id`: 内核使用它来保存创建这个环境的父级环境的 `env_id`。通过这种方式,环境就可以形成一个“家族树”,这对于做出“哪个环境可以对谁做什么”这样的安全决策非常有用。 - * **env_type**: + * `env_type`: 它用于去区分特定的环境。对于大多数环境,它将是 `ENV_TYPE_USER` 的。在稍后的实验中,针对特定的系统服务环境,我们将引入更多的几种类型。 - * **env_status**: + * `env_status`: 这个变量持有以下几个值之一: * `ENV_FREE`: 表示那个 `Env` 结构是非活动的,并且因此它还在 `env_free_list` 上。 @@ -135,59 +132,64 @@ JOS 内核在 `env_free_list` 上用数据结构 `Env` 保存了所有不活动 表示那个 `Env` 结构所代表的是一个当前活动的环境,但不是当前准备去运行的:例如,因为它正在因为一个来自其它环境的进程间通讯(IPC)而处于等待状态。 * `ENV_DYING`: 表示那个 `Env` 结构所表示的是一个僵尸环境。一个僵尸环境将在下一次被内核捕获后被释放。我们在实验 4 之前不会去使用这个标志。 - * **env_pgdir**: + * `env_pgdir`: 这个变量持有这个环境的内核虚拟地址的页目录。 - - 就像一个 Unix 进程一样,一个 JOS 环境耦合了“线程”和“地址空间”的概念。线程主要由保存的寄存器来定义(`env_tf` 字段),而地址空间由页目录和 `env_pgdir` 所指向的页表所定义。为运行一个环境,内核必须使用保存的寄存器值和相关的地址空间去设置 CPU。 我们的 `struct Env` 与 xv6 中的 `struct proc` 类似。它们都在一个 `Trapframe` 结构中持有环境(即进程)的用户模式寄存器状态。在 JOS 中,单个的环境并不能像 xv6 中的进程那样拥有它们自己的内核栈。在这里,内核中任意时间只能有一个 JOS 环境处于活动中,因此,JOS 仅需要一个单个的内核栈。 -##### 为环境分配数组 +#### 为环境分配数组 在实验 2 的 `mem_init()` 中,你为数组 `pages[]` 分配了内存,它是内核用于对页面分配与否的状态进行跟踪的一个表。你现在将需要去修改 `mem_init()`,以便于后面使用它分配一个与结构 `Env` 类似的数组,这个数组被称为 `envs`。 -```markdown -练习 1、修改在 `kern/pmap.c` 中的 `mem_init()`,以用于去分配和映射 `envs` 数组。这个数组完全由 `Env` 结构分配的实例 `NENV` 组成,就像你分配的 `pages` 数组一样。与 `pages` 数组一样,由内存支持的数组 `envs` 也将在 `UENVS`(它的定义在 `inc/memlayout.h` 文件中)中映射用户只读的内存,以便于用户进程能够从这个数组中读取。 -``` +> **练习 1**、修改在 `kern/pmap.c` 中的 `mem_init()`,以用于去分配和映射 `envs` 数组。这个数组完全由 `Env` 结构分配的实例 `NENV` 组成,就像你分配的 `pages` 数组一样。与 `pages` 数组一样,由内存支持的数组 `envs` 也将在 `UENVS`(它的定义在 `inc/memlayout.h` 文件中)中映射用户只读的内存,以便于用户进程能够从这个数组中读取。 你应该去运行你的代码,并确保 `check_kern_pgdir()` 是没有问题的。 -##### 创建和运行环境 +#### 创建和运行环境 -现在,你将在 `kern/env.c` 中写一些必需的代码去运行一个用户环境。因为我们并没有做一个文件系统,因此,我们将设置内核去加载一个嵌入到内核中的静态的二进制镜像。JOS 内核以一个 ELF 可运行镜像的方式将这个二进制镜像嵌入到内核中。 +现在,你将在 `kern/env.c` 中写一些必需的代码去运行一个用户环境。因为我们并没有做一个文件系统,因此,我们将设置内核去加载一个嵌入到内核中的静态的二进制镜像。JOS 内核以一个 ELF 可运行镜像的方式将这个二进制镜像嵌入到内核中。 在实验 3 中,`GNUmakefile` 将在 `obj/user/` 目录中生成一些二进制镜像。如果你看到 `kern/Makefrag`,你将注意到一些奇怪的的东西,它们“链接”这些二进制直接进入到内核中运行,就像 `.o` 文件一样。在链接器命令行上的 `-b binary` 选项,将因此把它们链接为“原生的”不解析的二进制文件,而不是由编译器产生的普通的 `.o` 文件。(就链接器而言,这些文件压根就不是 ELF 镜像文件 —— 它们可以是任何东西,比如,一个文本文件或图片!)如果你在内核构建之后查看 `obj/kern/kernel.sym` ,你将会注意到链接器很奇怪的生成了一些有趣的、命名很费解的符号,比如像 `_binary_obj_user_hello_start`、`_binary_obj_user_hello_end`、以及 `_binary_obj_user_hello_size`。链接器通过改编二进制文件的命令来生成这些符号;这种符号为普通内核代码使用一种引入嵌入式二进制文件的方法。 在 `kern/init.c` 的 `i386_init()` 中,你将写一些代码在环境中运行这些二进制镜像中的一种。但是,设置用户环境的关键函数还没有实现;将需要你去完成它们。 -```markdown -练习 2、在文件 `env.c` 中,写完以下函数的代码: +> **练习 2**、在文件 `env.c` 中,写完以下函数的代码: - * `env_init()` -初始化 `envs` 数组中所有的 `Env` 结构,然后把它们添加到 `env_free_list` 中。也称为 `env_init_percpu`,它通过配置硬件,在硬件上为 level 0(内核)权限和 level 3(用户)权限使用单独的段。 - * `env_setup_vm()` -为一个新环境分配一个页目录,并初始化新环境的地址空间的内核部分。 - * `region_alloc()` -为一个新环境分配和映射物理内存 - * `load_icode()` -你将需要去解析一个 ELF 二进制镜像,就像引导加载器那样,然后加载它的内容到一个新环境的用户地址空间中。 - * `env_create()` -使用 `env_alloc` 去分配一个环境,并调用 `load_icode` 去加载一个 ELF 二进制 - * `env_run()` -在用户模式中开始运行一个给定的环境 +> * `env_init()` +> 初始化 `envs` 数组中所有的 `Env` 结构,然后把它们添加到 `env_free_list` 中。也称为 `env_init_percpu`,它通过配置硬件,在硬件上为 level 0(内核)权限和 level 3(用户)权限使用单独的段。 +> * `env_setup_vm()` -在你写这些函数时,你可能会发现新的 cprintf 动词 `%e` 非常有用 -- 它可以输出一个错误代码的相关描述。比如: +> 为一个新环境分配一个页目录,并初始化新环境的地址空间的内核部分。 - r = -E_NO_MEM; - panic("env_alloc: %e", r); +> * `region_alloc()` -中 panic 将输出消息 "env_alloc: out of memory"。 +> 为一个新环境分配和映射物理内存 + +> * `load_icode()` + +> 你将需要去解析一个 ELF 二进制镜像,就像引导加载器那样,然后加载它的内容到一个新环境的用户地址空间中。 + +> * `env_create()` + +> 使用 `env_alloc` 去分配一个环境,并调用 `load_icode` 去加载一个 ELF 二进制 + +> * `env_run()` + +> 在用户模式中开始运行一个给定的环境 + +> 在你写这些函数时,你可能会发现新的 cprintf 动词 `%e` 非常有用 -- 它可以输出一个错误代码的相关描述。比如: + +> ``` + r = -E_NO_MEM; + panic("env_alloc: %e", r); ``` +> 中 panic 将输出消息 "env_alloc: out of memory"。 + 下面是用户代码相关的调用图。确保你理解了每一步的用途。 * `start` (`kern/entry.S`) @@ -200,107 +202,94 @@ JOS 内核在 `env_free_list` 上用数据结构 `Env` 保存了所有不活动 * `env_run` * `env_pop_tf` - - 在完成以上函数后,你应该去编译内核并在 QEMU 下运行它。如果一切正常,你的系统将进入到用户空间并运行二进制的 `hello` ,直到使用 `int` 指令生成一个系统调用为止。在那个时刻将存在一个问题,因为 JOS 尚未设置硬件去允许从用户空间到内核空间的各种转换。当 CPU 发现没有系统调用中断的服务程序时,它将生成一个一般保护异常,找到那个异常并去处理它,还将生成一个双重故障异常,同样也找到它并处理它,并且最后会出现所谓的“三重故障异常”。通常情况下,你将随后看到 CPU 复位以及系统重引导。虽然对于传统的应用程序(在 [这篇博客文章][3] 中解释了原因)这是重大的问题,但是对于内核开发来说,这是一个痛苦的过程,因此,在打了 6.828 补丁的 QEMU 上,你将可以看到转储的寄存器内容和一个“三重故障”的信息。 我们马上就会去处理这些问题,但是现在,我们可以使用调试器去检查我们是否进入了用户模式。使用 `make qemu-gdb` 并在 `env_pop_tf` 处设置一个 GDB 断点,它是你进入用户模式之前到达的最后一个函数。使用 `si` 单步进入这个函数;处理器将在 `iret` 指令之后进入用户模式。然后你将会看到在用户环境运行的第一个指令,它将是在 `lib/entry.S` 中的标签 `start` 的第一个指令 `cmpl`。现在,在 `hello` 中的 `sys_cputs()` 的 `int $0x30` 处使用 `b *0x...`(关于用户空间的地址,请查看 `obj/user/hello.asm` )设置断点。这个指令 `int` 是系统调用去显示一个字符到控制台。如果到 `int` 还没有运行,那么可能在你的地址空间设置或程序加载代码时发生了错误;返回去找到问题并解决后重新运行。 -##### 处理中断和异常 +#### 处理中断和异常 到目前为止,在用户空间中的第一个系统调用指令 `int $0x30` 已正式寿终正寝了:一旦处理器进入用户模式,将无法返回。因此,现在,你需要去实现基本的异常和系统调用服务程序,因为那样才有可能让内核从用户模式代码中恢复对处理器的控制。你所做的第一件事情就是彻底地掌握 x86 的中断和异常机制的使用。 -``` -练习 3、如果你对中断和异常机制不熟悉的话,阅读 80386 程序员手册的第 9 章(或 IA-32 开发者手册的第 5 章)。 -``` +> **练习 3**、如果你对中断和异常机制不熟悉的话,阅读 80386 程序员手册的第 9 章(或 IA-32 开发者手册的第 5 章)。 在这个实验中,对于中断、异常、以其它类似的东西,我们将遵循 Intel 的术语习惯。由于如异常exception陷阱trap中断interrupt故障fault中止abort这些术语在不同的架构和操作系统上并没有一个统一的标准,我们经常在特定的架构下(如 x86)并不去考虑它们之间的细微差别。当你在本实验以外的地方看到这些术语时,它们的含义可能有细微的差别。 -##### 受保护的控制转移基础 +#### 受保护的控制转移基础 -异常和中断都是“受保护的控制转移”,它将导致处理器从用户模式切换到内核模式(CPL=0)而不会让用户模式的代码干扰到内核的其它函数或其它的环境。在 Intel 的术语中,一个中断就是一个“受保护的控制转移”,它是由于处理器以外的外部异步事件所引发的,比如外部设备 I/O 活动通知。而异常正好与之相反,它是由当前正在运行的代码所引发的同步的、受保护的控制转移,比如由于发生了一个除零错误或对无效内存的访问。 +异常和中断都是“受保护的控制转移”,它将导致处理器从用户模式切换到内核模式(`CPL=0`)而不会让用户模式的代码干扰到内核的其它函数或其它的环境。在 Intel 的术语中,一个中断就是一个“受保护的控制转移”,它是由于处理器以外的外部异步事件所引发的,比如外部设备 I/O 活动通知。而异常正好与之相反,它是由当前正在运行的代码所引发的同步的、受保护的控制转移,比如由于发生了一个除零错误或对无效内存的访问。 为了确保这些受保护的控制转移是真正地受到保护,处理器的中断/异常机制设计是:当中断/异常发生时,当前运行的代码不能随意选择进入内核的位置和方式。而是,处理器在确保内核能够严格控制的条件下才能进入内核。在 x86 上,有两种机制协同来提供这种保护: - 1. **中断描述符表** 处理器确保中断和异常仅能够导致内核进入几个特定的、由内核本身定义好的、明确的入口点,而不是去运行中断或异常发生时的代码。 +1. **中断描述符表** 处理器确保中断和异常仅能够导致内核进入几个特定的、由内核本身定义好的、明确的入口点,而不是去运行中断或异常发生时的代码。 -x86 允许最多有 256 个不同的中断或异常入口点去进入内核,每个入口点都使用一个不同的中断向量。一个向量是一个介于 0 和 255 之间的数字。一个中断向量是由中断源确定的:不同的设备、错误条件、以及应用程序去请求内核使用不同的向量生成中断。CPU 使用向量作为进入处理器的中断描述符表(IDT)的索引,它是内核设置的内核私有内存,GDT 也是。从这个表中的适当的条目中,处理器将加载: + x86 允许最多有 256 个不同的中断或异常入口点去进入内核,每个入口点都使用一个不同的中断向量。一个向量是一个介于 0 和 255 之间的数字。一个中断向量是由中断源确定的:不同的设备、错误条件、以及应用程序去请求内核使用不同的向量生成中断。CPU 使用向量作为进入处理器的中断描述符表(IDT)的索引,它是内核设置的内核私有内存,GDT 也是。从这个表中的适当的条目中,处理器将加载: * 将值加载到指令指针寄存器(EIP),指向内核代码设计好的,用于处理这种异常的服务程序。 - * 将值加载到代码段寄存器(CS),它包含运行权限为 0—1 级别的、要运行的异常服务程序。(在 JOS 中,所有的异常处理程序都运行在内核模式中,运行级别为 level 0。) - 2. **任务状态描述符表** 处理器在中断或异常发生时,需要一个地方去保存旧的处理器状态,比如,处理器在调用异常服务程序之前的 `EIP` 和 `CS` 的原始值,这样那个异常服务程序就能够稍后通过还原旧的状态来回到中断发生时的代码位置。但是对于已保存的处理器的旧状态必须被保护起来,不能被无权限的用户模式代码访问;否则代码中的 bug 或恶意用户代码将危及内核。 + * 将值加载到代码段寄存器(CS),它包含运行权限为 0—1 级别的、要运行的异常服务程序。(在 JOS 中,所有的异常处理程序都运行在内核模式中,运行级别为 0。) -基于这个原因,当一个 x86 处理器产生一个中断或陷阱时,将导致权限级别的变更,从用户模式转换到内核模式,它也将导致在内核的内存中发生栈切换。有一个被称为 TSS 的任务状态描述符表规定段描述符和这个栈所处的地址。处理器在这个新栈上推送 `SS`、`ESP`、`EFLAGS`、`CS`、`EIP`、以及一个可选的错误代码。然后它从中断描述符上加载 `CS` 和 `EIP` 的值,然后设置 `ESP` 和 `SS` 去指向新的栈。 +2. **任务状态描述符表** 处理器在中断或异常发生时,需要一个地方去保存旧的处理器状态,比如,处理器在调用异常服务程序之前的 `EIP` 和 `CS` 的原始值,这样那个异常服务程序就能够稍后通过还原旧的状态来回到中断发生时的代码位置。但是对于已保存的处理器的旧状态必须被保护起来,不能被无权限的用户模式代码访问;否则代码中的 bug 或恶意用户代码将危及内核。 -虽然 TSS 很大并且默默地为各种用途服务,但是 JOS 仅用它去定义当从用户模式到内核模式的转移发生时,处理器即将切换过去的内核栈。因为在 JOS 中的“内核模式”仅运行在 x86 的 level 0 权限上,当进入内核模式时,处理器使用 TSS 上的 `ESP0` 和 `SS0` 字段去定义内核栈。JOS 并不去使用 TSS 的任何其它字段。 + 基于这个原因,当一个 x86 处理器产生一个中断或陷阱时,将导致权限级别的变更,从用户模式转换到内核模式,它也将导致在内核的内存中发生栈切换。有一个被称为 TSS 的任务状态描述符表规定段描述符和这个栈所处的地址。处理器在这个新栈上推送 `SS`、`ESP`、`EFLAGS`、`CS`、`EIP`、以及一个可选的错误代码。然后它从中断描述符上加载 `CS` 和 `EIP` 的值,然后设置 `ESP` 和 `SS` 去指向新的栈。 + 虽然 TSS 很大并且默默地为各种用途服务,但是 JOS 仅用它去定义当从用户模式到内核模式的转移发生时,处理器即将切换过去的内核栈。因为在 JOS 中的“内核模式”仅运行在 x86 的运行级别 0 权限上,当进入内核模式时,处理器使用 TSS 上的 `ESP0` 和 `SS0` 字段去定义内核栈。JOS 并不去使用 TSS 的任何其它字段。 - - -##### 异常和中断的类型 +#### 异常和中断的类型 所有的 x86 处理器上的同步异常都能够产生一个内部使用的、介于 0 到 31 之间的中断向量,因此它映射到 IDT 就是条目 0-31。例如,一个页故障总是通过向量 14 引发一个异常。大于 31 的中断向量仅用于软件中断,它由 `int` 指令生成,或异步硬件中断,当需要时,它们由外部设备产生。 在这一节中,我们将扩展 JOS 去处理向量为 0-31 之间的、内部产生的 x86 异常。在下一节中,我们将完成 JOS 的 48(0x30)号软件中断向量,JOS 将(随意选择的)使用它作为系统调用中断向量。在实验 4 中,我们将扩展 JOS 去处理外部生成的硬件中断,比如时钟中断。 -##### 一个示例 +#### 一个示例 我们把这些片断综合到一起,通过一个示例来巩固一下。我们假设处理器在用户环境下运行代码,遇到一个除零问题。 - 1. 处理器去切换到由 TSS 中的 `SS0` 和 `ESP0` 定义的栈,在 JOS 中,它们各自保存着值 `GD_KD` 和 `KSTACKTOP`。 - - 2. 处理器在内核栈上推入异常参数,起始地址为 `KSTACKTOP`: +1. 处理器去切换到由 TSS 中的 `SS0` 和 `ESP0` 定义的栈,在 JOS 中,它们各自保存着值 `GD_KD` 和 `KSTACKTOP`。 +2. 处理器在内核栈上推入异常参数,起始地址为 `KSTACKTOP`: + ``` + +--------------------+ KSTACKTOP + | 0x00000 | old SS | " - 4 + | old ESP | " - 8 + | old EFLAGS | " - 12 + | 0x00000 | old CS | " - 16 + | old EIP | " - 20 <---- ESP + +--------------------+ ``` - +--------------------+ KSTACKTOP - | 0x00000 | old SS | " - 4 - | old ESP | " - 8 - | old EFLAGS | " - 12 - | 0x00000 | old CS | " - 16 - | old EIP | " - 20 <---- ESP - +--------------------+ - -``` - - 3. 由于我们要处理一个除零错误,它将在 x86 上产生一个中断向量 0,处理器读取 IDT 的条目 0,然后设置 `CS:EIP` 去指向由条目描述的处理函数。 - - 4. 处理服务程序函数将接管控制权并处理异常,例如中止用户环境。 - - - +3. 由于我们要处理一个除零错误,它将在 x86 上产生一个中断向量 0,处理器读取 IDT 的条目 0,然后设置 `CS:EIP` 去指向由条目描述的处理函数。 +4. 处理服务程序函数将接管控制权并处理异常,例如中止用户环境。 对于某些类型的 x86 异常,除了以上的五个“标准的”寄存器外,处理器还推入另一个包含错误代码的寄存器值到栈中。页故障异常,向量号为 14,就是一个重要的示例。查看 80386 手册去确定哪些异常推入一个错误代码,以及错误代码在那个案例中的意义。当处理器推入一个错误代码后,当从用户模式中进入内核模式,异常处理服务程序开始时的栈看起来应该如下所示: ``` - +--------------------+ KSTACKTOP - | 0x00000 | old SS | " - 4 - | old ESP | " - 8 - | old EFLAGS | " - 12 - | 0x00000 | old CS | " - 16 - | old EIP | " - 20 - | error code | " - 24 <---- ESP - +--------------------+ + +--------------------+ KSTACKTOP + | 0x00000 | old SS | " - 4 + | old ESP | " - 8 + | old EFLAGS | " - 12 + | 0x00000 | old CS | " - 16 + | old EIP | " - 20 + | error code | " - 24 <---- ESP + +--------------------+ ``` -##### 嵌套的异常和中断 +#### 嵌套的异常和中断 处理器能够处理来自用户和内核模式中的异常和中断。当收到来自用户模式的异常和中断时才会进入内核模式中,而且,在推送它的旧寄存器状态到栈中和通过 IDT 调用相关的异常服务程序之前,x86 处理器会自动切换栈。如果当异常或中断发生时,处理器已经处于内核模式中(`CS` 寄存器低位两个比特为 0),那么 CPU 只是推入一些值到相同的内核栈中。在这种方式中,内核可以优雅地处理嵌套的异常,嵌套的异常一般由内核本身的代码所引发。在实现保护时,这种功能是非常重要的工具,我们将在稍后的系统调用中看到它。 如果处理器已经处于内核模式中,并且发生了一个嵌套的异常,由于它并不需要切换栈,它也就不需要去保存旧的 `SS` 或 `ESP` 寄存器。对于不推入错误代码的异常类型,在进入到异常服务程序时,它的内核栈看起来应该如下图: ``` - +--------------------+ <---- old ESP - | old EFLAGS | " - 4 - | 0x00000 | old CS | " - 8 - | old EIP | " - 12 - +--------------------+ + +--------------------+ <---- old ESP + | old EFLAGS | " - 4 + | 0x00000 | old CS | " - 8 + | old EIP | " - 12 + +--------------------+ ``` 对于需要推入一个错误代码的异常类型,处理器将在旧的 `EIP` 之后,立即推入一个错误代码,就和前面一样。 关于处理器的异常嵌套的功能,这里有一个重要的警告。如果处理器正处于内核模式时发生了一个异常,并且不论是什么原因,比如栈空间泄漏,都不会去推送它的旧的状态,那么这时处理器将不能做任何的恢复,它只是简单地重置。毫无疑问,内核应该被设计为禁止发生这种情况。 -##### 设置 IDT +#### 设置 IDT 到目前为止,你应该有了在 JOS 中为了设置 IDT 和处理异常所需的基本信息。现在,我们去设置 IDT 以处理中断向量 0-31(处理器异常)。我们将在本实验的稍后部分处理系统调用,然后在后面的实验中增加中断 32-47(设备 IRQ)。 @@ -311,102 +300,94 @@ x86 允许最多有 256 个不同的中断或异常入口点去进入内核, 你将要实现的完整的控制流如下图所描述: ```c - IDT trapentry.S trap.c + IDT trapentry.S trap.c +----------------+ -| &handler1 |---------> handler1: trap (struct Trapframe *tf) -| | // do stuff { -| | call trap // handle the exception/interrupt -| | // ... } +| &handler1 |----> handler1: trap (struct Trapframe *tf) +| | // do stuff { +| | call trap // handle the exception/interrupt +| | // ... } +----------------+ -| &handler2 |--------> handler2: -| | // do stuff -| | call trap -| | // ... +| &handler2 |----> handler2: +| | // do stuff +| | call trap +| | // ... +----------------+ . . . +----------------+ -| &handlerX |--------> handlerX: -| | // do stuff -| | call trap -| | // ... +| &handlerX |----> handlerX: +| | // do stuff +| | call trap +| | // ... +----------------+ ``` 每个异常或中断都应该在 `trapentry.S` 中有它自己的处理程序,并且 `trap_init()` 应该使用这些处理程序的地址去初始化 IDT。每个处理程序都应该在栈上构建一个 `struct Trapframe`(查看 `inc/trap.h`),然后使用一个指针调用 `trap()`(在 `trap.c` 中)到 `Trapframe`。`trap()` 接着处理异常/中断或派发给一个特定的处理函数。 -```markdown -练习 4、编辑 `trapentry.S` 和 `trap.c`,然后实现上面所描述的功能。在 `trapentry.S` 中的宏 `TRAPHANDLER` 和 `TRAPHANDLER_NOEC` 将会帮你,还有在 `inc/trap.h` 中的 T_* defines。你需要在 `trapentry.S` 中为每个定义在 `inc/trap.h` 中的陷阱添加一个入口点(使用这些宏),并且你将有 t、o 提供的 `_alltraps`,这是由宏 `TRAPHANDLER`指向到它。你也需要去修改 `trap_init()` 来初始化 `idt`,以使它指向到每个在 `trapentry.S` 中定义的入口点;宏 `SETGATE` 将有助你实现它。 +> 练习 4、编辑 `trapentry.S` 和 `trap.c`,然后实现上面所描述的功能。在 `trapentry.S` 中的宏 `TRAPHANDLER` 和 `TRAPHANDLER_NOEC` 将会帮你,还有在 `inc/trap.h` 中的 T_* defines。你需要在 `trapentry.S` 中为每个定义在 `inc/trap.h` 中的陷阱添加一个入口点(使用这些宏),并且你将有 t、o 提供的 `_alltraps`,这是由宏 `TRAPHANDLER`指向到它。你也需要去修改 `trap_init()` 来初始化 `idt`,以使它指向到每个在 `trapentry.S` 中定义的入口点;宏 `SETGATE` 将有助你实现它。 -你的 `_alltraps` 应该: +> 你的 `_alltraps` 应该: - 1. 推送值以使栈看上去像一个结构 Trapframe - 2. 加载 `GD_KD` 到 `%ds` 和 `%es` - 3. `pushl %esp` 去传递一个指针到 Trapframe 以作为一个 trap() 的参数 - 4. `call trap` (`trap` 能够返回吗?) +> 1. 推送值以使栈看上去像一个结构 Trapframe +> 2. 加载 `GD_KD` 到 `%ds` 和 `%es` +> 3. `pushl %esp` 去传递一个指针到 Trapframe 以作为一个 trap() 的参数 +> 4. `call trap` (`trap` 能够返回吗?) +> 考虑使用 `pushal` 指令;它非常适合 `struct Trapframe` 的布局。 +> 使用一些在 `user` 目录中的测试程序来测试你的陷阱处理代码,这些测试程序在生成任何系统调用之前能引发异常,比如 `user/divzero`。在这时,你应该能够成功完成 `divzero`、`softint`、以有 `badsegment` 测试。 -考虑使用 `pushal` 指令;它非常适合 `struct Trapframe` 的布局。 +. -使用一些在 `user` 目录中的测试程序来测试你的陷阱处理代码,这些测试程序在生成任何系统调用之前能引发异常,比如 `user/divzero`。在这时,你应该能够成功完成 `divzero`、`softint`、以有 `badsegment` 测试。 +> **小挑战!**目前,在 `trapentry.S` 中列出的 `TRAPHANDLER` 和他们安装在 `trap.c` 中可能有许多代码非常相似。清除它们。修改 `trapentry.S` 中的宏去自动为 `trap.c` 生成一个表。注意,你可以直接使用 `.text` 和 `.data` 在汇编器中切换放置其中的代码和数据。 + +. + +> **问题** + +> 在你的 `answers-lab3.txt` 中回答下列问题: + +> 1. 为每个异常/中断设置一个独立的服务程序函数的目的是什么?(即:如果所有的异常/中断都传递给同一个服务程序,在我们的当前实现中能否提供这样的特性?) +> 2. 你需要做什么事情才能让 `user/softint` 程序正常运行?评级脚本预计将会产生一个一般保护故障(trap 13),但是 `softint` 的代码显示为 `int $14`。为什么它产生的中断向量是 13?如果内核允许 `softint` 的 `int $14` 指令去调用内核页故障的服务程序(它的中断向量是 14)会发生什么事情? ``` -```markdown -小挑战!目前,在 `trapentry.S` 中列出的 `TRAPHANDLER` 和他们安装在 `trap.c` 中可能有许多代码非常相似。清除它们。修改 `trapentry.S` 中的宏去自动为 `trap.c` 生成一个表。注意,你可以直接使用 `.text` 和 `.data` 在汇编器中切换放置其中的代码和数据。 -``` - -```markdown -问题 - -在你的 `answers-lab3.txt` 中回答下列问题: - - 1. 为每个异常/中断设置一个独立的服务程序函数的目的是什么?(即:如果所有的异常/中断都传递给同一个服务程序,在我们的当前实现中能否提供这样的特性?) - 2. 你需要做什么事情才能让 `user/softint` 程序正常运行?评级脚本预计将会产生一个一般保护故障(trap 13),但是 `softint` 的代码显示为 `int $14`。为什么它产生的中断向量是 13?如果内核允许 `softint` 的 `int $14` 指令去调用内核页故障的服务程序(它的中断向量是 14)会发生什么事情? -``` - - 本实验的 Part A 部分结束了。不要忘了去添加 `answers-lab3.txt` 文件,提交你的变更,然后在 Part A 作业的提交截止日期之前运行 `make handin`。 -#### Part B:页故障、断点异常、和系统调用 +### Part B:页故障、断点异常、和系统调用 现在,你的内核已经有了最基本的异常处理能力,你将要去继续改进它,来提供依赖异常服务程序的操作系统原语。 -##### 处理页故障 +#### 处理页故障 页故障异常,中断向量为 14(`T_PGFLT`),它是一个非常重要的东西,我们将通过本实验和接下来的实验来大量练习它。当处理器产生一个页故障时,处理器将在它的一个特定的控制寄存器(`CR2`)中保存导致这个故障的线性地址(即:虚拟地址)。在 `trap.c` 中我们提供了一个专门处理它的函数的一个雏形,它就是 `page_fault_handler()`,我们将用它来处理页故障异常。 -```markdown -练习 5、修改 `trap_dispatch()` 将页故障异常派发到 `page_fault_handler()` 上。你现在应该能够成功测试 `faultread`、`faultreadkernel`、`faultwrite`、和 `faultwritekernel` 了。如果它们中的任何一个不能正常工作,找出问题并修复它。记住,你可以使用 make run- _x_ 或 make run- _x_ -nox 去重引导 JOS 进入到一个特定的用户程序。比如,你可以运行 make run-hello-nox 去运行 the _hello_ user 程序。 -``` +> **练习 5**、修改 `trap_dispatch()` 将页故障异常派发到 `page_fault_handler()` 上。你现在应该能够成功测试 `faultread`、`faultreadkernel`、`faultwrite` 和 `faultwritekernel` 了。如果它们中的任何一个不能正常工作,找出问题并修复它。记住,你可以使用 `make run-x` 或 `make run-x-nox` 去重引导 JOS 进入到一个特定的用户程序。比如,你可以运行 `make run-hello-nox` 去运行 `hello` 用户程序。 下面,你将进一步细化内核的页故障服务程序,因为你要实现系统调用了。 -##### 断点异常 +#### 断点异常 断点异常,中断向量为 3(`T_BRKPT`),它一般用在调试上,它在一个程序代码中插入断点,从而使用特定的 1 字节的 `int3` 软件中断指令来临时替换相应的程序指令。在 JOS 中,我们将稍微“滥用”一下这个异常,通过将它打造成一个伪系统调用原语,使得任何用户环境都可以用它来调用 JOS 内核监视器。如果我们将 JOS 内核监视认为是原始调试器,那么这种用法是合适的。例如,在 `lib/panic.c` 中实现的用户模式下的 `panic()` ,它在显示它的 `panic` 消息后运行一个 `int3` 中断。 -```markdown -练习 6、修改 `trap_dispatch()`,让它在调用内核监视器时产生一个断点异常。你现在应该可以在 `breakpoint` 上成功完成测试。 -``` +> **练习 6**、修改 `trap_dispatch()`,让它在调用内核监视器时产生一个断点异常。你现在应该可以在 `breakpoint` 上成功完成测试。 -```markdown -小挑战!修改 JOS 内核监视器,以便于你能够从当前位置(即:在 `int3` 之后,断点异常调用了内核监视器) '继续' 异常,并且因此你就可以一次运行一个单步指令。为了实现单步运行,你需要去理解 `EFLAGS` 寄存器中的某些比特的意义。 +. -可选:如果你富有冒险精神,找一些 x86 反汇编的代码 —— 即通过从 QEMU 中、或从 GNU 二进制工具中分离、或你自己编写 —— 然后扩展 JOS 内核监视器,以使它能够反汇编,显示你的每步的指令。结合实验 1 中的符号表,这将是你写的一个真正的内核调试器。 -``` +> **小挑战!**修改 JOS 内核监视器,以便于你能够从当前位置(即:在 `int3` 之后,断点异常调用了内核监视器) '继续' 异常,并且因此你就可以一次运行一个单步指令。为了实现单步运行,你需要去理解 `EFLAGS` 寄存器中的某些比特的意义。 -```markdown -问题 +> 可选:如果你富有冒险精神,找一些 x86 反汇编的代码 —— 即通过从 QEMU 中、或从 GNU 二进制工具中分离、或你自己编写 —— 然后扩展 JOS 内核监视器,以使它能够反汇编,显示你的每步的指令。结合实验 1 中的符号表,这将是你写的一个真正的内核调试器。 - 3. 在断点测试案例中,根据你在 IDT 中如何初始化断点条目的不同情况(即:你的从 `trap_init` 到 `SETGATE` 的调用),既有可能产生一个断点异常,也有可能产生一个一般保护故障。为什么?为了能够像上面的案例那样工作,你需要如何去设置它,什么样的不正确设置才会触发一个一般保护故障? - 4. 你认为这些机制的意义是什么?尤其是要考虑 `user/softint` 测试程序的工作原理。 -``` +. +> **问题** -##### 系统调用 +> 3. 在断点测试案例中,根据你在 IDT 中如何初始化断点条目的不同情况(即:你的从 `trap_init` 到 `SETGATE` 的调用),既有可能产生一个断点异常,也有可能产生一个一般保护故障。为什么?为了能够像上面的案例那样工作,你需要如何去设置它,什么样的不正确设置才会触发一个一般保护故障? + +> 4. 你认为这些机制的意义是什么?尤其是要考虑 `user/softint` 测试程序的工作原理。 + +#### 系统调用 用户进程请求内核为它做事情就是通过系统调用来实现的。当用户进程请求一个系统调用时,处理器首先进入内核模式,处理器和内核配合去保存用户进程的状态,内核为了完成系统调用会运行有关的代码,然后重新回到用户进程。用户进程如何获得内核的关注以及它如何指定它需要的系统调用的具体细节,这在不同的系统上是不同的。 @@ -414,45 +395,43 @@ x86 允许最多有 256 个不同的中断或异常入口点去进入内核, 应用程序将在寄存器中传递系统调用号和系统调用参数。通过这种方式,内核就不需要去遍历用户环境的栈或指令流。系统调用号将放在 `%eax` 中,而参数(最多五个)将分别放在 `%edx`、`%ecx`、`%ebx`、`%edi`、和 `%esi` 中。内核将在 `%eax` 中传递返回值。在 `lib/syscall.c` 中的 `syscall()` 中已为你编写了使用一个系统调用的汇编代码。你可以通过阅读它来确保你已经理解了它们都做了什么。 -```markdown -练习 7、在内核中为中断向量 `T_SYSCALL` 添加一个服务程序。你将需要去编辑 `kern/trapentry.S` 和 `kern/trap.c` 的 `trap_init()`。还需要去修改 `trap_dispatch()`,以便于通过使用适当的参数来调用 `syscall()` (定义在 `kern/syscall.c`)以处理系统调用中断,然后将系统调用的返回值安排在 `%eax` 中传递给用户进程。最后,你需要去实现 `kern/syscall.c` 中的 `syscall()`。如果系统调用号是无效值,确保 `syscall()` 返回值一定是 `-E_INVAL`。为确保你理解了系统调用的接口,你应该去阅读和掌握 `lib/syscall.c` 文件(尤其是行内汇编的动作),对于在 `inc/syscall.h` 中列出的每个系统调用都需要通过调用相关的内核函数来处理A。 +> **练习 7**、在内核中为中断向量 `T_SYSCALL` 添加一个服务程序。你将需要去编辑 `kern/trapentry.S` 和 `kern/trap.c` 的 `trap_init()`。还需要去修改 `trap_dispatch()`,以便于通过使用适当的参数来调用 `syscall()` (定义在 `kern/syscall.c`)以处理系统调用中断,然后将系统调用的返回值安排在 `%eax` 中传递给用户进程。最后,你需要去实现 `kern/syscall.c` 中的 `syscall()`。如果系统调用号是无效值,确保 `syscall()` 返回值一定是 `-E_INVAL`。为确保你理解了系统调用的接口,你应该去阅读和掌握 `lib/syscall.c` 文件(尤其是行内汇编的动作),对于在 `inc/syscall.h` 中列出的每个系统调用都需要通过调用相关的内核函数来处理A。 -在你的内核中运行 `user/hello` 程序(make run-hello)。它应该在控制台上输出 "`hello, world`",然后在用户模式中产生一个页故障。如果没有产生页故障,可能意味着你的系统调用服务程序不太正确。现在,你应该有能力成功通过 `testbss` 测试。 +> 在你的内核中运行 `user/hello` 程序(make run-hello)。它应该在控制台上输出 `hello, world`,然后在用户模式中产生一个页故障。如果没有产生页故障,可能意味着你的系统调用服务程序不太正确。现在,你应该有能力成功通过 `testbss` 测试。 + +. + +> 小挑战!使用 `sysenter` 和 `sysexit` 指令而不是使用 `int 0x30` 和 `iret` 来实现系统调用。 + +> `sysenter/sysexit` 指令是由 Intel 设计的,它的运行速度要比 `int/iret` 指令快。它使用寄存器而不是栈来做到这一点,并且通过假定了分段寄存器是如何使用的。关于这些指令的详细内容可以在 Intel 参考手册 2B 卷中找到。 + +> 在 JOS 中添加对这些指令支持的最容易的方法是,在 `kern/trapentry.S` 中添加一个 `sysenter_handler`,在它里面保存足够多的关于用户环境返回、设置内核环境、推送参数到 `syscall()`、以及直接调用 `syscall()` 的信息。一旦 `syscall()` 返回,它将设置好运行 `sysexit` 指令所需的一切东西。你也将需要在 `kern/init.c` 中添加一些代码,以设置特殊模块寄存器(MSRs)。在 AMD 架构程序员手册第 2 卷的 6.1.2 节中和 Intel 参考手册的 2B 卷的 SYSENTER 上都有关于 MSRs 的很详细的描述。对于如何去写 MSRs,在[这里][4]你可以找到一个添加到 `inc/x86.h` 中的 `wrmsr` 的实现。 + +> 最后,`lib/syscall.c` 必须要修改,以便于支持用 `sysenter` 来生成一个系统调用。下面是 `sysenter` 指令的一种可能的寄存器布局: + +> ``` +eax - syscall number +edx, ecx, ebx, edi - arg1, arg2, arg3, arg4 +esi - return pc +ebp - return esp +esp - trashed by sysenter ``` -```markdown -小挑战!使用 `sysenter` 和 `sysexit` 指令而不是使用 `int 0x30` 和 `iret` 来实现系统调用。 +> GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的值。不要忘了同时去保存(`push`)和恢复(`pop`)你使用的其它寄存器,或告诉内联汇编器你正在使用它们。内联汇编器不支持保存 `%ebp`,因此你需要自己去增加一些代码来保存和恢复它们,返回地址可以使用一个像 `leal after_sysenter_label, %%esi` 的指令置入到 `%esi` 中。 -`sysenter/sysexit` 指令是由 Intel 设计的,它的运行速度要比 `int/iret` 指令快。它使用寄存器而不是栈来做到这一点,并且通过假定了分段寄存器是如何使用的。关于这些指令的详细内容可以在 Intel 参考手册 2B 卷中找到。 +> 注意,它仅支持 4 个参数,因此你需要保留支持 5 个参数的系统调用的旧方法。而且,因为这个快速路径并不更新当前环境的 trap 帧,因此,在我们添加到后续实验中的一些系统调用上,它并不适合。 -在 JOS 中添加对这些指令支持的最容易的方法是,在 `kern/trapentry.S` 中添加一个 `sysenter_handler`,在它里面保存足够多的关于用户环境返回、设置内核环境、推送参数到 `syscall()`、以及直接调用 `syscall()` 的信息。一旦 `syscall()` 返回,它将设置好运行 `sysexit` 指令所需的一切东西。你也将需要在 `kern/init.c` 中添加一些代码,以设置特殊模块寄存器(MSRs)。在 AMD 架构程序员手册第 2 卷的 6.1.2 节中和 Intel 参考手册的 2B 卷的 SYSENTER 上都有关于 MSRs 的很详细的描述。对于如何去写 MSRs,在[这里][4]你可以找到一个添加到 `inc/x86.h` 中的 `wrmsr` 的实现。 +> 在接下来的实验中我们启用了异步中断,你需要再次去评估一下你的代码。尤其是,当返回到用户进程时,你需要去启用中断,而 `sysexit` 指令并不会为你去做这一动作。 -最后,`lib/syscall.c` 必须要修改,以便于支持用 `sysenter` 来生成一个系统调用。下面是 `sysenter` 指令的一种可能的寄存器布局: - - eax - syscall number - edx, ecx, ebx, edi - arg1, arg2, arg3, arg4 - esi - return pc - ebp - return esp - esp - trashed by sysenter - -GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的值。不要忘了同时去保存(push)和恢复(pop)你使用的其它寄存器,或告诉内联汇编器你正在使用它们。内联汇编器不支持保存 `%ebp`,因此你需要自己去增加一些代码来保存和恢复它们,返回地址可以使用一个像 `leal after_sysenter_label, %%esi` 的指令置入到 `%esi` 中。 - -注意,它仅支持 4 个参数,因此你需要保留支持 5 个参数的系统调用的旧方法。而且,因为这个快速路径并不更新当前环境的 trap 帧,因此,在我们添加到后续实验中的一些系统调用上,它并不适合。 - -在接下来的实验中我们启用了异步中断,你需要再次去评估一下你的代码。尤其是,当返回到用户进程时,你需要去启用中断,而 `sysexit` 指令并不会为你去做这一动作。 -``` - -##### 启动用户模式 +#### 启动用户模式 一个用户程序是从 `lib/entry.S` 的顶部开始运行的。在一些配置之后,代码调用 `lib/libmain.c` 中的 `libmain()`。你应该去修改 `libmain()` 以初始化全局指针 `thisenv`,使它指向到这个环境在数组 `envs[]` 中的 `struct Env`。(注意那个 `lib/entry.S` 中已经定义 `envs` 去指向到在 Part A 中映射的你的设置。)提示:查看 `inc/env.h` 和使用 `sys_getenvid`。 `libmain()` 接下来调用 `umain`,在 hello 程序的案例中,`umain` 是在 `user/hello.c` 中。注意,它在输出 "`hello, world`” 之后,它尝试去访问 `thisenv->env_id`。这就是为什么前面会发生故障的原因了。现在,你已经正确地初始化了 `thisenv`,它应该不会再发生故障了。如果仍然会发生故障,或许是因为你没有映射 `UENVS` 区域为用户可读取(回到前面 Part A 中 查看 `pmap.c`);这是我们第一次真实地使用 `UENVS` 区域)。 -```markdown -练习 8、添加要求的代码到用户库,然后引导你的内核。你应该能够看到 `user/hello` 程序会输出 "`hello, world`" 然后输出 "`i am environment 00001000`"。`user/hello` 接下来会通过调用 `sys_env_destroy()`(查看`lib/libmain.c` 和 `lib/exit.c`)尝试去"退出"。由于内核目前仅支持一个用户环境,它应该会报告它毁坏了唯一的环境,然后进入到内核监视器中。现在你应该能够成功通过 `hello` 的测试。 -``` +> **练习 8**、添加要求的代码到用户库,然后引导你的内核。你应该能够看到 `user/hello` 程序会输出 `hello, world` 然后输出 `i am environment 00001000`。`user/hello` 接下来会通过调用 `sys_env_destroy()`(查看`lib/libmain.c` 和 `lib/exit.c`)尝试去“退出”。由于内核目前仅支持一个用户环境,它应该会报告它毁坏了唯一的环境,然后进入到内核监视器中。现在你应该能够成功通过 `hello` 的测试。 -##### 页故障和内存保护 +#### 页故障和内存保护 内存保护是一个操作系统中最重要的特性,通过它来保证一个程序中的 bug 不会破坏其它程序或操作系统本身。 @@ -462,10 +441,8 @@ GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的 对于内存保护,系统调用中有一个非常有趣的问题。许多系统调用接口让用户程序传递指针到内核中。这些指针指向用户要读取或写入的缓冲区。然后内核在执行系统调用时废弃这些指针。这样就有两个问题: - 1. 内核中的页故障可能比用户程序中的页故障多的多。如果内核在维护它自己的数据结构时发生页故障,那就是一个内核 bug,而故障服务程序将使整个内核(和整个系统)崩溃。但是当内核废弃了由用户程序传递给它的指针后,它就需要一种方式去记住那些废弃指针所导致的页故障其实是代表用户程序的。 - 2. 一般情况下内核拥有比用户程序更多的权限。用户程序可以传递一个指针到系统调用,而指针指向的区域有可能是内核可以读取或写入而用户程序不可访问的区域。内核必须要非常小心,不能被废弃的这种指针欺骗,因为这可能导致泄露私有信息或破坏内核的完整性。 - - +1. 内核中的页故障可能比用户程序中的页故障多的多。如果内核在维护它自己的数据结构时发生页故障,那就是一个内核 bug,而故障服务程序将使整个内核(和整个系统)崩溃。但是当内核废弃了由用户程序传递给它的指针后,它就需要一种方式去记住那些废弃指针所导致的页故障其实是代表用户程序的。 +2. 一般情况下内核拥有比用户程序更多的权限。用户程序可以传递一个指针到系统调用,而指针指向的区域有可能是内核可以读取或写入而用户程序不可访问的区域。内核必须要非常小心,不能被废弃的这种指针欺骗,因为这可能导致泄露私有信息或破坏内核的完整性。 由于以上的原因,内核在处理由用户程序提供的指针时必须格外小心。 @@ -473,32 +450,33 @@ GCC 的内联汇编器将自动保存你告诉它的直接加载进寄存器的 这样,内核在废弃一个用户提供的指针时就绝不会发生页故障。如果内核出现这种页故障,它应该崩溃并终止。 -```markdown -练习 9、如果在内核模式中发生一个页故障,修改 `kern/trap.c` 去崩溃。 +> **练习 9**、如果在内核模式中发生一个页故障,修改 `kern/trap.c` 去崩溃。 -提示:判断一个页故障是发生在用户模式还是内核模式,去检查 `tf_cs` 的低位比特即可。 +> 提示:判断一个页故障是发生在用户模式还是内核模式,去检查 `tf_cs` 的低位比特即可。 -阅读 `kern/pmap.c` 中的 `user_mem_assert` 并在那个文件中实现 `user_mem_check`。 +> 阅读 `kern/pmap.c` 中的 `user_mem_assert` 并在那个文件中实现 `user_mem_check`。 -修改 `kern/syscall.c` 去常态化检查传递给系统调用的参数。 +> 修改 `kern/syscall.c` 去常态化检查传递给系统调用的参数。 -引导你的内核,运行 `user/buggyhello`。环境将被毁坏,而内核将不会崩溃。你将会看到: +> 引导你的内核,运行 `user/buggyhello`。环境将被毁坏,而内核将不会崩溃。你将会看到: - [00001000] user_mem_check assertion failure for va 00000001 - [00001000] free env 00001000 - Destroyed the only environment - nothing more to do! -最后,修改在 `kern/kdebug.c` 中的 `debuginfo_eip`,在 `usd`、`stabs`、和 `stabstr` 上调用 `user_mem_check`。如果你现在运行 `user/breakpoint`,你应该能够从内核监视器中运行回溯,然后在内核因页故障崩溃前看到回溯进入到 `lib/libmain.c`。是什么导致了这个页故障?你不需要去修复它,但是你应该明白它是如何发生的。 +> ``` +[00001000] user_mem_check assertion failure for va 00000001 +[00001000] free env 00001000 +Destroyed the only environment - nothing more to do! ``` +> 最后,修改在 `kern/kdebug.c` 中的 `debuginfo_eip`,在 `usd`、`stabs`、和 `stabstr` 上调用 `user_mem_check`。如果你现在运行 `user/breakpoint`,你应该能够从内核监视器中运行回溯,然后在内核因页故障崩溃前看到回溯进入到 `lib/libmain.c`。是什么导致了这个页故障?你不需要去修复它,但是你应该明白它是如何发生的。 + 注意,刚才实现的这些机制也同样适用于恶意用户程序(比如 `user/evilhello`)。 -``` -练习 10、引导你的内核,运行 `user/evilhello`。环境应该被毁坏,并且内核不会崩溃。你应该能看到: +> **练习 10**、引导你的内核,运行 `user/evilhello`。环境应该被毁坏,并且内核不会崩溃。你应该能看到: - [00000000] new env 00001000 - ... - [00001000] user_mem_check assertion failure for va f010000c - [00001000] free env 00001000 +> ``` +[00000000] new env 00001000 +... +[00001000] user_mem_check assertion failure for va f010000c +[00001000] free env 00001000 ``` **本实验到此结束。**确保你通过了所有的等级测试,并且不要忘记去写下问题的答案,在 `answers-lab3.txt` 中详细描述你的挑战练习的解决方案。提交你的变更并在 `lab` 目录下输入 `make handin` 去提交你的工作。 @@ -512,13 +490,13 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab3/ 作者:[csail.mit][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://pdos.csail.mit.edu [b]: https://github.com/lujun9972 -[1]: https://pdos.csail.mit.edu/6.828/2018/labs/labguide.html +[1]: https://linux.cn/article-10273-1.html [2]: https://pdos.csail.mit.edu/6.828/2018/labs/reference.html [3]: http://blogs.msdn.com/larryosterman/archive/2005/02/08/369243.aspx [4]: http://ftp.kh.edu.tw/Linux/SuSE/people/garloff/linux/k6mod.c From 200c0c874541dc3c05bae484da5acc14533aa5be Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 3 Dec 2018 23:15:45 +0800 Subject: [PATCH 052/135] PUB:20181004 Lab 3- User Environments.md @qhwdw https://linux.cn/article-10307-1.html --- .../tech => published}/20181004 Lab 3- User Environments.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181004 Lab 3- User Environments.md (100%) diff --git a/translated/tech/20181004 Lab 3- User Environments.md b/published/20181004 Lab 3- User Environments.md similarity index 100% rename from translated/tech/20181004 Lab 3- User Environments.md rename to published/20181004 Lab 3- User Environments.md From c906a626cbb041abaeea681a428568c62e6c3e40 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 4 Dec 2018 00:49:16 +0800 Subject: [PATCH 053/135] PRF:20180131 For your first HTML code lets help Batman write a love letter.md @MjSeven --- ...de lets help Batman write a love letter.md | 164 ++++++++---------- 1 file changed, 68 insertions(+), 96 deletions(-) diff --git a/translated/tech/20180131 For your first HTML code lets help Batman write a love letter.md b/translated/tech/20180131 For your first HTML code lets help Batman write a love letter.md index a35aa37ab6..adc41a04b7 100644 --- a/translated/tech/20180131 For your first HTML code lets help Batman write a love letter.md +++ b/translated/tech/20180131 For your first HTML code lets help Batman write a love letter.md @@ -1,17 +1,15 @@ -对于你的第一行 HTML 代码,让我们来帮助蝙蝠侠写一封情书 +编写你的第一行 HTML 代码,来帮助蝙蝠侠写一封情书 ====== ![](https://cdn-images-1.medium.com/max/1000/1*kZxbQJTdb4jn_frfqpRg9g.jpeg) -[Image Credit][1] - 在一个美好的夜晚,你的肚子拒绝消化你在晚餐吃的大块披萨,所以你不得不在睡梦中冲进洗手间。 在浴室里,当你在思考为什么会发生这种情况时,你听到一个来自通风口的低沉声音:“嘿,我是蝙蝠侠。” 这时,你会怎么做呢? -在你恐慌并处于关键节点之前,蝙蝠侠说:“我需要你的帮助。我是一个超级极客,但我不懂 HTML。我需要用 HTML 写一封情书,你愿意帮助我吗?” +在你恐慌并处于关键时刻之前,蝙蝠侠说:“我需要你的帮助。我是一个超级极客,但我不懂 HTML。我需要用 HTML 写一封情书,你愿意帮助我吗?” 谁会拒绝蝙蝠侠的请求呢,对吧?所以让我们用 HTML 来写一封蝙蝠侠的情书。 @@ -21,9 +19,9 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS 那么,让我们来创建一个 .html 文件。你可以在 Notepad 或其它任何编辑器中完成此任务,但我建议使用 VS Code。[在这里下载并安装 VS Code][2]。它是免费的,也是我唯一喜欢的微软产品。 -在系统中创建一个目录,将其命名为 “HTML Practice”(不带引号)。在这个目录中,再创建一个名为 “Batman’s Love Letter”(不带引号)的目录,这将是我们的项目根目录。这意味着我们所有与这个项目相关的文件都会在这里。 +在系统中创建一个目录,将其命名为 “HTML Practice”(不带引号)。在这个目录中,再创建一个名为 “Batman's Love Letter”(不带引号)的目录,这将是我们的项目根目录。这意味着我们所有与这个项目相关的文件都会在这里。 -打开 VS Code,按下 ctrl+n 创建一个新文件,按下 ctrl+s 保存文件。切换到 “Batman’s Love Letter” 文件夹并将其命名为 “loveletter.html”,然后单击保存。 +打开 VS Code,按下 `ctrl+n` 创建一个新文件,按下 `ctrl+s` 保存文件。切换到 “Batman's Love Letter” 文件夹并将其命名为 “loveletter.html”,然后单击保存。 现在,如果你在文件资源管理器中双击它,它将在你的默认浏览器中打开。我建议使用 Firefox 来进行 web 开发,但 Chrome 也可以。 @@ -37,7 +35,7 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS “After all the battles we fought together, after all the difficult times we saw together, and after all the good and bad moments we’ve been through, I think it’s time I let you know how I feel about you.” -复制这些到 VS Code 中的 loveletter.html。单击 View -> Toggle Word Wrap (alt+z) 自动换行。 +复制这些到 VS Code 中的 loveletter.html。单击 “View -> Toggle Word Wrap (alt+z)” 自动换行。 保存并在浏览器中打开它。如果它已经打开,单击浏览器中的刷新按钮。 @@ -61,7 +59,7 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS 我们不希望这样。没有人想要阅读这么长的行。让我们设定段落宽度为 550px。 -我们可以通过使用元素的 “style” 属性来实现。你可以在其 style 属性中定义元素的样式(例如,在我们的示例中为宽度)。以下行将在 “p” 元素上创建一个空样式属性: +我们可以通过使用元素的 `style` 属性来实现。你可以在其 `style` 属性中定义元素的样式(例如,在我们的示例中为宽度)。以下行将在 `p` 元素上创建一个空样式属性: ```

...

@@ -75,23 +73,25 @@ HTML 网页与你电脑上的其它文件一样。就同一个 .doc 文件以 MS

``` -我们将 “width” 属性设置为 550px,用冒号 “:” 分隔,以分号 “;” 结束。 +我们将 `width` 属性设置为 `550px`,用冒号 `:` 分隔,以分号 `;` 结束。 -另外,注意我们如何将 `

` 和 `

` 放在单独的行中,文本内容用一个 tab 缩进。像这样设置代码使其更具可读性。 +另外,注意我们如何将 `

` 和 `

` 放在单独的行中,文本内容用一个制表符缩进。像这样设置代码使其更具可读性。 ### HTML 中的列表 接下来,蝙蝠侠希望列出他所钦佩的人的一些优点,例如: -“ You complete my darkness with your light. I love: +``` +You complete my darkness with your light. I love: - the way you see good in the worst things - the way you handle emotionally difficult situations - the way you look at Justice -I have learned a lot from you. You have occupied a special place in my heart over time.” +I have learned a lot from you. You have occupied a special place in my heart over time. +``` 这看起来很简单。 -让我们继续,在 `

:` 下面复制所需的文本: +让我们继续,在 `

` 下面复制所需的文本: ```

@@ -137,11 +137,11 @@ I have learned a lot from you. You have occupied a special place in my heart ove 另外,注意我们没有写一个 `
`。有些标签不需要结束标签(它们被称为自闭合标签)。 -还有一件事:我们没有在两个段落之间使用 `
`,但第二个段落仍然是从一个新行开始,这是因为 “p” 元素会自动插入换行符。 +还有一件事:我们没有在两个段落之间使用 `
`,但第二个段落仍然是从一个新行开始,这是因为 `

` 元素会自动插入换行符。 我们使用纯文本编写列表,但是有两个标签可以供我们使用来达到相同的目的:`

    ` and `
  • `。 -为了得到命名(to 校正:这里不太理解):ul 代表无序列表,li 代表列表项目。让我们使用它们来展示我们的列表: +让我们解释一下名字的意思:ul 代表无序列表Unordered List,li 代表列表项目List Item。让我们使用它们来展示我们的列表: ```

    @@ -164,12 +164,9 @@ I have learned a lot from you. You have occupied a special place in my heart ove 在复制代码之前,注意差异部分: * 我们删除了所有的 `
    `,因为每个 `

  • ` 会自动显示在新行中 - * 我们将每个列表项包含在 `
  • ` 和 `
  • ` 之间 - * 我们将所有列表项的集合包裹在 `
      ` 和 `
    ` 之间 - -* 我们没有像 “p” 元素那样定义 “ul” 元素的宽度。这是因为 “ul” 是 “p” 的子节点,“p” 已经被约束到 550px,所以 “ul” 不会超出这个范围。 +* 我们没有像 `

    ` 元素那样定义 `

      ` 元素的宽度。这是因为 `
        ` 是 `

        ` 的子节点,`

        ` 已经被约束到 550px,所以 `

          ` 不会超出这个范围。 让我们保存文件并刷新浏览器以查看结果: @@ -177,7 +174,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove 你会立即注意到在每个列表项之前显示了重点标志。我们现在不需要在每个列表项之前写 “-”。 -经过仔细检查,你会注意到最后一行超出 550px 宽度。这是为什么?因为 HTML 不允许 “ul” 元素出现在 "p" 元素中。让我们将第一行和最后一行放在单独的 “p” 元素中: +经过仔细检查,你会注意到最后一行超出 550px 宽度。这是为什么?因为 HTML 不允许 `
            ` 元素出现在 `

            ` 元素中。让我们将第一行和最后一行放在单独的 `

            ` 元素中: ```

            @@ -207,11 +204,11 @@ I have learned a lot from you. You have occupied a special place in my heart ove 保存并刷新。 -注意,这次我们还定义了 “ul” 元素的宽度。那是因为我们现在已经将 “ul” 元素放在了 “p” 元素之外。 +注意,这次我们还定义了 `

              ` 元素的宽度。那是因为我们现在已经将 `
                ` 元素放在了 `

                ` 元素之外。 -定义情书中所有元素的宽度会变得很麻烦。我们有一个特定的元素用于此目的:“div” 元素。一个 “div” 元素就是一个通用容器,用于对内容进行分组,以便轻松设置样式。 +定义情书中所有元素的宽度会变得很麻烦。我们有一个特定的元素用于此目的:`

                ` 元素。一个 `
                ` 元素就是一个通用容器,用于对内容进行分组,以便轻松设置样式。 -让我们用 div 元素包装整个情书,并为其赋予宽度:550px +让我们用 `
                ` 元素包装整个情书,并为其赋予宽度:550px 。 ```
                @@ -238,11 +235,11 @@ I have learned a lot from you. You have occupied a special place in my heart ove 到目前为止,蝙蝠侠对结果很高兴,他希望在情书上标题。他想写一个标题: “Bat Letter”。当然,你已经看到这个名字了,不是吗?:D -你可以使用 ht, h2, h3, h4, h5 和 h6 标签来添加标题,h1 是最大的标题和最主要的标题,h6 是最小的标题。 +你可以使用 `

                `、`

                `、`

                `、`

                `、`

                ` 和 `
                ` 标签来添加标题,`

                ` 是最大的标题和最主要的标题,`

                ` 是最小的标题。 ![](https://cdn-images-1.medium.com/max/1000/1*Ud-NzfT-SrMgur1WX4LCkQ.jpeg) -让我们在第二段之前使用 h1 做主标题和一个副标题: +让我们在第二段之前使用 `

                ` 做主标题和一个副标题: ```
                @@ -280,9 +277,9 @@ I have learned a lot from you. You have occupied a special place in my heart ove 所以,让我们在情书中添加一个蝙蝠侠标志。 -在 HTML 中包含图像就像在一个 Word 文件中包含图像一样。在 MS Word 中,你到 菜单 -> 插入 -> 图像 -> 然后导航到图像位置为止 -> 选择图像 -> 单击插入。 +在 HTML 中包含图像就像在一个 Word 文件中包含图像一样。在 MS Word 中,你到 “菜单 -> 插入 -> 图像 -> 然后导航到图像位置为止 -> 选择图像 -> 单击插入”。 -在 HTML 中,我们使用 `` 标签让浏览器知道我们需要加载的图像,而不是单击菜单。我们在 “src” 属性中写入文件的位置和名称。如果图像在项目根目录中,我们可以简单地在 src 属性中写入图像文件的名称。 +在 HTML 中,我们使用 `` 标签让浏览器知道我们需要加载的图像,而不是单击菜单。我们在 `src` 属性中写入文件的位置和名称。如果图像在项目根目录中,我们可以简单地在 `src` 属性中写入图像文件的名称。 在我们深入编码之前,从[这里][3]下载蝙蝠侠标志。你可能希望裁剪图像中的额外空白区域。复制项目根目录中的图像并将其重命名为 “bat-logo.jpeg”。 @@ -311,7 +308,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove
                ``` -我们在第 3 行包含了 img 标签。这个标签也是一个自闭合的标签,所以我们不需要写 ``。在 src 属性中,我们给出了图像文件的名称。这个名称应与图像名称完全相同,包括扩展名(.jpeg)及其大小写。 +我们在第 3 行包含了 `` 标签。这个标签也是一个自闭合的标签,所以我们不需要写 ``。在 `src` 属性中,我们给出了图像文件的名称。这个名称应与图像名称完全相同,包括扩展名(.jpeg)及其大小写。 保存并刷新,查看结果。 @@ -319,7 +316,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove 该死的!刚刚发生了什么? -当使用 img 标签包含图像时,默认情况下,图像将以其原始分辨率显示。在我们的例子中,图像比 550px 宽得多。让我们使用 style 属性定义它的宽度: +当使用 `` 标签包含图像时,默认情况下,图像将以其原始分辨率显示。在我们的例子中,图像比 550px 宽得多。让我们使用 `style` 属性定义它的宽度: ``` @@ -353,7 +350,7 @@ I have learned a lot from you. You have occupied a special place in my heart ove ![](https://cdn-images-1.medium.com/max/1000/1*5c0ngx3BFVlyyP6UNtfYyg.jpeg) -太棒了!这给蝙蝠侠的脸带来了胆怯的微笑 :)。(to 校正:这里什么意思) +太棒了!这让蝙蝠侠的脸露出了羞涩的微笑 :)。 ### HTML 中的粗体和斜体 @@ -373,7 +370,7 @@ I don’t show my emotions, but I think this man behind the mask is falling for 你说:哦!我还以为是给神奇女侠的呢。 -蝙蝠侠说:不,这是给超人的,请在最后写上“I love you Superman.”。 +蝙蝠侠说:不,这是给超人的,请在最后写上 “I love you Superman.”。 好的,我们来写: @@ -462,13 +459,11 @@ I don’t show my emotions, but I think this man behind the mask is falling for 你可以通过三种方式设置样式或定义 HTML 元素的外观: -* 内联样式:我们使用元素的 “style” 属性来编写样式。这是我们迄今为止使用的,但这不是一个好的实践。 - -* 嵌入式样式:我们在由 包裹的 “style” 元素中编写所有样式。 - +* 内联样式:我们使用元素的 `style` 属性来编写样式。这是我们迄今为止使用的,但这不是一个好的实践。 +* 嵌入式样式:我们在由 `` 包裹的 “style” 元素中编写所有样式。 * 链接样式表:我们在具有 .css 扩展名的单独文件中编写所有元素的样式。此文件称为样式表。 -让我们来看看如何定义 “div” 的内联样式: +让我们来看看如何定义 `
                ` 的内联样式: ```
                @@ -484,9 +479,9 @@ div{ 在嵌入式样式中,我们编写的样式是与元素分开的。所以我们需要一种方法来关联元素及其样式。第一个单词 “div” 就做了这样的活。它让浏览器知道花括号 `{...}` 里面的所有样式都属于 “div” 元素。由于这种语法确定要应用样式的元素,因此它称为一个选择器。 -我们编写样式的方式保持不变:属性(宽度)和值(550px)用冒号(:)分隔,以分号(;)结束。 +我们编写样式的方式保持不变:属性(`width`)和值(`550px`)用冒号(`:`)分隔,以分号(`;`)结束。 -让我们从 “div” 和 “img” 元素中删除内联样式,将其写入 ` 将变得很大。这可能很快会混乱我们的主 HTML 文件。 +但是,你可以看到,随着我们包含越来越多的样式,`` 将变得很大。这可能很快会混乱我们的主 HTML 文件。 -因此,让我们更进一步,通过将 style 标签内的内容复制到一个新文件来使用链接样式。 +因此,让我们更进一步,通过将 ` 中编写元素的样式(这称为嵌入式样式) - - * 在 HTML 中如何使用 在单独的文件中编写样式并链接它(这称为链接样式表) - + * 如何在 `` 中编写元素的样式(这称为嵌入式样式) + * 在 HTML 中如何使用 `` 在单独的文件中编写样式并链接它(这称为链接样式表) * 什么是标签名称,属性,开始标签和结束标签 - * 如何使用 id 属性为一个元素赋予 id - * CSS 中的标签选择器和 id 选择器 我们学习了以下 HTML 标签: - * \

                :用于段落 - - * \
                :用于换行 - - * \

                  , \
                • :显示列表 - - * \
                  :用于分组我们信件的元素 - - * \

                  , \

                  :用于标题和子标题 - - * \:用于插入图像 - - * \, \:用于粗体和斜体文字样式 - - * \