mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
commit
35627a9c3d
@ -1,55 +1,51 @@
|
||||
[#]: collector: (Chao-zhi)
|
||||
[#]: translator: (Chao-zhi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13154-1.html)
|
||||
[#]: subject: (LaTeX typesetting,Part 3: formatting)
|
||||
[#]: via: (https://fedoramagazine.org/latex-typesetting-part-3-formatting/)
|
||||
[#]: author: (Earl Ramirez https://fedoramagazine.org/author/earlramirez/)
|
||||
|
||||
|
||||
LaTeX 排版 (3):排版
|
||||
LaTeX 排版(3):排版
|
||||
======
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/latex-series-redux-1536x650.jpg)
|
||||
![](https://img.linux.net.cn/data/attachment/album/202102/26/113031wattha0hojj4f4ej.png)
|
||||
|
||||
本[系列 ][1] 介绍了 LaTeX 中的基本格式。[第 1 部分 ][2] 介绍了列表。[第 2 部分 ][3] 阐述了表格。在第 3 部分中,您将了解 LaTeX 的另一个重要特性:细腻灵活的文档排版。本文介绍如何自定义页面布局、目录、标题部分和页面样式。
|
||||
本 [系列][1] 介绍了 LaTeX 中的基本格式。[第 1 部分][2] 介绍了列表。[第 2 部分][3] 阐述了表格。在第 3 部分中,你将了解 LaTeX 的另一个重要特性:细腻灵活的文档排版。本文介绍如何自定义页面布局、目录、标题部分和页面样式。
|
||||
|
||||
### 页面维度
|
||||
|
||||
当您第一次编写 LaTeX 文档时,您可能已经注意到默认边距比您想象的要大一些。页边距与指定的纸张类型有关,例如 A4、letter 和 documentclass(article、book、report) 等等。要修改页边距,有几个选项,最简单的选项之一是使用 [fullpage][4] 包。
|
||||
当你第一次编写 LaTeX 文档时,你可能已经注意到默认边距比你想象的要大一些。页边距与指定的纸张类型有关,例如 A4、letter 和 documentclass(article、book、report) 等等。要修改页边距,有几个选项,最简单的选项之一是使用 [fullpage][4] 包。
|
||||
|
||||
> 该软件包设置页面的主体,可以使主体几乎占满整个页面。
|
||||
>
|
||||
> ——FULLPAGE PACKAGE DOCUMENTATION
|
||||
> —— FULLPAGE PACKAGE DOCUMENTATION
|
||||
|
||||
下图演示了使用 fullpage 包和没有使用的区别。
|
||||
<!-- 但是原文中并没有这个图 -->
|
||||
|
||||
另一个选择是使用 [geometry][5] 包。在探索 geometry 包如何操纵页边距之前,请首先查看如下所示的页面尺寸。
|
||||
另一个选择是使用 [geometry][5] 包。在探索 `geometry` 包如何操纵页边距之前,请首先查看如下所示的页面尺寸。
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image.png)
|
||||
|
||||
1。1 英寸 + \hoffset
|
||||
2。1 英寸 + \voffset
|
||||
3。\oddsidemargin = 31pt
|
||||
4。\topmargin = 20pt
|
||||
5。\headheight = 12pt
|
||||
6。\headsep = 25pt
|
||||
7。\textheight = 592pt
|
||||
8。\textwidth = 390pt
|
||||
9。\marginparsep = 35pt
|
||||
10。\marginparwidth = 35pt
|
||||
11。\footskip = 30pt
|
||||
1. 1 英寸 + `\hoffset`
|
||||
2. 1 英寸 + `\voffset`
|
||||
3. `\oddsidemargin` = 31pt
|
||||
4. `\topmargin` = 20pt
|
||||
5. `\headheight` = 12pt
|
||||
6. `\headsep` = 25pt
|
||||
7. `\textheight` = 592pt
|
||||
8. `\textwidth` = 390pt
|
||||
9. `\marginparsep` = 35pt
|
||||
10. `\marginparwidth` = 35pt
|
||||
11. `\footskip` = 30pt
|
||||
|
||||
要使用 geometry 包将边距设置为 1 英寸,请使用以下示例
|
||||
要使用 `geometry` 包将边距设置为 1 英寸,请使用以下示例
|
||||
|
||||
```
|
||||
\usepackage{geometry}
|
||||
\geometry{a4paper, margin=1in}
|
||||
```
|
||||
|
||||
除上述示例外,geometry 命令还可以修改纸张尺寸和方向。要更改纸张尺寸,请使用以下示例:
|
||||
除上述示例外,`geometry` 命令还可以修改纸张尺寸和方向。要更改纸张尺寸,请使用以下示例:
|
||||
|
||||
```
|
||||
\usepackage[a4paper, total={7in, 8in}]{geometry}
|
||||
@ -57,7 +53,7 @@ LaTeX 排版 (3):排版
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image-2-1024x287.png)
|
||||
|
||||
要更改页面方向,需要将横向添加到 geometery 选项中,如下所示:
|
||||
要更改页面方向,需要将横向(`landscape`)添加到 `geometery` 选项中,如下所示:
|
||||
|
||||
```
|
||||
\usepackage{geometery}
|
||||
@ -68,9 +64,9 @@ LaTeX 排版 (3):排版
|
||||
|
||||
### 目录
|
||||
|
||||
默认情况下,目录的标题为 “contents”。有时,您更想将标题改为 “Table of Content”,更改目录和章节第一节之间的垂直间距,或者只更改文本的颜色。
|
||||
默认情况下,目录的标题为 “contents”。有时,你想将标题更改为 “Table of Content”,更改目录和章节第一节之间的垂直间距,或者只更改文本的颜色。
|
||||
|
||||
若要更改文本,请在导言区中添加以下行,用所需语言替换英语:
|
||||
若要更改文本,请在导言区中添加以下行,用所需语言替换英语(`english`):
|
||||
|
||||
```
|
||||
\usepackage[english]{babel}
|
||||
@ -78,11 +74,12 @@ LaTeX 排版 (3):排版
|
||||
\renewcommand{\contentsname}
|
||||
{\bfseries{Table of Contents}}}
|
||||
```
|
||||
要操纵目录与图,小节和章节列表之间的虚拟间距,请使用 tocloft 软件包。本文中使用的两个选项是 cftbeforesecskip 和 cftaftertoctitleskip。
|
||||
|
||||
要操纵目录与图、小节和章节列表之间的虚拟间距,请使用 `tocloft` 软件包。本文中使用的两个选项是 `cftbeforesecskip` 和 `cftaftertoctitleskip`。
|
||||
|
||||
> tocloft 包提供了控制目录、图表列表和表格列表的排版方法。
|
||||
>
|
||||
> ——TOCLOFT PACKAGE DOUCMENTATION
|
||||
> —— TOCLOFT PACKAGE DOUCMENTATION
|
||||
|
||||
```
|
||||
\usepackage{tocloft}
|
||||
@ -91,10 +88,12 @@ LaTeX 排版 (3):排版
|
||||
```
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image-3.png)
|
||||
默认目录
|
||||
|
||||
*默认目录*
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image-4.png)
|
||||
定制目录
|
||||
|
||||
*定制目录*
|
||||
|
||||
### 边框
|
||||
|
||||
@ -102,14 +101,14 @@ LaTeX 排版 (3):排版
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image-5.png)
|
||||
|
||||
要删除这些边框,请在导言区中包括以下内容,您将看到目录中没有任何边框。
|
||||
要删除这些边框,请在导言区中包括以下内容,你将看到目录中没有任何边框。
|
||||
|
||||
```
|
||||
\usepackage{hyperref}
|
||||
\hypersetup{ pdfborder = {0 0 0}}
|
||||
```
|
||||
|
||||
要修改标题部分的字体、样式或颜色,请使用程序包 [titlesec][7]。在本例中,您将更改节、子节和子节的字体大小、字体样式和字体颜色。首先,在导言区中增加以下内容。
|
||||
要修改标题部分的字体、样式或颜色,请使用程序包 [titlesec][7]。在本例中,你将更改节、子节和三级子节的字体大小、字体样式和字体颜色。首先,在导言区中增加以下内容。
|
||||
|
||||
```
|
||||
\usepackage{titlesec}
|
||||
@ -118,7 +117,7 @@ LaTeX 排版 (3):排版
|
||||
\titleformat*{\subsubsection}{\Large\bfseries\color{darkblue}}
|
||||
```
|
||||
|
||||
仔细看看代码,`\titleformat*{\section}` 指定要使用的节的深度。上面的示例最多使用第三个深度。`{\Huge\bfseries\color{darkblue}}` 部分指定字体大小、字体样式和字体颜色
|
||||
仔细看看代码,`\titleformat*{\section}` 指定要使用的节的深度。上面的示例最多使用第三个深度。`{\Huge\bfseries\color{darkblue}}` 部分指定字体大小、字体样式和字体颜色。
|
||||
|
||||
### 页面样式
|
||||
|
||||
@ -138,13 +137,16 @@ LaTeX 排版 (3):排版
|
||||
\renewcommand{\headrulewidth}{2pt} % add header horizontal line
|
||||
\renewcommand{\footrulewidth}{1pt} % add footer horizontal line
|
||||
```
|
||||
结果如下所示
|
||||
|
||||
结果如下所示:
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image-7.png)
|
||||
页眉
|
||||
|
||||
*页眉*
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image-8.png)
|
||||
页脚
|
||||
|
||||
*页脚*
|
||||
|
||||
### 小贴士
|
||||
|
||||
@ -231,13 +233,13 @@ $ cat article_structure.tex
|
||||
%\pagenumbering{roman}
|
||||
```
|
||||
|
||||
在您的文章中,请参考以下示例中所示的方法引用 `structure.tex` 文件:
|
||||
在你的文章中,请参考以下示例中所示的方法引用 `structure.tex` 文件:
|
||||
|
||||
```
|
||||
\documentclass[a4paper,11pt]{article}
|
||||
\input{/path_to_structure.tex}}
|
||||
\begin{document}
|
||||
…...
|
||||
......
|
||||
\end{document}
|
||||
```
|
||||
|
||||
@ -250,11 +252,12 @@ $ cat article_structure.tex
|
||||
\SetWatermarkText{\color{red}Classified} %add watermark text
|
||||
\SetWatermarkScale{4} %specify the size of the text
|
||||
```
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2020/07/image-10.png)
|
||||
|
||||
### 结论
|
||||
|
||||
在本系列中,您了解了 LaTeX 提供的一些基本但丰富的功能,这些功能可用于自定义文档以满足您的需要或将文档呈现给的受众。LaTeX 海洋中,还有许多软件包需要大家自行去探索。
|
||||
在本系列中,你了解了 LaTeX 提供的一些基本但丰富的功能,这些功能可用于自定义文档以满足你的需要或将文档呈现给的受众。LaTeX 海洋中,还有许多软件包需要大家自行去探索。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -263,15 +266,15 @@ via: https://fedoramagazine.org/latex-typesetting-part-3-formatting/
|
||||
作者:[Earl Ramirez][a]
|
||||
选题:[Chao-zhi][b]
|
||||
译者:[Chao-zhi](https://github.com/Chao-zhi)
|
||||
校对:[校对者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/earlramirez/
|
||||
[b]: https://github.com/Chao-zhi
|
||||
[1]:https://fedoramagazine.org/tag/latex/
|
||||
[2]:https://fedoramagazine.org/latex-typesetting-part-1/
|
||||
[3]:https://fedoramagazine.org/latex-typesetting-part-2-tables/
|
||||
[2]:https://linux.cn/article-13112-1.html
|
||||
[3]:https://linux.cn/article-13146-1.html
|
||||
[4]:https://www.ctan.org/pkg/fullpage
|
||||
[5]:https://www.ctan.org/geometry
|
||||
[6]:https://www.ctan.org/pkg/hyperref
|
150
published/20201103 How the Kubernetes scheduler works.md
Normal file
150
published/20201103 How the Kubernetes scheduler works.md
Normal file
@ -0,0 +1,150 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MZqk)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13155-1.html)
|
||||
[#]: subject: (How the Kubernetes scheduler works)
|
||||
[#]: via: (https://opensource.com/article/20/11/kubernetes-scheduler)
|
||||
[#]: author: (Mike Calizo https://opensource.com/users/mcalizo)
|
||||
|
||||
Kubernetes 调度器是如何工作的
|
||||
=====
|
||||
|
||||
> 了解 Kubernetes 调度器是如何发现新的吊舱并将其分配到节点。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202102/26/123446popgvrc0vppptvtk.jpg)
|
||||
|
||||
[Kubernetes][2] 已经成为容器和容器化工作负载的标准编排引擎。它提供一个跨公有云和私有云环境的通用和开源的抽象层。
|
||||
|
||||
对于那些已经熟悉 Kuberbetes 及其组件的人,他们的讨论通常围绕着如何尽量发挥 Kuberbetes 的功能。但当你刚刚开始学习 Kubernetes 时,尝试在生产环境中使用前,明智的做法是从一些关于 Kubernetes 相关组件(包括 [Kubernetes 调度器][3]) 开始学习,如下抽象视图中所示:
|
||||
|
||||
![][4]
|
||||
|
||||
Kubernetes 也分为控制平面和工作节点:
|
||||
|
||||
1. **控制平面:** 也称为主控,负责对集群做出全局决策,以及检测和响应集群事件。控制平面组件包括:
|
||||
* etcd
|
||||
* kube-apiserver
|
||||
* kube-controller-manager
|
||||
* 调度器
|
||||
2. **工作节点:** 也称节点,这些节点是工作负载所在的位置。它始终和主控联系,以获取工作负载运行所需的信息,并与集群外部进行通讯和连接。工作节点组件包括:
|
||||
* kubelet
|
||||
* kube-proxy
|
||||
* CRI
|
||||
|
||||
我希望这个背景信息可以帮助你理解 Kubernetes 组件是如何关联在一起的。
|
||||
|
||||
### Kubernetes 调度器是如何工作的
|
||||
|
||||
Kubernetes <ruby>[吊舱][5]<rt>pod</rt></ruby> 由一个或多个容器组成组成,共享存储和网络资源。Kubernetes 调度器的任务是确保每个吊舱分配到一个节点上运行。
|
||||
|
||||
(LCTT 译注:容器技术领域大量使用了航海比喻,pod 一词,意为“豆荚”,在航海领域指“吊舱” —— 均指盛装多个物品的容器。常不翻译,考虑前后文,可译做“吊舱”。)
|
||||
|
||||
在更高层面下,Kubernetes 调度器的工作方式是这样的:
|
||||
|
||||
1. 每个需要被调度的吊舱都需要加入到队列
|
||||
2. 新的吊舱被创建后,它们也会加入到队列
|
||||
3. 调度器持续地从队列中取出吊舱并对其进行调度
|
||||
|
||||
[调度器源码][6](`scheduler.go`)很大,约 9000 行,且相当复杂,但解决了重要问题:
|
||||
|
||||
#### 等待/监视吊舱创建的代码
|
||||
|
||||
监视吊舱创建的代码始于 `scheduler.go` 的 8970 行,它持续等待新的吊舱:
|
||||
|
||||
```
|
||||
// Run begins watching and scheduling. It waits for cache to be synced, then starts a goroutine and returns immediately.
|
||||
|
||||
func (sched *Scheduler) Run() {
|
||||
if !sched.config.WaitForCacheSync() {
|
||||
return
|
||||
}
|
||||
|
||||
go wait.Until(sched.scheduleOne, 0, sched.config.StopEverything)
|
||||
```
|
||||
|
||||
#### 负责对吊舱进行排队的代码
|
||||
|
||||
负责对吊舱进行排队的功能是:
|
||||
|
||||
```
|
||||
// queue for pods that need scheduling
|
||||
podQueue *cache.FIFO
|
||||
```
|
||||
|
||||
负责对吊舱进行排队的代码始于 `scheduler.go` 的 7360 行。当事件处理程序触发,表明新的吊舱显示可用时,这段代码将新的吊舱加入队列中:
|
||||
|
||||
```
|
||||
func (f *ConfigFactory) getNextPod() *v1.Pod {
|
||||
for {
|
||||
pod := cache.Pop(f.podQueue).(*v1.Pod)
|
||||
if f.ResponsibleForPod(pod) {
|
||||
glog.V(4).Infof("About to try and schedule pod %v", pod.Name)
|
||||
return pod
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 处理错误代码
|
||||
|
||||
在吊舱调度中不可避免会遇到调度错误。以下代码是处理调度程序错误的方法。它监听 `podInformer` 然后抛出一个错误,提示此吊舱尚未调度并被终止:
|
||||
|
||||
```
|
||||
// scheduled pod cache
|
||||
podInformer.Informer().AddEventHandler(
|
||||
cache.FilteringResourceEventHandler{
|
||||
FilterFunc: func(obj interface{}) bool {
|
||||
switch t := obj.(type) {
|
||||
case *v1.Pod:
|
||||
return assignedNonTerminatedPod(t)
|
||||
default:
|
||||
runtime.HandleError(fmt.Errorf("unable to handle object in %T: %T", c, obj))
|
||||
return false
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
换句话说,Kubernetes 调度器负责如下:
|
||||
|
||||
* 将新创建的吊舱调度至具有足够空间的节点上,以满足吊舱的资源需求。
|
||||
* 监听 kube-apiserver 和控制器是否创建新的吊舱,然后调度它至集群内一个可用的节点。
|
||||
* 监听未调度的吊舱,并使用 `/binding` 子资源 API 将吊舱绑定至节点。
|
||||
|
||||
例如,假设正在部署一个需要 1 GB 内存和双核 CPU 的应用。因此创建应用吊舱的节点上需有足够资源可用,然后调度器会持续运行监听是否有吊舱需要调度。
|
||||
|
||||
### 了解更多
|
||||
|
||||
要使 Kubernetes 集群工作,你需要使以上所有组件一起同步运行。调度器有一段复杂的的代码,但 Kubernetes 是一个很棒的软件,目前它仍是我们在讨论或采用云原生应用程序时的首选。
|
||||
|
||||
学习 Kubernetes 需要精力和时间,但是将其作为你的专业技能之一能为你的职业生涯带来优势和回报。有很多很好的学习资源可供使用,而且 [官方文档][7] 也很棒。如果你有兴趣了解更多,建议从以下内容开始:
|
||||
|
||||
* [Kubernetes the hard way][8]
|
||||
* [Kubernetes the hard way on bare metal][9]
|
||||
* [Kubernetes the hard way on AWS][10]
|
||||
|
||||
你喜欢的 Kubernetes 学习方法是什么?请在评论中分享吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/kubernetes-scheduler
|
||||
|
||||
作者:[Mike Calizo][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MZqk](https://github.com/MZqk)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mcalizo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software)
|
||||
[2]: https://kubernetes.io/
|
||||
[3]: https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/
|
||||
[4]: https://lh4.googleusercontent.com/egB0SSsAglwrZeWpIgX7MDF6u12oxujfoyY6uIPa8WLqeVHb8TYY_how57B4iqByELxvitaH6-zjAh795wxAB8zenOwoz2YSMIFRqHsMWD9ohvUTc3fNLCzo30r7lUynIHqcQIwmtRo
|
||||
[5]: https://kubernetes.io/docs/concepts/workloads/pods/
|
||||
[6]: https://github.com/kubernetes/kubernetes/blob/e4551d50e57c089aab6f67333412d3ca64bc09ae/plugin/pkg/scheduler/scheduler.go
|
||||
[7]: https://kubernetes.io/docs/home/
|
||||
[8]: https://github.com/kelseyhightower/kubernetes-the-hard-way
|
||||
[9]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-BareMetal.md
|
||||
[10]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-AWS.md
|
@ -0,0 +1,95 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (amorsu)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13157-1.html)
|
||||
[#]: subject: (4 reasons to choose Linux for art and design)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-art-design)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
选择 Linux 来做艺术设计的 4 个理由
|
||||
======
|
||||
|
||||
> 开源会强化你的创造力。因为它把你带出专有的思维定势,开阔你的视野,从而带来更多的可能性。让我们探索一些开源的创意项目。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202102/27/135654k1x4um187i1i7wm1.jpg)
|
||||
|
||||
2021 年,人们比以前的任何时候都更有理由来爱上 Linux。在这个系列,我会分享 21 个选择 Linux 的原因。今天,让我来解释一下,为什么 Linux 是艺术设计的绝佳选择。
|
||||
|
||||
Linux 在服务器和云计算方面获得很多的赞誉。让不少人感到惊讶的是,Linux 刚好也有一系列的很棒的创意设计工具,并且这些工具在用户体验和质量方面可以媲美那些流行的创意设计工具。我第一次使用开源的设计工具时,并不是因为我没有其他工具可以选择。相反的,我是在接触了大量的这些领先的公司提供的专有设计工具后,才开始使用开源设计工具。我之所以最后选择开源设计工具是因为开源更有意义,而且我能获得更好的产出。这些都是一些笼统的说法,所以请允许我解释一下。
|
||||
|
||||
### 高可用性意味着高生产力
|
||||
|
||||
“生产力”这一次对于不同的人来说含义不一样。当我想到生产力,就是当你坐下来做事情,并能够完成你给自己设定的所有任务的时候,这时就很有成就感。但是当你总是被一些你无法掌控的事情打断,那你的生产力就下降了。
|
||||
|
||||
计算机看起来是不可预测的,诚然有很多事情会出错。电脑是由很多的硬件组成的,它们任何一个都有可能在任何时间出问题。软件会有 bug,也有修复这些 bug 的更新,而更新后又会带来新的 bug。如果你对电脑不了解,它可能就像一个定时炸弹,等着爆发。带着数字世界里的这么多的潜在问题,去接受一个当某些条件不满足(比如许可证,或者订阅费)就会不工作的软件,对我来说就显得很不理智。
|
||||
|
||||
![Inkscape 应用][2]
|
||||
|
||||
开源的创意设计应用不需要订阅费,也不需要许可证。在你需要的时候,它们都能获取得到,并且通常都是跨平台的。这就意味着,当你坐在工作的电脑面前,你就能确定你能用到那些必需的软件。而如果某天你很忙碌,却发现你面前的电脑不工作了,解决办法就是找到一个能工作的,安装你的创意设计软件,然后开始工作。
|
||||
|
||||
例如,要找到一台无法运行 Inkscape 的电脑,比找到一台可以运行那些专有软件的电脑要难得多。这就叫做高可用。这是游戏规则的改变者。我从来不曾遇到因为软件用不了而不得不干等,浪费我数小时时间的事情。
|
||||
|
||||
### 开放访问更有利于多样性
|
||||
|
||||
我在设计行业工作的时候,我的很多同事都是通过自学的方式来学习艺术和技术方面的知识,这让我感到惊讶。有的通过使用那些最新的昂贵的“专业”软件来自学,但总有一大群人是通过使用自由和开源的软件来完善他们的数字化的职业技能。因为,对于孩子,或者没钱的大学生来说,这才是他们能负担的起,而且很容易就能获得的。
|
||||
|
||||
这是一种不同的高可用性,但这对我和许多其他用户来说很重要,如果不是因为开源,他们就不会从事创意行业。即使那些有提供付费订阅的开源项目,比如 Ardour,都能确保他的用户在不需要支付任何费用的时候也能使用软件。
|
||||
|
||||
![Ardour 界面][4]
|
||||
|
||||
当你不限制别人用你的软件的时候,你其实拥有了更多的潜在用户。如果你这样做了,那么你就开放了一个接收多样的创意声音的窗口。艺术钟爱影响力,你可以借鉴的经验和想法越多就越好。这就是开源设计软件所带来的可能性。
|
||||
|
||||
### 文件格式支持更具包容性
|
||||
|
||||
我们都知道在几乎所有行业里面包容性的价值。在各种意义上,邀请更多的人到派对可以造就更壮观的场面。知道这一点,当看到有的项目或者创新公司只邀请某些人去合作,只接受某些文件格式,就让我感到很痛苦。这看起来很陈旧,就像某个远古时代的精英主义的遗迹,而这是即使在今天都在发生的真实问题。
|
||||
|
||||
令人惊讶和不幸的是,这不是因为技术上的限制。专有软件可以访问开源的文件格式,因为这些格式是开源的,而且可以自由地集成到各种应用里面。集成这些格式不需要任何回报。而相比之下,专有的文件格式被笼罩在秘密之中,只被限制于提供给几个愿意付钱的人使用。这很糟糕,而且常常,你无法在没有这些专有软件的情况下打开一些文件来获取你的数据。令人惊喜的是,开源的设计软件却是尽力的支持更多的专有文件格式。以下是一些 Inkscape 所支持的令人难以置信的列表样本:
|
||||
|
||||
![可用的 Inkscape 文件格式][5]
|
||||
|
||||
而这大部分都是在没有这些专有格式厂商的支持下开发出来的。
|
||||
|
||||
支持开放的文件格式可以更包容,对所有人都更好。
|
||||
|
||||
### 对新的创意没有限制
|
||||
|
||||
我之所以爱上开源的其中一个原因是,解决一个指定任务时,有彻底的多样性。当你在专有软件周围时,你所看到的世界是基于你所能够获取得到的东西。比如说,你过你打算处理一些照片,你通常会把你的意图局限在你所知道的可能性上面。你从你的架子上的 4 款或 10 款应用中,挑选出 3 款,因为它们是目前你唯一能够获取得到的选项。
|
||||
|
||||
在开源领域,你通常会有好几个“显而易见的”必备解决方案,但同时你还有一打的角逐者在边缘转悠,供你选择。这些选项有时只是半成品,或者它们超级专注于某项任务,又或者它们学起来有点挑战性,但最主要的是,它们是独特的,而且充满创新的。有时候,它们是被某些不按“套路”出牌的人所开发的,因此处理的方法和市场上现有的产品截然不同。其他时候,它们是被那些熟悉做事情的“正确”方式,但还是在尝试不同策略的人所开发的。这就像是一个充满可能性的巨大的动态的头脑风暴。
|
||||
|
||||
这种类型的日常创新能够引领出闪现的灵感、光辉时刻,或者影响广泛的通用性改进。比如说,著名的 GIMP 滤镜,(用于从图像中移除项目并自动替换背景)是如此的受欢迎以至于后来被专有图片编辑软件商拿去“借鉴”。这是成功的一步,但是对于一个艺术家而言,个人的影响才是最关键的。我常感叹于新的 Linux 用户的创意,而我只是在技术展会上展示给他们一个简单的音频,或者视频滤镜,或者绘图应用。没有任何的指导,或者应用场景,从简单的交互中喷发出来的关于新的工具的主意,是令人兴奋和充满启发的,通过实验中一些简单的工具,一个全新的艺术系列可以轻而易举的浮现出来。
|
||||
|
||||
只要在适当的工具集都有的情况下,有很多方式来更有效的工作。虽然私有软件通常也不会反对更聪明的工作习惯的点子,专注于实现自动化任务让用户可以更轻松的工作,对他们也没有直接的收益。Linux 和开源软件就是很大程度专为 [自动化和编排][6] 而建的,而不只是服务器。像 [ImageMagick][7] 和 [GIMP 脚本][8] 这样的工具改变了我的处理图片的方式,包括批量处理方面和纯粹实验方面。
|
||||
|
||||
你永远不知道你可以创造什么,如果你有一个你从来想象不到会存在的工具的话。
|
||||
|
||||
### Linux 艺术家
|
||||
|
||||
这里有 [使用开源的艺术家社区][9],从 [photography][10] 到 [makers][11] 到 [musicians][12],还有更多更多。如果你想要创新,试试 Linux 吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-art-design
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[amorsu](https://github.com/amorsu)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen)
|
||||
[2]: https://opensource.com/sites/default/files/inkscape_0.jpg
|
||||
[3]: https://community.ardour.org/subscribe
|
||||
[4]: https://opensource.com/sites/default/files/ardour.jpg
|
||||
[5]: https://opensource.com/sites/default/files/formats.jpg
|
||||
[6]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[7]: https://opensource.com/life/16/6/fun-and-semi-useless-toys-linux#imagemagick
|
||||
[8]: https://opensource.com/article/21/1/gimp-scripting
|
||||
[9]: https://librearts.org
|
||||
[10]: https://pixls.us
|
||||
[11]: https://www.redhat.com/en/blog/channel/red-hat-open-studio
|
||||
[12]: https://linuxmusicians.com
|
@ -1,28 +1,28 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13158-1.html)
|
||||
[#]: subject: (Not Comfortable Using youtube-dl in Terminal? Use These GUI Apps)
|
||||
[#]: via: (https://itsfoss.com/youtube-dl-gui-apps/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
不习惯在终端使用 youtube-dl?使用这些 GUI 应用
|
||||
不习惯在终端使用 youtube-dl?可以使用这些 GUI 应用
|
||||
======
|
||||
|
||||
如果你一直在关注我们,可能已经知道 [youtube-dl 项目被 GitHub 暂时下架][1]以符合要求。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202102/27/143909m29a8m8kgkzmmskc.jpg)
|
||||
|
||||
考虑到它现在已经恢复并完全可以访问,可以说它并不是一个非法的工具。
|
||||
如果你一直在关注我们,可能已经知道 [youtube-dl 项目曾被 GitHub 暂时下架][1] 以合规。但它现在已经恢复并完全可以访问,可以说它并不是一个非法的工具。
|
||||
|
||||
它是一个非常有用的命令行工具,可以让你[从 YouTube][2] 和其他一些网站下载视频。使用 [youtube-dl][3] 并不复杂,但我明白使用命令来完成这种任务并不是每个人都喜欢的方式。
|
||||
它是一个非常有用的命令行工具,可以让你 [从 YouTube][2] 和其他一些网站下载视频。使用 [youtube-dl][3] 并不复杂,但我明白使用命令来完成这种任务并不是每个人都喜欢的方式。
|
||||
|
||||
好在有一些应用为 youtube-dl 工具提供了 GUI 前端。
|
||||
好在有一些应用为 `youtube-dl` 工具提供了 GUI 前端。
|
||||
|
||||
### 使用 youtube-dl GUI 应用的先决条件
|
||||
|
||||
在你尝试下面提到的一些选择之前,你可能需要在你的系统上安装 youtube-dl 和 [FFmpeg][4],才能够下载/选择不同的格式进行下载。
|
||||
在你尝试下面提到的一些选择之前,你可能需要在你的系统上安装 `youtube-dl` 和 [FFmpeg][4],才能够下载/选择不同的格式进行下载。
|
||||
|
||||
你可以按照我们的 [ffmpeg 使用完整指南][5]进行设置,并探索更多关于它的内容。
|
||||
你可以按照我们的 [ffmpeg 使用完整指南][5] 进行设置,并探索更多关于它的内容。
|
||||
|
||||
要安装 [youtube-dl][6],你可以在 Linux 终端输入以下命令:
|
||||
|
||||
@ -44,7 +44,7 @@ sudo chmod a+rx /usr/local/bin/youtube-dl
|
||||
|
||||
请注意,下面的列表没有特别的排名顺序。你可以根据你的要求选择。
|
||||
|
||||
#### 1\. AllTube Download
|
||||
#### 1、AllTube Download
|
||||
|
||||
![][8]
|
||||
|
||||
@ -52,9 +52,7 @@ sudo chmod a+rx /usr/local/bin/youtube-dl
|
||||
|
||||
* Web GUI
|
||||
* 开源
|
||||
* 自我托管选择
|
||||
|
||||
|
||||
* 可以自托管
|
||||
|
||||
AllTube 是一个开源的 web GUI,你可以通过 <https://alltubedownload.net/> 来访问。
|
||||
|
||||
@ -62,9 +60,9 @@ AllTube 是一个开源的 web GUI,你可以通过 <https://alltubedownload.ne
|
||||
|
||||
请注意,你不能使用这个工具提取视频的 MP3 文件,它只适用于视频。你可以通过他们的 [GitHub 页面][9]探索更多关于它的信息。
|
||||
|
||||
[AllTube Download Web GUI][10]
|
||||
- [AllTube Download Web GUI][10]
|
||||
|
||||
#### 2\. youtube-dl GUI
|
||||
#### 2、youtube-dl GUI
|
||||
|
||||
![][11]
|
||||
|
||||
@ -74,17 +72,15 @@ AllTube 是一个开源的 web GUI,你可以通过 <https://alltubedownload.ne
|
||||
* 显示预计下载大小
|
||||
* 有音频和视频下载选择
|
||||
|
||||
|
||||
|
||||
一个使用 electron 和 node.js 制作的有用的跨平台 GUI 应用。你可以很容易地下载音频和视频,以及选择各种可用的文件格式的选项。
|
||||
|
||||
如果你愿意的话,你还可以下载一个频道或播放列表的部分内容。特别是当你下载高质量的视频文件时,预计的下载大小绝对是非常方便的。
|
||||
|
||||
如上所述,它也适用于 Windows 和 MacOS。而且,你会在它的 [GitHub 发布][12]中得到一个适用于 Linux 的 AppImage 文件。
|
||||
|
||||
[Youtube-dl GUI][13]
|
||||
- [Youtube-dl GUI][13]
|
||||
|
||||
#### 3\. Videomass
|
||||
#### 3、Videomass
|
||||
|
||||
![][14]
|
||||
|
||||
@ -95,8 +91,6 @@ AllTube 是一个开源的 web GUI,你可以通过 <https://alltubedownload.ne
|
||||
* 支持多个 URL
|
||||
* 适用于也想使用 FFmpeg 的用户
|
||||
|
||||
|
||||
|
||||
如果你想从 YouTube 下载视频或音频,并将它们转换为你喜欢的格式,Videomass 可以是一个不错的选择。
|
||||
|
||||
要做到这点,你需要在你的系统上同时安装 youtube-dl 和 ffmpeg。你可以轻松的添加多个 URL 来下载,还可以根据自己的喜好设置输出目录。
|
||||
@ -107,9 +101,9 @@ AllTube 是一个开源的 web GUI,你可以通过 <https://alltubedownload.ne
|
||||
|
||||
它为 Ubuntu 用户提供了一个 PPA,为任何其他 Linux 发行版提供了一个 AppImage 文件。在它的 [Github 页面][16]探索更多信息。
|
||||
|
||||
[Videomass][17]
|
||||
- [Videomass][17]
|
||||
|
||||
#### 额外说明:Haruna Video Player
|
||||
#### 附送:Haruna Video Player
|
||||
|
||||
![][18]
|
||||
|
||||
@ -117,11 +111,9 @@ AllTube 是一个开源的 web GUI,你可以通过 <https://alltubedownload.ne
|
||||
|
||||
* 播放/流式传输 YouTube 视频
|
||||
|
||||
|
||||
|
||||
Haruna Video Player 原本是 [MPV][19] 的前端。虽然使用它不能下载 YouTube 视频,但可以通过 youtube-dl 观看/流式传输 YouTube 视频。
|
||||
|
||||
你可以在我们的[原始文章][20]中探索更多关于视频播放器的内容。
|
||||
你可以在我们的[文章][20]中探索更多关于视频播放器的内容。
|
||||
|
||||
### 总结
|
||||
|
||||
@ -129,8 +121,7 @@ Haruna Video Player 原本是 [MPV][19] 的前端。虽然使用它不能下载
|
||||
|
||||
[Tartube][21] 就是这样的一个选择,你可以尝试一下,但可能无法达到预期的效果。我用 Pop!_OS 和 Ubuntu MATE 20.04(全新安装)进行了测试。每次我尝试下载一些东西时,无论我怎么做都会失败(即使系统中安装了 youtube-dl 和 ffmpeg)。
|
||||
|
||||
|
||||
所以,我个人最喜欢的似乎是 web GUI([AllTube Download][9]),它不依赖于安装在你系统上的任何东西,也可以自我托管。
|
||||
所以,我个人最喜欢的似乎是 Web GUI([AllTube Download][9]),它不依赖于安装在你系统上的任何东西,也可以自托管。
|
||||
|
||||
如果我错过了你最喜欢的选择,请在评论中告诉我什么是最适合你的。
|
||||
|
||||
@ -141,7 +132,7 @@ via: https://itsfoss.com/youtube-dl-gui-apps/
|
||||
作者:[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/) 荣誉推出
|
||||
|
@ -1,128 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Set up a Linux cloud on bare metal)
|
||||
[#]: via: (https://opensource.com/article/21/1/cloud-image-virt-install)
|
||||
[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro)
|
||||
|
||||
Set up a Linux cloud on bare metal
|
||||
======
|
||||
Create cloud images with virt-install on Fedora.
|
||||
![Sky with clouds and grass][1]
|
||||
|
||||
Virtualization is one of the most used technologies. Fedora Linux uses [Cloud Base images][2] to create general-purpose virtual machines (VM), but there are many ways to set up Cloud Base images. Recently, the virt-install command-line tool for provisioning VMs added support for **cloud-init**, so it can now be used to configure and run a cloud image locally.
|
||||
|
||||
This article walks through how to set up a base Fedora cloud instance on bare metal. The same steps can be used with any raw or Qcow2 Cloud Base image.
|
||||
|
||||
### What is --cloud-init?
|
||||
|
||||
The **virt-install** command creates a KVM, Xen, or [LXC][3] guest using **libvirt**. The `--cloud-init` option uses a local file (called a **nocloud datasource**) so you don't need a network connection to create an image. The **nocloud** method derives user data and metadata for the guest from an iso9660 filesystem (an `.iso` file) during the first boot. When you use this option, **virt-install** generates a random (and temporary) password for the root user account, provides a serial console so you can log in and change your password, and then disables the `--cloud-init` option for subsequent boots.
|
||||
|
||||
### Set up a Fedora Cloud Base image
|
||||
|
||||
First, [download a Fedora Cloud Base (for OpenStack) image][2].
|
||||
|
||||
![Fedora Cloud website screenshot][4]
|
||||
|
||||
(Sumantro Mukherjee, [CC BY-SA 4.0][5])
|
||||
|
||||
Then install the **virt-install** command:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install virt-install`
|
||||
```
|
||||
|
||||
Once **virt-install** is installed and the Fedora Cloud Base image is downloaded, create a small YAML file named `cloudinit-user-data.yaml` to contain a few configuration lines that virt-install will use.
|
||||
|
||||
|
||||
```
|
||||
#cloud-config
|
||||
password: 'r00t'
|
||||
chpasswd: { expire: false }
|
||||
```
|
||||
|
||||
This simple cloud-config sets the password for the default **fedora** user. If you want to use a password that expires, you can set it to expire after logging in.
|
||||
|
||||
Create and boot the VM:
|
||||
|
||||
|
||||
```
|
||||
$ virt-install --name local-cloud18012709 \
|
||||
\--memory 2000 --noreboot \
|
||||
\--os-variant detect=on,name=fedora-unknown \
|
||||
\--cloud-init user-data="/home/r3zr/cloudinit-user-data.yaml" \
|
||||
\--disk=size=10,backing_store="/home/r3zr/Downloads/Fedora-Cloud-Base-33-1.2.x86_64.qcow2"
|
||||
```
|
||||
|
||||
In this example, `local-cloud18012709` is the name of the virtual machine, RAM is set to 2000MiB, disk size (the virtual hard drive) is set to 10GB, and `--cloud-init` and `backing_store` contain the absolute path to the YAML config file you created and the Qcow2 image you downloaded.
|
||||
|
||||
### Log in
|
||||
|
||||
After the image is created, you can log in with the username **fedora** and the password set in the YAML file (in my example, this is **r00t**, but you may have used something different). Change your password once you've logged in for the first time.
|
||||
|
||||
To power off your virtual machine, execute the `sudo poweroff` command, or press **Ctrl**+**]** on your keyboard.
|
||||
|
||||
### Start, stop, and kill VMs
|
||||
|
||||
The `virsh` command is used to start, stop, and kill VMs.
|
||||
|
||||
To start any VM that is running:
|
||||
|
||||
|
||||
```
|
||||
`$ virsh start <vm-name>`
|
||||
```
|
||||
|
||||
To stop any running VM:
|
||||
|
||||
|
||||
```
|
||||
`$ virsh shutdown <vm-name>`
|
||||
```
|
||||
|
||||
To list all VMs that are in a running state:
|
||||
|
||||
|
||||
```
|
||||
`$ virsh list`
|
||||
```
|
||||
|
||||
To destroy the VMs:
|
||||
|
||||
|
||||
```
|
||||
`$ virsh destroy <vm-name>`
|
||||
```
|
||||
|
||||
![Destroying a VM][6]
|
||||
|
||||
(Sumantro Mukherjee, [CC BY-SA 4.0][5])
|
||||
|
||||
### Fast and easy
|
||||
|
||||
The **virt-install** command combined with the `--cloud-init` option makes it fast and easy to create cloud-ready images without worrying about whether you have a cloud to run them on yet. Whether you're preparing for a a major deployment or just learning about containers, give `virt-install --cloud-init` a try.
|
||||
|
||||
Do you have a favourite tool for your work in the cloud? Tell us about them in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/1/cloud-image-virt-install
|
||||
|
||||
作者:[Sumantro Mukherjee][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/sumantro
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass)
|
||||
[2]: https://alt.fedoraproject.org/cloud/
|
||||
[3]: https://www.redhat.com/sysadmin/exploring-containers-lxc
|
||||
[4]: https://opensource.com/sites/default/files/uploads/fedoracloud.png (Fedora Cloud website)
|
||||
[5]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[6]: https://opensource.com/sites/default/files/uploads/destroyvm.png (Destroying a VM)
|
@ -1,74 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Use Mac-style emoji on Linux)
|
||||
[#]: via: (https://opensource.com/article/21/2/emoji-linux)
|
||||
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
|
||||
|
||||
Use Mac-style emoji on Linux
|
||||
======
|
||||
Splatmoji provides an easy way to spice up your communication with
|
||||
emoji.
|
||||
![Emoji keyboard][1]
|
||||
|
||||
Linux provides an amazing desktop experience by default. Although advanced users have the flexibility to choose their own [window manager][2], the day-to-day flow of Gnome is better than ever since the [GNOME 3.36 improvements][3]. As a long-time Mac enthusiast turned Linux user, that's huge.
|
||||
|
||||
There is, however, one shortcut I use every day on a Mac that you won't find by default on Linux. It's a task I do dozens of times a day and an essential part of my digital communication. It's the emoji launcher.
|
||||
|
||||
You might laugh when you see that, but stick with me.
|
||||
|
||||
Most communication includes body language, and experts estimate upwards of 80% of what people remember comes from it. According to Advancement Courses' [History of emoji][4], people have been using "typographical art" since the 1800s. It's indisputable that in 1881, _Puck Magazine_ included four emotional faces for joy, melancholy, indifference, and astonishment. There is some disagreement about whether Abraham Lincoln's use of a winking smiley face, `;)`, in 1862 was a typo or an intentional form of expression. I could speculate further back into hieroglyphics, as this [museum exhibit][5] did. However you look at it, emoji and their ancestorial predecessors have conveyed complex human emotion in writing for a long time. That power is not going away.
|
||||
|
||||
Macs make it trivial to add these odd forms of expression to text with a shortcut to insert emoji into a sentence quickly. Pressing **Cmd**+**Ctrl**+**Space** launches a menu, and a quick click completes the keystroke.
|
||||
|
||||
GNOME does not (yet) have this functionality by default, but there is open source software to add it.
|
||||
|
||||
## My first attempts at emoji on Linux
|
||||
|
||||
So how can you add emoji-shortcut functionality to a Linux window manager? I began with trial and error. I tried about a dozen different tools along the way. I found [Autokey][6], which has been a great way to insert text using shortcuts or keywords (and I still use for that), but the [emoji extension][7] did not render for me (on Fedora or Pop!_OS). I hope one day it does, so I can use colon notation to insert emoji, like `:+1:` to get a 👍️.
|
||||
|
||||
It turns out that the way emoji render and interact with font choices throughout a window manager is nontrivial. Partway through my struggle, I reached out to the GNOME emoji team (yes, there's a [team for emoji][8]!) and got a small taste of its complexity.
|
||||
|
||||
I did, however, find a project that works consistently across multiple Linux distributions. It's called Splatmoji.
|
||||
|
||||
## Splatmoji for inserting emoji
|
||||
|
||||
[Splatmoji][9] lets me consistently insert emoji into my Linux setup exactly like I would on a Mac. Here is what it looks like in action:
|
||||
|
||||
![Splatmoji scroll example][10]
|
||||
|
||||
(Matthew Broberg, [CC BY-SA 4.0][11])
|
||||
|
||||
It's written in Bash, which is impressive for all that it does. Splatmoji depends on a pretty interesting toolchain outside of Bash to avoid a lot of complexity in its main features. It uses:
|
||||
|
||||
* **[rofi][12]** to provide a smooth window-switcher experience
|
||||
* [**xdotool**][13] to input the keystrokes into the window
|
||||
* [**xsel**][14] or [**xclipboard**][15] to copy the selected item
|
||||
* [**jq**][16], a JSON processor, if JSON escaping is called
|
||||
|
||||
|
||||
|
||||
Thanks to these dependencies, Splatmoji is a surprisingly straightforward tool that calls these pieces in the right order.
|
||||
|
||||
## Set up Splatmoji
|
||||
|
||||
Splatmoji offers packaged releases for dnf and apt-based systems, but I set it up using the source code to keep up with the latest updates to the project:
|
||||
|
||||
|
||||
```
|
||||
# Go to whatever directory you want to store the source code.
|
||||
# I keep everything in a ~/Development folder, and do so here.
|
||||
# Note that `mkdir -p` will make that folder if you haven't already.
|
||||
$ mkdir -p ~/Development
|
||||
$ cd ~/Development
|
||||
$ git clone <https://github.com/cspeterson/splatmoji>
|
||||
$ cd splatmoji/
|
||||
```
|
||||
|
||||
Install the requirements above using the syntax for your package manager. I usually use [Homebrew][17] and add `/home/linuxbrew/.linuxbrew/bin/` to my path, but I will use `dnf` for this example:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install rofi xdoto
|
@ -1,253 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 Tweaks to Customize the Look of Your Linux Terminal)
|
||||
[#]: via: (https://itsfoss.com/customize-linux-terminal/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
5 Tweaks to Customize the Look of Your Linux Terminal
|
||||
======
|
||||
|
||||
The terminal emulator or simply the terminal is an integral part of any Linux distribution.
|
||||
|
||||
When you change the theme of your distribution, often the terminal also gets a makeover automatically. But that doesn’t mean you cannot customize the terminal further.
|
||||
|
||||
In fact, many It’s FOSS readers have asked us how come the terminal in our screenshots or videos look so cool, what fonts do we use, etc.
|
||||
|
||||
To answer this frequent question, I’ll show you some simple and some complex tweaks to change the appearance of the terminal. You can compare the visual difference in the image below:
|
||||
|
||||
![][1]
|
||||
|
||||
### Customizing Linux Terminal
|
||||
|
||||
_This tutorial utilizes a GNOME terminal on Pop!_OS to customize and tweak the look of the terminal. But, most of the advice should be applicable to other terminals as well._
|
||||
|
||||
For most of the elements like color, transparency, and fonts, you can utilize the GUI to tweak it without requiring to enter any special commands.
|
||||
|
||||
Open your terminal. In the top right corner, look for the hamburger menu. In here, click on “**Preferences**” as shown in the screenshot below:
|
||||
|
||||
![][2]
|
||||
|
||||
This is where you’ll find all the settings to change the appearance of the terminal.
|
||||
|
||||
#### Tip 0: Use separate terminal profiles for your customization
|
||||
|
||||
I would advise you to create a new profile for your customization. Why? Because this way, your changes won’t impact the main terminal profile. Suppose you make some weird change and cannot recall the default value? Profiles help separate the customization.
|
||||
|
||||
As you can see, Abhishek has separate profiles for taking screenshots and making videos.
|
||||
|
||||
![Terminal Profiles][3]
|
||||
|
||||
You can easily change the terminal profiles and open a new terminal window with the new profile.
|
||||
|
||||
![Change Terminal Profile][4]
|
||||
|
||||
That was the suggestion I wanted to put forward. Now, let’s see those tweaks.
|
||||
|
||||
#### Tip 1: Use a dark/light terminal theme
|
||||
|
||||
You may change the system theme and the terminal theme gets changed. Apart from that, you may switch between the dark theme or light theme, if you do not want to change the system theme.
|
||||
|
||||
Once you head in to the preferences, you will notice the general options to change the theme and other settings.
|
||||
|
||||
![][5]
|
||||
|
||||
#### Tip 2: Change the font and size
|
||||
|
||||
Select the profile that you want to customize. Now you’ll get the option to customize the text appearance, font size, font style, spacing, cursor shape, and toggle the terminal bell sound as well.
|
||||
|
||||
For the fonts, you can only change to what’s available on your system. If you want something different, download and install the font on your Linux system first.
|
||||
|
||||
One more thing! Use monospaced fonts otherwise fonts might overlap and the text may not be clearly readable. If you want suggestions, go with [Share Tech Mono][6] (open source) or [Larabiefont][7] (not open source).
|
||||
|
||||
Under the Text tab, select Custom font and then change the font and its size (if required).
|
||||
|
||||
![][8]
|
||||
|
||||
#### Tip 3: Change the color pallet and transparency
|
||||
|
||||
Apart from the text and spacing, you can access the “Colors” tab and change the color of the text and background of your terminal. You can also adjust the transparency to make it look even cool.
|
||||
|
||||
As you can notice, you can change the color palette from a set of pre-configured options or tweak it yourself.
|
||||
|
||||
![][9]
|
||||
|
||||
If you want to enable transparency just like I did, you click on “**Use transparent background**” option.
|
||||
|
||||
You can also choose to use colors from your system theme, if you want a similar color setting with your theme.
|
||||
|
||||
![][10]
|
||||
|
||||
#### Tip 4: Tweaking the bash prompt variables
|
||||
|
||||
Usually, you will see your username along with the hostname (your distribution) as the bash prompt when launching the terminal without any changes.
|
||||
|
||||
For instance, it would be “ankushdas**@**pop-os**:~$**” in my case. However, I [permanently changed the hostname][11] to “**itsfoss**“, so now it looks like:
|
||||
|
||||
![][12]
|
||||
|
||||
To change the hostname, you can type in:
|
||||
|
||||
```
|
||||
hostname CUSTOM_NAME
|
||||
```
|
||||
|
||||
However, this will be applicable only for the current sessions. So, when you restart, it will revert to the default. To permanently change the hostname, you need to type in:
|
||||
|
||||
```
|
||||
sudo hostnamectl set-hostname CUSTOM_NAME
|
||||
```
|
||||
|
||||
Similarly, you can also change your username, but it requires some additional configuration that includes killing all the current processes associated with the active username, so we’ll avoid it to change the look/feel of the terminal.
|
||||
|
||||
#### Tip 5: NOT RECOMMENDED: Changing the font and color of the bash prompt (for advanced users)
|
||||
|
||||
However, you can tweak the font and color of the bash prompt (**[[email protected]][13]:~$**) using commands.
|
||||
|
||||
You will need to utilize the **PS1** environment variable which controls what is being displayed as the prompt. You can learn more about it in the [man page][14].
|
||||
|
||||
For instance, when you type in:
|
||||
|
||||
```
|
||||
echo $PS1
|
||||
```
|
||||
|
||||
The output in my case is:
|
||||
|
||||
```
|
||||
\[\e]0;\[email protected]\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
|
||||
```
|
||||
|
||||
We need to focus on the first part of the output:
|
||||
|
||||
```
|
||||
\[\e]0;\[email protected]\h: \w\a\]$
|
||||
```
|
||||
|
||||
Here, you need to know the following:
|
||||
|
||||
* **\e** is a special character that denotes the start of a color sequence
|
||||
* **\u** indicates the username followed by the @ symbol
|
||||
* **\h** denotes the hostname of the system
|
||||
* **\w** denotes the base directory
|
||||
* **\a** indicates the active directory
|
||||
* **$** indicates non-root user
|
||||
|
||||
|
||||
|
||||
The output in your case can be different, but the variables will be the same, so you need to play with the commands mentioned below depending on your output.
|
||||
|
||||
Before you do that, keep these in mind:
|
||||
|
||||
* Codes for text format: **0** for normal text, **1** for bold, **3** for italic and **4** for underline text
|
||||
* Color range for background colors: **40-47**
|
||||
* Color range for text color: **30-37**
|
||||
|
||||
|
||||
|
||||
You just need to type in the following to change the color and font:
|
||||
|
||||
```
|
||||
PS1="\e[41;3;32m[\[email protected]\h:\w\a\$]"
|
||||
```
|
||||
|
||||
This is how your bash prompt will look like after typing the command:
|
||||
|
||||
![][15]
|
||||
|
||||
If you notice the command properly, as mentioned above, \e helps us assign a color sequence.
|
||||
|
||||
In the command above, I’ve assigned a **background color first**, then the **text style**, and then the **font color** followed by “**m**“.
|
||||
|
||||
Here, “**m**” indicates the end of the color sequence.
|
||||
|
||||
So, all you have to do is, play around with this part:
|
||||
|
||||
```
|
||||
41;3;32
|
||||
```
|
||||
|
||||
Rest of the command should remain the same, you just need to assign different numbers to change the background color, text style, and text color.
|
||||
|
||||
Do note that this is in no particular order, you can assign the text style first, background color next, and the text color at the end as “**3;41;32**“, where the command becomes:
|
||||
|
||||
```
|
||||
PS1="\e[3;41;32m[\[email protected]\h:\w\a\$]"
|
||||
```
|
||||
|
||||
![][16]
|
||||
|
||||
As you can notice, the color customization is the same no matter the order. So, just keep in mind the codes for customization and play around with it till you’re sure you want this as a permanent change.
|
||||
|
||||
The above command that I mentioned temporarily customizes the bash prompt for the current session. If you close the session, you will lose the customization.
|
||||
|
||||
So, to make this a permanent change, you need to add it to **.bashrc** file (this is a configuration file that loads up every time you load up a session).
|
||||
|
||||
![][17]
|
||||
|
||||
You can access the file by simply typing:
|
||||
|
||||
```
|
||||
nano ~/.bashrc
|
||||
```
|
||||
|
||||
Unless you’re sure what you’re doing, do not change anything. And, just for the sake of restoring the settings back, you should keep a backup of the PS1 environment variable (copy-paste what’s in it by default) to a text file.
|
||||
|
||||
So, even if you need the default font and color, you can again edit the **.bashrc file** and paste the PS1 environment variable.
|
||||
|
||||
#### Bonus Tip: Change the terminal color pallet based on your wallpaper
|
||||
|
||||
If you want to change the background and text color of the terminal but you are not sure which colors to pick, you can use a Python-based tool Pywal. It [automatically changes the color of the terminal based on your wallpaper][18] or the image you provide to it.
|
||||
|
||||
![][19]
|
||||
|
||||
I have written about it in details if you are interested in using this tool.
|
||||
|
||||
**Recommended Read:**
|
||||
|
||||
![][20]
|
||||
|
||||
#### [Automatically Change Color Scheme of Your Linux Terminal Based on Your Wallpaper][18]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
Of course, it is easy to customize using the GUI while getting a better control of what you can change. But, the need to know the commands is also necessary in case you start [using WSL][21] or access a remote server using SSH, you can customize your experience no matter what.
|
||||
|
||||
How do you customize the Linux terminal? Share your secret ricing recipe with us in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/customize-linux-terminal/
|
||||
|
||||
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/default-terminal.jpg?resize=773%2C493&ssl=1
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?resize=800%2C350&ssl=1
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/02/terminal-profiles.jpg?resize=800%2C619&ssl=1
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?resize=796%2C347&ssl=1
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?resize=800%2C363&ssl=1
|
||||
[6]: https://fonts.google.com/specimen/Share+Tech+Mono
|
||||
[7]: https://www.dafont.com/larabie-font.font
|
||||
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?resize=800%2C500&ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?resize=759%2C607&ssl=1
|
||||
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?resize=800%2C571&ssl=1
|
||||
[11]: https://itsfoss.com/change-hostname-ubuntu/
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?resize=800%2C188&ssl=1
|
||||
[13]: https://itsfoss.com/cdn-cgi/l/email-protection
|
||||
[14]: https://linux.die.net/man/1/bash
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?resize=800%2C190&ssl=1
|
||||
[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?resize=800%2C158&ssl=1
|
||||
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=800%2C615&ssl=1
|
||||
[18]: https://itsfoss.com/pywal/
|
||||
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/wallpy-2.jpg?resize=800%2C442&ssl=1
|
||||
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/pywal-linux.jpg?fit=800%2C450&ssl=1
|
||||
[21]: https://itsfoss.com/install-bash-on-windows/
|
@ -1,74 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 reasons to use Linux package managers)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-package-management)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
5 reasons to use Linux package managers
|
||||
======
|
||||
Package managers track all components of the software you install,
|
||||
making updates, reinstalls, and troubleshooting much easier.
|
||||
![Gift box opens with colors coming out][1]
|
||||
|
||||
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. Today, I'll talk about software repositories
|
||||
|
||||
Before I used Linux, I took the applications I had installed on my computer for granted. I would install applications as needed, and if I didn't end up using them, I'd forget about them, letting them languish as they took up space on my hard drive. Eventually, space on my drive would become scarce, and I'd end up frantically removing applications to make room for more important data. Inevitably, though, the applications would only free up so much space, and so I'd turn my attention to all of the other bits and pieces that got installed along with those apps, whether it was media assets or configuration files and documentation. It wasn't a great way to manage my computer. I knew that, but it didn't occur to me to imagine an alternative, because as they say, you don't know what you don't know.
|
||||
|
||||
When I switched to Linux, I found that installing applications worked a little differently. On Linux, you were encouraged not to go out to websites for an application installer. Instead, you ran a command, and the application was installed on the system, with every individual file, library, configuration file, documentation, and asset recorded.
|
||||
|
||||
### What is a software repository?
|
||||
|
||||
The default method of installing applications on Linux is from a distribution software repository. That might sound like an app store, and that's because modern app stores have borrowed much from the concept of software repositories. [Linux has app stores, too][2], but software repositories are unique. You get an application from a software repository through a _package manager_, which enables your Linux system to record and track every component of what you've installed.
|
||||
|
||||
Here are five reasons that knowing exactly what's on your system can be surprisingly useful.
|
||||
|
||||
#### 1\. Removing old applications
|
||||
|
||||
When your computer knows every file that was installed with any given application, it's really easy to uninstall files you no longer need. On Linux, there's no problem with installing [31 different text editors][3] only to later uninstall the 30 you don't love. When you uninstall on Linux, you really uninstall.
|
||||
|
||||
#### 2\. Reinstall like you mean it
|
||||
|
||||
Not only is an uninstall thorough, a _reinstall_ is meaningful. On many platforms, should something go wrong with an application, you're sometimes advised to reinstall it. Usually, nobody can say why you should reinstall an application. Still, there's often the vague suspicion that some file somewhere has become corrupt (in other words, data got written incorrectly), and so the hope is that a reinstall might overwrite the bad files and make things work again. It's not bad advice, but it's frustrating for any technician not to know what's gone wrong. Worse still, there's no guarantee, without careful tracking, that all files will be refreshed during a reinstall because there's often no way of knowing that all the files installed with an application were removed in the first place. With a package manager, you can force a complete removal of old files to ensure a fresh installation of new files. Just as significantly, you can account for every file and probably find out which one is causing problems, but that's a feature of open source and Linux rather than package management.
|
||||
|
||||
#### 3\. Keep your applications updated
|
||||
|
||||
Don't let anybody tell you that Linux is "more secure" than other operating systems. Computers are made of code, and we humans find ways to exploit that code in new and interesting ways every day. Because the vast majority of applications on Linux are open source, many exploits are filed publically as Common Vulnerability and Exposures (CVE). A flood of incoming security bug reports may seem like a bad thing, but this is definitely a case when _knowing_ is far better than _not knowing_. After all, just because nobody's told you that there's a problem doesn't mean that there's not a problem. Bug reports are good. They benefit everyone. And when developers fix security bugs, it's important for you to be able to get those fixes promptly, and preferably without having to remember to do it yourself.
|
||||
|
||||
A package manager is designed to do exactly that. When applications receive updates, whether it's to patch a potential security problem or introduce an exciting new feature, your package manager application alerts you of the available update.
|
||||
|
||||
#### 4\. Keep it light
|
||||
|
||||
Say you have application A and application B, both of which require library C. On some operating systems, by getting A and B, you get two copies of C. That's obviously redundant, so imagine it happening several times per application. Redundant libraries add up quickly, and by having no single source of "truth" for a given library, it's nearly impossible to ensure you're using the most up-to-date or even just a consistent version of it.
|
||||
|
||||
I admit I don't tend to sit around pondering software libraries all day, but I do remember the days when I did, even though I didn't know that's what was troubling me. Before I had switched to Linux, it wasn't uncommon for me to encounter errors when dealing with media files for work, or glitches when playing different video games, or quirks when reading a PDF, and so on. I spent a lot of time investigating these errors back then. I still remember learning that two major applications on my system each had bundled the same (but different) graphic backend technologies. The mismatch was causing errors when the output of one was imported into the other. It was meant to work, but because of a bug in an older version of the same collection of library files, a hotfix for one application didn't benefit the other.
|
||||
|
||||
A package manager knows what backends (referred to as a _dependency_) are needed for each application and refrains from reinstalling software that's already on your system.
|
||||
|
||||
#### 5\. Keep it simple
|
||||
|
||||
As a Linux user, I appreciate a good package manager because it helps make my life simple. I don't have to think about the software I install, what I need to update, or whether something's really been uninstalled when I'm finished with it. I audition software without hesitation. And when I'm setting up a new computer, I run [a simple Ansible script][4] to automate the installation of the latest versions of all the software I rely upon. It's simple, smart, and uniquely liberating.
|
||||
|
||||
### Better package management
|
||||
|
||||
Linux takes a holistic view of applications and the operating system. After all, open source is built upon the work of other open source, so distribution maintainers understand the concept of a dependency _stack_. Package management on Linux has an awareness of your whole system, the libraries and support files on it, and the applications you install. These disparate parts work together to provide you with an efficient, optimized, and robust set of applications.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-package-management
|
||||
|
||||
作者:[Seth Kenlon][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/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
|
||||
[2]: http://flathub.org
|
||||
[3]: https://opensource.com/article/21/1/text-editor-roundup
|
||||
[4]: https://opensource.com/article/20/9/install-packages-ansible
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,155 +0,0 @@
|
||||
[#]: subject: (A little tool to make DNS queries)
|
||||
[#]: via: (https://jvns.ca/blog/2021/02/24/a-little-tool-to-make-dns-queries/)
|
||||
[#]: author: (Julia Evans https://jvns.ca/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
A little tool to make DNS queries
|
||||
======
|
||||
|
||||
Hello! I made a small tool to make DNS queries over the last couple of days, and you can try it at <https://dns-lookup.jvns.ca/>.
|
||||
|
||||
I started thinking about this because I’m working on writing a zine about owning a domain name, and I wanted to encourage people to make a bunch of DNS queries to understand what the responses look like.
|
||||
|
||||
So I tried to find other tools are available to make DNS queries.
|
||||
|
||||
### dig is kind of complicated
|
||||
|
||||
I usually make DNS queries using `dig`, like this.
|
||||
|
||||
```
|
||||
$ dig jvns.ca
|
||||
|
||||
; <<>> DiG 9.16.1-Ubuntu <<>> a jvns.ca
|
||||
;; global options: +cmd
|
||||
;; Got answer:
|
||||
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8447
|
||||
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
|
||||
|
||||
;; OPT PSEUDOSECTION:
|
||||
; EDNS: version: 0, flags:; udp: 512
|
||||
;; QUESTION SECTION:
|
||||
;jvns.ca. IN A
|
||||
|
||||
;; ANSWER SECTION:
|
||||
jvns.ca. 216 IN A 104.21.5.215
|
||||
jvns.ca. 216 IN A 172.67.133.222
|
||||
|
||||
;; Query time: 40 msec
|
||||
;; SERVER: fdaa:0:bff::3#53(fdaa:0:bff::3)
|
||||
;; WHEN: Wed Feb 24 08:53:22 EST 2021
|
||||
;; MSG SIZE rcvd: 68
|
||||
```
|
||||
|
||||
This is great if you’re used to reading it and if you know which parts to ignore and which parts to pay attention to, but for many people this is too much information.
|
||||
|
||||
Like, what does `flags: qr rd ra` mean? Why does it say `QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1`? What is the point of `MSG SIZE rcvd: 68`? What does `IN` mean? I mostly know the answers to these questions becuase I implemented a toy DNS server one time, but it’s kinda confusing!
|
||||
|
||||
### google webmaster tools has a nice interface for making DNS queries
|
||||
|
||||
Google has a [DNS lookup tool][1] with a simple web interface that lets you type in a domain name, click the kind of record you want (`A`, `AAAA`, etc), and get the response. I was really excited about this and I thought, “ok, great, this is what I can tell people to use!”.
|
||||
|
||||
But then I looked at the output of the tool, which you can see in this screenshot:
|
||||
|
||||
![][2]
|
||||
|
||||
This is just as bad as dig! (the tool is called “dig”, so it’s not a big surprise, but still :)). So I thought it would be a fun project to make a DNS lookup tool with output that’s more comprehensible by humans
|
||||
|
||||
I also wanted to add an option for people to query all the record types at once.
|
||||
|
||||
### what my lookup tool looks like
|
||||
|
||||
I copied the query design from the Google tool because I thought it was nice, but I put the answers in a table and left out a lot of information I thought wasn’t necessary for most people like the flags, and the `IN` (we’re all on the internet!)
|
||||
|
||||
It has a GET ME ALL THE RECORDS button which will make a query for each record type.
|
||||
|
||||
[![][3]][4]
|
||||
|
||||
I also made a responsive version of the table because it got too wide for a phone:
|
||||
|
||||
[![][5]][4]
|
||||
|
||||
### to get all the record types, you need to make multiple queries
|
||||
|
||||
The Google tool has an `ANY` option which makes an `ANY` DNS query for the domain. Some DNS servers support getting all the DNS records with an ANY query, but not all do – Cloudflare has a good blog post explaining [why they removed support for ANY][6].
|
||||
|
||||
So instead of making an `ANY` query (which usually doesn’t work), the tool I made just kicks off a query for each record type it wants to know about.
|
||||
|
||||
### the record type isn’t redundant
|
||||
|
||||
At first when I was removing redundant information I thought the record type was redundant too (if you’re making an A query, the responses you get back will be A records, right?), but then I remembered that this actually isn’t true – you can see in [this query for A records on www.twitter.com][7] that it replies with a CNAME record because [www.twitter.com][8] is CNAMEd to twitter.com.
|
||||
|
||||
### how it works
|
||||
|
||||
The source is on GitHub at <https://github.com/jvns/dns-lookup>.
|
||||
|
||||
It’s basically just 3 files right now:
|
||||
|
||||
* [dns.js][9] (some Javascript using vue.js)
|
||||
* [index.html][10]
|
||||
* [dns.go][11] is the backend, it’s a Go HTTP handler running on Netlify functions
|
||||
|
||||
|
||||
|
||||
Using an AWS Lambda-style function was really nice and made this project super easy to deploy. It’s fun not to have worry about servers!
|
||||
|
||||
Originally I thought I was going to use the DNS code in the Go standard library, but I ended up using <https://github.com/miekg/dns> to make the DNS queries because it seemed simpler.
|
||||
|
||||
I also tried to use Node’s DNS library to write the backend in Javascript before I switched to Go, but I couldn’t figure out how to get that library to return a TTL for my DNS queries. I think this kind of systems-y thing is generally simpler in Go anyway.
|
||||
|
||||
### other DNS lookup tools
|
||||
|
||||
As always, after I made this, people told me about some other useful tools in the space. Here they are:
|
||||
|
||||
* [zone.vision][12], which is nice because it queries the authoritative nameservers for a domain directly
|
||||
* [mxtoolbox.com][13], which seems a bit more oriented towards MX/SPF queries but does lots more
|
||||
* the [Google DNS lookup tool][1] again
|
||||
|
||||
|
||||
|
||||
If you know of others I’d love to add them here!
|
||||
|
||||
### things I might add
|
||||
|
||||
some things on my list are:
|
||||
|
||||
* maybe reverse DNS queries (technically they’re supported right now if you know how to type in 4.3.2.1.in-addr.arpa, but who has time for that)
|
||||
* support for more DNS query types (I want to figure how to support all query types without cluttering up the UI too much)
|
||||
* tooltips explaining what a TTL is
|
||||
* maybe make the design less of a copy of that Google tool, it has kind of a material design vibe and I don’t know if I love it :)
|
||||
|
||||
|
||||
|
||||
### a link to the tool again
|
||||
|
||||
Here’s it is! <https://dns-lookup.jvns.ca/>.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2021/02/24/a-little-tool-to-make-dns-queries/
|
||||
|
||||
作者:[Julia Evans][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://jvns.ca/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://toolbox.googleapps.com/apps/dig/#A/
|
||||
[2]: https://jvns.ca/images/google-tool.png
|
||||
[3]: https://jvns.ca/images/my-tool.png
|
||||
[4]: https://dns-lookup.jvns.ca
|
||||
[5]: https://jvns.ca/images/responsive.png
|
||||
[6]: https://blog.cloudflare.com/deprecating-dns-any-meta-query-type/
|
||||
[7]: https://dns-lookup.jvns.ca/#www.twitter.com%7CA
|
||||
[8]: http://www.twitter.com
|
||||
[9]: https://github.com/jvns/dns-lookup/blob/4be37ca3681480ed0f15a670fbd854ca427329de/site/dns.js
|
||||
[10]: https://github.com/jvns/dns-lookup/blob/4be37ca3681480ed0f15a670fbd854ca427329de/site/index.html
|
||||
[11]: https://github.com/jvns/dns-lookup/blob/4be37ca3681480ed0f15a670fbd854ca427329de/dns.go
|
||||
[12]: https://zone.vision/#/twitter.com
|
||||
[13]: https://mxtoolbox.com/SuperTool.aspx
|
58
sources/tech/20210225 4 new open source licenses.md
Normal file
58
sources/tech/20210225 4 new open source licenses.md
Normal file
@ -0,0 +1,58 @@
|
||||
[#]: subject: (4 new open source licenses)
|
||||
[#]: via: (https://opensource.com/article/21/2/osi-licenses-cal-cern-ohl)
|
||||
[#]: author: (Pam Chestek https://opensource.com/users/pchestek)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
4 new open source licenses
|
||||
======
|
||||
Get to know the new OSI-approved Cryptographic Autonomy License and CERN
|
||||
open hardware licenses.
|
||||
![Law books in a library][1]
|
||||
|
||||
As the steward of the [Open Source Defintion][2], the [Open Source Initiative][3] has been designating licenses as "open source" for over 20 years. These licenses are the foundation of the open source software ecosystem, ensuring that everyone can use, improve, and share software. When a license is approved, it is because the OSI believes that the license fosters collaboration and sharing for the benefit of everyone who participates in the ecosystem.
|
||||
|
||||
The world has changed over the past 20 years, with software now used in new and even unimaginable ways. The OSI has seen that the familiar open source licenses are not always well-suited for these new situations. But license stewards have stepped up, submitting several new licenses for more expansive uses. The OSI was challenged to evaluate whether these new concepts in licensing would continue to advance sharing and collaboration and merit being referred to as "open source" licenses, ultimately approving some new special purpose licenses.
|
||||
|
||||
### Four new licenses
|
||||
|
||||
First is the [Cryptographic Autonomy License][4]. This license is designed for distributed cryptographic applications. The challenge of this use case was that the existing open source licenses wouldn't assure openness because it would be possible for one peer to impair the functioning of the network if there was no obligation to also share data with the other peers. So, in addition to being a strong copyleft license, the CAL also includes an obligation to provide third parties the permissions and materials needed to independently use and modify the software without that third party having a loss of data or capability.
|
||||
|
||||
As more and more uses arise for peer-to-peer sharing using a cryptographic structure, it wouldn't be surprising if more developers found themselves in need of a legal tool like the CAL. The community on License-Discuss and License-Review, OSI's two mailing lists where proposed new open source licenses are discussed, asked many questions about this license. We hope that the resulting license is clear and easy to understand and that other open source practitioners will find it useful.
|
||||
|
||||
Next, the European Organization for Nuclear Research, CERN, submitted the CERN Open Hardware Licence (OHL) family of licenses for consideration. All three of its licenses are primarily intended for open hardware, a field of open access that is similar to open source software but with its own challenges and nuances. The line between hardware and software has blurred considerably, so applying separate hardware and software licenses has become more and more difficult. CERN undertook crafting a license that would ensure freedom for both hardware and software.
|
||||
|
||||
The OSI probably would not have considered adding an open hardware license to its list of open source licenses back when it started, but the world has changed. So while the wording in the CERN licenses encompasses hardware concepts, it also meets all the qualifications to be approved by the OSI as an open source software license.
|
||||
|
||||
The suite of CERN Open Hardware licenses includes a [permissive license][5], a [weak reciprocal license][6], and a [strong reciprocal license][7]. Most recently, the license has been adopted by an international research project that is building simple, easily replicable ventilators to use with COVID-19 patients.
|
||||
|
||||
### Learn more
|
||||
|
||||
The CAL and CERN OHL licenses are special-purpose, and the OSI does not recommend their use outside the fields for which they were designed. But the OSI is eager to see whether these licenses will work as intended, fostering robust open ecosystems in these newer computing arenas.
|
||||
|
||||
More information on the [license approval process][8] is available from the OSI.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/osi-licenses-cal-cern-ohl
|
||||
|
||||
作者:[Pam Chestek][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/pchestek
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_lawdotgov3.png?itok=e4eFKe0l (Law books in a library)
|
||||
[2]: https://opensource.org/osd
|
||||
[3]: https://opensource.org/
|
||||
[4]: https://opensource.org/licenses/CAL-1.0
|
||||
[5]: https://opensource.org/CERN-OHL-P
|
||||
[6]: https://opensource.org/CERN-OHL-W
|
||||
[7]: https://opensource.org/CERN-OHL-S
|
||||
[8]: https://opensource.org/approval
|
@ -0,0 +1,82 @@
|
||||
[#]: subject: (AIOps vs. MLOps: What's the difference?)
|
||||
[#]: via: (https://opensource.com/article/21/2/aiops-vs-mlops)
|
||||
[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
AIOps vs. MLOps: What's the difference?
|
||||
======
|
||||
Break down the differences between these disciplines to learn how you
|
||||
should use them in your open source project.
|
||||
![Brick wall between two people, a developer and an operations manager][1]
|
||||
|
||||
In late 2019, O'Reilly hosted a survey on artificial intelligence [(AI) adoption in the enterprise][2]. The survey broke respondents into two stages of adoption: Mature and Evaluation.
|
||||
|
||||
When asked what's holding back their AI adoption, those in the latter category most often cited company culture. Trouble identifying good use cases for AI wasn't far behind.
|
||||
|
||||
![Bottlenecks to AI adoption][3]
|
||||
|
||||
[AI adoption in the enterprise 2020][2] (O'Reilly, ©2020)
|
||||
|
||||
MLOps, or machine learning operations, is increasingly positioned as a solution to these problems. But that leaves a question: What _is_ MLOps?
|
||||
|
||||
It's fair to ask for two key reasons. This discipline is new, and it's often confused with a sister discipline that's equally important yet distinctly different: Artificial intelligence operations, or AIOps.
|
||||
|
||||
Let's break down the key differences between these two disciplines. This exercise will help you decide how to use them in your business or open source project.
|
||||
|
||||
### What is AIOps?
|
||||
|
||||
[AIOps][4] is a series of multi-layered platforms that automate IT to make it more efficient. Gartner [coined the term][5] in 2017, which emphasizes how new this discipline is. (Disclosure: I worked for Gartner for four years.)
|
||||
|
||||
At its best, AIOps allows teams to improve their IT infrastructure by using big data, advanced analytics, and machine learning techniques. That first item is crucial given the mammoth amount of data produced today.
|
||||
|
||||
When it comes to data, more isn't always better. In fact, many business leaders say they receive so much data that it's [increasingly hard][6] for them to collect, clean, and analyze it to find insights that can help their businesses.
|
||||
|
||||
This is where AIOps comes in. By helping DevOps and data operations (DataOps) teams choose what to automate, from development to production, this discipline [helps open source teams][7] predict performance problems, do root cause analysis, find anomalies, [and more][8].
|
||||
|
||||
### What is MLOps?
|
||||
|
||||
MLOps is a multidisciplinary approach to managing machine learning algorithms as ongoing products, each with its own continuous lifecycle. It's a discipline that aims to build, scale, and deploy algorithms to production consistently.
|
||||
|
||||
Think of MLOps as DevOps applied to machine learning pipelines. [It's a collaboration][9] between data scientists, data engineers, and operations teams. Done well, it gives members of all teams more shared clarity on machine learning projects.
|
||||
|
||||
MLOps has obvious benefits for data science and data engineering teams. Since members of both teams sometimes work in silos, using shared infrastructure boosts transparency.
|
||||
|
||||
But MLOps can benefit other colleagues, too. This discipline offers the ops side more autonomy over regulation.
|
||||
|
||||
As an increasing number of businesses start using machine learning, they'll come under more scrutiny from the government, media, and public. This is especially true of machine learning in highly regulated industries like healthcare, finance, and autonomous vehicles.
|
||||
|
||||
Still skeptical? Consider that just [13% of data science projects make it to production][10]. The reasons are outside this article's scope. But, like AIOps helps teams automate their tech lifecycles, MLOps helps teams choose which tools, techniques, and documentation will help their models reach production.
|
||||
|
||||
When applied to the right problems, AIOps and MLOps can both help teams hit their production goals. The trick is to start by answering this question:
|
||||
|
||||
### What do you want to automate? Processes or machines?
|
||||
|
||||
When in doubt, remember: AIOps automates machines while MLOps standardizes processes. If you're on a DevOps or DataOps team, you can—and should—consider using both disciplines. Just don't confuse them for the same thing.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/aiops-vs-mlops
|
||||
|
||||
作者:[Lauren Maffeo][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/lmaffeo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devops_confusion_wall_questions.png?itok=zLS7K2JG (Brick wall between two people, a developer and an operations manager)
|
||||
[2]: https://www.oreilly.com/radar/ai-adoption-in-the-enterprise-2020/
|
||||
[3]: https://opensource.com/sites/default/files/uploads/oreilly_bottlenecks-with-maturity.png (Bottlenecks to AI adoption)
|
||||
[4]: https://www.bmc.com/blogs/what-is-aiops/
|
||||
[5]: https://www.appdynamics.com/topics/what-is-ai-ops
|
||||
[6]: https://www.millimetric.ai/2020/08/10/data-driven-to-madness-what-to-do-when-theres-too-much-data/
|
||||
[7]: https://opensource.com/article/20/8/aiops-devops-itsm
|
||||
[8]: https://thenewstack.io/how-aiops-conquers-performance-gaps-on-big-data-pipelines/
|
||||
[9]: https://medium.com/@ODSC/what-are-mlops-and-why-does-it-matter-8cff060d4067
|
||||
[10]: https://venturebeat.com/2019/07/19/why-do-87-of-data-science-projects-never-make-it-into-production/
|
170
sources/tech/20210225 How to use the Linux anacron command.md
Normal file
170
sources/tech/20210225 How to use the Linux anacron command.md
Normal file
@ -0,0 +1,170 @@
|
||||
[#]: subject: (How to use the Linux anacron command)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-automation)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to use the Linux anacron command
|
||||
======
|
||||
Instead of manually performing repetitive tasks, let Linux do them for
|
||||
you.
|
||||
![Command line prompt][1]
|
||||
|
||||
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. Automation is one of the best reasons to use Linux.
|
||||
|
||||
One of my favorite things about Linux is its willingness to do work for me. Instead of performing repetitive tasks that eat up my time, or are prone to error, or that I'm likely to forget, I schedule Linux to do them for me.
|
||||
|
||||
### Preparing for automation
|
||||
|
||||
The term "automation" can be as intimidating as it is appealing. I find it helps to approach it modularly.
|
||||
|
||||
#### 1\. What do you want to make happen?
|
||||
|
||||
First, know what outcome you want to produce. Are you watermarking images? Removing files from a cluttered directory? Performing a backup of important data? Define the task clearly for yourself so that you know what to aim for. If there's any task you find yourself doing every day, much less more than once a day, then it could be a candidate for automation.
|
||||
|
||||
#### 2\. Learn the applications you need
|
||||
|
||||
Break down big tasks into small components and learn how to produce each result manually but in a repeatable and predictable way. Much of what can be done on Linux can be scripted, but it's important to recognize your current limitations. There's a world of difference between learning how to automate resizing several images so that they can be emailed conveniently vs. using machine learning to generate elaborate artwork for your weekly newsletter. One of these things you can learn in an afternoon and the other could take years. However, we all have to start somewhere, so just start small and always be on the lookout for ways to improve.
|
||||
|
||||
#### 3\. Automate it
|
||||
|
||||
Use an automation tool on Linux to make it happen on a regular basis. This is the step this article covers!
|
||||
|
||||
To automate something, you need a script that automates a task. When testing, it's best to keep things simple, so the task this article automates is the creation of a file called `hello` in the `/tmp` directory:
|
||||
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
touch /tmp/hello
|
||||
```
|
||||
|
||||
Copy and paste that simple script into a text file and name it `example`.
|
||||
|
||||
### Cron
|
||||
|
||||
The built-in automation solution that every Linux install comes with is the cron system. Linux users tend to refer to cron generically as the method you use to schedule a task (usually called a "cron job"), but there are multiple applications that provide cron's functionality. The most versatile is [cronie][2]; its advantage is that it does _not_ assume that your computer is always on, the way historical cron applications designed for system administrators do.
|
||||
|
||||
Verify which cron system your Linux distribution provides. If it's anything other than cronie, you can probably install cronie from your distro's software repository. If your distribution doesn't have a package for cronie, you can use the old `anacron` package instead. The `anacron` command is included with cronie, so regardless of how you acquire it, you want to ensure that you have the `anacron` command available on your system before continuing. Anacron may require administrative root privileges, depending on your setup.
|
||||
|
||||
|
||||
```
|
||||
$ which anacron
|
||||
/usr/sbin/anacron
|
||||
```
|
||||
|
||||
Anacron's job is to ensure that your automation jobs are executed on a regular basis. To do this, anacron checks to find out when the last time a job ran and then checks how often you have told it to run jobs.
|
||||
|
||||
Suppose you set anacron to run a script once every five days. Every time you turn your computer on or wake it from sleep, anacron scans its logs to determine whether it needs to run the job. If a job ran five or more days ago, then anacron runs the job.
|
||||
|
||||
### Cron jobs
|
||||
|
||||
Many Linux systems come bundled with a few maintenance jobs for cron to perform. I like to keep my jobs separate from the system jobs, so I create a directory in my home directory. Specifically, there's a hidden folder called `~/.local` ("local" in the sense that it's customized for your user account rather than for your "global" computer system), so I create the subdirectory `etc/cron.daily` to mirror cron's usual home on my system. You must also create a spool directory to keep track of the last time jobs were run.
|
||||
|
||||
|
||||
```
|
||||
`$ mkdir -p ~/.local/etc/cron.daily ~/.var/spool/anacron`
|
||||
```
|
||||
|
||||
You can place any script you want to run regularly into the `~/.local/etc/cron.daily` directory. Copy the `example` script into the directory now, and [mark it executable using the chmod command][3].
|
||||
|
||||
|
||||
```
|
||||
$ cp example ~/.local/etc/cron.daily
|
||||
# chmod +x ~/.local/etc/cron.daily/example
|
||||
```
|
||||
|
||||
Next, set up anacron to run whatever scripts are located in the `~/.local/etc/cron.daily` directory.
|
||||
|
||||
### Anacron
|
||||
|
||||
By default, much of the cron system is considered the systems administrator's domain because it's often used for important low-level tasks, like rotating log files and updating certificates. The configuration demonstrated in this article is designed for a regular user setting up personal automation tasks.
|
||||
|
||||
To configure anacron to run your cron jobs, create a configuration file at `/.local/etc/anacrontab`:
|
||||
|
||||
|
||||
```
|
||||
SHELL=/bin/sh
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
1 0 cron.mine run-parts /home/tux/.local/etc/cron.daily/
|
||||
```
|
||||
|
||||
This file tells anacron to run all executable scripts (`run-parts`) found in `~/.local/etc/cron.daily` every one day (that is, daily), with a zero-minute delay. Sometimes, a few minutes' delay is used so that your computer isn't hit with all the possible tasks right after you log in. These settings are suitable for testing, though.
|
||||
|
||||
The `cron.mine` value is an arbitrary name for the process. I call it `cron.mine` but you could call it `cron.personal` or `penguin` or anything you want.
|
||||
|
||||
Verify your `anacrontab` file's syntax:
|
||||
|
||||
|
||||
```
|
||||
$ anacron -T -t ~/.local/etc/anacrontab \
|
||||
-S /home/tux/.var/spool/anacron
|
||||
```
|
||||
|
||||
Silence means success.
|
||||
|
||||
### Adding anacron to .profile
|
||||
|
||||
Finally, you must ensure that anacron runs with your local configuration. Because you're running anacron as a regular user and not as the root user, you must direct it to your local configurations —the `anacrontab` file telling anacron what to do, and the spool directory helping anacron keep track of how many days it's been since each job was last executed:
|
||||
|
||||
|
||||
```
|
||||
anacron -fn -t /home/tux/.local/etc/anacrontab \
|
||||
-S /home/tux/.var/spool/anacron
|
||||
```
|
||||
|
||||
The `-fn` options tell anacron to _ignore_ timestamps, meaning that you're forcing it to run your cron job no matter what. This is exclusively for testing purposes.
|
||||
|
||||
### Testing your cron job
|
||||
|
||||
Now that everything's set up, you can test the job. You can technically test this without rebooting, but it makes the most sense to reboot because that's what this is designed to handle: interrupted and irregular login sessions. Take a moment to reboot your computer, log in, and then look for the test file:
|
||||
|
||||
|
||||
```
|
||||
$ ls /tmp/hello
|
||||
/tmp/hello
|
||||
```
|
||||
|
||||
Assuming the file exists, your example script has executed successfully. You can now remove the test options from `~/.profile`, leaving this as your final configuration:
|
||||
|
||||
|
||||
```
|
||||
anacron -t /home/tux/.local/etc/anacrontab \
|
||||
-S /home/tux/.var/spool/anacron
|
||||
```
|
||||
|
||||
### Using anacron
|
||||
|
||||
You have your personal automation infrastructure configured, so you can place any script you want your computer to manage for you into the `~/.local/etc/cron.daily` directory and it will run as scheduled.
|
||||
|
||||
It's up to you how often you want jobs to run. Your example script is executed once a day. Obviously, that depends on whether your computer is powered on and awake on any given day. If you use your computer on Friday but set it aside for the weekend, the script won't run on Saturday and Sunday. However, on Monday the script will execute because anacron will know that at least one day has passed. You can add weekly, fortnightly, or even monthly directories to `~/.local/etc` to schedule a wide variety of intervals.
|
||||
|
||||
To add a new interval:
|
||||
|
||||
1. Add a directory to `~/.local/etc` (for instance, `cron.weekly`).
|
||||
2. Add a line to `~/.local/etc/anacrontab` to run scripts in the new directory. For a weekly interval, the configuration would be: [code]`7 0 cron.mine run-parts /home/tux/.local/etc/cron.weekly/`[/code] (with the `0` value optionally being some number of minutes to politely delay the start of the script).
|
||||
3. Place your scripts in the `cron.weekly` directory.
|
||||
|
||||
|
||||
|
||||
Welcome to the automated lifestyle. It won't feel like it, but you're about to become a lot more productive.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-automation
|
||||
|
||||
作者:[Seth Kenlon][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/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt)
|
||||
[2]: https://github.com/cronie-crond/cronie
|
||||
[3]: https://opensource.com/article/19/8/linux-chmod-command
|
@ -1,158 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MZqk)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How the Kubernetes scheduler works)
|
||||
[#]: via: (https://opensource.com/article/20/11/kubernetes-scheduler)
|
||||
[#]: author: (Mike Calizo https://opensource.com/users/mcalizo)
|
||||
|
||||
Kubernetes 调度器是如何工作的
|
||||
=====
|
||||
了解 Kubernetes 调度器是如何发现新的 pod 并将其分配到节点。
|
||||
![Parts, modules, containers for software][1]
|
||||
|
||||
[Kubernetes][2] 作为容器和容器化工作负载标的准编标准引擎出现。它供提供一个了通用、开放的抽象层,跨公有云和私有云的环境。
|
||||
|
||||
对于那些已经熟悉 Kuberbetes 及其组件的人,他们讨论通常围绕着最大化使用 Kuberbetes 的功能。但当您只是 Kubernetes 初学者时或尝试在生产环境中使用前,明智的做法是从一些关于 Kubernetes 相关组件(包括 [Kubernetes 调度器][3]) 开始学习,如下抽象视图中所示。
|
||||
|
||||
![][4]
|
||||
|
||||
Kubernetes 也分为控制平面和节点。
|
||||
|
||||
1. **控制平面:** 也称为 Master,负责对群集做出全局决策,以及检测和响应集群事件。控制平面组件包括:
|
||||
* etcd
|
||||
* kube-apiserver
|
||||
* kube-controller-manager
|
||||
* scheduler
|
||||
2. **工作节点:** 也称 Node,是工作负载所在的位置。它始终和 Master 联系,以获取工作负载运行、集群外部进行通讯和连接所需的信息。工作节点组件包括:
|
||||
* kubelet
|
||||
* kube-proxy
|
||||
* CRI
|
||||
|
||||
|
||||
|
||||
我希望在这种背景下可以帮助您理解 Kubernetes 组件是如何关联在一起的。
|
||||
|
||||
### Kubernetes 调度器是如何工作的
|
||||
|
||||
Kubernetes [pod][5] 由一个或多个容器组成组成,共享存储和网络资源。Kubernetes 调度器的任务是确保每个 pod 分配到节点上运行。
|
||||
|
||||
在更深层次下,Kubernetes 调度器的工作方式是这样的:
|
||||
|
||||
1. 每个被调度的 pod 都需要加入到队列
|
||||
2. 新的 pod 被创建后,它们也会加入到队列
|
||||
3. 调度器持续从队列中取出 pod 并对其进行调度
|
||||
|
||||
|
||||
|
||||
[调度器源码][6] (`scheduler.go`) 很大,约 9000 行,且相当复杂,但解决了重要问题:
|
||||
|
||||
1. **等待/监视 pod 创建的代码**
|
||||
监视 pod 创建的代码 `scheduler.go` 从 8970 行开始,它持续等待新的 pod:
|
||||
|
||||
|
||||
```
|
||||
// Run begins watching and scheduling. It waits for cache to be synced, then starts a goroutine and returns immediately.
|
||||
|
||||
func (sched *Scheduler) Run() {
|
||||
if !sched.config.WaitForCacheSync() {
|
||||
return
|
||||
}
|
||||
|
||||
go wait.Until(sched.scheduleOne, 0, sched.config.StopEverything)
|
||||
```
|
||||
|
||||
2. **负责对 pod 进行排队的代码**
|
||||
负责 pod 进行排队的功能是:
|
||||
|
||||
|
||||
```
|
||||
// queue for pods that need scheduling
|
||||
podQueue *cache.FIFO
|
||||
```
|
||||
|
||||
负责 pod 进行排队的代码从 7360 行开始 `scheduler.go`。当新的 pod 显示可用时事件处理程序触发,这段代码将新的 pod 加入队列中:
|
||||
|
||||
|
||||
```
|
||||
func (f *ConfigFactory) getNextPod() *v1.Pod {
|
||||
for {
|
||||
pod := cache.Pop(f.podQueue).(*v1.Pod)
|
||||
if f.ResponsibleForPod(pod) {
|
||||
glog.V(4).Infof("About to try and schedule pod %v", pod.Name)
|
||||
return pod
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **处理错误代码**
|
||||
在 pod 调度中您不可避免会遇到调度错误。以下代码是处理调度程序错误的方法。它监听 `podInformer` 然后抛出一个错误,提示此 pod 尚未调度并被终止:
|
||||
|
||||
|
||||
```
|
||||
// scheduled pod cache
|
||||
podInformer.Informer().AddEventHandler(
|
||||
cache.FilteringResourceEventHandler{
|
||||
FilterFunc: func(obj interface{}) bool {
|
||||
switch t := obj.(type) {
|
||||
case *v1.Pod:
|
||||
return assignedNonTerminatedPod(t)
|
||||
default:
|
||||
runtime.HandleError(fmt.Errorf("unable to handle object in %T: %T", c, obj))
|
||||
return false
|
||||
}
|
||||
},
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
I换句话说,Kubernetes 调度器负责如下:
|
||||
|
||||
* 将新创建的 pod 调度至具有足够空间的节点上,以满足 pod 的资源需求。
|
||||
* 监听 kube-apiserver 和控制器是否创建新的 pod,然后调度它至集群内一个可用的节点。
|
||||
* 监听未安排的 pod,并使用 `/binding` 子资源 API 将 pod 绑定至节点。
|
||||
|
||||
|
||||
|
||||
例如,假设正在部署一个需要 1 GB 内存和双核 CPU 的应用。因此创建应用 pod 的节点上需有足够资源可用,然后调度器会持续运行监听是否有 pod 需要调度。
|
||||
|
||||
### 了解更多
|
||||
|
||||
要使 Kubernetes 集群工作,你需要使用以上所有组件一起同步运行。调度器有一段复杂的的代码,但是 Kubernetes 是一个很棒的软件,目前它仍是我们在讨论或采用云原生应用程序时的首选。
|
||||
|
||||
学习 Kubernetes 需要精力和时间,但是将其作为您的专业技能之一能为您的职业生涯带来优势和回报。有很多很好的学习资源可供使用,而且[官方文档][7]也很棒。如果您有兴趣了解更多,建议从以下内容开始:
|
||||
|
||||
* [Kubernetes the hard way][8]
|
||||
* [Kubernetes the hard way on bare metal][9]
|
||||
* [Kubernetes the hard way on AWS][10]
|
||||
|
||||
|
||||
|
||||
你喜欢的 Kubernetes 学习方法是什么?请在评论中分享吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/11/kubernetes-scheduler
|
||||
|
||||
作者:[Mike Calizo][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/MZqk)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mcalizo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software)
|
||||
[2]: https://kubernetes.io/
|
||||
[3]: https://kubernetes.io/docs/concepts/scheduling-eviction/kube-scheduler/
|
||||
[4]: https://lh4.googleusercontent.com/egB0SSsAglwrZeWpIgX7MDF6u12oxujfoyY6uIPa8WLqeVHb8TYY_how57B4iqByELxvitaH6-zjAh795wxAB8zenOwoz2YSMIFRqHsMWD9ohvUTc3fNLCzo30r7lUynIHqcQIwmtRo
|
||||
[5]: https://kubernetes.io/docs/concepts/workloads/pods/
|
||||
[6]: https://github.com/kubernetes/kubernetes/blob/e4551d50e57c089aab6f67333412d3ca64bc09ae/plugin/pkg/scheduler/scheduler.go
|
||||
[7]: https://kubernetes.io/docs/home/
|
||||
[8]: https://github.com/kelseyhightower/kubernetes-the-hard-way
|
||||
[9]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-BareMetal.md
|
||||
[10]: https://github.com/Praqma/LearnKubernetes/blob/master/kamran/Kubernetes-The-Hard-Way-on-AWS.md
|
119
translated/tech/20210119 Set up a Linux cloud on bare metal.md
Normal file
119
translated/tech/20210119 Set up a Linux cloud on bare metal.md
Normal file
@ -0,0 +1,119 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Set up a Linux cloud on bare metal)
|
||||
[#]: via: (https://opensource.com/article/21/1/cloud-image-virt-install)
|
||||
[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro)
|
||||
|
||||
在裸机上建立 Linux 云
|
||||
======
|
||||
|
||||
> 在 Fedora 上用 virt-install 创建云镜像。
|
||||
|
||||
![云和草的天空][1]
|
||||
|
||||
虚拟化是使用最多的技术之一。Fedora Linux 使用 [Cloud Base 镜像][2] 来创建通用虚拟机(VM),但设置 Cloud Base 镜像的方法有很多。最近,用于调配虚拟机的 `virt-install` 命令行工具增加了对 `cloud-init` 的支持,因此现在可以使用它在本地配置和运行云镜像。
|
||||
|
||||
本文介绍了如何在裸机上设置一个基本的 Fedora 云实例。同样的步骤可以用于任何 raw 或Qcow2 Cloud Base 镜像。
|
||||
|
||||
### 什么是 --cloud-init?
|
||||
|
||||
`virt-install` 命令使用 `libvirt` 创建一个 KVM、Xen 或 [LXC][3] 客户机。`--cloud-init` 选项使用一个本地文件(称为 “nocloud 数据源”),所以你不需要网络连接来创建镜像。在第一次启动时,`nocloud` 方法会从 iso9660 文件系统(`.iso` 文件)中获取访客机的用户数据和元数据。当你使用这个选项时,`virt-install` 会为 root 用户账户生成一个随机的(临时)密码,提供一个串行控制台,以便你可以登录并更改密码,然后在随后的启动中禁用 `--cloud-init` 选项。
|
||||
|
||||
### 设置 Fedora Cloud Base 镜像
|
||||
|
||||
首先,[下载一个 Fedora Cloud Base(for OpenStack)镜像][2]。
|
||||
|
||||
![Fedora Cloud 网站截图][4]
|
||||
|
||||
然后安装 `virt-install` 命令:
|
||||
|
||||
```
|
||||
$ sudo dnf install virt-install
|
||||
```
|
||||
|
||||
一旦 `virt-install` 安装完毕并下载了 Fedora Cloud Base 镜像,请创建一个名为`cloudinit-user-data.yaml` 的小型 YAML 文件,其中包含 `virt-install` 将使用的一些配置行:
|
||||
|
||||
```
|
||||
#cloud-config
|
||||
password: 'r00t'
|
||||
chpasswd: { expire: false }
|
||||
```
|
||||
|
||||
这个简单的云配置可以设置默认的 `fedora` 用户的密码。如果你想使用会过期的密码,可以将其设置为登录后过期。
|
||||
|
||||
创建并启动虚拟机:
|
||||
|
||||
```
|
||||
$ virt-install --name local-cloud18012709 \
|
||||
--memory 2000 --noreboot \
|
||||
--os-variant detect=on,name=fedora-unknown \
|
||||
--cloud-init user-data="/home/r3zr/cloudinit-user-data.yaml" \
|
||||
--disk=size=10,backing_store="/home/r3zr/Downloads/Fedora-Cloud-Base-33-1.2.x86_64.qcow2"
|
||||
```
|
||||
|
||||
在这个例子中,`local-cloud18012709` 是虚拟机的名称,内存设置为 2000MiB,磁盘大小(虚拟硬盘)设置为 10GB,`--cloud-init` 和 `backing_store` 分别带有你创建的 YAML 配置文件和你下载的 Qcow2 镜像的绝对路径。
|
||||
|
||||
### 登录
|
||||
|
||||
在创建镜像后,你可以用用户名 `fedora` 和 YAML 文件中设置的密码登录(在我的例子中,密码是 `r00t`,但你可能用了别的密码)。一旦你第一次登录,请更改你的密码。
|
||||
|
||||
要关闭虚拟机的电源,执行 `sudo poweroff` 命令,或者按键盘上的 `Ctrl+]`。
|
||||
|
||||
### 启动、停止和销毁虚拟机
|
||||
|
||||
`virsh` 命令用于启动、停止和销毁虚拟机。
|
||||
|
||||
要启动任何停止的虚拟机:
|
||||
|
||||
```
|
||||
$ virsh start <vm-name>
|
||||
```
|
||||
|
||||
要停止任何运行的虚拟机:
|
||||
|
||||
```
|
||||
$ virsh shutdown <vm-name>
|
||||
```
|
||||
|
||||
要列出所有处于运行状态的虚拟机:
|
||||
|
||||
```
|
||||
$ virsh list
|
||||
```
|
||||
|
||||
要销毁虚拟机:
|
||||
|
||||
```
|
||||
$ virsh destroy <vm-name>
|
||||
```
|
||||
|
||||
![销毁虚拟机][6]
|
||||
|
||||
### 快速而简单
|
||||
|
||||
`virt-install` 命令与 `--cloud-init` 选项相结合,可以快速轻松地创建云就绪镜像,而无需担心是否有云来运行它们。无论你是在为重大部署做准备,还是在学习容器,都可以试试`virt-install --cloud-init`。
|
||||
|
||||
在云计算工作中,你有喜欢的工具吗?请在评论中告诉我们。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/1/cloud-image-virt-install
|
||||
|
||||
作者:[Sumantro Mukherjee][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://opensource.com/users/sumantro
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass)
|
||||
[2]: https://alt.fedoraproject.org/cloud/
|
||||
[3]: https://www.redhat.com/sysadmin/exploring-containers-lxc
|
||||
[4]: https://opensource.com/sites/default/files/uploads/fedoracloud.png (Fedora Cloud website)
|
||||
[5]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[6]: https://opensource.com/sites/default/files/uploads/destroyvm.png (Destroying a VM)
|
@ -0,0 +1,241 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 Tweaks to Customize the Look of Your Linux Terminal)
|
||||
[#]: via: (https://itsfoss.com/customize-linux-terminal/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
定制你的 Linux 终端外观的 5 项调整
|
||||
======
|
||||
|
||||
终端仿真器(或简称终端)是任何 Linux 发行版中不可或缺的一部分。
|
||||
|
||||
当你改变发行版的主题时,往往终端也会自动得到改造。但这并不意味着你不能进一步定制终端。
|
||||
|
||||
事实上,很多读者都问过我们,为什么我们截图或视频中的终端看起来那么酷,我们用的是什么字体等等。
|
||||
|
||||
为了回答这个经常被问到的问题,我将向你展示一些简单或复杂的调整来改变终端的外观。你可以在下图中对比一下视觉上的差异:
|
||||
|
||||
![][1]
|
||||
|
||||
### 自定义 Linux 终端
|
||||
|
||||
本教程利用 Pop!_OS 上的 GNOME 终端来定制和调整终端的外观。但是,大多数建议也应该适用于其他终端。
|
||||
|
||||
对于大多数元素,如颜色、透明度和字体,你可以利用 GUI 来调整它,而不需要输入任何特殊的命令。
|
||||
|
||||
打开你的终端。在右上角寻找汉堡菜单。在这里,点击 “偏好设置”,如下图所示:
|
||||
|
||||
![][2]
|
||||
|
||||
在这里你可以找到改变终端外观的所有设置。
|
||||
|
||||
#### 技巧 0:使用独立的终端配置文件进行定制
|
||||
|
||||
我建议你建立一个新的配置文件用于你的定制。为什么要这样做?因为这样一来,你的改变就不会影响到终端的主配置文件。假设你做了一些奇怪的改变,却想不起默认值?配置文件有助于分离你的定制。
|
||||
|
||||
如你所见,我有个单独的配置文件,用于截图和制作视频。
|
||||
|
||||
![终端配置文件][3]
|
||||
|
||||
你可以轻松地更改终端配置文件,并使用新的配置文件打开一个新的终端窗口。
|
||||
|
||||
![更改终端配置文件][4]
|
||||
|
||||
这就是我想首先提出的建议。现在,让我们看看这些调整。
|
||||
|
||||
#### 技巧 1:使用深色/浅色终端主题
|
||||
|
||||
你可以改变系统主题,终端主题也会随之改变。除此之外,如果你不想改变系统主题。你也可以切换终端的深色主题或浅色主题,
|
||||
|
||||
一旦你进入“偏好设置”,你会注意到在“常规”选项中可以改变主题和其他设置。
|
||||
|
||||
![][5]
|
||||
|
||||
#### 技巧 2:改变字体和大小
|
||||
|
||||
选择你要自定义的配置文件。现在你可以选择自定义文本外观、字体大小、字体样式、间距、光标形状,还可以切换终端铃声。
|
||||
|
||||
对于字体,你只能改成你系统上可用的字体。如果你想要不同的字体,请先在你的 Linux 系统上下载并安装字体。
|
||||
|
||||
还有一点! 要使用等宽字体,否则字体可能会重叠,文字可能无法清晰阅读。如果你想要一些建议,可以选择 [Share Tech Mono][6](开源)或 [Larabiefont][7](不开源)。
|
||||
|
||||
在“文本”选项卡下,选择“自定义字体”,然后更改字体及其大小(如果需要)。
|
||||
|
||||
![][8]
|
||||
|
||||
#### 技巧 3:改变调色板和透明度
|
||||
|
||||
除了文字和间距,你还可以进入“颜色”选项,改变终端的文字和背景的颜色。你还可以调整透明度,让它看起来更酷。
|
||||
|
||||
正如你所注意到的那样,你可以从一组预先配置的选项中选择调色板,也可以自己调整。
|
||||
|
||||
![][9]
|
||||
|
||||
如果你想和我一样启用透明,点击“使用透明背景”选项。
|
||||
|
||||
如果你想要和你的系统主题类似的颜色设置,你也可以选择使用系统主题的颜色。
|
||||
|
||||
![][10]
|
||||
|
||||
#### 技巧 4:调整 bash 提示符变量
|
||||
|
||||
通常当你启动终端时,无需任何修改你就会看到你的用户名和主机名(你的发行版名称)作为 bash 提示符。
|
||||
|
||||
例如,在我的例子中,它会是 “ankushdas@pop-os:~$”。然而,我把 [主机名永久地改成了][11] “itsfoss”,所以现在看起来像这样:
|
||||
|
||||
![][12]
|
||||
|
||||
要改变主机名,你可以键入:
|
||||
|
||||
```
|
||||
hostname 定制名称
|
||||
```
|
||||
|
||||
然而,这只适用于当前会话。因此,当你重新启动时,它将恢复到默认值。要永久地更改主机名,你需要输入:
|
||||
|
||||
```
|
||||
sudo hostnamectl set-hostname 定制名称
|
||||
```
|
||||
|
||||
同样,你也可以改变你的用户名,但它需要一些额外的配置,包括杀死所有与活动用户名相关联的当前进程,所以我们会跳过用它来改变终端的外观/感觉。
|
||||
|
||||
#### 技巧 5:不推荐:改变 bash 提示符的字体和颜色(面向高级用户)
|
||||
|
||||
然而,你可以使用命令调整 bash 提示符的字体和颜色。
|
||||
|
||||
你需要利用 `PS1` 环境变量来控制提示符的显示内容。你可以在 [手册页][14] 中了解更多关于它的信息。
|
||||
|
||||
例如,当你键入:
|
||||
|
||||
```
|
||||
echo $PS1
|
||||
```
|
||||
|
||||
在我这里输出:
|
||||
|
||||
```
|
||||
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
|
||||
```
|
||||
|
||||
我们需要关注的是该输出的第一部分:
|
||||
|
||||
```
|
||||
\[\e]0;\u@\h: \w\a\]$
|
||||
```
|
||||
|
||||
在这里,你需要知道以下几点:
|
||||
|
||||
* `\e` 是一个特殊的字符,表示一个颜色序列的开始。
|
||||
* `\u` 表示用户名,后面可以跟着 `@` 符号。
|
||||
* `\h` 表示系统的主机名。
|
||||
* `\w` 表示基本目录。
|
||||
* `\a` 表示活动目录。
|
||||
* `$` 表示非 root 用户。
|
||||
|
||||
在你的情况下输出可能不一样,但变量是一样的,所以你需要根据你的输出来试验下面提到的命令。
|
||||
|
||||
在你这样做之前,请记住这些:
|
||||
|
||||
* 文本格式代码:`0` 代表正常文本,`1` 代表粗体,`3` 代表斜体,`4` 代表下划线文本。
|
||||
* 背景色的颜色范围:`40` - `47`。
|
||||
* 文本颜色的颜色范围:`30` - `37`。
|
||||
|
||||
你只需要键入以下内容来改变颜色和字体:
|
||||
|
||||
```
|
||||
PS1="\e[41;3;32m[\u@\h:\w\a\$]"
|
||||
```
|
||||
|
||||
这是输入该命令后 bash 提示符的样子:
|
||||
|
||||
![][15]
|
||||
|
||||
如果你注意到这个命令,就像上面提到的,`\e` 可以帮助我们分配一个颜色序列。
|
||||
|
||||
在上面的命令中,我先分配了一个**背景色**,然后是**文字样式**,接着是**字体颜色**,然后是 `m`。这里,`m` 表示颜色序列的结束。
|
||||
|
||||
所以,你要做的就是,调整这部分:
|
||||
|
||||
```
|
||||
41;3;32
|
||||
```
|
||||
|
||||
命令其余部分应该是不变的,你只需要分配不同的数字来改变背景色、文字样式和文字颜色。
|
||||
|
||||
要注意的是,这并没有特定的顺序,你可以先指定文字样式,再指定背景色,最后指定文字颜色,如 `3;41;32`,这里的命令就变成了:
|
||||
|
||||
```
|
||||
PS1="\e[3;41;32m[\u@\h:\w\a\$]"
|
||||
```
|
||||
|
||||
![][16]
|
||||
|
||||
正如你所注意到的,无论顺序如何,颜色的定制都是一样的。所以,只要记住自定义的代码,并在你确定你想把它作为一个永久的变化之前,试试它。
|
||||
|
||||
上面我提到的命令会临时定制当前会话的 bash 提示符。如果你关闭了会话,你将失去这个自定义设置。
|
||||
|
||||
所以,要想把它变成一个永久的改变,你需要把它添加到 `.bashrc` 文件中(这是一个配置文件,每次加载会话时都会加载)。
|
||||
|
||||
![][17]
|
||||
|
||||
简单键入如下命令来访问该文件:
|
||||
|
||||
```
|
||||
nano ~/.bashrc
|
||||
```
|
||||
|
||||
除非你明确知道你在做什么,否则不要改变任何东西。而且,为了可以恢复设置,你应该把 `PS1` 环境变量的备份(默认情况下复制粘贴其中的内容)保存到一个文本文件中。
|
||||
|
||||
所以,即使你需要默认的字体和颜色,你也可以再次编辑 `.bashrc` 文件并粘贴 `PS1` 环境变量。
|
||||
|
||||
#### 附赠技巧:根据你的墙纸改变终端的调色板
|
||||
|
||||
如果你想改变终端的背景和文字颜色,但又不知道该选哪种颜色,你可以使用一个基于 Python 的工具 Pywal,它可以 [根据你的壁纸][18] 或你提供的图片自动改变终端的颜色。
|
||||
|
||||
![][19]
|
||||
|
||||
如果你有兴趣使用这个工具,我之前已经详细[介绍][18]过了。
|
||||
|
||||
### 总结
|
||||
|
||||
当然,使用 GUI 定制很容易,同时也可以更好地控制你可以改变的东西。但是,需要知道命令也是必要的,万一你开始 [使用 WSL][21] 或者使用 SSH 访问远程服务器,无论如何都可以定制你的体验。
|
||||
|
||||
你是如何定制 Linux 终端的?在评论中与我们分享你的秘方。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/customize-linux-terminal/
|
||||
|
||||
作者:[Ankush Das][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://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/default-terminal.jpg?resize=773%2C493&ssl=1
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-preferences.jpg?resize=800%2C350&ssl=1
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/02/terminal-profiles.jpg?resize=800%2C619&ssl=1
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/02/change-terminal-profile.jpg?resize=796%2C347&ssl=1
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-theme.jpg?resize=800%2C363&ssl=1
|
||||
[6]: https://fonts.google.com/specimen/Share+Tech+Mono
|
||||
[7]: https://www.dafont.com/larabie-font.font
|
||||
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-customization-1.jpg?resize=800%2C500&ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-color-customization.jpg?resize=759%2C607&ssl=1
|
||||
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal.jpg?resize=800%2C571&ssl=1
|
||||
[11]: https://itsfoss.com/change-hostname-ubuntu/
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/01/itsfoss-hostname.jpg?resize=800%2C188&ssl=1
|
||||
[13]: https://itsfoss.com/cdn-cgi/l/email-protection
|
||||
[14]: https://linux.die.net/man/1/bash
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/terminal-bash-prompt-customization.jpg?resize=800%2C190&ssl=1
|
||||
[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/01/linux-terminal-customization-1s.jpg?resize=800%2C158&ssl=1
|
||||
[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/01/bashrch-customization-terminal.png?resize=800%2C615&ssl=1
|
||||
[18]: https://itsfoss.com/pywal/
|
||||
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/wallpy-2.jpg?resize=800%2C442&ssl=1
|
||||
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/pywal-linux.jpg?fit=800%2C450&ssl=1
|
||||
[21]: https://itsfoss.com/install-bash-on-windows/
|
@ -1,102 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (amorsu)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 reasons to choose Linux for art and design)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-art-design)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
选择Linux来做艺术设计的4个理由
|
||||
======
|
||||
|
||||
开源会强化你的创造力。因为它把你带出私有化的思维定势,开阔你的视野,从而带来更多的可能性。探索一些开源的创意项目。
|
||||
![在一台电脑屏幕上的喷涂艺术][1]
|
||||
|
||||
2021年,人们比以前的任何时候都更有理由来爱上Linux。在这个系列,我会分享21个选择Linux的原因。今天,让我来解释一下,为什么Linux是艺术设计的绝佳选择。
|
||||
|
||||
Linux在服务器和云计算方面获得很多的赞誉。让不少人感到惊讶的是,Linux刚好有一系列的创意设计工具,并且这些工具在用户体验和质量方面可以轻松打败那些流行的创意设计工具。我第一次使用开源的设计工具,并不是因为我没有其他工具可以选择。相反的,我是在接触了大量的这些领先的公司提供的私有化的设计工具后,才开始使用开源设计工具。我之所以最后选择开源设计工具是因为它们更合情而且我能获得更好的产出。以下是好几个方面,让我来慢慢解释吧!
|
||||
|
||||
### 高可用性意味着高生产力
|
||||
|
||||
“生产力”这一次对于不同的人来说含义不一样。当我想到生产力,就是当你坐下来做事情,并能够完成你给自己设定的所有任务的时候,这时就很有成就感。
|
||||
但是当你总是被一些你无法掌控的事情打断,那你的生产力就下降了。
|
||||
|
||||
电脑有时候会显得无法预测,并且大家也公认在很多方面会有可能出问题。电脑是由很多的硬件组成的,它们任何一个都有可能在任何时间出问题。软件会有bug,以及修复这些bug的更新,而更新后又会带来新的bug。如果你对电脑不了解,它可能就像一个定时炸弹,等着爆发。带着数字世界里的这么多的潜在问题,去接受一个当某些条件不满足(比如授权,或者订阅费)就会不工作的软件,对我来说就显得很不理智。
|
||||
|
||||
![Inkscape 应用][2]
|
||||
|
||||
Inkscape
|
||||
|
||||
开源的创意设计app不需要订阅费,也不需要授权。在你需要的时候,它们都能获取得到,并且通常都是跨平台的。这就意味着,当你坐在工作的电脑面前,你就能确定你能用到那些必需的软件。而如果某天你很忙碌,却发现你面前的电脑不工作了,解决办法就是找到一个能工作的,安装你的创意设计软件,然后开始工作。
|
||||
|
||||
想要找到一台无法运行Inkscape的电脑是很困难的。比找一台可以运行那些私有软件的电脑,还要难。这就叫做高可用。这是游戏规则的改变者。我从来不曾遇到因为软件用不了而不得不干等,浪费我数小时时间的事情。
|
||||
|
||||
### 开源更有多样性
|
||||
|
||||
我在设计行业工作的时候,我的很多同事都是通过自学的方式来学习艺术和技术方面的知识,这让我感到惊讶。有的通过使用那些最新的昂贵的“专业”软件来自学,当大部分人则是通过使用免费和开源的软件来完善他们的数字化的职业技能。因为,对于孩子,或者没钱的大学生来说,这才是他们能负担的起,而且很容易就能获得的。
|
||||
|
||||
高可用有很多种,但有一种对我而言很重要,而且对那些没有在设计行业但使用开源软件的人也很重要。即使那些有提供付费订阅的开源项目,比如Ardour,都能确保他的用户在不需要支付任何费用的时候也能使用软件。
|
||||
|
||||
![Ardour 界面][4]
|
||||
|
||||
Ardour
|
||||
|
||||
当你不限制别人用你的软件的时候,你其实拥有了更多的潜在用户。如果你这样做了,那么你就开放了一个接收多样的创意声音的窗口。艺术钟爱影响力,你能从越多的不同用户经验中获得越多的观点,就越好。这就是开源设计软件所带来的可能性。
|
||||
|
||||
### 文件格式支持更具包容性
|
||||
|
||||
我们都知道在几乎所有行业里面包容性的价值。在各种意义上,邀请更多的人到派对造就更壮观的场面。知道这一点,当看到有的项目或者创新公司只邀请某些人去合作,只接受某些文件格式,就让我很痛苦。这看起来很陈旧,就像某个远古时代的精英主义的遗迹,而这是即使在今天都在发生的真实问题。
|
||||
|
||||
这是一个意外而不幸的转变,而且不是因为技术上的限制。私有软件可以访问开源的文件格式,因为这些格式是开源的而且可以免费的集成到各种应用里面。集成这些格式不需要任何回报。而相比之下,私有的文件格式笼罩着秘密,只被限制于提供给几个愿意付钱的人使用。这很糟糕,而且常常,你无法在没有这些私有软件的情况下打开一些文件来获取你的数据。令人惊喜的是,开源的设计软件却是尽力的支持更多的私有文件格式。以下是一些Inkscape所支持的令人难以置信的列表样本:
|
||||
|
||||
|
||||
![可用的 Inkscape 文件格式][5]
|
||||
|
||||
Inkscape 文件格式
|
||||
|
||||
而这大部分都是在没有这些私有格式厂商的支持下开发出来的。
|
||||
|
||||
支持开放的文件格式可以更包容,对所有人都更好。
|
||||
|
||||
### 对新的创意没有限制
|
||||
|
||||
我之所以爱上开源的其中一个原因是,解决一个指定任务时,有彻底的多样性。当你在当你环绕在私有软件中,你所看到的世界是基于你所能够获取得到的东西。比如说,你过你打算处理一些照片,你通常会把你的意图框限在你所知道的可能性上面。你从你的架子上的4款或10款应用中,挑选出3款,因为它们是目前你唯一能够获取得到的选项。
|
||||
|
||||
在开源领域,你通常会有好几个“明显的”必备解决方案,但同时你还有一打的角逐者在边缘转悠,供你选择。这些选项有时只是半成品,或者它们超级专注于某项任务,又或者它们学起来有点挑战性,但最主要的是,它们是唯一的,而且充满创新的。有时候,它们是被某些不按“套路”出牌的人所开发的,因此处理的方法和市场上现有的产品截然不同。其他时候,它们是被那些熟悉做事情的“正确”方式,但还是在尝试不同策略的人所开发的。这就像是一个充满可能性的巨大的动态的头脑风暴。
|
||||
|
||||
这种类型的日常创新能够引领出闪现的灵感,光辉时刻,或者影响广泛的通用性改进。比如说,著名的GIMP滤镜,(用于从图像中移除项目并自动替换背景)是如此的受欢迎以至于后来被私有图片编辑软件商拿去“借鉴”。这是成功的一步,但是对于一个艺术家而言,个人的影响才是最关键的。我常感叹于新的Linux用户的创意,而我只是在技术展会上展示给他们一个简单的音频,或者视频滤镜,或者绘图应用。没有任何的指导,或者应用场景,从简单的交互中喷发出来的关于新的工具的主意,是令人兴奋和充满启发的,通过实验中一些简单的工具,一个全新的艺术系列可以轻而易举的浮现出来。
|
||||
|
||||
只要在适当的工具集都有的情况下,有很多方式来更有效的工作。虽然私有软件通常也不会反对更聪明的工作习惯的点子,专注于实现自动化任务让用户可以更轻松的工作,对他们也没有直接的收益。Linux和开源软件就是很大程度专为[自动化和编排][6]而建的。而不只是服务器。像 [ImageMagick][7] 和 [GIMP scripts][8]这样的工具改变了我的处理图片的方式,包括批量处理方面和纯粹实验方面。
|
||||
|
||||
你永远不知道你可以创造什么,如果你有一个你从来想象不到会存在的工具的话。
|
||||
|
||||
### Linux艺术家
|
||||
|
||||
这里有 [使用开源的艺术家社区][9], 从 [photography][10] 到 [makers][11] 到 [musicians][12], 还有更多更多。 如果你想要创新, 试试Linux吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-art-design
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[amorsu](https://github.com/amorsu)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen)
|
||||
[2]: https://opensource.com/sites/default/files/inkscape_0.jpg
|
||||
[3]: https://community.ardour.org/subscribe
|
||||
[4]: https://opensource.com/sites/default/files/ardour.jpg
|
||||
[5]: https://opensource.com/sites/default/files/formats.jpg
|
||||
[6]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[7]: https://opensource.com/life/16/6/fun-and-semi-useless-toys-linux#imagemagick
|
||||
[8]: https://opensource.com/article/21/1/gimp-scripting
|
||||
[9]: https://librearts.org
|
||||
[10]: https://pixls.us
|
||||
[11]: https://www.redhat.com/en/blog/channel/red-hat-open-studio
|
||||
[12]: https://linuxmusicians.com
|
@ -0,0 +1,74 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 reasons to use Linux package managers)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-package-management)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
使用 Linux 软件包管理器的 5 个理由
|
||||
======
|
||||
包管理器跟踪你安装的软件的所有组件,使得更新、重装和故障排除更加容易。
|
||||
![Gift box opens with colors coming out][1]
|
||||
|
||||
在 2021 年,人们喜欢 Linux 的理由比以往任何时候都多。在这个系列中,我将分享 21 个使用 Linux 的不同理由。今天,我将谈谈软件仓库。
|
||||
|
||||
在我使用 Linux 之前,我认为在计算机上安装的应用是理所当然的。我会根据需要安装应用,如果我最后没有使用它们,我就会把它们忘掉,让它们占用我的硬盘空间。最终,我的硬盘空间会变得稀缺,我最终会疯狂地删除应用,为更重要的数据腾出空间。但不可避免的是,应用只能释放出有限的空间,所以我将注意力转移到与这些应用一起安装的所有其他零碎内容上,无论是媒体内容还是配置文件和文档。这不是一个管理电脑的好方法。我知道这一点,但我并没有想过要有其他的选择,因为正如人们所说,你不知道你不知道的事情。
|
||||
|
||||
当我改用 Linux 时,我发现安装应用的方式有些不同。在 Linux 上,你被鼓励不要去网站上找应用的安装程序。取而代之的是,运行一个命令,应用就会被安装到系统上,并记录每个单独的文件、库、配置文件、文档和资产。
|
||||
|
||||
### 什么是软件仓库?
|
||||
|
||||
在 Linux 上安装应用的默认方法是从发行版软件仓库中安装。这可能听起来像应用商店,那是因为现代应用商店借鉴了很多软件仓库的概念。[Linux 也有应用商店][2],但软件仓库是独一无二的。你通过一个_包管理器_从软件仓库中获得一个应用,它使你的 Linux 系统能够记录和跟踪你所安装的每一个组件。
|
||||
|
||||
这里有五个原因可以让你确切地知道你的系统上有什么东西,可以说是非常有用。
|
||||
|
||||
#### 1\.移除旧应用
|
||||
|
||||
当你的计算机知道任何给定应用安装的每一个文件时,卸载你不再需要的文件真的很容易。在 Linux 上,安装 [31 个不同的文本编辑器][3],然后卸载 30 个你不喜欢的文本编辑器是没有问题的。当你在 Linux 上卸载的时候,你就真的卸载了。
|
||||
|
||||
#### 2\. 按你的意思重新安装
|
||||
|
||||
不仅卸载要彻底,_重装_也很有意义。在许多平台上,如果一个应用出了问题,有时会建议你重新安装它。通常情况下,谁也说不清为什么要重装一个应用。不过,人们还是经常会隐隐约约地怀疑某个地方的文件已经损坏了(换句话说,数据写入错误),所以希望重装可以覆盖坏的文件以让软件重新工作。这是个不错的建议,但对于任何技术人员来说,不知道是什么地方出了问题都是令人沮丧的。更糟糕的是,如果不仔细跟踪,就不能保证所有的文件都会在重装过程中被刷新,因为通常没有办法知道一开始就删除了与应用程序一起安装的所有文件。有了软件包管理器,你可以强制彻底删除旧文件,以确保新文件的全新安装。同样重要的是,你可以考虑每个文件并可能找出导致问题的文件,但这是开源和 Linux 的一个特点,而不是包管理。
|
||||
|
||||
|
||||
#### 3\. 保持你应用的更新
|
||||
|
||||
不要让任何人告诉你,Linux 比其他操作系统“更安全”。计算机是由代码组成的,而我们人类每天都会以新的、有趣的方式找到利用这些代码的方法。因为 Linux 上的绝大多数应用都是开源的,所以许多漏洞都会以“公共漏洞和暴露” (CVE) 的形式公开。大量涌入的安全漏洞报告似乎是一件坏事,但这绝对是一个_知道_远比_不知道_好的案例。毕竟,没有人告诉你有问题,并不意味着没有问题。漏洞报告是好的。它们对每个人都有好处。而且,当开发人员修复安全漏洞时,对你而言,及时获得这些修复程序很重要,最好不要记住自己动手进行修复。
|
||||
|
||||
包管理器正是为了实现这一点而设计的。当应用收到更新时,无论是修补潜在的安全问题还是引入令人兴奋的新功能,你的包管理器应用都会提醒你可用的更新。
|
||||
|
||||
#### 4\. 保持轻便
|
||||
|
||||
假设你有应用 A 和应用 B,这两个应用都需要库 C。在某些操作系统上,通过得到 A 和 B,你得到了两个 C 的副本。这显然是多余的,所以想象一下,每个应用都会发生几次。冗余的库很快就会增加,而且由于对一个给定的库没有单一的“正确”来源,所以几乎不可能确保你使用的是最新的甚至只是一个一致的版本。
|
||||
|
||||
我承认我并不倾向于整天坐在这里琢磨软件库,但我确实记得我琢磨的日子,尽管我不知道这就是困扰我的原因。在我还没有改用 Linux 之前,我在处理工作用的媒体文件时遇到错误,或者在玩不同的游戏时出现故障,或者在阅读 PDF 时出现怪异,等等,这些都不是什么稀奇的事情。当时我花了很多时间去调查这些错误。我仍然记得,我的系统上有两个主要的应用分别捆绑了相同(但是不同)的图形后端技术。当一个程序的输出导入到另一个程序时,这种不匹配会导致错误。它本来是可以工作的,但是由于同一个库文件集合的旧版本中的一个错误,一个应用的热修复程序并没有给另一个应用带来好处。
|
||||
|
||||
包管理器知道每个应用需要哪些后端(被称为_依赖关系_),并且避免重新安装已经在你系统上的软件。
|
||||
|
||||
#### 5\. 保持简单
|
||||
|
||||
作为一个 Linux 用户,我很欣赏一个好的包管理器,因为它帮助我的生活变得简单。我不必考虑我安装的软件,我需要更新的东西,也不必考虑完成后是否真的将其卸载了。我毫不犹豫地试用软件。而当我在安装一台新电脑时,我运行[一个简单的 Ansible 脚本][4]来自动安装我所依赖的所有软件的最新版本。这很简单,很智能,也是一种独特的解放。
|
||||
|
||||
### 更好的包管理
|
||||
|
||||
Linux 从整体看待应用和操作系统。毕竟,开源是建立在其他开源工作基础上的,所以发行版维护者理解依赖_栈_的概念。Linux 上的包管理对你的整个系统、系统上的库和支持文件以及你安装的应用都有认识。这些不同的部分一起工作,为你提供一套高效、优化和强大的应用。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-package-management
|
||||
|
||||
作者:[Seth Kenlon][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://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
|
||||
[2]: http://flathub.org
|
||||
[3]: https://opensource.com/article/21/1/text-editor-roundup
|
||||
[4]: https://opensource.com/article/20/9/install-packages-ansible
|
Loading…
Reference in New Issue
Block a user