Merge pull request #3 from LCTT/master

Update from LCTT
This commit is contained in:
chen ni 2019-06-14 11:33:34 +08:00 committed by GitHub
commit 269f7410c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 715 additions and 483 deletions

View File

@ -0,0 +1,178 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10969-1.html)
[#]: subject: (GoAccess A Real-Time Web Server Log Analyzer And Interactive Viewer)
[#]: via: (https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/)
[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/)
GoAccess一个实时的 Web 日志分析器及交互式查看器
======
![](https://img.linux.net.cn/data/attachment/album/201906/12/222616h80pl0k0tt811071.jpg)
分析日志文件对于 Linux 管理员来说是一件非常令人头疼的事情,因为它记录了很多东西。大多数新手和初级管理员都不知道如何分析。如果你在分析日志方面拥有很多知识,那么你就成了 *NIX 系统高手。
Linux 中有许多工具可以轻松分析日志。GoAccess 是允许用户轻松分析 Web 服务器日志的工具之一。我们将在本文中详细讨论 GoAccess 工具。
### GoAccess
GoAccess 是一个实时 Web 日志分析器和交互式查看器,可以在 *nix 系统中的终端运行或通过浏览器访问。
GoAccess 需要的依赖极少,它是用 C 语言编写的,只需要 ncurses。
它支持 Apache、Nginx 和 Lighttpd 日志。它为需要动态可视化服务器报告的系统管理员即时提供了快速且有价值的 HTTP 统计信息。
GoAccess 可以解析指定的 Web 日志文件并将数据输出到 X 终端和浏览器。
GoAccess 被设计成一个基于终端的快速日志分析器。其核心思想是实时快速分析和查看 Web 服务器统计信息,而无需使用浏览器。
默认输出是在终端输出,它也能够生成完整的、自包含的实时 HTML 报告,以及 JSON 和 CSV 报告。
GoAccess 支持任何自定义日志格式并包含以下预定义日志格式选项Apache/Nginx 中的组合日志格式 XLF/ELFApache 中的通用日志格式 CLF但不限于此。
### GoAccess 功能
* 完全实时:所有指标在终端上每 200 毫秒更新一次,在 HTML 输出上每秒更新一次。
* 跟踪应用程序响应时间:跟踪服务请求所需的时间。如果你想跟踪减慢了网站速度的网页,则非常有用。
* 访问者:按小时或日期确定最慢运行的请求的点击量、访问者数、带宽数和指标。
* 按虚拟主机的度量标准:如果有多个虚拟主机(`Server`),它提供了一个面板,可显示哪些虚拟主机正在消耗大部分 Web 服务器资源。
### 如何安装 GoAccess
我建议用户在包管理器的帮助下从发行版官方的存储库安装 GoAccess。它在大多数发行版官方存储库中都可用。
我们知道,我们在标准发行方式的发行版中得到的是过时的软件包,而滚动发行方式的发行版总是包含最新的软件包。
如果你使用标准发行方式的发行版运行操作系统,我建议你检查替代选项,如 PPA 或 GoAccess 官方维护者存储库等,以获取最新的软件包。
对于 Debian / Ubuntu 系统,使用 [APT-GET 命令][1]或 [APT 命令][2]在你的系统上安装 GoAccess。
```
# apt install goaccess
```
要获取最新的 GoAccess 包,请使用以下 GoAccess 官方存储库。
```
$ echo "deb https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
$ wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install goaccess
```
对于 RHEL / CentOS 系统,使用 [YUM 包管理器][3]在你的系统上安装 GoAccess。
```
# yum install goaccess
```
对于 Fedora 系统,使用 [DNF 包管理器][4]在你的系统上安装 GoAccess。
```
# dnf install goaccess
```
对于基于 ArchLinux / Manjaro 的系统,使用 [Pacman 包管理器][5]在你的系统上安装 GoAccess。
```
# pacman -S goaccess
```
对于 openSUSE Leap 系统,使用[Zypper 包管理器][6]在你的系统上安装 GoAccess。
```
# zypper install goaccess
# zypper ar -f obs://server:http
# zypper ref && zypper in goaccess
```
### 如何使用 GoAccess
成功安装 GoAccess 后。只需输入 `goaccess` 命令,然后输入 Web 服务器日志位置即可查看。
```
# goaccess [options] /path/to/Web Server/access.log
# goaccess /var/log/apache/2daygeek_access.log
```
执行上述命令时,它会要求您选择日志格式配置。
![][8]
我用 Apache 访问日志对此进行了测试。Apache 日志被分为十五个部分。详情如下。主要部分显示了这十五个部分的摘要。
以下屏幕截图包括四个部分,例如唯一身份访问者、请求的文件、静态请求、未找到的网址。
![][10]
以下屏幕截图包括四个部分,例如访客主机名和 IP、操作系统、浏览器、时间分布。
![][10]
以下屏幕截图包括四个部分例如来源网址、来源网站Google 的搜索引擎结果、HTTP状态代码。
![][11]
如果要生成 html 报告,请使用以下命令。最初我在尝试生成 html 报告时遇到错误。
```
# goaccess 2daygeek_access.log -a > report.html
GoAccess - version 1.3 - Nov 23 2018 11:28:19
Config file: No config file used
Fatal error has occurred
Error occurred at: src/parser.c - parse_log - 2764
No time format was found on your conf file.Parsing... [0] [0/s]
```
它说“你的 conf 文件没有找到时间格式”。要解决此问题,请为其添加 “COMBINED” 日志格式选项。
```
# goaccess -f 2daygeek_access.log --log-format=COMBINED -o 2daygeek.html
Parsing...[0,165] [50,165/s]
```
![][12]
GoAccess 也允许你访问和分析实时日志并进行过滤和解析。
```
# tail -f /var/log/apache/2daygeek_access.log | goaccess -
```
更多细节请参考其 man 手册页或帮助。
```
# man goaccess
# goaccess --help
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/
作者:[Vinoth Kumar][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/vinoth/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
[3]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
[5]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
[7]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[8]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-1.png
[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-2.png
[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-3.png
[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-4.png
[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-5.png

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10974-1.html)
[#]: subject: (Unity Editor is Now Officially Available for Linux)
[#]: via: (https://itsfoss.com/unity-editor-linux/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
@ -10,59 +10,55 @@
Unity 编辑器现已正式面向 Linux 推出
======
如果你是设计师、开发者或艺术家,你可能一直在使用 Linux 上的实验性 [Unity 编辑器][1]。然而,实验性版本无法永远满足 - 开发者需要一个完整稳定的工作经验。
如果你是设计师、开发者或艺术家,你可能一直在使用 Linux 上的实验性 [Unity 编辑器][1]。然而,不能一直用实验性版本 —— 开发者需要一个完整稳定的工作经验。
因此,他们最近宣布你可以在 Linux 上使用完整功能的 Unity 编辑器了。
虽然这是一个令人兴奋的消息,但它正式支持哪些 Linux 发行版?我们来谈谈更多细节......
虽然这是一个令人兴奋的消息,但它正式支持哪些 Linux 发行版?我们来谈谈更多细节……
非 FOSS 警告
> 非 FOSS 警告
Linux 上的 Unity 编辑器(或任何其他平台)不是开源软件。我们在这里介绍它是因为
> Linux (或任何其他平台)上的 Unity 编辑器不是开源软件。我们在这里介绍它是因为
### 官方支持 Ubuntu 和 CentOS 7
![][2]
无论你拥有个人许可还是专业许可,如果你安装了 Unity 2019.1 或更高版本,都可以使用编辑器。
无论你拥有个人许可还是专业许可,如果你安装了 Unity 2019.1 或更高版本,都可以使用编辑器。
此外,他们优先支持 Ubuntu 16.04、Ubuntu 18.04 和 CentOS 7。
在[公告][3]中,他们还提到了支持的配置:
* x86-64 架构
  * 运行在 X11 窗口系统之上的 Gnome 桌面环境
  * Nvidia 官方专有显卡驱动和 AMD Mesa 显卡驱动
  * 桌面计算机,在没有仿真或兼容层的设备/硬件上运行
* x86-64 架构
* 运行在 X11 窗口系统之上的 Gnome 桌面环境
* Nvidia 官方专有显卡驱动和 AMD Mesa 显卡驱动
* 桌面计算机,在没有仿真或兼容层的设备/硬件上运行
你可以尝试其他的 —— 但最好坚持官方要求以获得最佳体验。
> 关于第三方工具的说明
你可以尝试其他的 - 但最好坚持官方要求以获得最佳体验
> 如果你碰巧在某个项目中使用了任何第三方工具,那么必须单独检查它们是否支持
关于第三方工具的说明
### 如何在 Linux 上安装 Unity 编辑器
如果你碰巧在任何项目中使用了任何第三方工具,那么必须单独检查它们是否支持。
现在你已经了解了,那么该如何安装?
### 如何在 Linux 上安装Unity 编辑器
现在你已经了解了它,那么该如何安装?
To install Unity, you will have to download and install the [Unity Hub][4].
要安装 Unity你需要下载并安装 [Unity Hub][4]。
![Unity Hub][5]
我们将引导你完成以下步骤:
* 从[官方论坛页面][4]下载适用于 Linux 的 Unity Hub。
  * 它将下载一个 AppImage 文件。简单地说,让它可执行并运行它。如果你不了解它,你应该查看关于[如何在 Linux 上使用 AppImage][6] 的指南。
  * 启动 Unity Hub 后,它会要求你使用 Unity ID 登录(或注册)以激活许可证。有关许可证生效的更多信息,请参阅他们的 [FAQ 页面][7]。
  * 使用 Unity ID 登录后,进入“**安装**”选项(如上图所示)并添加所需的版本/组件。
你需要完成以下步骤:
* 从[官方论坛页面][4]下载适用于 Linux 的 Unity Hub。
* 它将下载一个 AppImage 文件。简单地说,让它可执行并运行它。如果你不了解,你应该查看关于[如何在 Linux 上使用 AppImage][6] 的指南。
* 启动 Unity Hub 后,它会要求你使用 Unity ID 登录(或注册)以激活许可证。有关许可证生效的更多信息,请参阅他们的 [FAQ 页面][7]。
* 使用 Unity ID 登录后,进入 “Installs” 选项(如上图所示)并添加所需的版本/组件。
就是这些了。这就是获取并快速安装的最佳方法。
**总结**
### 总结
即使这是一个令人兴奋的消息,但官方配置支持似乎并不广泛。如果你在 Linux 上使用它,请在[他们的 Linux 论坛帖子][9]上分享你的反馈和意见。
@ -77,7 +73,7 @@ via: https://itsfoss.com/unity-editor-linux/
作者:[Ankush Das][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/) 荣誉推出

View File

@ -0,0 +1,68 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10973-1.html)
[#]: subject: (5 reasons to use Kubernetes)
[#]: via: (https://opensource.com/article/19/6/reasons-kubernetes)
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
使用 Kubernetes 的 5 个理由
======
> Kubernetes 解决了一些开发和运维团队每天关注的的常见问题。
![](https://img.linux.net.cn/data/attachment/album/201906/14/110657gk2jz6f6kqff2kk4.jpg)
[Kubernetes][2]K8S是面向企业的开源容器编排工具的事实标准。它提供了应用部署、扩展、容器管理和其他功能使企业能够通过容错能力快速优化硬件资源利用率并延长生产环境运行时间。该项目最初由谷歌开发并将该项目捐赠给[云原生计算基金会][3]CNCF。2018 年,它成为第一个从 CNCF [毕业][4]的项目。
这一切都很好,但它并不能解释为什么开发者和运维人员应该在 Kubernetes 上投入宝贵的时间和精力。Kubernetes 之所以如此有用,是因为它有助于开发者和运维人员迅速解决他们每天都在努力解决的问题。
以下是 Kubernetes 帮助开发者和运维人员解决他们最常见问题的五种能力。
### 1、厂商无关
许多公有云提供商不仅提供托管 Kubernetes 服务还提供许多基于这些服务构建的云产品来用于本地应用容器编排。由于与供应商无关使运营商能够轻松、安全地设计、构建和管理多云和混合云平台而不会有供应商锁定的风险。Kubernetes 还消除了运维团队对复杂的多云/混合云战略的担忧。
### 2、服务发现
为了开发微服务应用Java 开发人员必须控制服务可用性就应用是否可以提供服务而言并确保服务持续存在以响应客户端的请求而没有任何例外。Kubernetes 的[服务发现功能][5]意味着开发人员不再需要自己管理这些东西。
### 3、触发
你的 DevOps 会如何在上千台虚拟机上部署多语言、云原生应用?理想情况下,开发和运维会在 bug 修复、功能增强、新功能、安全更新时触发部署。Kubernetes 的[部署功能][6]会自动化这个日常工作。更重要的时,它支持高级部署策略,例如[蓝绿部署和金丝雀部署][7]。
### 4、可伸缩性
自动扩展是处理云环境中大量工作负载所需的关键功能。通过构建容器平台,你可以为终端用户提高系统可靠性。[Kubernetes Horizontal Pod Autoscaler][8]HPA允许一个集群增加或减少应用程序或 Pod的数量以应对峰值流量或性能峰值从而减少对意外系统中断的担忧。
### 5、容错性
在现代应用体系结构中应考虑故障处理代码来控制意外错误并快速从中恢复。但是开发人员需要花费大量的时间和精力来模拟偶然的错误。Kubernetes 的 [ReplicaSet][9] 通过确保指定数量的 Pod 持续保持活动来帮助开发人员解决此问题。
### 结论
Kubernetes 使企业能够轻松、快速、安全地解决常见的开发和运维问题。它还提供其他好处,例如构建无缝的多云/混合云战略,节省基础架构成本以及加快产品上市时间。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/6/reasons-kubernetes
作者:[Daniel Oh][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/daniel-oh
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_wheel_gear_devops_kubernetes.png?itok=xm4a74Kv
[2]: https://opensource.com/resources/what-is-kubernetes
[3]: https://www.cncf.io/projects/
[4]: https://www.cncf.io/blog/2018/03/06/kubernetes-first-cncf-project-graduate/
[5]: https://kubernetes.io/docs/concepts/services-networking/service/
[6]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
[7]: https://opensource.com/article/17/5/colorful-deployments
[8]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
[9]: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/

View File

@ -1,3 +1,4 @@
Translating by Robsean
How To Resize Active/Primary root Partition Using GParted Utility
======
Today we are going to discuss about disk partition. Its one of the best topics in Linux. This allow users to resize the active root partition in Linux.

View File

@ -1,187 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (GoAccess A Real-Time Web Server Log Analyzer And Interactive Viewer)
[#]: via: (https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/)
[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/)
GoAccess A Real-Time Web Server Log Analyzer And Interactive Viewer
======
Analyzing a log file is a big headache for Linux administrators as its capturing a lot of things.
Most of the newbies and L1 administrators doesnt know how to analyze this.
If you have good knowledge to analyze a logs then you will be a legend for NIX system.
There are many tools available in Linux to analyze the logs easily.
GoAccess is one of the tool which allow users to analyze web server logs easily.
We will be going to discuss in details about GoAccess tool in this article.
### What is GoAccess?
GoAccess is a real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser.
GoAccess has minimal requirements, its written in C and requires only ncurses.
It will support Apache, Nginx and Lighttpd logs. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly.
GoAccess parses the specified web log file and outputs the data to the X terminal and browser.
GoAccess was designed to be a fast, terminal-based log analyzer. Its core idea is to quickly analyze and view web server statistics in real time without needing to use your browser.
Terminal output is the default output, it has the capability to generate a complete, self-contained, real-time HTML report, as well as a JSON, and CSV report.
GoAccess allows any custom log format and the following (Combined Log Format (XLF/ELF) Apache | Nginx & Common Log Format (CLF) Apache) predefined log format options are included, but not limited to.
### GoAccess Features
* **`Completely Real Time:`** All the metrics are updated every 200 ms on the terminal and every second on the HTML output.
* **`Track Application Response Time:`** Track the time taken to serve the request. Extremely useful if you want to track pages that are slowing down your site.
* **`Visitors:`** Determine the amount of hits, visitors, bandwidth, and metrics for slowest running requests by the hour, or date.
* **`Metrics per Virtual Host:`** Have multiple Virtual Hosts (Server Blocks)? It features a panel that displays which virtual host is consuming most of the web server resources.
### How to Install GoAccess?
I would advise users to install GoAccess from distribution official repository with help of Package Manager. It is available in most of the distributions official repository.
As we know, we will be getting bit outdated package for standard release distribution and rolling release distributions always include latest package.
If you are running the OS with standard release distributions, i would suggest you to check the alternative options such as PPA or Official GoAccess maintainer repository, etc, to get a latest package.
For **`Debian/Ubuntu`** systems, use **[APT-GET Command][1]** or **[APT Command][2]** to install GoAccess on your systems.
```
# apt install goaccess
```
To get a latest GoAccess package, use the below GoAccess official repository.
```
$ echo "deb https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
$ wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install goaccess
```
For **`RHEL/CentOS`** systems, use **[YUM Package Manager][3]** to install GoAccess on your systems.
```
# yum install goaccess
```
For **`Fedora`** system, use **[DNF Package Manager][4]** to install GoAccess on your system.
```
# dnf install goaccess
```
For **`ArchLinux/Manjaro`** based systems, use **[Pacman Package Manager][5]** to install GoAccess on your systems.
```
# pacman -S goaccess
```
For **`openSUSE Leap`** system, use **[Zypper Package Manager][6]** to install GoAccess on your system.
```
# zypper install goaccess
# zypper ar -f obs://server:http
# zypper ref && zypper in goaccess
```
### How to Use GoAccess?
After successful installation of GoAccess. Just enter the goaccess command and followed by the web server log location to view it.
```
# goaccess [options] /path/to/Web Server/access.log
# goaccess /var/log/apache/2daygeek_access.log
```
When you execute the above command, it will ask you to select the **Log Format Configuration**.
![][8]
I had tested this with Apache access log. The Apache log is splitted in fifteen section. The details are below. The main section shows the summary about the fifteen section.
The below screenshots included four sessions such as Unique Visitors, Requested files, Static Requests, Not found URLs.
![][9]
The below screenshots included four sessions such as Visitor Hostnames and IPs, Operating Systems, Browsers, Time Distribution.
![][10]
The below screenshots included four sessions such as Referrers URLs, Referring Sites, Googles search engine results, HTTP status codes.
![][11]
If you would like to generate a html report, use the following format.
Initially i got an error when i was trying to generate the html report.
```
# goaccess 2daygeek_access.log -a > report.html
GoAccess - version 1.3 - Nov 23 2018 11:28:19
Config file: No config file used
Fatal error has occurred
Error occurred at: src/parser.c - parse_log - 2764
No time format was found on your conf file.Parsing... [0] [0/s]
```
It says “No time format was found on your conf file”. To overcome this issue, add the “COMBINED” log format option on it.
```
# goaccess -f 2daygeek_access.log --log-format=COMBINED -o 2daygeek.html
Parsing...[0,165] [50,165/s]
```
![][12]
GoAccess allows you to access and analyze the real-time log filtering and parsing.
```
# tail -f /var/log/apache/2daygeek_access.log | goaccess -
```
For more details navigate to man or help page.
```
# man goaccess
or
# goaccess --help
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer/
作者:[Vinoth 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]: https://www.2daygeek.com/author/vinoth/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
[2]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
[3]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
[5]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
[7]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[8]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-1.png
[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-2.png
[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-3.png
[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-4.png
[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/goaccess-a-real-time-web-server-log-analyzer-and-interactive-viewer-5.png

View File

@ -0,0 +1,174 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (I don't know how CPUs work so I simulated one in code)
[#]: via: (https://djhworld.github.io/post/2019/05/21/i-dont-know-how-cpus-work-so-i-simulated-one-in-code/)
[#]: author: (daniel harper https://djhworld.github.io)
I don't know how CPUs work so I simulated one in code
======
![][1]
A few months ago it dawned on me that I didnt really understand how computers work under the hood. I still dont understand how modern computers work.
However, after making my way through [But How Do It Know?][2] by J. Clark Scott, a book which describes the bits of a simple 8-bit computer from the NAND gates, through to the registers, RAM, bits of the CPU, ALU and I/O, I got a hankering to implement it in code.
While Im not that interested in the physics of the circuitry, the book just about skims the surface of those waters and gives a neat overview of the wiring and how bits move around the system without the requisite electrical engineering knowledge. For me though I cant get comfortable with book descriptions, I have to see things in action and learn from my inevitable mistakes, which led me to chart a course on the rough seas of writing a circuit in code and getting a bit weepy about it.
The fruits of my voyage can be seen in [simple-computer][3]; a simple computer thats simple and computes things.
[![][4]][5] [![][6]][7] [![][8]][9]
Example programs
It is quite a neat little thing, the CPU code is implemented [as a horrific splurge of gates turning on and off][10] but it works, Ive [unit tested it][11], and we all know unit tests are irrefutable proof that something works.
It handles [keyboard inputs][12], and renders text [to a display][13] using a painstakingly crafted set of glyphs for a professional font Ive named “Daniel Code Pro”. The only cheat bit is to get the keyboard input and display output working I had to hook up go channels to speak to the outside world via [GLFW][14], but the rest of it is a simulated circuit.
I even wrote a [crude assembler][15] which was eye opening to say the least. Its not perfect. Actually its a bit crap, but it highlighted to me the problems that other people have already solved many, many years ago and I think Im a better person for it. Or worse, depending who you ask.
### But why you do that?
> “Ive seen thirteen year old children do this in Minecraft, come back to me when youve built a REAL CPU out of telegraph relays”
My mental model of computing is stuck in beginner computer science textbooks, and the CPU that powers the [gameboy emulator I wrote back in 2013][16] is really nothing like the CPUs that are running today. Even saying that, the emulator is just a state machine, it doesnt describe the stuff at the logic gate level. You can implement most of it using just a `switch` statement and storing the state of the registers.
So Im trying to get a better understanding of this stuff because I dont know what L1/L2 caches are, I dont know what pipelining means, Im not entirely sure I understand the Meltdown and Spectre vulnerability papers. Someone told me they were optimising their code to make use of CPU caches, I dont know how to verify that other than taking their word for it. Im not really sure what all the x86 instructions mean. I dont understand how people off-load work to a GPU or TPU. I dont know what a TPU is. I dont know how to make use of SIMD instructions.
But all that is built on a foundation of knowledge you need to earn your stripes for, so I aint gonna get there without reading the map first. Which means getting back to basics and getting my hands dirty with something simple. The “Scott Computer” described in the book is simple. Thats the reason.
### Great Scott! Its alive!
The Scott computer is an 8-bit processor attached to 256 bytes of RAM, all connected via an 8-bit system bus. It has 4 general purpose registers and can execute [17 machine instructions][17]. Someone built a visual simulator [for the web here][18], which is really cool, I dread to think how long it took to track all the wiring states!
[![][19]][20]
A diagram outlining all the components that make up the Scott CPU
Copyright © 2009 - 2016 by Siegbert Filbinger and John Clark Scott.
The book takes you on a journey from the humble NAND gate, onto a Bit of memory, onto a register and then keeps layering on components until you end up with something resembling the above. I really recommend reading it, even if you are already familiar with the concepts because its quite a good overview. I dont recommend the Kindle version though because the diagrams are sometimes hard to zoom in and decipher on a screen. A perennial problem for the Kindle in my experience.
The only thing thats different about my computer is I upgraded it to 16-bit to have more memory to play with, as storing even just the glyphs for the [ASCII table][21] would have dwarfed most of the 8-bit machine described in the book, with not much room left for useful code.
### My development journey
During development it really was just a case of reading the text, scouring the diagrams and then attempting to translate that using a general purpose programming language code and definitely not using something thats designed for integrated circuit development. The reason why I wrote it in Go, is well, I know a bit of Go. Naysayers might chime in and say, you blithering idiot! I cant believe you didnt spend all your time learning [VHDL][22] or [Verilog][23] or [LogSim][24] or whatever but Id already written my bits and bytes and NANDs by that point, I was in too deep. Maybe Ill learn them next and weep about my time wasted, but thats my cross to bear.
In the grand scheme of things most of the computer is just passing around a bunch of booleans, so any boolean friendly language will do the job.
Applying a schema to those booleans is what helps you (the programmer) derive its meaning, and the biggest decision anyone needs to make is decide what [endianness][25] your system is going to use and make sure all the components transfer things to and from the bus in the right order.
This was an absolute pain in the backside to implement. From the offset I opted for little endian but when testing the ALU my hair took a beating trying to work out why the numbers were coming out wrong. Many, many print statements took place on this one.
Development did take a while, maybe about a month or two during some of my free time, but once the CPU was done and successfully able to execute 2 + 2 = 5, I was happy.
Well, until the book discussed the I/O features, with designs for a simple keyboard and display interface so you can get things in and out of the machine. Well Ive already gotten this far, no point in leaving it in a half finished state. I set myself a goal of being able to type something on a keyboard and render the letters on a display.
### Peripherals
The peripherals use the [adapter pattern][26] to act as a hardware interface between the CPU and the outside world. Its probably not a huge leap to guess this was what the software design pattern took inspiration from.
![][27]
How the I/O adapters connect to a GLFW window
With this separation of concerns it was actually pretty simple to hook the other end of the keyboard and display to a window managed by GLFW. In fact I just pulled most of the code from my [emulator][28] and reshaped it a bit, using go channels to act as the signals in and out of the machine.
### Bringing it to life
![][29]
This was probably the most tricky part, or at least the most cumbersome. Writing assembly with such a limited instruction set sucks. Writing assembly using a crude assembler I wrote sucks even more because you cant shake your fist at someone other than yourself.
The biggest problem was juggling the 4 registers and keeping track of them, pulling and putting stuff in memory as a temporary store. Whilst doing this I remembered the Gameboy CPU having a stack pointer register so you could push and pop state. Unfortunately this computer doesnt have such a luxury, so I was mostly moving stuff in and out of memory on a bespoke basis.
The only pseudo instruction I took the time to implement was `CALL` to help calling functions, this allows you to run a function and then return to the point after the function was called. Without that stack though you can only call one level deep.
Also as the machine does not support interrupts, you have to implement awful polling code for functions like getting keyboard state. The book does discuss the steps needed to implement interrupts, but it would involve a lot more wiring.
But anyway enough of the moaning, I ended up writing [four programs][30] and most of them make use of some shared code for drawing fonts, getting keyboard input etc. Not exactly operating system material but it did make me appreciate some of the services a simple operating system might provide.
It wasnt easy though, the trickiest part of the text-writer program was getting the maths right to work out when to go to a newline, or what happens when you hit the enter key.
```
main-getInput:
CALL ROUTINE-io-pollKeyboard
CALL ROUTINE-io-drawFontCharacter
JMP main-getInput
```
The main loop for the text-writer program
I didnt get round to implementing the backspace key either, or any of the modifier keys. Made me appreciate how much work must go in to making text editors and how tedious that probably is.
### On reflection
This was a fun and very rewarding project for me. In the midst of programming in the assembly language Id largely forgotten about the NAND, AND and OR gates firing underneath. Id ascended into the layers of abstraction above.
While the CPU in the is very simple and a long way from whats sitting in my laptop, I think this project has taught me a lot, namely:
* How bits move around between all components using a bus
* How a simple ALU works
* What a simple Fetch-Decode-Execute cycle looks like
* That a machine without a stack pointer register + concept of a stack sucks
* That a machine without interrupts sucks
* What an assembler is and does
* How a peripherals communicate with a simple CPU
* How simple fonts work and an approach to rendering them on a display
* What a simple operating system might start to look like
So whats next? The book said that no-one has built a computer like this since 1952, meaning Ive got 67 years of material to brush up on, so that should keep me occupied for a while. I see the [x86 manual is 4800 pages long][31], enough for some fun, light reading at bedtime.
Maybe Ill have a brief dalliance with operating system stuff, a flirtation with the C language, a regrettable evening attempting to [solder up a PiDP-11 kit][32] then probably call it quits. I dunno, well see.
With all seriousness though I think Im going to start looking into RISC based stuff next, maybe RISC-V, but probably start with early RISC processors to get an understanding of the lineage. Modern CPUs have a lot more features like caches and stuff so I want to understand them as well. A lot of stuff out there to learn.
Do I need to know any of this stuff in my day job? Probably helps, but not really, but Im enjoying it, so whatever, thanks for reading xxxx
--------------------------------------------------------------------------------
via: https://djhworld.github.io/post/2019/05/21/i-dont-know-how-cpus-work-so-i-simulated-one-in-code/
作者:[daniel harper][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://djhworld.github.io
[b]: https://github.com/lujun9972
[1]: https://djhworld.github.io/img/simple-computer/text-writer.gif (Hello World)
[2]: http://buthowdoitknow.com/
[3]: https://github.com/djhworld/simple-computer
[4]: https://djhworld.github.io/img/simple-computer/ascii1.png (ASCII)
[5]: https://djhworld.github.io/img/simple-computer/ascii.png
[6]: https://djhworld.github.io/img/simple-computer/brush1.png (brush)
[7]: https://djhworld.github.io/img/simple-computer/brush.png
[8]: https://djhworld.github.io/img/simple-computer/text-writer1.png (doing the typesin')
[9]: https://djhworld.github.io/img/simple-computer/text-writer.png
[10]: https://github.com/djhworld/simple-computer/blob/master/cpu/cpu.go#L763
[11]: https://github.com/djhworld/simple-computer/blob/master/cpu/cpu_test.go
[12]: https://github.com/djhworld/simple-computer/blob/master/io/keyboard.go#L20
[13]: https://github.com/djhworld/simple-computer/blob/master/io/display.go#L13
[14]: https://github.com/djhworld/simple-computer/blob/master/cmd/simulator/glfw_io.go
[15]: https://github.com/djhworld/simple-computer/blob/master/asm/assembler.go
[16]: https://github.com/djhworld/gomeboycolor
[17]: https://github.com/djhworld/simple-computer#instructions
[18]: http://www.buthowdoitknow.com/but_how_do_it_know_cpu_model.html
[19]: https://djhworld.github.io/img/simple-computer/scott-cpu.png (The Scott CPU)
[20]: https://djhworld.github.io/img/simple-computer/scott-cpu.png
[21]: https://github.com/djhworld/simple-computer/blob/master/_programs/ascii.asm#L27
[22]: https://en.wikipedia.org/wiki/VHDL
[23]: https://en.wikipedia.org/wiki/Verilog
[24]: http://www.cburch.com/logisim/
[25]: https://en.wikipedia.org/wiki/Endianness
[26]: https://en.wikipedia.org/wiki/Adapter_pattern
[27]: https://djhworld.github.io/img/simple-computer/io.png (i couldn't be bothered to do the corners around the CPU for the system bus)
[28]: https://github.com/djhworld/gomeboycolor-glfw
[29]: https://djhworld.github.io/img/simple-computer/brush.gif (brush.bin)
[30]: https://github.com/djhworld/simple-computer/blob/master/_programs/README.md
[31]: https://software.intel.com/sites/default/files/managed/39/c5/325462-sdm-vol-1-2abcd-3abcd.pdf
[32]: https://obsolescence.wixsite.com/obsolescence/pidp-11

View File

@ -1,67 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 reasons to use Kubernetes)
[#]: via: (https://opensource.com/article/19/6/reasons-kubernetes)
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
5 reasons to use Kubernetes
======
Kubernetes solves some of the most common problems development and
operations teams see every day.
![][1]
[Kubernetes][2] is the de facto open source container orchestration tool for enterprises. It provides application deployment, scaling, container management, and other capabilities, and it enables enterprises to optimize hardware resource utilization and increase production uptime through fault-tolerant functionality at speed. The project was initially developed by Google, which donated the project to the [Cloud-Native Computing Foundation][3]. In 2018, it became the first CNCF project to [graduate][4].
This is all well and good, but it doesn't explain why development and operations should invest their valuable time and effort in Kubernetes. The reason Kubernetes is so useful is that it helps dev and ops quickly solve the problems they struggle with every day.
Following are five ways Kubernetes' capabilities help dev and ops professionals address their most common problems.
### 1\. Vendor-agnostic
Many public cloud providers not only serve managed Kubernetes services but also lots of cloud products built on top of those services for on-premises application container orchestration. Being vendor-agnostic enables operators to design, build, and manage multi-cloud and hybrid cloud platforms easily and safely without risk of vendor lock-in. Kubernetes also eliminates the ops team's worries about a complex multi/hybrid cloud strategy.
### 2\. Service discovery
To develop microservices applications, Java developers must control service availability (in terms of whether the application is ready to serve a function) and ensure the service continues living, without any exceptions, in response to the client's requests. Kubernetes' [service discovery feature][5] means developers don't have to manage these things on their own anymore.
### 3\. Invocation
How would your DevOps initiative deploy polyglot, cloud-native apps over thousands of virtual machines? Ideally, dev and ops could trigger deployments for bug fixes, function enhancements, new features, and security patches. Kubernetes' [deployment feature][6] automates this daily work. More importantly, it enables advanced deployment strategies, such as [blue-green and canary][7] deployments.
### 4\. Elasticity
Autoscaling is the key capability needed to handle massive workloads in cloud environments. By building a container platform, you can increase system reliability for end users. [Kubernetes Horizontal Pod Autoscaler][8] (HPA) allows a cluster to increase or decrease the number of applications (or Pods) to deal with peak traffic or performance spikes, reducing concerns about unexpected system outages.
### 5\. Resilience
In a modern application architecture, failure-handling codes should be considered to control unexpected errors and recover from them quickly. But it takes a lot of time and effort for developers to simulate all the occasional errors. Kubernetes' [ReplicaSet][9] helps developers solve this problem by ensuring a specified number of Pods are kept alive continuously.
### Conclusion
Kubernetes enables enterprises to solve common dev and ops problems easily, quickly, and safely. It also provides other benefits, such as building a seamless multi/hybrid cloud strategy, saving infrastructure costs, and speeding time to market.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/6/reasons-kubernetes
作者:[Daniel Oh][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/daniel-oh
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_wheel_gear_devops_kubernetes.png?itok=xm4a74Kv
[2]: https://opensource.com/resources/what-is-kubernetes
[3]: https://www.cncf.io/projects/
[4]: https://www.cncf.io/blog/2018/03/06/kubernetes-first-cncf-project-graduate/
[5]: https://kubernetes.io/docs/concepts/services-networking/service/
[6]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
[7]: https://opensource.com/article/17/5/colorful-deployments
[8]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
[9]: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/

View File

@ -0,0 +1,76 @@
[#]: collector: (lujun9972)
[#]: translator: (murphyzhao)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Applications for writing Markdown)
[#]: via: (https://fedoramagazine.org/applications-for-writing-markdown/)
[#]: author: (Ryan Lerch https://fedoramagazine.org/author/ryanlerch/)
Applications for writing Markdown
======
![][1]
Markdown is a lightweight markup language that is useful for adding formatting while still maintaining readability when viewing as plain text. Markdown (and Markdown derivatives) are used extensively as the priumary form of markup of documents on services like GitHub and pagure. By design, Markdown is easily created and edited in a text editor, however, there are a multitude of editors available that provide a formatted preview of Markdown markup, and / or provide a text editor that highlights the markdown syntax.
This article covers 3 desktop applications for Fedora Workstation that help out when editing Markdown.
### UberWriter
[UberWriter][2] is a minimal Markdown editor and previewer that allows you to edit in text, and preview the rendered document.
![][3]
The editor itself has inline previews built in, so text marked up as bold is displayed bold. The editor also provides inline previews for images, formulas, footnotes, and more. Ctrl-clicking one of these items in the markup provides an instant preview of that element to appear.
In addition to the editor features, UberWriter also features a full screen mode and a focus mode to help minimise distractions. Focus mode greys out all but the current paragraph to help you focus on that element in your document
Install UberWriter on Fedora from the 3rd-party Flathub repositories. It can be installed directly from the Software application after [setting up your system to install from Flathub][4]
### Marker
Marker is a Markdown editor that provides a simple text editor to write Markdown in, and provides a live preview of the rendered document. The interface is designed with a split screen layout with the editor on the left, and the live preview on the right.
![][5]
Additionally, Marker allows you to export you document in a range of different formats, including HTML, PDF, and the Open Document Format (ODF).
Install Marker on Fedora from the 3rd-party Flathub repositories. It can be installed directly from the Software application after [setting up your system to install from Flathub][4]
### Ghostwriter
Where the previous editors are more focussed on a minimal user experice, Ghostwriter provides many more features and options to play with. Ghostwriter provides a text editor that is partially styled as you write in Markdown format. Bold text is bold, and headings are in a larger font to assist in writing the markup.
![][6]
It also provides a split screen with a live updating preview of the rendered document.
![][7]
Ghostwriter also includes a range of other features, including the ability to choose the Markdown flavour that the preview is rendered in, as well as the stylesheet used to render the preview too.
Additionally, it provides a format menu (and keyboard shortcuts) to insert some of the frequent markdown tags like bold, bullets, and italics.
Install Ghostwriter on Fedora from the 3rd-party Flathub repositories. It can be installed directly from the Software application after [setting up your system to install from Flathub][4]
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/applications-for-writing-markdown/
作者:[Ryan Lerch][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://fedoramagazine.org/author/ryanlerch/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/markdownapps.png-816x345.jpg
[2]: https://uberwriter.github.io/uberwriter/#1
[3]: https://fedoramagazine.org/wp-content/uploads/2019/06/uberwriter-editor-1.png
[4]: https://fedoramagazine.org/install-flathub-apps-fedora/
[5]: https://fedoramagazine.org/wp-content/uploads/2019/06/marker-screenshot-1024x500.png
[6]: https://fedoramagazine.org/wp-content/uploads/2019/06/ghostwriter-1024x732.png
[7]: https://fedoramagazine.org/wp-content/uploads/2019/06/ghostwriter2-1024x566.png

View File

@ -1,157 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Expand And Unexpand Commands Tutorial With Examples)
[#]: via: (https://www.ostechnix.com/expand-and-unexpand-commands-tutorial-with-examples/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Expand And Unexpand Commands Tutorial With Examples
======
![Expand And Unexpand Commands Explained][1]
This guide explains two Linux commands namely **Expand** and **Unexpand** with practical examples. For those wondering, the Expand and Unexpand commands are used to replace TAB characters in files with SPACE characters and vice versa. There is also a command called “Expand” in MS-DOS, which is used to expand a compressed file. But the Linux Expand command simply converts the tabs to spaces. These two commands are part of **GNU coreutils** and written by **David MacKenzie**.
For the demonstration purpose, I will be using a text file named “ostechnix.txt” throughout this guide. All commands given below are tested in Arch Linux.
### Expand command examples
Like I already mentioned, the Expand command replaces TAB characters in a file with SPACE characters.
Now, let us convert tabs to spaces in the ostechnix.txt file and write the result to standard output using command:
```
$ expand ostechnix.txt
```
If you dont want to display the result in standard output, just upload it to another file like below.
```
$ expand ostechnix.txt>output.txt
```
We can also convert tabs to spaces, reading from standard input. To do so, just run “expand” command without mentioning the source file name:
```
$ expand
```
Just type the text and hit ENTER to convert tabs to spaces. Press **CTRL+C** to quit.
If you do not want to convert tabs after non blanks, use **-i** flag like below.
```
$ expand -i ostechnix.txt
```
We can also have tabs a certain number of characters apart, not 8 (the default value):
```
$ expand -t=5 ostechnix.txt
```
You can even mention multiple tab positions with comma separated like below.
```
$ expand -t 5,10,15 ostechnix.txt
```
Or,
```
$ expand -t "5 10 15" ostechnix.txt
```
For more details, refer man pages.
```
$ man expand
```
### Unexpand Command Examples
As you may have already guessed, the **Unexpand** command will do the opposite of the Expand command. I.e It will convert SPACE charatcers to TAB characters. Let me show you a few examples to learn how to use Unexpand command.
To convert blanks (spaces, of course) in a file to tabs and write the output to stdout, do:
```
$ unexpand ostechnix.txt
```
If you want to write the output in a file instead of just displaying it to stdout, use this command:
```
$ unexpand ostechnix.txt>output.txt
```
Convert blanks to tabs, reading from standard output:
```
$ unexpand
```
By default, Unexpand command will only convert the initial blanks. If you want to convert all blanks, instead of just initial blanks, use **-a** flag:
```
$ unexpand -a ostechnix.txt
```
To convert only leading sequences of blanks (Please note that it overrides **-a** ):
```
$ unexpand --first-only ostechnix.txt
```
Have tabs a certain number of characters apart, not **8** (enables **-a** ):
```
$ unexpand -t 5 ostechnix.txt
```
Similarly, we can mention multiple tab positions with comma separated like below.
```
$ unexpand -t 5,10,15 ostechnix.txt
```
Or,
```
$ unexpand -t "5 10 15" ostechnix.txt
```
For more details, refer man pages.
```
$ man unexpand
```
* * *
**Suggested read:**
* [**The Fold Command Tutorial With Examples For Beginners**][2]
* * *
When you working on large number of files, the Expand and Unexpand commands could be very helpful to replace unwanted TAB characters with SPACE characters and vice versa.
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/expand-and-unexpand-commands-tutorial-with-examples/
作者:[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/wp-content/uploads/2019/05/Expand-And-Unexpand-Commands-720x340.png
[2]: https://www.ostechnix.com/fold-command-tutorial-examples-beginners/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (murphyzhao)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,46 +1,46 @@
Translanting by robsean
BootISO A Simple Bash Script To Securely Create A Bootable USB Device From ISO File
BootISO 一个简单的 Bash 脚本来安全地从 ISO 文件中创建一个可启动的 USB 设备
======
Most of us (including me) very often create a bootable USB device from ISO file for OS installation.
为操作系统安装,我们中的大多数人(包括我)非常经常地从 ISO 文件中创建一个可启动的 USB 设备。
There are many applications freely available in Linux for this purpose. Even we wrote few of the utility in the past.
为达到这个目的,在 Linux 中有很多自由可用的应用程序。甚至在过去我们写了几个实用程序。
Every one uses different application and each application has their own features and functionality.
每个人使用不同的应用程序,每个应用程序有它们自己的特色和功能。
In that few of applications are belongs to CLI and few of them associated with GUI.
在这些应用程序中,一些应用程序属于 CLI ,一些应用程序与 GUI 关联。
Today we are going to discuss about similar kind of utility called BootISO. Its a simple bash script, which allow users to create a USB device from ISO file.
今天,我们将讨论相同类型的称为 BootISO 的实用程序。它是一个简单的 bash 脚本,允许用户来从 ISO 文件中创建一个可启动的 USB 设备。
Many of the Linux admin uses dd command to create bootable ISO, which is one of the native and famous method but the same time, its one of the very dangerous command. So, be careful, when you performing any action with dd command.
很多 Linux 管理员使用 dd 命令开创建可启动的 ISO ,它是一个本地的且著名的方法,但是与此同时,它也是一个非常危险的命令。因此,小心,当你执行一些带有 dd 命令的动作。
**Suggested Read :**
**(#)** [Etcher Easy way to Create a bootable USB drive & SD card from an ISO image][1]
**(#)** [Create a bootable USB drive from an ISO image using dd command on Linux][2]
**建议阅读:**
**(#)** [Etcher 简单的方法来从一个 ISO 镜像中创建一个可启动的 USB 驱动器 & SD 卡][1]
### What IS BootISO
**(#)** [在 Linux 上使用 dd 命令来从一个 ISO 镜像中创建一个可启动的 USB 驱动器][2]
[BootIOS][3] is a simple bash script, which allow users to securely create a bootable USB device from one ISO file. Its written in bash.
### BootISO 是什么
It doesnt offer any GUI but in the same time it has vast of options, which allow newbies to create a bootable USB device in Linux without any issues. Since its a intelligent tool that automatically choose if any USB device is connected on the system.
[BootIOS][3] 是一个简单的 bash 脚本,允许用户来安全的从一个 ISO 文件中创建一个可启动的 USB 设备,它是用 bash 编写的。
It will print the list when the system has more than one USB device connected. When you choose manually another hard disk manually instead of USB, this will safely exit without writing anything on it.
它不提供任何图形用户界面,但是与此同时,它有大量的选项,允许初学者在 Linux 上来创建一个可启动的 USB 设备,而没有任何问题。因为它是一个智能工具,自动地选择是否一些 USB 设备被连接到系统上。
This script will also check for dependencies and prompt user for installation, it works with all package managers such as apt-get, yum, dnf, pacman and zypper.
当系统有多个 USB 设备连接,它将打印列表。当你手动选择另一个硬盘而不是 USB ,在这种情况下,它将安全地退出,而不在硬盘上写任何东西。
### BootISO Features
这个脚本也将检查依赖关系,并提示用户安装,它与所有的软件包管理器一起工作,例如 apt-getyumdnfpacman 和 zypper。
* It checks whether the selected ISO has the correct mime-type or not. If no then it exit.
* BootISO will exit automatically, if you selected any other disks (local hard drive) except USB drives.
* BootISO allow users to select the desired USB drives when you have more than one.
* BootISO prompts the user for confirmation before erasing and paritioning USB device.
* BootISO will handle any failure from a command properly and exit.
* BootISO will call a cleanup routine on exit with trap.
### BootISO 特色
* 它检查选择的 ISO 是否是正确的 mime 类型。如果不是,那么退出。.
* 如果你选择除 USB 设备以外的任何其它的磁盘(本地硬盘)BootISO 将自动地退出。
* 当你有多个驱动器时BootISO 允许用户选择想要的 USB 驱动器。
* 在擦除和分区 USB 设备前BootISO 提示用户确认。
* BootISO 将正确地处理来自一个命令的任何失灵,并退出。
* BootISO 在退出陷阱时将调用一个清理例行程序。
### How To Install BootISO In Linux
### 如果在 Linux 中安装 BootISO
There are few ways are available to install BootISO in Linux but i would advise users to install using the following method.
在 Linux 中安装 BootISO 有几个可用的方法,但是,我建议用户使用下面的方法安装。
```
$ curl -L https://git.io/bootiso -O
$ chmod +x bootiso
@ -48,7 +48,7 @@ $ sudo mv bootiso /usr/local/bin/
```
Once BootISO installed, run the following command to list the available USB devices.
一旦 BootISO 已经安装,运行下面的命令来列出可用的 USB 设备。
```
$ bootiso -l
@ -58,7 +58,7 @@ sdd 1 32G running disk
```
If you have only one USB device, then simple run the following command to create a bootable USB device from ISO file.
如果你仅有一个 USB 设备,那么简单地运行下面的命令来从一个 ISO 文件中创建一个可启动的 USB 设备。
```
$ bootiso /path/to/iso file
@ -85,37 +85,37 @@ You can safely remove it !
```
Mention your device name, when you have more than one USB device using `--device` option.
提到你的设备名称,当你有多个 USB 设备时,使用 `--device` 选项。
```
$ bootiso -d /dev/sde /opt/iso_images/archlinux-2018.05.01-x86_64.iso
```
By default bootios uses `rsync` command to perform all the action and if you want to use `dd` command instead of, use the following format.
默认情况下BootISO 使用 `rsync` 命令来执行所有的动作,如果你想使用 `dd` 命令代替它,使用下面的格式。
```
$ bootiso --dd -d /dev/sde /opt/iso_images/archlinux-2018.05.01-x86_64.iso
```
If you want to skip `mime-type` check, include the following option with bootios utility.
如果你想跳过 `mime-type` 检查BootISO 实用程序带有下面的选项。
```
$ bootiso --no-mime-check -d /dev/sde /opt/iso_images/archlinux-2018.05.01-x86_64.iso
```
Add the below option with bootios to skip user for confirmation before erasing and partitioning USB device.
为 BootISO 添加下面的选项来跳过在擦除和分区 USB 设备前的用户确认。
```
$ bootiso -y -d /dev/sde /opt/iso_images/archlinux-2018.05.01-x86_64.iso
```
Enable autoselecting USB devices in conjunction with -y option.
连同 -y 选项一起,启用自动选择 USB 设备。
```
$ bootiso -y -a /opt/iso_images/archlinux-2018.05.01-x86_64.iso
```
To know more all the available option for bootiso, run the following command.
为知道更多全部可用的 BootISO 选项,运行下面的命令。
```
$ bootiso -h
Create a bootable USB from any ISO securely.
@ -162,7 +162,7 @@ via: https://www.2daygeek.com/bootiso-a-simple-bash-script-to-securely-create-a-
作者:[Prakash Subramanian][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -7,15 +7,16 @@
[#]: via: (https://blog.hoetzel.info/post/eshell-notifications/)
[#]: author: (Jürgen Hötzel https://blog.hoetzel.info)
Get desktop notifications from Emacs shell commands ·
让 Emacs shell 命令发送桌面通知
======
When interacting with the operating systems I always use [Eshell][1] because it integrates seamlessly with Emacs, supports (remote) [TRAMP][2] file names and also works nice on Windows.
After starting shell commands (like long running build jobs) I often lose track the task when switching buffers.
我总是使用 [Eshell][1] 来与操作系统进行交互,因为它与 Emacs 无缝整合、支持处理 (远程) [TRAMP][2] 文件 而且在 Windows 上也能工作得很好。
Thanks to Emacs [hooks][3] mechanism you can customize Emacs to call a elisp function when an external command finishes.
启动 shell 命令后 (比如耗时严重的构建任务) 我经常会由于切换 buffer 而忘了追踪任务的运行状态。
I use [John Wiegleys][4] excellent [alert][5] package to send desktop notifications:
多亏了 Emacs 的 [hooks][3] 机制,你可以配置 Emacs 在某个外部命令完成后调用一个 elisp 函数。
我使用 [John Wiegleys][4] 所编写的超棒的 [alert][5] 包来发送桌面通知:
```
(require 'alert)
@ -32,7 +33,7 @@ I use [John Wiegleys][4] excellent [alert][5] package to send desktop notificati
(add-hook 'eshell-kill-hook #'eshell-command-alert)
```
[alert][5] rules can be setup programmatically. In my case I only want to get notified if the corresponding buffer is not visible:
[alert][5] 的规则可以用程序来设置。就我这个情况来看,我只需要当对应的 buffer 不可见时被通知:
```
(alert-add-rule :status '(buried) ;only send alert when buffer not visible
@ -40,9 +41,10 @@ I use [John Wiegleys][4] excellent [alert][5] package to send desktop notificati
:style 'notifications)
```
This even works on [TRAMP][2] buffers. Below is a screenshot showing a Gnome desktop notification of a failed `make` command.
![../../img/eshell.png][6]
这甚至对于 [TRAMP][2] 也一样生效。下面这个截屏展示了失败的 `make` 命令产生的 Gnome 桌面通知。
![。./。./img/eshell.png][6]
--------------------------------------------------------------------------------

View File

@ -0,0 +1,148 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Expand And Unexpand Commands Tutorial With Examples)
[#]: via: (https://www.ostechnix.com/expand-and-unexpand-commands-tutorial-with-examples/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
expand 与 unexpand 命令教程与示例
======
![Expand And Unexpand Commands Explained][1]
本指南通过实际的例子解释两个 Linux 命令,即 **expand****unexpand**。对于好奇的人expand 和 unexpand 命令用于将文件中的 TAB 字符替换为空格,反之亦然。在 MS-DOS 中也有一个名为 “expand” 的命令,它用于解压压缩文件。但 Linux expand 命令只是将 tab 转换为空格。这两个命令是 **GNU coreutils** 的一部分,由 **David MacKenzie** 编写。
为了演示,我将在本文使用名为 “ostechnix.txt” 的文本文件。下面给出的所有命令都在 Arch Linux 中进行测试。
### expand 命令示例
与我之前提到的一样expand 命令使用空格替换文件中的 TAB 字符。
现在让我们将ostechnix.txt 中的 tab 转换为空格,并将结果写入标准输出:
```
$ expand ostechnix.txt
```
如果你不想在标准输出中显示结果,只需将其写入另一个文件,如下所示。
```
$ expand ostechnix.txt>output.txt
```
我们还可以将标准输入中的 tab 转换为空格。为此,只需运行 “expand” 命令而不带文件名:
```
$ expand
```
只需输入文本并按回车键就能将 tab 转换为空格。按 **CTRL+C** 退出。
如果你不想在非空白符后转换 tab请使用 **-i** 标记,如下所示。
```
$ expand -i ostechnix.txt
```
我们还可以设置每个 tab 为指定数字的宽度,而不是 8默认值
```
$ expand -t=5 ostechnix.txt
```
我们甚至可以使用逗号分隔指定多个 tab 位置,如下所示
```
$ expand -t 5,10,15 ostechnix.txt
```
或者,
```
$ expand -t "5 10 15" ostechnix.txt
```
有关更多详细信息,请参阅手册页。
```
$ man expand
```
### unexpand 命令示例
正如你可能已经猜到的那样,**unexpand** 命令将执行与 expand 命令相反的操作。即它会将空格转换为 TAB。让我向你展示一些例子以了解如何使用 unexpand 命令。
要将文件中的空白(当然是空格)转换为 tab 并将输出写入标准输出,请执行以下操作:
```
$ unexpand ostechnix.txt
```
如果要将输出写入文件而不是仅将其显示到标准输出,请使用以下命令:
```
$ unexpand ostechnix.txt>output.txt
```
从标准输出读取内容,将空格转换为制表符:
```
$ unexpand
```
默认情况下unexpand 命令仅转换初始的空格。如果你想转换所有空格而不是只是初始空格,请使用 **-a** 标志:
```
$ unexpand -a ostechnix.txt
```
仅转换开头的空白(请注意它会覆盖 **-a**
```
$ unexpand --first-only ostechnix.txt
```
使多少个空格替换成一个 tab而不是 **8**(启用 **-a**
```
$ unexpand -t 5 ostechnix.txt
```
相似地我们可以使用逗号分隔指定多个tab的位置。
```
$ unexpand -t 5,10,15 ostechnix.txt
```
或者,
```
$ unexpand -t "5 10 15" ostechnix.txt
```
有关更多详细信息,请参阅手册页。
```
$ man unexpand
```
在处理大量文件时expand 和 unexpand 命令对于用空格替换不需要的 TAB 时非常有用,反之亦然。
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/expand-and-unexpand-commands-tutorial-with-examples/
作者:[sk][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者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/wp-content/uploads/2019/05/Expand-And-Unexpand-Commands-720x340.png