mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-01 21:50:13 +08:00
commit
b073bbb69f
125
published/20210308 How the ARPANET Protocols Worked.md
Normal file
125
published/20210308 How the ARPANET Protocols Worked.md
Normal file
@ -0,0 +1,125 @@
|
||||
[#]: subject: (How the ARPANET Protocols Worked)
|
||||
[#]: via: (https://twobithistory.org/2021/03/08/arpanet-protocols.html)
|
||||
[#]: author: (Two-Bit History https://twobithistory.org)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (Lin-vy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13643-1.html)
|
||||
|
||||
ARPANET 协议是如何工作的
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/03/130239ybmxjmixx3xbx7ix.jpg)
|
||||
|
||||
ARPANET 通过证明可以使用标准化协议连接完全不同的制造商的计算机,永远改变了计算。在我的 [关于 ARPANET 的历史意义的文章][1] 中,我提到了其中的一些协议,但没有详细描述它们。所以我想仔细看看它们。也想看看那些早期协议的设计有多少保留到了我们今天使用的协议中。
|
||||
|
||||
ARPANET 协议像我们现代的互联网协议,是通过分层形式来组织的。[^1] 较高层协议运行在较低层协议之上。如今的 TCP/IP 套件有 5 层(物理层、链路层、网络层、传输层以及应用层),但是这个 ARPANET 仅有 3 层,也可能是 4 层,这取决于你怎样计算它们。
|
||||
|
||||
我将会解释每一层是如何工作的,但首先,你需要知道是谁在 ARPANET 中构建了些什么,你需要知道这一点才能理解为什么这些层是这样划分的。
|
||||
|
||||
### 一些简短的历史背景
|
||||
|
||||
ARPANET 由美国联邦政府资助,确切的说是位于美国国防部的<ruby>高级研究计划局<rt>Advanced Research Projects Agency</rt></ruby>(因此被命名为 “ARPANET” )。美国政府并没有直接建设这个网络;而是,把这项工作外包给了位于波士顿的一家名为 “Bolt, Beranek, and Newman” 的咨询公司,通常更多时候被称为 BBN。
|
||||
|
||||
而 BBN 则承担了实现这个网络的大部分任务,但不是全部。BBN 所做的是设计和维护一种称为<ruby>接口消息处理机<rt>Interface Message Processor</rt></ruby>(简称为 IMP) 的机器。这个 IMP 是一种定制的<ruby>霍尼韦尔<rt>Honeywell</rt></ruby><ruby>小型机<rt>minicomputer</rt></ruby>,它们被分配给那些想要接入这个 ARPANET 的遍及全国各地的各个站点。它们充当通往 ARPANET 的网关,为每个站点提供多达四台主机的连接支持。它基本上是一台路由器。BBN 控制在 IMP 上运行的软件,把数据包从一个 IMP 转发到另一个 IMP ,但是该公司无法直接控制那些将要连接到 IMP 上并且成为 ARPANET 网络中实际主机的机器。
|
||||
|
||||
那些主机由网络中作为终端用户的计算机科学家们所控制。这些计算机科学家在全国各地的主机站负责编写软件,使主机之间能够相互通讯。而 IMP 赋予主机之间互相发送消息的能力,但是那并没有多大用处,除非主机之间能商定一种用于消息的格式。为了解决这个问题,一群杂七杂八的人员组成了网络工作组,其中有大部分是来自各个站点的研究生们,该组力求规定主机计算机使用的协议。
|
||||
|
||||
因此,如果你设想通过 ARPANET 进行一次成功的网络互动,(例如发送一封电子邮件),使这些互动成功的一些工程由一组人负责(BBN),然而其他的一些工程则由另一组人负责(网络工作组和在每个站点的工程师们)。这种组织和后勤方面的偶然性或许对推动采用分层的方法来管理 ARPANET 网络中的协议起到很大的作用,这反过来又影响了 TCP/IP 的分层方式。
|
||||
|
||||
### 好的,回到协议上来
|
||||
|
||||
![ARPANET Network Stack][3]
|
||||
|
||||
*ARPANET 协议层次结构*
|
||||
|
||||
这些协议层被组织成一个层次结构,在最底部是 “Level 0”。[^2] 这在某种意义上是不算数的,因为在 ARPANET 中这层完全由 BBN 控制,所以不需要标准协议。Level 0 的作用是管理数据在 IMP 之间如何传输。在 BBN 内部,有管理 IMP 如何做到这一点的规则;在 BBN 之外,IMP 子网是一个黑匣子,它只会传送你提供的任意数据。因此,Level 0 是一个没有真正协议的层,就公开已知和商定的规则集而言,它的存在可以被运行在 ARPANET 的主机上的软件忽略。粗略地说,它处理相当于当今使用的 TCP/IP 套件的物理层、链路层和网络层下的所有内容,甚至还包括相当多的传输层,这是我将在这篇文章的末尾回来讨论的内容。
|
||||
|
||||
“Level 1” 层在 ARPANET 的主机和它们所连接的 IMP 之间建立了接口。如果你愿意,可以认为它是为 BBN 构建的 “Level 0” 层的黑匣子使用的一个应用程序接口(API)。当时它也被称为 IMP-Host 协议。必须编写该协议并公布出来,因为在首次建立 ARPANET 网络时,每个主机站点都必须编写自己的软件来与 IMP 连接。除非 BBN 给他们一些指导,否则他们不会知道如何做到这一点。
|
||||
|
||||
BBN 在一份名为 [BBN Report 1822][5] 的冗长文件中规定了 IMP-Host 协议。随着 ARPANET 的发展,该文件多次被修订;我将在这里大致描述 IMP-Host 协议最初设计时的工作方式。根据 BBN 的规则,主机可以将长度不超过 8095 位的消息传递给它们的 IMP,并且每条消息都有一个包含目标主机号和链路识别号的头部字段。[^3] IMP 将检查指定的主机号,然后尽职尽责地将消息转发到网络中。当从远端主机接收到消息时,接收的 IMP 在将消息传递给本地主机之前会把目标主机号替换为源主机号。实际上在 IMP 之间传递的内容并不是消息 —— IMP 将消息分解成更小的数据包以便通过网络传输 —— 但该细节对主机来说是不可见的。
|
||||
|
||||
![1969 Host-IMP Leader][7]
|
||||
|
||||
*Host-IMP 消息头部格式,截至 1969。 图表来自 [BBN Report 1763][8]*
|
||||
|
||||
链路号的取值范围为 0 到 255 ,它有两个作用。一是更高级别的协议可以利用它在网络上的任何两台主机之间建立多个通信信道,因为可以想象得到,在任何时刻都有可能存在多个本地用户与同一个目标主机进行通信的场景(换句话说,链路号允许在主机之间进行多路通信)。二是它也被用在 “Level 1” 层去控制主机之间发送的大量流量,以防止高性能计算机压制低性能计算机的情况出现。按照最初的设计,这个 IMP-Host 协议限制每台主机在某一时刻通过某条链路仅发送一条消息。一旦某台主机沿着某条链路发送了一条消息给远端主机后,在它沿着该链路发送下一条消息之前,必须等待接收一条来自远端的 IMP 的特别类型的消息,叫做 RFNM(<ruby>请求下一条消息<rt>Request for Next Message</rt></ruby>)。后来为了提高性能,对该系统进行了修订,允许一台主机在给定的时刻传送多达 8 条消息给另一台主机。[^4]
|
||||
|
||||
“Level 2” 层才是事情真正开始变得有趣的地方,因为这一层和在它上面的那一层由 BBN 和国防部全部留给学者们和网络工作组自己去研发。“Level 2” 层包括了 Host-Host 协议,这个协议最初在 RFC9 中草拟,并且在 RFC54 中首次正式规定。在 [ARPANET 协议手册][10] 中有更易读的 Host-Host 协议的解释。
|
||||
|
||||
“Host-Host 协议” 管理主机之间如何创建和管理连接。“连接”是某个主机上的写套接字和另一个主机上的读套接字之间的一个单向的数据管道。“<ruby>套接字<rt>socket</rt></ruby>” 的概念是在 “Level-1” 层的有限的链路设施(记住,链路号只能是那 256 个值中的一个)之上被引入的,是为了给程序提供寻址运行在远端主机上的特定进程的一种方式。“读套接字” 是用偶数表示的,而“写套接字”是用奇数表示的;套接字是 “读” 还是 “写” 被称为套接字的 “性别”。并没有类似于 TCP 协议那样的 “端口号” 机制,连接的打开、维持以及关闭操作是通过主机之间使用 “链路 0” 发送指定格式的 Host-Host 控制消息来实现的,这也是 “链路 0” 被保留的目的。一旦在 “链路 0” 上交换控制消息来建立起一个连接后,就可以使用接收端挑选的另一个链路号来发送进一步的数据消息。
|
||||
|
||||
Host-Host 控制消息一般通过 3 个字母的助记符来表示。当两个主机交换一条 STR(<ruby>发送端到接收端<rt>sender-to-receiver</rt></ruby>)消息和一条配对的 RTS(<ruby>接收端到发送端<rt>receiver-to-sender</rt></ruby>)消息后,就建立起了一条连接 —— 这些控制消息都被称为请求链接消息。链接能够被 CLS(<ruby>关闭<rt>close</rt></ruby>)控制消息关闭。还有更多的控制信息能够改变从发送端到接收端发送消息的速率。从而再次需要确保较快的主机不会压制较慢的主机。在 “Level 1” 层上的协议提供了流量控制的功能,但对 “Level 2” 层来说显然是不够的;我怀疑这是因为从远端 IMP 接收到的 RFNM 只能保证远端 IMP 已经传送该消息到目标主机,而不能保证目标主机已经全部处理了该消息。还有 INR(<ruby>接收端中断<rt>interrupt-by-receiver</rt></ruby>)、INS(<ruby>发送端中断<rt>interrupt-by-sender</rt></ruby>)控制消息,主要供更高级别的协议使用。
|
||||
|
||||
更高级别的协议都位于 “Level 3”,这层是 ARPANET 的应用层。Telnet 协议,它提供到另一台主机的一个虚拟电传链接,其可能是这些协议中最重要的。但在这层中也有许多其他协议,例如用于传输文件的 FTP 协议和各种用于发送 Email 的协议实验。
|
||||
|
||||
在这一层中有一个不同于其他的协议:<ruby>初始链接协议<rt>Initial Connection Protocol</rt></ruby>(ICP)。ICP 被认为是一个 “Level-3” 层协议,但实际上它是一种 “Level-2.5” 层协议,因为其他 “Level-3” 层协议都依赖它。之所以需要 ICP,是因为 “Level 2” 层的 Host-Host 协议提供的链接只是单向的,但大多数的应用需要一个双向(例如:全双工)的连接来做任何有趣的事情。要使得运行在某个主机上的客户端能够连接到另一个主机上的长期运行的服务进程,ICP 定义了两个步骤。第一步是建立一个从服务端到客户端的单向连接,通过使用服务端进程的众所周知的套接字号来实现。第二步服务端通过建立的这个连接发送一个新的套接字套接字号给客户端。到那时,那个存在的连接就会被丢弃,然后会打开另外两个新的连接,它们是基于传输的套接字号建立的“读”连接和基于传输的套接字号加 1 的“写”连接。这个小插曲是大多数事务的一个前提——比如它是建立 Telnet 链接的第一步。
|
||||
|
||||
以上是我们逐层攀登了 ARPANET 协议层次结构。你们可能一直期待我在某个时候提一下 “<ruby>网络控制协议<rt>Network Control Protocol</rt></ruby>”(NCP) 。在我坐下来为这篇文章和上一篇文章做研究之前,我肯定认为 ARPANET 运行在一个叫 “NCP” 的协议之上。这个缩写有时用来指代整个 ARPANET 协议,这可能就是我为什么有这个想法的原因。举个例子,[RFC801][11] 讨论了将 ARPANET 从 “NCP” 过渡到 “TCP” 的方式,这使 NCP 听起来像是一个相当于 TCP 的 ARPANET 协议。但是对于 ARPANET 来说,从来都没有一个叫 “网络控制协议” 的东西(即使 [大英百科全书是这样认为的][12]),我怀疑人们错误地将 “NCP” 解释为 “<ruby>网络控制协议<rt>Network Control Protocol</rt></ruby>” ,而实际上它代表的是 “<ruby>网络控制程序<rt>Network Control Program</rt></ruby>” 。网络控制程序是一个运行在各个主机上的内核级别的程序,主要负责处理网络通信,等同于现如今操作系统中的 TCP/IP 协议栈。用在 RFC 801 的 “NCP” 是一种转喻,而不是协议。
|
||||
|
||||
### 与 TCP/IP 的比较
|
||||
|
||||
ARPANET 协议以后都会被 TCP/IP 协议替换(但 Telnet 和 FTP 协议除外,因为它们很容易就能在 TCP 上适配运行)。然而 ARPANET 协议都基于这么一个假设:就是网络是由一个单一实体(BBN)来构建和管理的。而 TCP/IP 协议套件是为网间网设计的,这是一个网络的网络,在那里一切都是不稳定的和不可靠的。这就导致了我们的现代协议套件和 ARPANET 协议有明显的不同,比如我们现在怎样区分网络层和传输层。在 ARPANET 中部分由 IMP 实现的类似传输层的功能现在完全由在网络边界的主机负责。
|
||||
|
||||
我发现 ARPANET 协议最有趣的事情是,现在在 TCP 中的许多传输层的功能是如何在 ARPANET 上经历了一个糟糕的青春期。我不是网络专家,因此我拿出大学时的网络课本(让我们跟着 Kurose 和 Ross 学习一下),他们对传输层通常负责什么给出了一个非常好的概述。总结一下他们的解释,一个传输层协议必须至少做到以下几点。这里的 “<ruby>段<rt>segment</rt></ruby>” 基本等同于 ARPANET 上的术语 “<ruby>消息<rt>message</rt></ruby>”:
|
||||
|
||||
* 提供进程之间的传送服务,而不仅仅是主机之间的(传输层多路复用和多路分解)
|
||||
* 在每个段的基础上提供完整性检查(即确保传输过程中没有数据损坏)
|
||||
|
||||
像 TCP 那样,传输层也能够提供可靠的数据传输,这意味着:
|
||||
|
||||
* “段” 是按顺序被传送的
|
||||
* 不会丢失任何 “段”
|
||||
* “段” 的传送速度不会太快以至于被接收端丢弃(流量控制)
|
||||
|
||||
似乎在 ARPANET 上关于如何进行多路复用和多路分解以便进程可以通信存在一些混淆 —— BBN 在 IMP-Host 层引入了链路号来做到这一点,但结果证明在 Host-Host 层上无论如何套接字号都是必要的。然后链路号只是用于 IMP-Host 级别的流量控制,但 BBN 似乎后来放弃了它,转而支持在唯一的主机对之间进行流量控制,这意味着链路号一开始是一个超载的东西,后来基本上变成了虚设。TCP 现在使用端口号代替,分别对每一个 TCP 连接单独进行流量控制。进程间的多路复用和多路分解完全在 TCP 内部进行,不会像 ARPANET 一样泄露到较低层去。
|
||||
|
||||
同样有趣的是,鉴于 Kurose 和 Ross 如何开发 TCP 背后的想法,ARPANET 一开始就采用了 Kurose 和 Ross 所说的一个严谨的 “<ruby>停止并等待<rt>stop-and-wait</rt></ruby>” 方法,来实现 IMP-Host 层上的可靠的数据传输。这个 “停止并等待” 方法发送一个 “段” 然后就拒绝再去发送更多 “段” ,直到收到一个最近发送的 “段” 的确认为止。这是一种简单的方法,但这意味着只有一个 “段” 在整个网络中运行,从而导致协议非常缓慢 —— 这就是为什么 Kurose 和 Ross 将 “停止并等待” 仅仅作为在通往功能齐全的传输层协议的路上的垫脚石的原因。曾有一段时间 “停止并等待” 是 ARPANET 上的工作方式,因为在 IMP–Host 层,必须接收到<ruby>请求下一条消息<rt>Request for Next Message</rt></ruby>(RFNM)以响应每条发出的消息,然后才能发送任何进一步的消息。客观的说 ,BBN 起初认为这对于提供主机之间的流量控制是必要的,因此减速是故意的。正如我已经提到的,为了更好的性能,RFNM 的要求后来放宽松了,而且 IMP 也开始向消息中添加序列号和保持对传输中的消息的 “窗口” 的跟踪,这或多或少与如今 TCP 的实现如出一辙。[^5]
|
||||
|
||||
因此,ARPANET 表明,如果你能让每个人都遵守一些基本规则,异构计算系统之间的通信是可能的。正如我先前所说的,这是 ARPANET 的最重要的遗产。但是,我希望对这些基线规则的仔细研究揭示了 ARPANET 协议对我们今天使用的协议有多大影响。在主机和 IMP 之间分担传输层职责的方式上肯定有很多笨拙之处,有时候是冗余的。现在回想起来真的很可笑,主机之间一开始只能通过给出的任意链路在某刻只发送一条消息。但是 ARPANET 实验是一个独特的机会,可以通过实际构建和操作网络来学习这些经验,当到了是时候升级到我们今天所知的互联网时,似乎这些经验变得很有用。
|
||||
|
||||
_如果你喜欢这篇贴子,更喜欢每四周发布一次的方式!那么在 Twitter 上关注 [@TwoBitHistory][14] 或者订阅 [RSS 提要][15],以确保你知道新帖子的发布时间。_
|
||||
|
||||
[^1]: 协议分层是网络工作组发明的。这个论点是在 [RFC 871][17] 中提出的。分层也是 BBN 如何在主机和 IMP 之间划分职责的自然延伸,因此 BBN 也值得称赞。
|
||||
[^2]: “level” 是被网络工作组使用的术语。 详见 [RFC 100][19]
|
||||
[^3]: 在 IMP-Host 协议的后续版本中,扩展了头部字段,并且将链路号升级为消息 ID。但是 Host-Host 协议仅仅继续使用消息 ID 字段的高位 8 位,并将其视为链路号。请参阅 [ARPANET 协议手册][10] 的 “Host-Host” 协议部分。
|
||||
[^4]: John M. McQuillan 和 David C. Walden。 “ARPA 网络设计决策”,第 284页,<https://www.walden-family.com/public/whole-paper.pdf>。 2021 年 3 月 8 日查看。
|
||||
[^5]: 同上。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://twobithistory.org/2021/03/08/arpanet-protocols.html
|
||||
|
||||
作者:[Two-Bit History][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Lin-vy](https://github.com/Lin-vy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://twobithistory.org
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://twobithistory.org/2021/02/07/arpanet.html
|
||||
[2]: tmp.szauPoOKtk#fn:1
|
||||
[3]: https://twobithistory.org/images/arpanet-stack.png
|
||||
[4]: tmp.szauPoOKtk#fn:2
|
||||
[5]: https://walden-family.com/impcode/BBN1822_Jan1976.pdf
|
||||
[6]: tmp.szauPoOKtk#fn:3
|
||||
[7]: https://twobithistory.org/images/host-imp-1969.png
|
||||
[8]: https://walden-family.com/impcode/1969-initial-IMP-design.pdf
|
||||
[9]: tmp.szauPoOKtk#fn:4
|
||||
[10]: http://mercury.lcs.mit.edu/~jnc/tech/arpaprot.html
|
||||
[11]: https://tools.ietf.org/html/rfc801
|
||||
[12]: https://www.britannica.com/topic/ARPANET
|
||||
[13]: tmp.szauPoOKtk#fn:5
|
||||
[14]: https://twitter.com/TwoBitHistory
|
||||
[15]: https://twobithistory.org/feed.xml
|
||||
[16]: https://twitter.com/TwoBitHistory/status/1358487195905064960?ref_src=twsrc%5Etfw
|
||||
[17]: https://tools.ietf.org/html/rfc871
|
||||
[18]: tmp.szauPoOKtk#fnref:1
|
||||
[19]: https://www.rfc-editor.org/info/rfc100
|
||||
[20]: tmp.szauPoOKtk#fnref:2
|
||||
[21]: tmp.szauPoOKtk#fnref:3
|
||||
[22]: tmp.szauPoOKtk#fnref:4
|
||||
[23]: tmp.szauPoOKtk#fnref:5
|
@ -0,0 +1,120 @@
|
||||
[#]: subject: "3 essential Linux cheat sheets for productivity"
|
||||
[#]: via: "https://opensource.com/article/21/4/linux-cheat-sheets"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "YungeG"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13662-1.html"
|
||||
|
||||
3 个提高生产力的必备 Linux 速查表
|
||||
======
|
||||
|
||||
> 下载 `sed`、`grep` 和 `parted` 的速查表来整合新的流程到你的工作中。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/09/121350vvha4adg77b77j7c.jpg)
|
||||
|
||||
Linux 因其命令闻名,部分原因是 Linux 执行的几乎所有操作都可以从终端调用;另一部分原因是 Linux 是一个高度模块化的操作系统,它的工具被设计用于产生十分确定的结果,在非常了解一些命令后,你可以将这些命令进行奇妙的组合,产生有用的输出。Linux 的学习过程一半是学习命令,另一半是学习如何将这些命令连成有意思的组合。
|
||||
|
||||
然而有这么多 Linux 命令需要学习,迈出第一步似乎令人望而生畏。应该先学习哪一个命令?有那些命令需要熟练掌握,又有哪些命令只需要浅尝辄止?认真考虑过这些问题后,我个人不相信有一个通用的答案。对所有人来说,“基本”命令很可能是相同的:
|
||||
|
||||
* `ls`
|
||||
* `cd`
|
||||
* `mv`
|
||||
|
||||
有这些命令你就可以浏览自己的 Linux 文件系统。
|
||||
|
||||
但是,除了基本命令,不同行业的“默认”命令有所不同。系统管理员需要 [系统自我检查和监测][2] 的工具;艺术家需要 [媒体转换][3] 和 [图形处理][4] 工具;家庭用户可能想要 [PDF 处理][5]、[日历][6]、[文档转换][7] 工具。这份列表无穷无尽。
|
||||
|
||||
然而一些 Linux 命令由于极其重要能够脱颖而出 —— 或者因为这些命令是每个人不时需要的常用的底层工具,或者因为这些命令是每个人在大多数时间都会觉得有用的万能工具。
|
||||
|
||||
这里有三个需要添加到你的列表中的命令。
|
||||
|
||||
### Sed
|
||||
|
||||
**用途:** `sed` 是一个任何 Linux 用户都可以从学习中获益的优良通用工具。从表面上看,它只是一个基于终端的“查找和替换”,能够简单快速地纠正多个文档。`sed` 命令为我节省了打开单个文件、寻找和替换一个单词、保存文件、关闭文件所需要的数个小时(也可能是数天)时间,仅此一条命令就证明了我在学习 Linux 终端的投入是合理的。一旦充分了解 `sed`,你很有可能发现一个使生活更加轻松的潜在编辑技巧世界。
|
||||
|
||||
**长处:** 命令的长处在于重复。如果你只有一个要编辑的文件,很容易在传统的 [文本编辑器][8]打开并进行“查找和替换”。然而,如果要替换 5 或 50 个文件,恰当地使用 `sed` 命令(可能结合 [GNU Parallel][9] 进行加速)可以帮你节省数个小时。
|
||||
|
||||
**不足:** 你需要权衡直接更改期望所花的时间和构建正确的 `sed` 命令可能需要的时间。使用常见的 `sed 's/foo/bar/g'` 语法所做的简单编辑通常值得上输入这些命令所花的时间;但是利用保持空间和任何 `ed` 形式子命令的复杂 `sed` 命令可能需要高度集中的注意力和多次的试错。事实证明,使用 `sed` 进行编辑通常是更好的方式。
|
||||
|
||||
**秘技:** 下载我们的 [sed 速查表][10] 获取命令的单字母子命令和语法概述的快速参考。
|
||||
|
||||
### Grep
|
||||
|
||||
**用途:** `grep` 一词来源于其公认的笨拙描述:全局正则表达式打印。换言之,在文件中(或者其他形式的输入中)找到的任何匹配模式,`grep` 都会打印到终端。这使得 `grep` 成为一个强大的搜索工具,尤其擅长处理大量的文本。
|
||||
|
||||
你可以使用 `grep` 查找 URL:
|
||||
|
||||
```
|
||||
$ grep --only-matching \
|
||||
http\:\/\/.* example.txt
|
||||
```
|
||||
|
||||
你可以使用 `grep` 查找一个特定的配置项:
|
||||
|
||||
```
|
||||
$ grep --line-number \
|
||||
foo= example.ini
|
||||
2:foo=true
|
||||
```
|
||||
|
||||
当然,你还可以将 `grep` 和其他命令组合:
|
||||
|
||||
```
|
||||
$ grep foo= example.ini | cut -d= -f2
|
||||
true
|
||||
```
|
||||
|
||||
**长处:** `grep` 是一个简单的搜索命令,如果你阅读了上面的例子,就已经基本有所了解。为了增强灵活性,你可以使用命令的扩展正则表达式语法。
|
||||
|
||||
**不足:** `grep` 的问题也是它的长处:它只有搜索功能。一旦你找到想要的内容,可能会面临一个更大的问题 —— 如何处理找到的内容。有时进行的处理可能简单如重定向输出到一个文件,作为过滤后的结果列表。但是,更复杂的使用场景可能需要对结果做进一步处理,或者使用许多类似 [awk][11]、[curl][12](凑巧的是,我们也有 [curl 速查表][13])的命令,或者使用现代计算机上你所拥有的数千个其他选项中的任何一个命令。
|
||||
|
||||
**秘技:** 下载我们的 [grep 速查表][14] 获取更多命令选项和正则表达式语法的快速参考。
|
||||
|
||||
### Parted
|
||||
|
||||
**用途:** GNU `parted` 不是一个常用命令,但它是最强大的硬盘操作工具之一。关于硬盘驱动器的沮丧事实是 —— 数年来你一直忽略它们,直到需要设置一个新的硬盘时,才会想起自己对于格式化驱动器的最好方式一无所知,而此时熟悉 `parted` 会十分有用。GNU `parted` 能够创建磁盘卷标,新建、备份、恢复分区。此外,你可以通过命令获取驱动器及其布局的许多信息,并为文件系统初始化驱动器。
|
||||
|
||||
**长处:** 我偏爱 `parted` 而不是 `fdisk` 等类似工具的原因在于它组合了简单的交互模式和完全的非交互选项。不管你如何使用 `parted`,它的命令符合相同的语法,其编写良好的帮助菜单包含了丰富的信息。更棒的是,命令本身是 _智能_ 的 —— 给一个驱动器分区时,你可以用扇区和百分比指明分区的大小,`parted` 会尽可能计算出更精细的位置存放分区表。
|
||||
|
||||
**不足:** 在很长一段时间内我不清楚驱动器的工作原理,因此切换到 Linux 后,我花费了很长时间学习 GNU `parted`。GNU `parted` 和大多数终端磁盘工具假定你已经知晓什么是一个分区、驱动器由扇区组成、初始时驱动器缺少文件系统,需要磁盘卷标和分区表等等知识。硬盘驱动器的基础而不是命令本身的学习曲线十分陡峭,而 GNU `parted` 并没有做太多的努力来弥补潜在的认知差距。可以说,带你完成磁盘驱动器的基础知识学习不是命令的职责,因为有类似的 [图形应用][15],但是一个聚焦于工作流程的选项对于 GNU `parted` 可能是一个有用的附加功能。
|
||||
|
||||
**秘技:** 下载我们的 [parted 速查表][16] 获取大量子命令和选项的快速参考。
|
||||
|
||||
### 了解更多
|
||||
|
||||
这是一些我最喜欢的命令列表,但是其中的命令自然取决于我如何使用自己的计算机。我编写很多命令解释器脚本,因此频繁地使用 `grep` 查找配置选项,通过 `sed` 编辑文本。我还会用到 `parted`,因为处理多媒体项目时,通常涉及很多硬盘驱动器。你可能已经开发了,或者很快就要使用最喜欢的(至少是 _频繁使用的_)命令开发自己的工作流程。
|
||||
|
||||
整合新的流程到日常工作时,我会创建或者下载一个速查表(就像上面的链接),然后进行练习。我们都有自己的学习方式,找出最适合你的方式,学习一个新的必需命令。你对最常使用的命令了解越多,你就越能充分地使用它们。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/4/linux-cheat-sheets
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[YungeG](https://github.com/YungeG)
|
||||
校对:[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/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC "Hand putting a Linux file folder into a drawer"
|
||||
[2]: https://opensource.com/life/16/2/open-source-tools-system-monitoring
|
||||
[3]: https://opensource.com/article/17/6/ffmpeg-convert-media-file-formats
|
||||
[4]: https://opensource.com/article/17/8/imagemagick
|
||||
[5]: https://opensource.com/article/20/8/reduce-pdf
|
||||
[6]: https://opensource.com/article/19/4/calendar-git
|
||||
[7]: https://opensource.com/article/20/5/pandoc-cheat-sheet
|
||||
[8]: https://opensource.com/article/21/2/open-source-text-editors
|
||||
[9]: https://opensource.com/article/18/5/gnu-parallel
|
||||
[10]: https://opensource.com/downloads/sed-cheat-sheet
|
||||
[11]: https://opensource.com/article/20/9/awk-ebook
|
||||
[12]: https://www.redhat.com/sysadmin/social-media-curl
|
||||
[13]: https://opensource.com/article/20/5/curl-cheat-sheet
|
||||
[14]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[15]: https://opensource.com/article/18/11/partition-format-drive-linux#gui
|
||||
[16]: https://opensource.com/downloads/parted-cheat-sheet
|
@ -3,51 +3,48 @@
|
||||
[#]: author: "Peter Gervase https://opensource.com/users/pgervase"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13650-1.html"
|
||||
|
||||
使用 Linux 安全工具进行渗透测试
|
||||
======
|
||||
使用 Kali Linux 和其他开源工具来发现系统中的安全漏洞和弱点。
|
||||
![Magnifying glass on code][1]
|
||||
|
||||
大量广泛报道的大型消费企业入侵事件凸显了系统安全管理的重要性。幸运的是,有许多不同的应用程序可以帮助保护计算机系统。其中一个是 [Kali][2],一个为安全和渗透测试而开发的 Linux 发行版。本文演示了如何使用 Kali Linux 来审视你的系统以发现威胁。
|
||||
> 使用 Kali Linux 和其他开源工具来发现系统中的安全漏洞和弱点。
|
||||
|
||||
Kali 安装了很多工具,它们都是开源的,默认情况下安装它们会让事情变得更容易。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/05/111124w66lpuzsc467nlv1.jpg)
|
||||
|
||||
众多被广泛报道的大型消费企业入侵事件凸显了系统安全管理的重要性。幸运的是,有许多不同的应用程序可以帮助保护计算机系统。其中一个是 [Kali][2],一个为安全和渗透测试而开发的 Linux 发行版。本文演示了如何使用 Kali Linux 来审视你的系统以发现弱点。
|
||||
|
||||
Kali 安装了很多工具,它们都是开源的,默认情况下安装了它们会让事情变得更容易。
|
||||
|
||||
(LCTT 译注:Kali 及其携带工具只应该用于对自己拥有合法审查权利的系统和设备,任何未经授权的扫描、渗透和攻击均是违法的。本文作者、译者均不承担任何非授权使用的结果。)
|
||||
|
||||
![Kali's tools][3]
|
||||
|
||||
(Peter Gervase, [CC BY-SA 4.0][4])
|
||||
|
||||
本文使用的系统是:
|
||||
|
||||
1. `kali.usersts.redhat.com`:我会启动扫描和攻击的系统。它拥有 30GB 内存和 6 个虚拟 CPU(vCPU)。
|
||||
2. `vulnerable.usersys.redhat.com`: Red Hat 企业版 Linux 8 系统,它也会成为目标。它拥有 16GB 内存和 6 个 vCPU。它是一个相对较新的系统,但有些软件包可能已经过时。
|
||||
3. 这个系统还将包括 `httpd-2.4.37-30.module+el8.3.0+7001+0766b9e7.x86_64`、 `mariadb-server-10.3.27-3.module+el8.3.0+8972+5e3224e9.x86_64`、 `tigervnc-server-1.9.0-15.el8_1.x86_64`、 `vsftpd-3.0.3-32.el8.x86_64` 和一个 5.6.1 版本的 WordPress。
|
||||
1. `kali.usersts.redhat.com`:这是我将用来启动扫描和攻击的系统。它拥有 30GB 内存和 6 个虚拟 CPU(vCPU)。
|
||||
2. `vulnerable.usersys.redhat.com`: 这是一个 Red Hat 企业版 Linux 8 系统,它会成为目标。它拥有 16GB 内存和 6 个 vCPU。它是一个相对较新的系统,但有些软件包可能已经过时。
|
||||
3. 这个系统包括 `httpd-2.4.37-30.module+el8.3.0+7001+0766b9e7.x86_64`、 `mariadb-server-10.3.27-3.module+el8.3.0+8972+5e3224e9.x86_64`、 `tigervnc-server-1.9.0-15.el8_1.x86_64`、 `vsftpd-3.0.3-32.el8.x86_64` 和一个 5.6.1 版本的 WordPress。
|
||||
|
||||
我在上面列出了硬件规格,因为一些任务要求很高,尤其是在运行 WordPress 安全扫描程序([WPScan][5])时对目标系统 CPU 的要求。
|
||||
|
||||
### 探测你的系统
|
||||
|
||||
首先,我会在目标系统上进行基本的 Nmap 扫描(你可以阅读[使用 Nmap 结果帮助加固 Linux 系统][6]一文来更深入地了解 Nmap)。Nmap 扫描是一种快速的方法,可以大致了解被测系统中哪些端口和服务是暴露的。
|
||||
首先,我会在目标系统上进行基本的 Nmap 扫描(你可以阅读 [使用 Nmap 结果帮助加固 Linux 系统][6] 一文来更深入地了解 Nmap)。Nmap 扫描是一种快速的方法,可以大致了解被测系统中哪些端口和服务是暴露的。
|
||||
|
||||
![Nmap scan][7]
|
||||
|
||||
(Peter Gervase, [CC BY-SA 4.0][4])
|
||||
|
||||
默认扫描显示有几个你可能感兴趣的开放端口。实际上,任何开放端口都可能成为攻击者破坏你网络的一种方式。在本例中,端口 21、22、80 和 443 很容易扫描,因为它们是常用服务的端口。在这个早期阶段,我只是在做侦察工作,尽可能多地获取有关目标系统的信息。
|
||||
默认扫描显示有几个你可能感兴趣的开放端口。实际上,任何开放端口都可能成为攻击者破坏你网络的一种方式。在本例中,端口 21、22、80 和 443 是不错的扫描对象,因为它们是常用服务的端口。在这个早期阶段,我只是在做侦察工作,尽可能多地获取有关目标系统的信息。
|
||||
|
||||
我想用 Nmap 侦察 80 端口,所以我使用 `-p 80` 参数来查看端口 80,`-A` 参数来获取操作系统和应用程序版本等信息。
|
||||
|
||||
![Nmap scan of port 80][8]
|
||||
|
||||
(Peter Gervase, [CC BY-SA 4.0][4])
|
||||
|
||||
关键信息有:
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
PORT STATE SERVICE VERSION
|
||||
80/tcp open http Apache httpd 2.4.37 ((Red Hat Enterprise Linux))
|
||||
|_http-generator: WordPress 5.6.1
|
||||
@ -55,25 +52,24 @@ PORT STATE SERVICE VERSION
|
||||
|
||||
现在我知道了这是一个 WordPress 服务器,我可以使用 WPScan 来获取有关潜在威胁的信息。一个很好的侦察方法是尝试找到一些用户名,使用 `--enumerate u` 告诉 WPScan 在 WordPress 实例中查找用户名。例如:
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
┌──(root💀kali)-[~]
|
||||
└─# wpscan --url vulnerable.usersys.redhat.com --enumerate u
|
||||
_______________________________________________________________
|
||||
__ _______ _____
|
||||
\ \ / / __ \ / ____|
|
||||
\ \ /\ / /| |__) | (___ ___ __ _ _ __ ®
|
||||
\ \/ \/ / | ___/ \\___ \ / __|/ _` | '_ \
|
||||
\ /\ / | | ____) | (__| (_| | | | |
|
||||
\/ \/ |_| |_____/ \\___|\\__,_|_| |_|
|
||||
__ _______ _____
|
||||
\ \ / / __ \ / ____|
|
||||
\ \ /\ / /| |__) | (___ ___ __ _ _ __ ®
|
||||
\ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \
|
||||
\ /\ / | | ____) | (__| (_| | | | |
|
||||
\/ \/ |_| |_____/ \___|\__,_|_| |_|
|
||||
|
||||
WordPress Security Scanner by the WPScan Team
|
||||
Version 3.8.10
|
||||
Sponsored by Automattic - <https://automattic.com/>
|
||||
@_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
|
||||
WordPress Security Scanner by the WPScan Team
|
||||
Version 3.8.10
|
||||
Sponsored by Automattic - https://automattic.com/
|
||||
@_WPScan_, @ethicalhack3r, @erwan_lr, @firefart
|
||||
_______________________________________________________________
|
||||
|
||||
[+] URL: <http://vulnerable.usersys.redhat.com/> [10.19.47.242]
|
||||
[+] URL: http://vulnerable.usersys.redhat.com/ [10.19.47.242]
|
||||
[+] Started: Tue Feb 16 21:38:49 2021
|
||||
|
||||
Interesting Finding(s):
|
||||
@ -81,37 +77,35 @@ Interesting Finding(s):
|
||||
[i] User(s) Identified:
|
||||
|
||||
[+] admin
|
||||
| Found By: Author Posts - Display Name (Passive Detection)
|
||||
| Confirmed By:
|
||||
| Author Id Brute Forcing - Author Pattern (Aggressive Detection)
|
||||
| Login Error Messages (Aggressive Detection)
|
||||
| Found By: Author Posts - Display Name (Passive Detection)
|
||||
| Confirmed By:
|
||||
| Author Id Brute Forcing - Author Pattern (Aggressive Detection)
|
||||
| Login Error Messages (Aggressive Detection)
|
||||
|
||||
[+] pgervase
|
||||
| Found By: Author Posts - Display Name (Passive Detection)
|
||||
| Confirmed By:
|
||||
| Author Id Brute Forcing - Author Pattern (Aggressive Detection)
|
||||
| Login Error Messages (Aggressive Detection)
|
||||
| Found By: Author Posts - Display Name (Passive Detection)
|
||||
| Confirmed By:
|
||||
| Author Id Brute Forcing - Author Pattern (Aggressive Detection)
|
||||
| Login Error Messages (Aggressive Detection)
|
||||
```
|
||||
|
||||
显示有两个用户:`admin` 和 `pgervase`。我将尝试使用密码字典来猜测 `admin` 的密码。密码字典是一个包含很多密码的文本文件。我使用的字典大小有 37G,有 3,543,076,137 行。
|
||||
这显示有两个用户:`admin` 和 `pgervase`。我将尝试使用密码字典来猜测 `admin` 的密码。密码字典是一个包含很多密码的文本文件。我使用的字典大小有 37G,有 3,543,076,137 行。
|
||||
|
||||
就像你可以选择不同的文本编辑器、Web 浏览器和其他应用程序 一样,也有很多工具可以启动密码攻击。下面是两个使用 Nmap 和 WPScan 的示例命令:
|
||||
|
||||
|
||||
```shell
|
||||
```
|
||||
# nmap -sV --script http-wordpress-brute --script-args userdb=users.txt,passdb=/path/to/passworddb,threads=6 vulnerable.usersys.redhat.com
|
||||
```
|
||||
|
||||
```bash
|
||||
```
|
||||
# wpscan --url vulnerable.usersys.redhat.com --passwords /path/to/passworddb --usernames admin --max-threads 50 | tee nmap.txt
|
||||
```
|
||||
|
||||
这个 Nmap 脚本是我使用的许多脚本之一,使用 WPScan 扫描 URL 只是这个工具可以完成的许多任务之一。你可以决定你喜欢的那一个。
|
||||
这个 Nmap 脚本是我使用的许多脚本之一,使用 WPScan 扫描 URL 只是这个工具可以完成的许多任务之一。你可以用你喜欢的那一个。
|
||||
|
||||
WPScan 示例在文件末尾显示了密码:
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
┌──(root💀kali)-[~]
|
||||
└─# wpscan --url vulnerable.usersys.redhat.com --passwords passwords.txt --usernames admin
|
||||
_______________________________________________________________
|
||||
@ -133,7 +127,7 @@ _______________________________________________________________
|
||||
|
||||
Interesting Finding(s):
|
||||
|
||||
…..
|
||||
......
|
||||
|
||||
[+] Performing password attack on Wp Login against 1 user/s
|
||||
Trying admin / redhat Time: 00:01:57 <==================================================================================================================> (3231 / 3231) 100.00% Time: 00:01:57
|
||||
@ -155,13 +149,12 @@ Trying admin / redhat Time: 00:01:57 <==========================================
|
||||
[+] Elapsed time: 00:02:02
|
||||
```
|
||||
|
||||
在末尾的有效组合部分包含管理员用户名和密码,3231 行只用了两分钟。
|
||||
在末尾的“找到有效组合”部分包含了管理员用户名和密码,3231 行只用了两分钟。
|
||||
|
||||
我还有另一个字典文件,其中包含 3,238,659,984 行,使用它花费的时间更长并且会留下更多的证据。
|
||||
|
||||
使用 Nmap 可以更快地产生结果:
|
||||
|
||||
|
||||
```
|
||||
┌──(root💀kali)-[~]
|
||||
└─# nmap -sV --script http-wordpress-brute --script-args userdb=users.txt,passdb=password.txt,threads=6 vulnerable.usersys.redhat.com
|
||||
@ -196,23 +189,22 @@ Nmap done: 1 IP address (1 host up) scanned in 7.68 seconds
|
||||
|
||||
然而,运行这样的扫描可能会在目标系统上留下大量的 HTTPD 日志消息:
|
||||
|
||||
```
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:01 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:02 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:02 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:02 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "http://vulnerable.usersys.redhat.com/" "WPScan v3.8.10 (https://wpscan.org/)"
|
||||
|
||||
```shell
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:01 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:00 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:02 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:02 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
10.19.47.170 - - [18/Feb/2021:20:14:02 -0500] "POST /wp-login.php HTTP/1.1" 200 7575 "<http://vulnerable.usersys.redhat.com/>" "WPScan v3.8.10 (<https://wpscan.org/>)"
|
||||
```
|
||||
|
||||
为了获得关于在最初的 Nmap 扫描中发现的 HTTPS 服务器的信息,我使用了 `sslscan` 命令:
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
┌──(root💀kali)-[~]
|
||||
└─# sslscan vulnerable.usersys.redhat.com
|
||||
Version: 2.0.6-static
|
||||
@ -234,8 +226,7 @@ TLSv1.3 enabled
|
||||
|
||||
它显示了有关启用的 SSL 协议的信息,在最下方,是关于 Heartbleed 漏洞的信息:
|
||||
|
||||
|
||||
```bash
|
||||
```
|
||||
Heartbleed:
|
||||
TLSv1.3 not vulnerable to heartbleed
|
||||
TLSv1.2 not vulnerable to heartbleed
|
||||
@ -246,15 +237,13 @@ TLSv1.2 not vulnerable to heartbleed
|
||||
有很多方法可以保护你的系统免受大量攻击。几个关键点是:
|
||||
|
||||
* **了解你的系统:**包括了解哪些端口是开放的,哪些端口应该开放,谁应该能够看到这些开放的端口,以及使用这些端口服务的预期流量是多少。Nmap 是了解网络系统的一个绝佳工具。
|
||||
* **使用最新的最佳实践:** 现在的最佳实践可能不是未来的最佳实践。作为管理员,了解信息安全领域的最新趋势非常重要。
|
||||
* **使用当前的最佳实践:** 现在的最佳实践可能不是未来的最佳实践。作为管理员,了解信息安全领域的最新趋势非常重要。
|
||||
* **知道如何使用你的产品:** 例如,与其让攻击者不断攻击你的 WordPress 系统,不如阻止他们的 IP 地址并限制尝试登录的次数。在现实世界中,阻止 IP 地址可能没有那么有用,因为攻击者可能会使用受感染的系统来发起攻击。但是,这是一个很容易启用的设置,可以阻止一些攻击。
|
||||
* **维护和验证良好的备份:** 如果攻击者攻击了一个或多个系统,能从已知的良好和干净的备份中重新构建可以节省大量时间和金钱。
|
||||
* **检查日志:** 如上所示,扫描和渗透命令可能会留下大量日志,这表明攻击者正在攻击系统。如果你注意到它们,可以采取先发制人的行动来降低风险。
|
||||
* **更新系统、应用程序和任何额外的模块:** 正如 [NIST Special Publication 800-40r3][9] 所解释的那样,“补丁通常是减轻软件缺陷漏洞最有效的方法,而且通常是唯一完全有效的解决方案。”
|
||||
* **更新系统、应用程序和任何额外的模块:** 正如 [NIST Special Publication 800-40r3][9] 所解释的那样,“补丁通常是减轻软件缺陷漏洞最有效的方法,而且通常是唯一完全有效的解决方案。”
|
||||
* **使用供应商提供的工具:** 供应商有不同的工具来帮助你维护他们的系统,因此一定要充分利用它们。例如,红帽企业 Linux 订阅中包含的 [Red Hat Insights][10] 可以帮助你优化系统并提醒你注意潜在的安全威胁。
|
||||
|
||||
|
||||
|
||||
### 了解更多
|
||||
|
||||
本文对安全工具及其使用方法的介绍只是冰山一角。深入了解的话,你可能需要查看以下资源:
|
||||
@ -265,8 +254,6 @@ TLSv1.2 not vulnerable to heartbleed
|
||||
* [NIST 网络安全页面][14]
|
||||
* [使用 Nmap 结果来帮助加固 Linux 系统][6]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/linux-security-tools
|
||||
@ -274,7 +261,7 @@ via: https://opensource.com/article/21/5/linux-security-tools
|
||||
作者:[Peter Gervase][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -288,7 +275,7 @@ via: https://opensource.com/article/21/5/linux-security-tools
|
||||
[6]: https://www.redhat.com/sysadmin/using-nmap-harden-systems
|
||||
[7]: https://opensource.com/sites/default/files/uploads/nmap-scan.png "Nmap scan"
|
||||
[8]: https://opensource.com/sites/default/files/uploads/nmap-port80.png "Nmap scan of port 80"
|
||||
[9]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-40r3.pdf%5D(https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-40r3.pdf
|
||||
[9]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-40r3.pdf
|
||||
[10]: https://www.redhat.com/sysadmin/how-red-hat-insights
|
||||
[11]: https://en.wikipedia.org/wiki/Armitage_(computing)
|
||||
[12]: https://access.redhat.com/security
|
@ -0,0 +1,107 @@
|
||||
[#]: subject: (Windows 11 Look Inspired by KDE Plasma and GNOME?)
|
||||
[#]: via: (https://www.debugpoint.com/2021/06/windows-11-inspiration-linux-kde-plasma/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (imgradeone)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13653-1.html)
|
||||
|
||||
Windows 11 的外观受到了 KDE Plasma 和 GNOME 的启发吗?
|
||||
======
|
||||
|
||||
> 截图显示,微软即将发布的 Windows 11 操作系统与我们所心爱的 KDE Plasma 和 GNOME 有许多相似之处。它们到底有多相似呢?我们试着比较了一下。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/06/103308cfoo3xoz2c002hx2.jpg)
|
||||
|
||||
我曾记得一句俗话 —— “<ruby>优秀者模仿,伟大者剽窃<rt>Good artists copy. Great artists steal</rt></ruby>”。我不认识 Windows 11 背后的设计团队,但他们似乎很大程度上受到了 Linux 桌面的影响。如果你回顾近几年来的 Windows 系统外观 —— 从 Windows XP 到 7,再到 10 —— 整体视觉上都没有什么太大的变化,直到今天为止。
|
||||
|
||||
Windows 操作系统的新版本通常有 5 到 7 年的生命周期。如果你试着回想 Windows 提供给你的个性化选项,你会发现这些选项近几年来基本都是一致的,甚至包括开始菜单位置、宽度、颜色在内的桌面整体的体验,一切都没变过。
|
||||
|
||||
但随着 Windows 11 的全新外观,这一点终于改变了。让我带你看一些我之前所见过的截图,并且分析一下,它们到底和流行的 Linux [桌面环境][1](如 KDE Plasma 和 GNOME)有多相似。
|
||||
|
||||
### Windows 11 的外观受到了 KDE Plasma 和 GNOME 的启发?
|
||||
|
||||
#### 开始菜单和任务栏
|
||||
|
||||
传统的开始菜单和任务栏主题在 Windows 11 上有所变化。开始菜单和任务栏图标位于任务栏中央(默认视图)。Windows 也在设置中提供了将任务栏图标和开始菜单移回左侧的选项。
|
||||
|
||||
![Windows 11 – 浅色模式下的开始菜单][2]
|
||||
|
||||
整体的布局方式和默认图标的色彩让我想起了 KDE Plasma 的任务栏和启动器。这些图标很精致,并且居中,给你带来一种类似 GNOME 上 Adwaita 图标的观感,而任务栏就更像是 KDE Plasma 的任务栏。
|
||||
|
||||
当你打开开始菜单后,它为你提供不同的图标和选项的排列方式。此外,当你开始打字时,顶部的搜索选项就会弹出。
|
||||
|
||||
现在,来看看全新设计的 KDE Plasma 启动器。我知道间距、图标大小和清晰度并不完全一致,但你可以看到,两者看起来有多么惊人的相似。
|
||||
|
||||
![KDE Plasma 5.22 亮色模式下的启动器][3]
|
||||
|
||||
如果你正在使用 GNOME 或 Xfce 桌面,借助 [Arc Menu][4] 和一些小修改,你可以让两者看上去完全一致。
|
||||
|
||||
![修改过的 Arc Menu][5]
|
||||
|
||||
#### 窗口装饰
|
||||
|
||||
按照传统,GNOME 总是用圆角作为标准的窗口装饰。作为对照,Windows 则一直采用直角作为窗口装饰 —— 似乎一直都这样,直到现在为止。嗯,在 Windows 11 中,所有窗口装饰都是圆角,看起来很好。圆角的概念不是什么版权专利或者新想法,这就有一个问题了,为什么现在全都在用圆角?是有什么隐藏的目的吗?
|
||||
|
||||
![Windows 资源管理器和 Nautilus 的圆角][6]
|
||||
|
||||
哦,还记得 GNOME 的应用程序菜单的小指示器吗?这些小点提示着这里到底有多少页的应用程序。Windows 11 似乎也使用了这种这种思路。
|
||||
|
||||
![标记页面数量的小点][7]
|
||||
|
||||
#### 调色盘
|
||||
|
||||
Windows 多年来始终有基于“蓝色”或其他蓝色变体的主题。虽然用户可以自行更改任务栏、开始菜单背景、窗口标题栏颜色,但借助这个选项,调色板与亮暗模式结合,展示出巨大变化,给 Windows 桌面带来了更圆滑、迷人的外观。也许这个灵感源自 Ubuntu、KDE 或者其它风格的调色板。
|
||||
|
||||
#### 暗黑模式
|
||||
|
||||
Windows 11 首次官方支持了暗黑模式,或者说是暗色主题。那么,我就直接在下面放两张截图,由大家自己评判。左侧是 Windows 11 暗黑模式下的开始菜单,右侧是使用了 Breeze Dark 主题的 KDE Plasma。
|
||||
|
||||
![Windows 11 开始菜单与 KDE Plasma 的比较][9]
|
||||
|
||||
#### 全新桌面小组件
|
||||
|
||||
灵感的启发从来不会停止。还记得 KDE Plasma 的小组件吗?其实,这也不是什么新概念,然而小组件已经出现在 Windows 11。这是全新小组件面板的截图。你可以添加、移除或者重新排序这些小组件。
|
||||
|
||||
![小组件菜单][10]
|
||||
|
||||
这些只是吸引我眼球的冰山一角。也许 Windows 11 还有许多“灵感”来“启发”它的外观。
|
||||
|
||||
但问题来了 —— 为什么现在是一次推出这些功能和外观的最佳时机?
|
||||
|
||||
### 结束语
|
||||
|
||||
实话实说,当我第一次看到 Windows 11 的新外观时,我脑袋里就浮现出 Breeze Dark 主题的 KDE Plasma。借助很少量的修改,你可以让 KDE Plasma 看上去像 Windows 11。这本身就说明了它们两者是有多么地相似。
|
||||
|
||||
如果你看向整个桌面操作系统的市场,竞争者只有 Windows、Linux 桌面和 macOS。至今为止,它们的外观都有明显的标志性特征,例如 macOS 有自己独一无二的外观。直到现在,Windows 也有一样的蓝色主题的常规开始菜单,等等。但借助这些新变化,Windows 为用户提供了更丰富的定制选项,让它看上去更像 Linux 桌面。
|
||||
|
||||
在我个人看来,Windows 团队需要一种不同的标志性特征,而不是一直从我们心爱的 Linux 桌面获得“启发”。
|
||||
|
||||
我不知道未来会发生什么,但现在看来,“E-E-E” 还在竭尽全力运作。(LCTT 译注:“E-E-E”是微软臭名昭著的<ruby>拥抱、扩展再消灭<rt>Embrace, extend, and extinguish</rt></ruby>策略。)
|
||||
|
||||
再会。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/06/windows-11-inspiration-linux-kde-plasma/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[imgradeone](https://github.com/imgradeone)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/category/desktop-environment
|
||||
[2]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Windows-11-Start-menu-in-light-mode.jpg
|
||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/KDE-Plasma-5.22-Launcher-in-Light-mode.jpg
|
||||
[4]: https://gitlab.com/LinxGem33/Arc-Menu
|
||||
[5]: https://www.debugpoint.com/blog/wp-content/uploads/2020/12/gnomecustomize2020-2-1024x576.jpg
|
||||
[6]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Rounded-Corners-in-Windows-Explorer-and-Nautilus-1024x716.jpg
|
||||
[7]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Dots-in-paging-1024x468.jpg
|
||||
[8]: https://www.debugpoint.com/2021/06/windows-11-system-requirement/
|
||||
[9]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Comparison-of-Windows-11-Start-Menu-and-KDE-Plasma-1024x505.jpg
|
||||
[10]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Widgets-menu-1024x833.jpg
|
@ -3,23 +3,24 @@
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "turbokernel"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13649-1.html"
|
||||
|
||||
Python 读写文件
|
||||
使用 Python 读写文件
|
||||
======
|
||||
每种编程语言处理数据文件的方式都不同,Python 是这么干的。
|
||||
![Hands on a keyboard with a Python book ][1]
|
||||
|
||||
有些数据是临时的,它们在应用程序运行时存储在 RAM 中,然后丢弃。但是有些数据是持久的。它们存储在硬盘驱动器上供以后使用,而且它们通常是用户最关心的东西。对于程序员来说,编写代码读写文件是很常见的,但每种语言处理这个任务的方式都有些不同。本文演示了如何使用 Python 处理数据文件。
|
||||
> 每种编程语言处理文件数据的方式不尽相同,Python 是这么干的。
|
||||
|
||||
### 安装Python
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/05/094700u9kj42rn4jh5h4hr.jpg)
|
||||
|
||||
在 Linux 上,你可能已经安装了 Python。如果没有,你可以从发行版软件仓库安装它。例如,在 CentOS 或 RHEL 上:
|
||||
有些数据是临时的,它们在应用程序运行时存储在内存中,然后丢弃。但是有些数据是持久的。它们存储在硬盘驱动器上供以后使用,而且它们通常是用户最关心的东西。对于程序员来说,编写代码读写文件是很常见的,但每种语言处理该任务的方式都不同。本文演示了如何使用 Python 处理文件数据。
|
||||
|
||||
### 安装 Python
|
||||
|
||||
```bash
|
||||
在 Linux 上,你可能已经安装了 Python。如果没有,你可以通过发行版软件仓库安装它。例如,在 CentOS 或 RHEL 上:
|
||||
|
||||
```
|
||||
$ sudo dnf install python3
|
||||
```
|
||||
|
||||
@ -31,39 +32,37 @@ $ sudo dnf install python3
|
||||
|
||||
如果你需要向一个文件中写入数据,记住有三个步骤:
|
||||
|
||||
1. Open
|
||||
2. Write
|
||||
3. Close
|
||||
1. 打开
|
||||
2. 写入
|
||||
3. 关闭
|
||||
|
||||
这与你在计算机上写代码、编辑照片或执行其他操作时使用的步骤完全相同。首先,打开要编辑的文档,然后进行编辑,最后关闭文档。
|
||||
这与你在计算机上编码、编辑照片或执行其他操作时使用的步骤完全相同。首先,打开要编辑的文档,然后进行编辑,最后关闭文档。
|
||||
|
||||
在 Python 中,过程是这样的:
|
||||
|
||||
|
||||
```python
|
||||
```
|
||||
f = open('example.txt', 'w')
|
||||
f.write('hello world')
|
||||
f.close()
|
||||
```
|
||||
|
||||
这个例子中,第一行以**写**模式打开了一个文件,然后用变量 `f` 表示,我使用了 `f` 是因为它在 Python 代码中很常见,但其他任意有效变量名也能正常工作。
|
||||
这个例子中,第一行以**写**模式打开了一个文件,然后用变量 `f` 表示,我使用了 `f` 是因为它在 Python 代码中很常见,使用其他任意有效变量名也能正常工作。
|
||||
|
||||
在打开文件时,有不同的模式:
|
||||
|
||||
* **w** 代表写入
|
||||
* **r+** 代表可读可写
|
||||
* **a** 表示追加
|
||||
* `w` 代表写入
|
||||
* `r+` 代表可读可写
|
||||
* `a` 表示追加
|
||||
|
||||
第二行表示向文件中写入数据,本例写入的是纯文本,但你可以写入任意类型的数据。
|
||||
|
||||
最后一行关闭了文件。
|
||||
|
||||
### 使用 'with' 语法写入数据
|
||||
#### 使用 `with` 语法写入数据
|
||||
|
||||
有一种简短的方法可以写入数据,对于快速的文件交互很有用。它不会使文件保持打开状态,所以你不必记得调用 **close()** 函数。相反,它使用 **with** 语法:
|
||||
对于快速的文件交互,常用有一种简短的方法可以写入数据。它不会使文件保持打开状态,所以你不必记得调用 `close()` 函数。相反,它使用 `with` 语法:
|
||||
|
||||
|
||||
```python
|
||||
```
|
||||
with open('example.txt', 'a') as f:
|
||||
f.write('hello open source')
|
||||
```
|
||||
@ -72,16 +71,15 @@ with open('example.txt', 'a') as f:
|
||||
|
||||
如果你或你的用户需要通过应用程序需要向文件中写入一些数据,然后你需要使用它们,那么你就需要读取文件了。与写入类似,逻辑一样:
|
||||
|
||||
1. Open
|
||||
2. Read
|
||||
3. Close
|
||||
1. 打开
|
||||
2. 读取
|
||||
3. 关闭
|
||||
|
||||
同样的,这个逻辑反映了你一开始使用计算机就已经知道的内容。阅读文档,你可以打开、阅读,然后关闭。在计算机术语中,”打开“文件意味着将其加载到内存中。
|
||||
同样的,这个逻辑反映了你一开始使用计算机就已知的内容。阅读文档,你可以打开、阅读,然后关闭。在计算机术语中,“打开”文件意味着将其加载到内存中。
|
||||
|
||||
实际上,一个文本文件内容肯定不止一行。例如,你需要读取一个配置文件、游戏保存的数据或乐队下一首歌曲的歌词,正如你打开一本实体书时,你不可能立刻读完整本书,代码也只能解析已经加载到内存中的文件。因此,你可能需要遍历文件的内容。
|
||||
实际上,一个文本文件内容肯定不止一行。例如,你需要读取一个配置文件、游戏存档或乐队下一首歌曲的歌词,正如你打开一本实体书时,你不可能立刻读完整本书,代码也只能解析已经加载到内存中的文件。因此,你可能需要遍历文件的内容。
|
||||
|
||||
|
||||
```python
|
||||
```
|
||||
f = open('example.tmp', 'r')
|
||||
|
||||
for line in f:
|
||||
@ -90,16 +88,15 @@ for line in f:
|
||||
f.close()
|
||||
```
|
||||
|
||||
示例的第一行表示使用 **读** 模式打开一个文件,然后文件交由变量 `f` 表示,但就像你写数据一样,变量名是任意的。`f` 并没有什么特殊的,它只是单词 "file" 的最简表示,所以 Python 程序员会经常使用它。
|
||||
示例的第一行指明使用 **读** 模式打开一个文件,然后文件交由变量 `f` 表示,但就像你写数据一样,变量名是任意的。`f` 并没有什么特殊的,它只是单词 “file” 的最简表示,所以 Python 程序员会经常使用它。
|
||||
|
||||
在第二行,我们使用了 `line`,另一个任意变量名,用来表示 `f` 的每一行。这告诉 Python 逐行迭代文件的内容,并将每一行的内容打印到输出中(在本例中为终端或 [IDLE][5])。
|
||||
|
||||
### 使用 'with' 语法读取数据
|
||||
#### 使用 `with` 语法读取数据
|
||||
|
||||
就像写入一样,使用 `with` 语法是一种更简短的方法读取数据。即不需要调用 **close()** 方法,方便地快速交互。
|
||||
就像写入一样,使用 `with` 语法是一种更简短的方法读取数据。即不需要调用 `close()` 方法,方便地快速交互。
|
||||
|
||||
|
||||
```python
|
||||
```
|
||||
with open('example.txt', 'r') as f:
|
||||
for line in f:
|
||||
print(line)
|
||||
@ -107,7 +104,7 @@ with open('example.txt', 'r') as f:
|
||||
|
||||
### 文件和 Python
|
||||
|
||||
使用 Python 有很多方法向文件写入数据,包括用 [JSON、YAML、TOML][6] 等不同的格式写入。还有一个非常好的内置方法用于创建和维护 [SQLite][7] 数据库,以及许多库来处理不同的文件格式,包括[图像][8]、音频和视频等。
|
||||
使用 Python 有很多方法向文件写入数据,包括用 [JSON、YAML、TOML][6] 等不同的格式写入。还有一个非常好的内置方法用于创建和维护 [SQLite][7] 数据库,以及许多库来处理不同的文件格式,包括 [图像][8]、音频和视频等。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -116,7 +113,7 @@ via: https://opensource.com/article/21/7/read-write-files-python
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[turbokernel](https://github.com/turbokernel)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -129,4 +126,4 @@ via: https://opensource.com/article/21/7/read-write-files-python
|
||||
[5]: https://opensource.com/article/17/10/python-101#idle
|
||||
[6]: https://opensource.com/article/21/6/parse-configuration-files-python
|
||||
[7]: https://opensource.com/article/21/2/sqlite3-cheat-sheet
|
||||
[8]: https://opensource.com/article/19/3/python-image-manipulation-tools
|
||||
[8]: https://opensource.com/article/19/3/python-image-manipulation-tools
|
@ -3,45 +3,42 @@
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13647-1.html)
|
||||
|
||||
如何从 Debian 10 升级到 Debian 11
|
||||
提前尝鲜,从 Debian 10 升级到 Debian 11
|
||||
======
|
||||
本指南解释了从 Debian 10 升级到 Debian 11 的步骤。
|
||||
|
||||
[Debian][1] 的发布是很罕见的。因为它往往是来自社区的多年努力。这就是为什么 Debian 是真正的通用操作系统,并且在稳定性方面坚如磐石。
|
||||
> 本指南解释了从 Debian 10 升级到 Debian 11 的步骤。
|
||||
|
||||
[Debian 11][2],代号 Bullseye,即将正式发布。2021 年 7 月 15 日,Debian 11 进入完全冻结状态,这意味着发行在即。虽然官方日期还没有最终确定,但你现在就可以从 Debian 10 安装或升级到 Debian 11。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/04/114428rewb8x8m8tckevt9.jpg)
|
||||
|
||||
[Debian][1] 的大版本发布是很罕见的,因为它往往需要社区的多年努力。这就是为什么 Debian 是真正的通用操作系统,并且在稳定性方面坚如磐石。
|
||||
|
||||
代号 Bullseye 的 [Debian 11][2] 即将正式发布。2021 年 7 月 15 日,Debian 11 进入完全冻结状态,这意味着发行在即。虽然官方发布日期还没有最终确定,但你现在就可以从 Debian 10 安装或升级到 Debian 11。
|
||||
|
||||
以下是方法。
|
||||
|
||||
### 前提条件
|
||||
|
||||
* 升级的过程非常简单明了。然而,采取某些预先注意事项是一个好的做法。特别是如果你正在升级一台服务器。
|
||||
* 升级的过程非常简单明了。然而,采取某些预防措施是一个好的做法。特别是如果你正在升级一台服务器。
|
||||
* 对你的系统进行备份,包括所有重要的数据和文件。
|
||||
* 尝试禁用/删除你可能在一段时间内添加的任何外部仓库(PPA)。你可以在升级后逐一启用它们。
|
||||
* 关闭所有正在运行的应用。
|
||||
* 停止任何你可能已经启用的运行中的服务。升级完成后,你可以通过 [systemctl][3] 启动它们。这包括网络服务器、SSH 服务器、FTP 服务器或任何其他服务器。
|
||||
* 停止任何你可能已经启用的运行中的服务。升级完成后,你可以通过 [systemctl][3] 启动它们。这包括 Web 服务器、SSH 服务器、FTP 服务器或任何其他服务器。
|
||||
* 确保你有稳定的互联网连接。
|
||||
* 你的系统有足够的停机时间。因为根据你的系统配置,Debian 版本升级需要时间大约在 1.5 小时到 2 小时之间。
|
||||
|
||||
|
||||
* 并为你的系统留出足够的停机时间。因为根据你的系统配置,Debian 版本升级需要时间大约在 1.5 小时到 2 小时之间。
|
||||
|
||||
### 将 Debian 10 Buster 升级到 11 Bullseye
|
||||
|
||||
* 确保你的系统是最新的,而且你的软件包列表是最新的。
|
||||
|
||||
|
||||
确保你的系统是最新的,而且你的软件包列表是最新的。
|
||||
|
||||
```
|
||||
sudo apt update && sudo apt upgrade
|
||||
```
|
||||
|
||||
* 使用下面的命令安装 gcc-8-base 包。这是必须的,因为在历史上曾出现过升级失败的情况,这是因为下面的软件包中包含了某些依赖。
|
||||
|
||||
|
||||
使用下面的命令安装 `gcc-8-base` 包。这是必须的,因为在历史上曾出现过升级失败的情况,这是因为下面的软件包中包含了某些依赖。
|
||||
|
||||
```
|
||||
sudo apt install gcc-8-base
|
||||
@ -49,18 +46,13 @@ sudo apt install gcc-8-base
|
||||
|
||||
![upgrade debian – system check][4]
|
||||
|
||||
* 打开 /etc/apt/sources.list,通过注释 Debian 10 buster 包,而使用 bullseye 仓库进行更新。
|
||||
|
||||
|
||||
* 注释所有的 buster 仓库,在行的开头加上 “#”。
|
||||
|
||||
打开 `/etc/apt/sources.list`,通过注释 Debian 10 buster 包,而使用 bullseye 仓库进行更新。
|
||||
|
||||
注释所有的 buster 仓库,在行的开头加上 `#`。
|
||||
|
||||
![Comment the Debian 10 lines][5]
|
||||
|
||||
* 在文件的末尾添加以下几行。
|
||||
|
||||
|
||||
在文件的末尾添加以下几行。
|
||||
|
||||
```
|
||||
deb http://deb.debian.org/debian bullseye main contrib non-free
|
||||
@ -71,23 +63,17 @@ deb http://ftp.debian.org/debian bullseye-backports main contrib non-free
|
||||
|
||||
![Add Debian 11 lines][6]
|
||||
|
||||
* 按 Ctrl + O 保存文件,按 Ctrl + X 退出 nano。
|
||||
|
||||
|
||||
* 更新一次系统仓库列表,以验证仓库的添加情况。
|
||||
|
||||
按 `Ctrl + O` 保存文件,按 `Ctrl + X` 退出 `nano`。
|
||||
|
||||
更新一次系统仓库列表,以验证仓库的添加情况。
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
* 如果上面的命令没有出现任何错误,那么你已经成功地添加了 bullseye 仓库。
|
||||
|
||||
|
||||
* 现在,通过运行下面的命令开始升级过程。基本安装的下载大小约为 1.2GB。这可能会根据你的系统配置而有所不同。
|
||||
|
||||
如果上面的命令没有出现任何错误,那么你已经成功地添加了 bullseye 仓库。
|
||||
|
||||
现在,通过运行下面的命令开始升级过程。基本安装的下载大小约为 1.2GB。这可能会根据你的系统配置而有所不同。
|
||||
|
||||
```
|
||||
sudo apt full-upgrade
|
||||
@ -95,33 +81,25 @@ sudo apt full-upgrade
|
||||
|
||||
![Debian upgrade start][7]
|
||||
|
||||
* 这个命令需要时间。但不要让系统无人看管。因为升级过程中需要各种输入。
|
||||
|
||||
|
||||
这个命令需要时间。但不要让系统无人看管。因为升级过程中需要各种输入。
|
||||
|
||||
![lib6 config][8]
|
||||
|
||||
![sudoers file][9]
|
||||
|
||||
* 完成后,你可以用以下命令重启系统。
|
||||
|
||||
|
||||
完成后,你可以用以下命令重启系统。
|
||||
|
||||
```
|
||||
systemctl reboot
|
||||
```
|
||||
|
||||
* 重启后,运行以下命令,以确保你的系统是最新的,并且清理了所有不再需要的不必要的软件包。
|
||||
|
||||
|
||||
重启后,运行以下命令,以确保你的系统是最新的,并且清理了所有不再需要的不必要的软件包。
|
||||
|
||||
```
|
||||
sudo apt --purge autoremove
|
||||
```
|
||||
|
||||
* 如果一切顺利,你应该看到 Debian 11 bullseye。你可以用下面的命令来验证版本:
|
||||
|
||||
|
||||
如果一切顺利,你应该看到了 Debian 11 bullseye。你可以用下面的命令来验证版本:
|
||||
|
||||
```
|
||||
cat /etc/os-release
|
||||
@ -133,7 +111,6 @@ cat /etc/os-release
|
||||
|
||||
我希望这个指南能帮助你将你的系统升级到 Debian 11 bullseye。如果你遇到任何问题,请在下面的评论栏告诉我。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/upgrade-debian-11-from-debian-10/
|
||||
@ -141,7 +118,7 @@ via: https://www.debugpoint.com/2021/07/upgrade-debian-11-from-debian-10/
|
||||
作者:[Arindam][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/) 荣誉推出
|
||||
|
@ -0,0 +1,376 @@
|
||||
[#]: subject: (Command line quick tips: wc, sort, sed and tr)
|
||||
[#]: via: (https://fedoramagazine.org/command-line-quick-tips-wc-sort-sed-and-tr/)
|
||||
[#]: author: (mahesh1b https://fedoramagazine.org/author/mahesh1b/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (perfiffer)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13664-1.html)
|
||||
|
||||
一些命令行小技巧:wc、sort、sed 和 tr
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/10/085720hyd795y1wrmd5rx9.jpg)
|
||||
|
||||
Linux 发行版十分好用,而且它们有一些用户可能不知道的技巧。让我们来看看一些命令行实用工具,当你热衷于终端而不是 GUI 时,它们可能更顺手。
|
||||
|
||||
我们都知道在一个系统上使用终端会更高效。当你编辑和排版一个文本文件时,终端会让你确切的感受到,生活如此简单。
|
||||
|
||||
本文将向你介绍 `wc`、`sort`、`tr` 和 `sed` 命令。
|
||||
|
||||
### wc
|
||||
|
||||
`wc` 是一个实用工具,全称是 “word count”。顾名思义,它可以用来统计任何文件的行数、单词数和字节数。
|
||||
|
||||
让我们来看看它是如何工作的:
|
||||
|
||||
```
|
||||
$ wc filename
|
||||
lines words characters filename
|
||||
```
|
||||
|
||||
输出的是文件的行数、单词数、字符数和文件名。
|
||||
|
||||
想获得特定的输出,我们必须使用选项:
|
||||
|
||||
* `-c` 打印字节总数
|
||||
* `-l` 打印行数
|
||||
* `-w` 打印单词总数
|
||||
* `-m` 打印字符总数
|
||||
|
||||
#### wc 示例
|
||||
|
||||
让我们来看看它的运行结果。
|
||||
|
||||
让我们从一个文本文件 `lormipsm.txt` 开始。首先,我们通过 `cat` 查看文件内容,然后使用 `wc`:
|
||||
|
||||
```
|
||||
$ cat loremipsm.txt
|
||||
Linux is the best-known and most-used open source operating system.
|
||||
As an operating system, Linux is software that sits underneath all of the other software on a computer,
|
||||
receiving requests from those programs and replaying these requests to the computer's hardware.
|
||||
|
||||
$ wc loremipsm.txt
|
||||
3 41 268 loremipsm.txt
|
||||
```
|
||||
|
||||
假设我只想查看文件的字节数:
|
||||
|
||||
```
|
||||
$ wc -c loremipsm.txt
|
||||
268 loremipsm.txt
|
||||
```
|
||||
|
||||
查看文件的行数:
|
||||
|
||||
```
|
||||
$ wc -l loremipsm.txt
|
||||
3 loremipsm.txt
|
||||
```
|
||||
|
||||
查看文件的单词数:
|
||||
|
||||
```
|
||||
$ wc -w loremipsm.txt
|
||||
41 loremipsm.txt
|
||||
```
|
||||
|
||||
现在只查看文件的字符数:
|
||||
|
||||
```
|
||||
$ wc -m loremipsm.txt
|
||||
268 loremipsm.txt
|
||||
```
|
||||
|
||||
### sort
|
||||
|
||||
`sort` 命令是最有用的工具之一。它会对文件的数据进行排序。可以根据字符或数字进行升序或降序排列。它也可以用来对文件中的行进行排序和随机化。
|
||||
|
||||
使用 `sort` 非常简单。我们需要做的仅仅是提供一个文件名:
|
||||
|
||||
```
|
||||
$ sort filename
|
||||
```
|
||||
|
||||
默认的是按照字母顺序对数据进行排序。需要注意的是 `sort` 命令仅仅是对数据进行排序展示。它并不会改写文件。
|
||||
|
||||
使用 `sort` 命令的一些有用的选项:
|
||||
|
||||
* `-r` 将文件中的行按倒序进行排序
|
||||
* `-R` 将文件中的行打乱为随机顺序
|
||||
* `-o` 将输出保存到另一个文件中
|
||||
* `-k` 按照特定列进行排序
|
||||
* `-t` 使用指定的分隔符,而不使用空格
|
||||
* `-n` 根据数值对数据进行排序
|
||||
|
||||
#### sort 示例
|
||||
|
||||
让我们看看 `sort` 的几个简单示例。
|
||||
|
||||
我们有一个 `list.txt` 的文件,包含逗号分隔的名称和数值。
|
||||
|
||||
首先让我们打印出文件内容并简单排序:
|
||||
|
||||
```
|
||||
$ cat list.txt
|
||||
Cieran Wilks, 9
|
||||
Adelina Rowland, 4
|
||||
Hayden Mcfarlnd, 1
|
||||
Ananya Lamb, 5
|
||||
Shyam Head, 2
|
||||
Lauryn Fuents, 8
|
||||
Kristian Felix, 10
|
||||
Ruden Dyer, 3
|
||||
Greyson Meyers, 6
|
||||
Luther Cooke, 7
|
||||
|
||||
$ sort list.txt
|
||||
Adelina Rowland, 4
|
||||
Ananya Lamb, 5
|
||||
Cieran Wilks, 9
|
||||
Greyson Meyers, 6
|
||||
Hayden Mcfarlnd, 1
|
||||
Kristian Felix, 10
|
||||
Lauryn Fuents, 8
|
||||
Luther Cooke, 7
|
||||
Ruden Dyer, 3
|
||||
Shyam Head, 2
|
||||
```
|
||||
|
||||
现在对数据进行倒序排序:
|
||||
|
||||
```
|
||||
$ sort -r list.txt
|
||||
Shyam Head, 2
|
||||
Ruden Dyer, 3
|
||||
Luther Cooke, 7
|
||||
Lauryn Fuents, 8
|
||||
Kristian Felix, 10
|
||||
Hayden Mcfarlnd, 1
|
||||
Greyson Meyers, 6
|
||||
Cieran Wilks, 9
|
||||
Ananya Lamb, 5
|
||||
Adelina Rowland, 4
|
||||
```
|
||||
|
||||
让我们打乱数据:
|
||||
|
||||
```
|
||||
$ sort -R list.txt
|
||||
Cieran Wilks, 9
|
||||
Greyson Meyers, 6
|
||||
Adelina Rowland, 4
|
||||
Kristian Felix, 10
|
||||
Luther Cooke, 7
|
||||
Ruden Dyer, 3
|
||||
Lauryn Fuents, 8
|
||||
Hayden Mcfarlnd, 1
|
||||
Ananya Lamb, 5
|
||||
Shyam Head, 2
|
||||
```
|
||||
|
||||
来看一点更复杂的。这次我们根据第二个字段,也就是数值对数据进行排序,并使用 `-o` 选项将输出保存到另一个文件中:
|
||||
|
||||
```
|
||||
$ sort -n -k2 -t ',' -o sorted_list.txt list.txt
|
||||
$ ls
|
||||
sorted_list.txt list.txt
|
||||
$ cat sorted_list.txt
|
||||
Hayden Mcfarlnd, 1
|
||||
Shyam Head, 2
|
||||
Ruden Dyer, 3
|
||||
Adelina Rowland, 4
|
||||
Ananya Lamb, 5
|
||||
Greyson Meyers, 6
|
||||
Luther Cooke, 7
|
||||
Lauryn Fuents, 8
|
||||
Cieran Wilks, 9
|
||||
Kristian Felix, 10
|
||||
```
|
||||
|
||||
这里我们使用 `-n` 选项按数字顺序进行排序,`-k` 选项用来指定要排序的字段(在本例中为第 2 个字段),`-t` 选项指定分隔符或字段分隔符(逗号),`-o` 选项将输出保存到 `sorted_list.txt` 文件中。
|
||||
|
||||
### sed
|
||||
|
||||
`sed` 是一个流编辑器,用于过滤和转换输出中的文本。这意味着我们不需要对原文件进行修改,只需要对输出进行修改。如果需要,我们可以将更改保存到一个新的文件中。`sed` 提供了很多有用的选项用于过滤和编辑数据。
|
||||
|
||||
`sed` 的语法格式如下:
|
||||
|
||||
```
|
||||
$ sed [OPTION] ‘PATTERN’ filename
|
||||
```
|
||||
|
||||
sed 常用的一些选项:
|
||||
|
||||
* `-n` 取消默认输出
|
||||
* `p` 打印指定的数据
|
||||
* `d` 删除指定行
|
||||
* `q` 退出 `sed` 脚本
|
||||
|
||||
#### sed 示例
|
||||
|
||||
我们来看看 `sed` 是如何运作的。我们从 `data` 文件开始,其中的字段表示编号、名称、年龄和操作系统。
|
||||
|
||||
如果行出现在特定的行范围内,该行将打印 2 次:
|
||||
|
||||
```
|
||||
$ cat data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
|
||||
$ sed '3,7 p' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
```
|
||||
|
||||
这里的操作用单引号括起来,表示第 3 行和第 7 行,并且使用了 `p` 打印出符合匹配规则的数据。sed 的默认行为是在解析后打印每一行。这意味着由于使用了 `p` ,第 3 行到第 7 行打印了两次。
|
||||
|
||||
如何打印文件中特定的行?使用 `-n` 选项来消除在输出中不匹配的行:
|
||||
|
||||
```
|
||||
$ sed -n '3,7 p' data
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
```
|
||||
|
||||
使用 ‘-n’ 仅仅只有第 3 行到第 7 行会被打印。
|
||||
|
||||
省略文件中的特定行。使用 `d` 从输出中删除行:
|
||||
|
||||
```
|
||||
$ sed '3 d' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
|
||||
$ sed '5,9 d' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
```
|
||||
|
||||
从文件中搜索特定的关键字:
|
||||
|
||||
```
|
||||
$ sed -n '/linux/ p' data
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
|
||||
$ sed -n '/linux/I p' data
|
||||
1 Vicky Grant 20 Linux
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
```
|
||||
|
||||
在这些例子中,我们在 `/ /` 中使用了一个正则表达式。如果文件中有类似的单词,但大小写不一致,可以使用 `I` 使得搜索不区分大小写。回想一下,`-n` 删除了输出中不匹配的行。
|
||||
|
||||
替换文件中的单词:
|
||||
|
||||
```
|
||||
$ sed 's/linux/linus/' data
|
||||
1 Vicky Grant 20 Linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linus
|
||||
8 Ralph Martin 19 linus
|
||||
9 Mindy Howard 20 Mac
|
||||
```
|
||||
|
||||
这里 `s/ / /` 表示它是一个正则表达式。在两个 `/` 之间的就是定位的单词和需要替换的新单词。
|
||||
|
||||
### tr
|
||||
|
||||
`tr` 命令可以用来转换或删除字符。它可以将小写字母转换为大写字母,也可以将大写字母转换为小写字母,可以消除重复字符,也可以删除特定字符。
|
||||
|
||||
`tr` 的奇怪之处在于,它不同于 `wc`、`sort`、`sed` 那样接受文件作为输入。我们使用 `|` (管道符)为 `tr` 命令提供输入。
|
||||
|
||||
```
|
||||
$ cat filename | tr [OPTION]
|
||||
```
|
||||
|
||||
`tr` 命令使用的一些选项:
|
||||
|
||||
* `-d` 删除给定输入第一个集合中的指定字符,不做转换
|
||||
* `-s` 将重复出现的字符替换为单个
|
||||
|
||||
#### tr 示例
|
||||
|
||||
现在让我们使用 `tr` 命令将 `letter` 文件中的所有小写字符转换为大写字符:
|
||||
|
||||
```
|
||||
$ cat letter
|
||||
Linux is too easy to learn,
|
||||
And you should try it too.
|
||||
|
||||
$ cat letter | tr 'a-z' 'A-Z'
|
||||
LINUX IS TOO EASY TO LEARN,
|
||||
AND YOU SHOULD TRY IT TOO.
|
||||
```
|
||||
|
||||
这里的 `a-z`、`A-Z` 表示我们想要将 `a` 到 `z` 范围内的小写字符转换为大写字符。
|
||||
|
||||
删除文件中的 `o` 字符:
|
||||
|
||||
```
|
||||
$ cat letter | tr -d 'o'
|
||||
Linux is t easy t learn,
|
||||
And yu shuld try it t.
|
||||
```
|
||||
|
||||
从文件中压缩字符 `o` 意味着如果 `o` 在文件中重复出现,那么它将会被删除并且只打印一次:
|
||||
|
||||
```
|
||||
$ cat letter | tr -s 'o'
|
||||
Linux is to easy to learn,
|
||||
And you should try it to.
|
||||
```
|
||||
|
||||
### 总结
|
||||
|
||||
这是使用 `wc`、`sort`、`sed`、`tr` 命令的快速演示。这些命令可以方便快捷的操作终端上的文本文件。你可以使用 `man` 命令来了解这些命令的更多信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/command-line-quick-tips-wc-sort-sed-and-tr/
|
||||
|
||||
作者:[mahesh1b][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[perfiffer](https://github.com/perfiffer)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/mahesh1b/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg
|
@ -4,56 +4,52 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (perfiffer)
|
||||
[#]: reviewer: (turbokernel)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13644-1.html)
|
||||
|
||||
如何在 Linux 上使用 cron 定时器
|
||||
======
|
||||
cron 定时器是一个可以按照计划自动运行命令的工具。
|
||||
![Cron 表达式][1]
|
||||
|
||||
cron 定时器是一个可以按照计划自动运行命令的工具。定时器作业称为 cronjob,创建于 crontab 文件中。这是用户自动操作电脑的最简单也是最古老的方法。
|
||||
> cron 定时器是一个可以按照计划自动运行命令的工具。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/03/132733qhmt6mavtbh66m5j.jpg)
|
||||
|
||||
cron 定时器是一个可以按照计划自动运行命令的工具。定时器作业称为 cronjob,创建于 `crontab` 文件中。这是用户自动操作电脑的最简单也是最古老的方法。
|
||||
|
||||
### 创建一个 cronjob
|
||||
|
||||
要创建一个 cronjob,你可以使用 crontab 命令,并添加 `-e` 选项:
|
||||
要创建一个 cronjob,你可以使用 `crontab` 命令,并添加 `-e` 选项:
|
||||
|
||||
```
|
||||
`$ crontab -e`
|
||||
$ crontab -e
|
||||
```
|
||||
|
||||
这将使用默认的文本编辑器打开 crontab。如需指定文本编辑器,请使用 `EDITOR` [环境变量][1]:
|
||||
这将使用默认的文本编辑器打开 `crontab`。如需指定文本编辑器,请使用 `EDITOR` [环境变量][1]:
|
||||
|
||||
```
|
||||
`$ EDITOR=nano crontab -e`
|
||||
$ EDITOR=nano crontab -e
|
||||
```
|
||||
|
||||
### Cron 语法
|
||||
|
||||
如需调度一个 cronjob,你需要提供给计算机你想要执行的命令,然后提供一个 cron 表达式。cron 表达式在命令调度时运行:
|
||||
|
||||
* minute (0 到 59)
|
||||
|
||||
* hour (0 到 23, 0 代表午夜执行)
|
||||
|
||||
* day of month (1 到 31)
|
||||
|
||||
* month (1 到 12)
|
||||
|
||||
* day of week (0 到 6, 星期天是 0)
|
||||
|
||||
|
||||
* 分钟(0 到 59)
|
||||
* 小时(0 到 23, 0 代表午夜执行)
|
||||
* 日期(1 到 31)
|
||||
* 月份(1 到 12)
|
||||
* 星期(0 到 6, 星期天是 0)
|
||||
|
||||
星号 (`*`) 代表的是“每一个”。例如,下面的表达式在每月每日每小时的 0 分钟运行备份脚本:
|
||||
|
||||
```
|
||||
`/opt/backup.sh 0 * * * *`
|
||||
/opt/backup.sh 0 * * * *
|
||||
```
|
||||
|
||||
下面的表达式在周日的凌晨 3:30 运行备份脚本:
|
||||
|
||||
```
|
||||
`/opt/backup.sh 30 3 * * 0`
|
||||
/opt/backup.sh 30 3 * * 0
|
||||
```
|
||||
|
||||
### 简写语法
|
||||
@ -61,34 +57,29 @@ cron 定时器是一个可以按照计划自动运行命令的工具。定时器
|
||||
现代的 cron 支持简化的宏,而不是 cron 表达式:
|
||||
|
||||
* `@hourly` 在每天的每小时的 0 分运行
|
||||
|
||||
* `@daily` 在每天的 0 时 0 分运行
|
||||
|
||||
* `@weekly` 在周日的 0 时 0 分运行
|
||||
|
||||
* `@monthly` 在每月的第一天的 0 时 0 分运行
|
||||
|
||||
|
||||
|
||||
例如,下面的 crontab 命令在每天的 0 时运行备份脚本:
|
||||
例如,下面的 `crontab` 命令在每天的 0 时运行备份脚本:
|
||||
|
||||
```
|
||||
`/opt/backup.sh @daily`
|
||||
/opt/backup.sh @daily
|
||||
```
|
||||
|
||||
### 如何停止一个 cronjob
|
||||
|
||||
一旦你开始了一个 cronjob,它就会永远按照计划运行。想要在启动后停止 cronjob,你必须编辑 crontab,删除触发该作业的命令行,然后保存文件。
|
||||
一旦你开始了一个 cronjob,它就会永远按照计划运行。想要在启动后停止 cronjob,你必须编辑 `crontab`,删除触发该作业的命令行,然后保存文件。
|
||||
|
||||
```
|
||||
`$ EDITOR=nano crontab -e`
|
||||
$ EDITOR=nano crontab -e
|
||||
```
|
||||
|
||||
如需停止一个正在运行的作业,可以[使用标准的Linux进程命令][3]来停止一个正在运行的进程。
|
||||
如需停止一个正在运行的作业,可以 [使用标准的 Linux 进程命令][3] 来停止一个正在运行的进程。
|
||||
|
||||
### 它是自动的
|
||||
|
||||
一旦你编写完 crontab,保存了文件并且退出了编辑器。你的 cronjob 就已经被调度了,剩下的工作都交给 cron 完成。
|
||||
一旦你编写完 `crontab`,保存了文件并且退出了编辑器。你的 cronjob 就已经被调度了,剩下的工作都交给 cron 完成。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -4,19 +4,20 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (turbokernel)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13656-1.html)
|
||||
|
||||
使用 du 检查 Linux 上已用的磁盘空间
|
||||
======
|
||||
用 Linux 的 du 命令了解你正在使用多少磁盘空间。
|
||||
![Check disk usage][1]
|
||||
|
||||
> 用 Linux 的 du 命令了解你正在使用多少磁盘空间。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/06/200731j561cwxyxyekaic5.jpg)
|
||||
|
||||
无论你有多少存储空间,它总有可能被填满。在大多数个人设备上,磁盘被照片、视频和音乐填满,但在服务器上,由于用户账户和日志文件数据,空间减少是很正常的。无论你是负责管理一个多用户系统,还是只负责自己的笔记本电脑,你都可以用 `du` 命令检查磁盘的使用情况。
|
||||
|
||||
默认情况下,`du` 列出了当前目录中使用的磁盘空间,以及每个子目录的大小。
|
||||
|
||||
|
||||
```
|
||||
$ du
|
||||
12 ./.backups
|
||||
@ -25,8 +26,7 @@ $ du
|
||||
|
||||
在这个例子中,当前目录总共占用了 60KB,其中 12KB 被子目录 `.backups` 占用。
|
||||
|
||||
如果你觉得这很混乱,并希望分别看到所有的大小,你可以使用 `--separate-dirs`(或简写 `S`)选项:
|
||||
|
||||
如果你觉得这很混乱,并希望分别看到所有的大小,你可以使用 `--separate-dirs`(或简写 `-S`)选项:
|
||||
|
||||
```
|
||||
$ du --separate-dirs
|
||||
@ -36,8 +36,7 @@ $ du --separate-dirs
|
||||
|
||||
显示相同的信息(48KB 加 12KB 是 60KB),但每个目录被独立处理。
|
||||
|
||||
如需看到更多的细节,可以使用 --all(简写 -a)选项,它显示每个目录中以及每个文件:
|
||||
|
||||
如需看到更多的细节,可以使用 `--all`(简写 `-a`)选项,它显示每个目录中以及每个文件:
|
||||
|
||||
```
|
||||
$ du --separate-dirs --all
|
||||
@ -52,10 +51,9 @@ $ du --separate-dirs --all
|
||||
|
||||
### 查看文件的修改时间
|
||||
|
||||
当查看文件以找出占用空间的内容时,查看文件最后一次被修改的时间是很有用的。一年内没有使用的文件很可能是归档的候选文件,特别是当你的空间快用完时。
|
||||
|
||||
通过 du 查看文件的修改时间,使用 `--time` 选项:
|
||||
当查看文件以找出占用空间的内容时,查看文件最后一次被修改的时间是很有用的。一年内没有使用过的文件可以考虑归档,特别是当你的空间快用完时。
|
||||
|
||||
通过 `du` 查看文件的修改时间,使用 `--time` 选项:
|
||||
|
||||
```
|
||||
$ du --separate-dirs --all --time
|
||||
@ -70,7 +68,6 @@ $ du --separate-dirs --all --time
|
||||
|
||||
当为了磁盘空间而查看文件时,你可能只关心较大的文件。你可以通过 `--threshold`(简写 `-t`)选项为文件大小设置一个阈值。例如,只查看大于 1GB 的文件:
|
||||
|
||||
|
||||
```
|
||||
$ \du --separate-dirs --all --time --threshold=1G ~/Footage/
|
||||
1839008 2021-07-14 13:55 /home/tux/Footage/snowfall.mp4
|
||||
@ -80,10 +77,8 @@ $ \du --separate-dirs --all --time --threshold=1G ~/Footage/
|
||||
|
||||
当文件较大时,它们可能难以阅读。使用 `--human-readable`(简写 `-h`)选项可以使文件大小更容易阅读:
|
||||
|
||||
|
||||
```
|
||||
$ \du --separate-dirs --all --time \
|
||||
\--threshold=1G --human-readable ~/Footage/
|
||||
$ du --separate-dirs --all --time --threshold=1G --human-readable ~/Footage/
|
||||
1.8G 2021-07-14 13:55 /home/tux/Footage/snowfall.mp4
|
||||
1.6G 2020-04-11 13:10 /home/tux/Footage/waterfall.mp4
|
||||
8.5G 2021-07-14 13:55 /home/tux/Footage/
|
@ -3,28 +3,28 @@
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13655-1.html)
|
||||
|
||||
如何在 elementary OS 中改变锁定和登录屏幕的壁纸
|
||||
======
|
||||
本教程解释了在 elementary OS 中改变锁定和登录屏幕背景的步骤。这将取代默认的灰色背景。
|
||||
|
||||
在 elementary OS 中改变锁屏或登录屏背景的灰色默认壁纸是有点困难的。典型的用图像文件的路径改变 greeter 配置是行不通的。
|
||||
> 本教程解释了在 elementary OS 中改变锁定和登录屏幕背景的步骤。这将取代默认的灰色背景。
|
||||
|
||||
不幸的是,这不是一个更简单的解决方案,因为灰色背景是一个图像文件,它的数据在 greeter 中是硬编码的,需要用新的图像重新编译才能使其发挥作用。
|
||||
在 elementary OS 中改变锁屏或登录屏背景的灰色默认壁纸是有点困难的。典型的用图像文件的路径改变 `greeter` 的配置是行不通的。
|
||||
|
||||
下面是方法。
|
||||
不幸的是,这不是一个更简单的解决方案,因为灰色背景是一个图像文件,它的数据是硬编码在 `greeter` 中的,需要用新的图像重新编译才能使其发挥作用。
|
||||
|
||||
下面是方法:
|
||||
|
||||
![Lock / Login screen background elementary OS \(Odin\)][1]
|
||||
|
||||
### 改变 elementary OS 锁定和登录屏幕背景
|
||||
|
||||
* 在 elementary OS 中打开一个终端。
|
||||
* 为 [greeter包][2]安装 git 和以下依赖项。
|
||||
|
||||
在 elementary OS 中打开一个终端。
|
||||
|
||||
为 [greeter 包][2]安装 git 和以下依赖项:
|
||||
|
||||
```
|
||||
sudo apt install git
|
||||
@ -34,24 +34,18 @@ sudo apt install git
|
||||
sudo apt install -y gnome-settings-daemon libaccountsservice-dev libgdk-pixbuf2.0-dev libgranite-dev libgtk-3-dev libhandy-1-dev liblightdm-gobject-1-dev libmutter-6-dev libwingpanel-dev libx11-dev meson valac
|
||||
```
|
||||
|
||||
* 进入临时的 /tmp 目录,从 GitHub 克隆最新的 greeter 主分支。
|
||||
|
||||
|
||||
进入临时的 `/tmp` 目录,从 GitHub 克隆最新的 greeter 主分支:
|
||||
|
||||
```
|
||||
cd /tmp
|
||||
git clone https://github.com/elementary/greeter.git
|
||||
```
|
||||
|
||||
* 克隆完成后,在文件管理器中打开路径 `/tmp/greeter/data`。
|
||||
|
||||
|
||||
* 初级操作系统使用一个 100×100px 的 PNG 文件作为登录屏幕/锁屏的默认背景。该图像是平铺的,给人一种灰色背景的感觉。
|
||||
|
||||
|
||||
* 用 `texture.png` 重命名你想要的墙纸图像,并在路径中覆盖以下文件。
|
||||
克隆完成后,在文件管理器中打开路径 `/tmp/greeter/data`。
|
||||
|
||||
elementary OS 使用一个 100×100px 的 PNG 文件作为登录屏幕/锁屏的默认背景。该图像是平铺的,给人一种灰色背景的感觉。
|
||||
|
||||
用 `texture.png` 重命名你想要的墙纸图像,并在路径中覆盖以下文件:
|
||||
|
||||
![gray background is created using this file][3]
|
||||
|
||||
@ -59,9 +53,7 @@ git clone https://github.com/elementary/greeter.git
|
||||
/tmp/greeter/data/texture.png
|
||||
```
|
||||
|
||||
* 在文本编辑器中打开文件 `/tmp/greeter/compositor/SystemBackground.vala`,并替换下面一行:
|
||||
|
||||
|
||||
在文本编辑器中打开文件 `/tmp/greeter/compositor/SystemBackground.vala`,并替换下面一行:
|
||||
|
||||
![change the path of image][4]
|
||||
|
||||
@ -75,12 +67,10 @@ resource:///io/elementary/desktop/gala/texture.png
|
||||
resource:///io/elementary/greeter/texture.png
|
||||
```
|
||||
|
||||
* 保存该文件。
|
||||
|
||||
|
||||
* 再次打开终端,使用以下命令构建 `greeter`。
|
||||
保存该文件。
|
||||
|
||||
|
||||
再次打开终端,使用以下命令构建 `greeter`。
|
||||
|
||||
```
|
||||
cd /tmp/greeter
|
||||
@ -90,10 +80,9 @@ sudo ninja install -C _build
|
||||
|
||||
![building greeter][5]
|
||||
|
||||
* 如果你遇到任何构建错误,请在下面的评论中告诉我。你应该不会看到任何错误,因为我已经测试过了。
|
||||
如果你遇到任何构建错误,请在下面的评论中告诉我。你应该不会看到任何错误,因为我已经测试过了。
|
||||
|
||||
|
||||
上面的命令完成后,你可以在测试模式下运行 lightdm 来测试登录屏:
|
||||
上面的命令完成后,你可以在测试模式下运行 `lightdm` 来测试登录屏:
|
||||
|
||||
```
|
||||
lightdm --test-mode --debug
|
||||
@ -116,7 +105,7 @@ via: https://www.debugpoint.com/2021/07/change-lock-login-screen-background-elem
|
||||
作者:[Arindam][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/) 荣誉推出
|
||||
|
@ -3,20 +3,22 @@
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (piaoshi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13646-1.html)
|
||||
|
||||
使用 df 命令查看 Linux 上的可用磁盘空间。
|
||||
使用 df 命令查看 Linux 上的可用磁盘空间
|
||||
======
|
||||
利用 df 命令查看 Linux 磁盘还剩多少空间。
|
||||
![Free disk space][1]
|
||||
|
||||
磁盘空间已经不像计算机早期那样珍贵,但无论你有多少磁盘空间,总有耗尽的可能。计算机需要一些磁盘空间才能启动运行,所以为了确保你没有在无意间用尽了所有的硬盘空间,偶尔检查一下是非常必要的。在 Linux 终端,你可以用 df 命令来做这件事。
|
||||
> 利用 df 命令查看 Linux 磁盘还剩多少空间。
|
||||
|
||||
df 命令可以显示文件系统中可用的磁盘空间。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/04/110742netskjccb5vzvujk.jpg)
|
||||
|
||||
要想使输出结果易于阅读,你可以加上 --human-readable(或其简写 -h)选项:
|
||||
磁盘空间已经不像计算机早期那样珍贵,但无论你有多少磁盘空间,总有耗尽的可能。计算机需要一些磁盘空间才能启动运行,所以为了确保你没有在无意间用尽了所有的硬盘空间,偶尔检查一下是非常必要的。在 Linux 终端,你可以用 `df` 命令来做这件事。
|
||||
|
||||
`df` 命令可以显示文件系统中可用的磁盘空间。
|
||||
|
||||
要想使输出结果易于阅读,你可以加上 `--human-readable`(或其简写 `-h`)选项:
|
||||
|
||||
```
|
||||
$ df --human-readable
|
||||
@ -26,7 +28,7 @@ Filesystem Size Used Avail Use% Mounted on
|
||||
|
||||
在这个例子中,计算机的磁盘已经用了 52%,还有 500 GB 可用空间。
|
||||
|
||||
由于 Linux 完整地看待所有挂载设备的文件系统,df 命令会展示出连接到计算机上的每个存储设备的详细信息。如果你有很多磁盘,那么输出结果将会反映出来:
|
||||
由于 Linux 从整体上看待所有挂载设备的文件系统,`df` 命令会展示出连接到计算机上的每个存储设备的详细信息。如果你有很多磁盘,那么输出结果将会反映出来:
|
||||
|
||||
```
|
||||
$ df --human-readable
|
||||
@ -44,7 +46,7 @@ tmpfs 12G 848K 12G 1% /run
|
||||
|
||||
### 查看总的可用磁盘空间
|
||||
|
||||
如果你的文件系统确实很复杂,而你希望看到所有磁盘的总空间,可以使用 --total 选项:
|
||||
如果你的文件系统确实很复杂,而你希望看到所有磁盘的总空间,可以使用 `--total` 选项:
|
||||
|
||||
```
|
||||
$ df --human-readable --total
|
||||
@ -72,7 +74,7 @@ via: https://opensource.com/article/21/7/check-disk-space-linux-df
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[piaoshi](https://github.com/piaoshi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -2,97 +2,99 @@
|
||||
[#]: via: (https://itsfoss.com/install-chrome-linux-mint/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13659-1.html)
|
||||
|
||||
How to Install Google Chrome on Linux Mint [Beginners Tip]
|
||||
初级:如何在 Linux Mint 上安装 Google Chrome
|
||||
======
|
||||
|
||||
This should be a really simple topic but I am writing this because I see so many websites recommending strange command line steps for installing Google Chrome on Linux Mint. That would work but that’s unnecessarily complicated, specially for beginners not familiar with the command line.
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/08/133301ni5k5i8rziezwe5i.jpg)
|
||||
|
||||
In reality, you don’t need to go terminal way at all. All you have to do is to go to Google Chrome’s website and download the installer file for Ubuntu and install it.
|
||||
这应该是一个非常简单的话题,但我写这个是因为我看到很多网站推荐在 Linux Mint 上安装 Google Chrome 的奇怪命令行步骤。那是可行的,但那是不必要的复杂,特别是对于不熟悉命令行的初学者。
|
||||
|
||||
Let me detail the steps for your understanding.
|
||||
实际上,你根本不需要走终端方式。你所要做的就是去谷歌浏览器的网站,下载 Ubuntu 的安装文件并安装。
|
||||
|
||||
### Installing Google Chrome on Linux Mint
|
||||
让我详细介绍一下步骤,供你了解。
|
||||
|
||||
Go to the website of Google Chrome.
|
||||
### 在 Linux Mint 上安装 Google Chrome
|
||||
|
||||
进入 Google Chrome 的网站。
|
||||
|
||||
[Google Chrome Website][1]
|
||||
|
||||
You’ll see a “Download Chrome” button here. Click on it.
|
||||
你会看到一个 “Download Chrome” 的按钮。点击它。
|
||||
|
||||
![Download Chrome for Linux][2]
|
||||
|
||||
It will show you two option for downloading Chrome on Linux. Go with the Debian/Ubuntu option and hit the “Accept and Install” button.
|
||||
它将向你显示在 Linux 上下载 Chrome 的两个选项。选择 Debian/Ubuntu 选项并点击 “Accept and Install” 按钮。
|
||||
|
||||
![Select Debian/Ubuntu option for Chrome package on Mint][3]
|
||||
|
||||
Before starting the download, Firefox asks you if you want to open the downloaded file with Gdebi or save it. You can go with either option because ultimately, you’ll be [using Gdebi for installing the deb file][4]. However, I prefer to save the file first.
|
||||
在开始下载之前,Firefox 会询问你是否要用 Gdebi 打开下载的文件或保存它。你可以选择任何一个选项,因为最终你会 [使用 Gdebi 来安装 deb 文件][4]。然而,我更喜欢先保存文件。
|
||||
|
||||
![Save the deb file][5]
|
||||
|
||||
Wait for the download to finish.
|
||||
等待下载完成。
|
||||
|
||||
![Wait for Google Chrome download to finish][6]
|
||||
|
||||
Once the download finishes, go to the Downloads folder in File Explorer. To [install the deb file][7], either double click on it or right click on it and select ‘Open With GDebi Package Installer’.
|
||||
下载完成后,在文件管理器中进入下载文件夹。要 [安装 deb 文件][7],可以双击它或者右击它并选择 “Open With GDebi Package Installer”。
|
||||
|
||||
![Double click on the downloaded deb file to install it][8]
|
||||
|
||||
Wait for a few seconds and it should give you the option to install.
|
||||
等待几秒钟,它应该给你一个安装的选项。
|
||||
|
||||
![Hit the Install Package option in Gdebi][9]
|
||||
|
||||
It will ask for Linux Mint account password. In Linux, you need to provide your password for installing any application.
|
||||
它将要求你提供 Linux Mint 的账户密码。在 Linux 中,你需要提供你的密码来安装任何应用。
|
||||
|
||||
![Enter your password for installing an application][10]
|
||||
|
||||
You are almost there. It will show what additional packages will be installed with it (if any). Just hit the Continue button.
|
||||
你就要完成了。它将显示哪些额外的软件包将与之一起安装(如果有的话)。点击继续按钮即可。
|
||||
|
||||
![Details on the packages to be installed][11]
|
||||
|
||||
It should take a few seconds or a minute at most for installation to complete.
|
||||
安装完成应该只需要几秒钟或最多一分钟。
|
||||
|
||||
![Installing Chrome in progress][12]
|
||||
|
||||
You should see a screen like this when the installation completes.
|
||||
安装完成后,你应该看到这样的屏幕。
|
||||
|
||||
![Chrome successfully installed on Linux Mint][13]
|
||||
|
||||
Once installed, you can run Google Chrome by looking for it in the application menu.
|
||||
安装完成后,你可以在应用菜单中寻找 Google Chrome 来运行它。
|
||||
|
||||
![Run Google Chrome in Linux Mint][14]
|
||||
|
||||
And then enjoy Google Chrome on Linux Mint.
|
||||
然后在 Linux Mint 上享受 Google Chrome。
|
||||
|
||||
![Google Chrome running in Linux Mint][15]
|
||||
|
||||
### How to update Google Chrome on Linux Mint
|
||||
### 如何在 Linux Mint 上更新 Google Chrome
|
||||
|
||||
The good thing about this method is that Google Chrome gets updated with system updates. When you install the deb file, it also adds a repository from Google to your system.
|
||||
这个方法的好处是,谷歌浏览器会随着系统的更新而更新。当你安装 deb 文件的时候,它也会在你的系统中添加一个来自谷歌的仓库。
|
||||
|
||||
![Chrome adds a repository to the system for providing updates][16]
|
||||
|
||||
Thanks to this added repository, the updates on the Chrome browser will be added to the system updates. So when you update Linux Mint, it gets updated as well (if there is an update available).
|
||||
由于这个添加的仓库,Chrome 浏览器上的更新将被添加到系统更新中。因此,当你更新 Linux Mint 时,它也会被更新(如果有可用的更新)。
|
||||
|
||||
### How to remove Google Chrome from Linux Mint
|
||||
### 如何从 Linux Mint 中删除 Google Chrome
|
||||
|
||||
Don’t like Chrome? No worries. You can uninstall Google Chrome from Linux Mint. And no, you don’t need to use terminal this time as well.
|
||||
不喜欢 Chrome?不用担心。你可以从 Linux Mint 中卸载谷歌浏览器。同样这次你也不需要使用终端。
|
||||
|
||||
Click on the menu and search for Chrome. Right click on the Chrome icon and you’ll see an ‘Uninstall’ option. Select it.
|
||||
点击菜单,搜索 Chrome。在 Chrome 图标上点击右键,你会看到一个 “Uninstall” 选项。选择它。
|
||||
|
||||
![Removing Google Chrome from Linux Mint][17]
|
||||
|
||||
You’ll have to enter your password, of course. It will show the package to be removed. Click OK here.
|
||||
当然,你必须输入你的密码。它将显示要删除的软件包。在这里点击 OK。
|
||||
|
||||
![Uninstalling Google Chrome from Linux mint][18]
|
||||
|
||||
You may leave the repo from Google Chrome or remove it. It’s your choice, really.
|
||||
你可以留下 Google Chrome 的仓库,也可以删除它。这是你的选择。
|
||||
|
||||
I hope you find this tutorial helpful in using Google Chrome on Linux Mint.
|
||||
我希望你觉得这个教程对在 Linux Mint 上使用 Google Chrome 有帮助。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -100,8 +102,8 @@ via: https://itsfoss.com/install-chrome-linux-mint/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,112 @@
|
||||
[#]: subject: "Firefox Lost Almost 50 million Users: Here’s Why It is Concerning"
|
||||
[#]: via: "https://news.itsfoss.com/firefox-decline/"
|
||||
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "imgradeone"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13658-1.html"
|
||||
|
||||
Firefox 失去了近 5000 万用户:令人担忧的原因
|
||||
======
|
||||
|
||||
> 2018 年以来,Mozilla 的火狐浏览器正在大面积流失用户,为什么用户正在远离它?这是否值得担心?
|
||||
|
||||
![](https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/08/firefox-decline.jpg?w=1200&ssl=1)
|
||||
|
||||
Mozilla 的 Firefox 是基于 Chromium 内核的浏览器的唯一流行替代品。
|
||||
|
||||
它一直是 Linux 用户,以及每个平台上注重隐私的用户的默认选择。
|
||||
|
||||
然而,即便凭借着大量优势成为最好的 Web 浏览器之一,Firefox 近几年逐渐流失了它的影响力。
|
||||
|
||||
实话实说,我们都不需要借助统计数据来论证这一点,因为我们当中的许多人就已经转向其它 Chromium 内核的浏览器,或者 Chromium 本身,而不是 Firefox 和 Google Chrome。
|
||||
|
||||
不过,我在 Reddit 上偶然发现了由 [u/nixcraft][1] 写的一篇帖子,这篇帖子强调了 Firefox 的用户数从 2018 年来不断下降的原因。
|
||||
|
||||
而令人惊讶的是,这篇帖子的原始信息来源就是 [Firefox 的公开数据报表][2]。
|
||||
|
||||
![][3]
|
||||
|
||||
根据官方数据统计,在 2018 年底,其报告的(月度)活跃人数达到了 **2.44 亿**。
|
||||
|
||||
但,到了 **2021 年第二季度**,这个数字降到了 **1.98 亿**。
|
||||
|
||||
由此可以得出,Firefox 的用户基数下降了高达 **4600 万**。
|
||||
|
||||
### Firefox 的衰落确实令人担忧,但也很明显
|
||||
|
||||
鉴于在 2021 年以隐私为重点的工具在其用户群体中大量出现,Mozilla 的 Firefox 用户基数正面临着不断下降。
|
||||
|
||||
尤其是在 Firefox 设法引入一些业界首创的隐私功能之后。呵,是不是很讽刺?
|
||||
|
||||
如果你从来没有使用过 Firefox,或者已经迁移至其他浏览器许久,这篇 [关于 Brave 和 Firefox 浏览器的比较][4] 表明,到目前为止,Firefox 其实还是一个可靠的浏览器。
|
||||
|
||||
所以,为什么许多用户迁移到了 Chromium 内核的浏览器,尤其是 Chrome 呢?
|
||||
|
||||
我这里马上就想到了这几点:
|
||||
|
||||
* Google Chrome 是 Android 设备上的默认浏览器
|
||||
* Microsoft Edge 是 Windows 设备上的默认浏览器(因此自然就有巨大的市场份额)
|
||||
* Google.com(最大的搜索引擎)建议用户安装 Google Chrome(实际上是一种潜在的反竞争手段)
|
||||
* 一些 Web 服务只兼容基于 Chromium 的浏览器
|
||||
|
||||
除此之外,Firefox 可能也做错了这几件事:
|
||||
|
||||
* 不断以大修的方式来破坏用户体验
|
||||
* 近年来缺乏显著的性能改进
|
||||
|
||||
当然,没有哪个浏览器是完美的,但这是什么值得担心的事吗?嗯,我觉得是的。
|
||||
|
||||
### 为什么你应该担忧
|
||||
|
||||
Mozilla 的 Firefox 是基于 Chromium 的浏览器的唯一可行的竞争品。如果 Firefox 消失了,用户就会失去其它浏览器内核的选择。
|
||||
|
||||
我相信你会同意,纵容垄断是有害的,因此我们需要一些 Google Chromium 引擎的替代品。
|
||||
|
||||
实际上,相当多的网站会根据基于 Chromium 的浏览器来优化用户体验。
|
||||
|
||||
因此,如果用户量下降的趋势一直持续下去,**我们这样的用户可能就会被迫适应新的工作流程而改用其他浏览器**。
|
||||
|
||||
即使忽略掉 Google 的 Chromium 引擎在互联网的主导地位,或者认为 Chrome 之类的浏览器在技术上更好,Firefox 仍旧十分珍贵。因为它至少提供了更多的个性化功能,也不断改进隐私体验,与其他的都不一样。
|
||||
|
||||
换句话说,我们可能会(被迫)失去许多好的东西,而这一切仅仅是因为其他竞争对手都选择基于 Chromium 内核,或者从事反竞争活动。
|
||||
|
||||
也许,你现在对 Firefox 很失望而想转向其他浏览器。当然,这是你自己的选择。
|
||||
|
||||
**但是,待到 Firefox 因为各种使其衰落的因素而彻底消失后,你又该何去何从呢?**
|
||||
|
||||
![][5]
|
||||
|
||||
因此,为了让一切保持平衡,我认为我们应该不断反抗科技巨头的反竞争行为,并且开始使用 Mozilla Firefox(不论是什么身份,甚至是作为备用浏览器)。
|
||||
|
||||
当然,Mozilla 也需要面对这种情况做出什么措施了。
|
||||
|
||||
当他们忙于添加隐私网络服务、邮件中继和其他服务集成时,Mozilla 在用户体验改善方面做的并不成功。
|
||||
|
||||
至少,我是这么认为的。多年来,我一直使用 Firefox 作为主力浏览器,但我最终还是会偶尔转向其他浏览器,尤其是每次 Firefox 界面进行大幅度更改后。
|
||||
|
||||
### 你怎么看?
|
||||
|
||||
我很想知道你对此有何想法,以及你认为究竟是什么因素导致了 Firefox 用户数的下降。
|
||||
|
||||
你更喜欢将哪款浏览器作为你的主力浏览器?在评论区中告诉我吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/firefox-decline/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[imgradeone](https://github.com/imgradeone)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.reddit.com/user/nixcraft/
|
||||
[2]: https://data.firefox.com/dashboard/user-activity
|
||||
[3]: https://news.itsfoss.com/wp-content/uploads/2021/08/firefox-userbase-decline.png
|
||||
[4]: https://itsfoss.com/brave-vs-firefox/
|
||||
[5]: https://news.itsfoss.com/wp-content/uploads/2021/08/firefox-survive.jpg
|
@ -0,0 +1,108 @@
|
||||
[#]: subject: (How to Find and Remove Duplicate Photos in Linux)
|
||||
[#]: via: (https://itsfoss.com/find-remove-duplicate-photos-linux/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (zpl1025)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13661-1.html)
|
||||
|
||||
如何在 Linux 系统里查找并删除重复相片
|
||||
======
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202108/09/101511dq8uo51o8go5s9n9.jpg)
|
||||
|
||||
点击打开了很多相似的相片?同样的相片保存在不同文件夹里?我理解这种感受。
|
||||
|
||||
在相机里点击相片,通过 WhatsApp 发送。然后又备份相片,于是在 WhatsApp 和系统相册里就会存下同样的拷贝。这个很烦人,很乱而且额外占用不必要的存储空间。
|
||||
|
||||
我是在翻看我岳父的相片收藏时遇到这个问题的。下面是我如何找出重复相片并删除的做法。
|
||||
|
||||
### 使用 digiKam 来找出和删除重复相片
|
||||
|
||||
[digiKam][1] 是一个 [用来管理和收集相片的自由开源应用][2]。它主要是方便摄影师,但并不是说一定要专业玩相机的人才能用。
|
||||
|
||||
我可以演示如何使用这个工具来查找重复相片,然后根据需要删除重复内容。
|
||||
|
||||
#### 第一步
|
||||
|
||||
首先是安装 digiKam。它是一个很流行的应用程序,应该可以在软件中心里直接安装,或者通过你的发行版的包管理器安装。
|
||||
|
||||
![通过软件中心安装 digikam][3]
|
||||
|
||||
#### 第二步
|
||||
|
||||
在第一次运行 digiKam 时,它会要求你选择相片保存的位置。然后会创建一个 SQLite 数据库并开始导入图片。
|
||||
|
||||
![][4]
|
||||
|
||||
![][5]
|
||||
|
||||
![][6]
|
||||
|
||||
#### 第三步
|
||||
|
||||
在相片导入完成以后,在文件菜单里选择**工具->查找重复图片**。
|
||||
|
||||
![在文件菜单里,选择工具->查找重复图片][7]
|
||||
|
||||
#### 第四步
|
||||
|
||||
根据你所收集的图片数量,会需要一些时间。之后,你应该可以在左侧边栏里看到有重复的所有相片。在选中图片后,重复的相片会在右侧边栏里显示出来。
|
||||
|
||||
![digiKam 找到的重复图片][8]
|
||||
|
||||
在上面的截图里,我在左侧选中的图片有四张一样的。其中有一张图片标记了“<ruby>参考图片<rt>Reference image</rt></ruby>”,不过还是由你来确定哪张是原始的,哪张是复制的。
|
||||
|
||||
重复的相片默认会按保存位置(比如文件夹)来分组。可以在文件菜单里选择**视图->分类显示**选择其他方式。
|
||||
|
||||
**要删除重复相片的话**,选中有侧边栏里的相片并按下删除键。
|
||||
|
||||
可以重复这个操作,选择左侧边栏里的图片,一个个删除重复图片。会花太长时间?有个方法可以一次删除多个重复内容。
|
||||
|
||||
#### 在 digiKam 里删除多个重复图片
|
||||
|
||||
如果想一次把所有重复相片全删掉的话,可以在左侧边栏里选中所有相片。
|
||||
|
||||
然后,打开**文件菜单->视图->排序**,然后选择按相似程度。
|
||||
|
||||
![删除多个重复相片][9]
|
||||
|
||||
之后会在底部显示所有参考图片。然后可以在右侧边栏里选中所有没有标记重复的相片,并按下删除按钮。
|
||||
|
||||
#### 额外提示:可以在垃圾桶里恢复已删除的相片
|
||||
|
||||
意外总是有的。人们经常会不小心误删了相片。这也是为什么 digiKam 不会立刻彻底删除图片。而是选择在保存相片的文件夹下创建隐藏的 `.dtrash` 文件夹,然后将“已删除”的相片移动到里面。
|
||||
|
||||
在应用程序界面上,你也可以看到这个垃圾桶文件夹。在里面可以找到你“删除”的相片,然后根据需要可以选择恢复。
|
||||
|
||||
![digiKam 的垃圾桶文件夹][10]
|
||||
|
||||
希望你能喜欢这个关于在 Linux 上查找和删除重复图片的简短教程。类似的,你可能会想了解 [使用 GUI 工具在 Linux 系统里搜索重复文件][11]。
|
||||
|
||||
有任何问题和建议,请在下方留评。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/find-remove-duplicate-photos-linux/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[zpl1025](https://github.com/zpl1025)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.digikam.org/
|
||||
[2]: https://itsfoss.com/linux-photo-management-software/
|
||||
[3]: https://itsfoss.com/wp-content/uploads/2021/08/digikam-software-center-800x452.webp
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2021/08/digikam-initial-setup-1.webp
|
||||
[5]: https://itsfoss.com/wp-content/uploads/2021/08/digikam-initial-setup-2.webp
|
||||
[6]: https://itsfoss.com/wp-content/uploads/2021/08/digikam-initial-setup-3-800x607.webp
|
||||
[7]: https://itsfoss.com/wp-content/uploads/2021/08/find-duplicates-digikam-800x462.webp
|
||||
[8]: https://itsfoss.com/wp-content/uploads/2021/08/duplicate-images-found-with-digikam-800x530.webp
|
||||
[9]: https://itsfoss.com/wp-content/uploads/2021/08/remove-multiple-duplicate-photos-800x528.webp
|
||||
[10]: https://itsfoss.com/wp-content/uploads/2021/08/trash-option-digiKam-800x545.webp
|
||||
[11]: https://itsfoss.com/find-duplicate-files-linux/
|
@ -0,0 +1,113 @@
|
||||
[#]: subject: (4MLinux 37.0 Release Packs in Linux Kernel 5.10 LTS and New Applications)
|
||||
[#]: via: (https://news.itsfoss.com/4mlinux-37-0-release/)
|
||||
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
4MLinux 37.0 Release Packs in Linux Kernel 5.10 LTS and New Applications
|
||||
======
|
||||
|
||||
One of the most lightweight distros, [4MLinux][1], has just announced its 37th major release. This version brings a variety of improvements, of which we shall be looking at here.
|
||||
|
||||
Before that, however, I feel that it would be appropriate to find out more about it, especially since it’s such a niche distro.
|
||||
|
||||
### What Is 4MLinux?
|
||||
|
||||
Despite its somewhat unusual name, it actually is quite logical, especially when you look at the project’s goals:
|
||||
|
||||
* **M**aintenance (system rescue Live CD),
|
||||
* **M**ultimedia (full support for a huge number of image, audio and video formats),
|
||||
* **M**iniserver (DNS, FTP, HTTP, MySQL, NFS, Proxy, SMTP, SSH, and Telnet),
|
||||
* **M**ystery (meaning a collection of classic Linux games).
|
||||
|
||||
|
||||
|
||||
This is where it gets the “4M” part of the name from.
|
||||
|
||||
One interesting quirk of this distro is that it doesn’t come with a traditional package manager, instead opting for an ecosystem of extensions. The minimum requirements are also quite relaxed, requiring just 32 MB of RAM to run. The result of all this is an incredibly lightweight and fast distro, perfect for those older computers gathering dust in a cupboard.
|
||||
|
||||
### New Features
|
||||
|
||||
This release brings a variety of improvements, most of which are as follows:
|
||||
|
||||
* 4 new applications can be installed
|
||||
* [Linux 5.10 LTS][2]
|
||||
* [LibreOffice 7.1.5][3]
|
||||
* Firefox 90.0.2
|
||||
* Thunderbird 78.12
|
||||
* Other Updated applications
|
||||
|
||||
|
||||
|
||||
#### Linux 5.10 LTS
|
||||
|
||||
This release brings in Linux kernel 5.10 LTS, resulting in better hardware support and many small improvements. To be honest, I was actually quite surprised at this addition, as I thought that they may not opt for one of the latest kernels right now.
|
||||
|
||||
If you want to see what other improvements this addition brings, I would suggest reading [our coverage for Linux kernel 5.10 release][2].
|
||||
|
||||
#### New Applications
|
||||
|
||||
One area that M4Linux struggles in is application support. Due to the lack of a package manager, the list of available apps is very short, making each addition to it extremely meaningful.
|
||||
|
||||
This release brings the Dmidecode tool for reading hardware-related data from SMBIOS, FluidSynth software synthesizer, HandBrake video transcoder, and qBittorrent BitTorrent client.
|
||||
|
||||
These applications should improve the usefulness of this distribution, hopefully helping older computers stay out of landfill.
|
||||
|
||||
#### Updated Applications
|
||||
|
||||
2021 has had a plethora of large app upgrades, including the new interface in Firefox 89 and the vast improvements of LibreOffice 7.1.5. Now, all these improvements are coming to M4Linux with the new release.
|
||||
|
||||
Here’s a list of updated applications with this release:
|
||||
|
||||
* LibreOffice 7.1.5
|
||||
* Firefox 90.0.2
|
||||
* Mozilla Thunderbird 78.12.0
|
||||
* Audacious 4.1
|
||||
* VLC 3.0.16
|
||||
* MPV 0.33.0
|
||||
* AbiWord 3.0.5
|
||||
* GIMP 2.10.24
|
||||
* Gnumeric 1.12.50
|
||||
* Chromium 90.0
|
||||
* Mesa 21.0
|
||||
|
||||
|
||||
|
||||
In all, these updated applications should provide a much-improved user experience.
|
||||
|
||||
### Final Thoughts
|
||||
|
||||
M4Linux, despite being quite a niche, has made some incredible improvements with this release, especially when considering the incredibly small development team.
|
||||
|
||||
Even though it isn’t targeting the latest hardware, I can still see how this distribution might be perfect for some use cases.
|
||||
|
||||
You can read the [official announcement][4] to learn more.
|
||||
|
||||
_What do you think about M4Linux 37.0? Let me know in the comments below!_
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/4mlinux-37-0-release/
|
||||
|
||||
作者:[Jacob Crume][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://news.itsfoss.com/author/jacob/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://4mlinux.com/index.php?page=home
|
||||
[2]: https://news.itsfoss.com/kernel-5-10-release/
|
||||
[3]: https://news.itsfoss.com/libreoffice-7-1-community/
|
||||
[4]: https://4mlinux-releases.blogspot.com/2021/07/4mlinux-370-stable-released.html
|
@ -0,0 +1,78 @@
|
||||
[#]: subject: (GNOME Web Canary is Now Available to Test Bleeding Edge Features)
|
||||
[#]: via: (https://news.itsfoss.com/gnome-web-canary/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
GNOME Web Canary is Now Available to Test Bleeding Edge Features
|
||||
======
|
||||
|
||||
Epiphany or [GNOME Web][1] is a minimal and yet capable browser for Linux distributions. You should find it as the default browser for elementary OS.
|
||||
|
||||
With GNOME 40, the Epiphany browser has had some [improvements and additions][2].
|
||||
|
||||
Behind the scenes, it regularly gets some exciting improvements and feature additions. And for that, you can opt for the Tech Preview version of GNOME Web tailored for early testers.
|
||||
|
||||
Now, a new Canary flavor has been introduced that you can use to test features that are not yet available even in the tech preview build.
|
||||
|
||||
### GNOME Web Canary Flavor
|
||||
|
||||
![][3]
|
||||
|
||||
GNOME Web’s “Canary” builds let you test features that are not even available in the latest [WebKitGTK][4] version.
|
||||
|
||||
Do note that the canary builds are supposed to be extremely unstable, even worse than the development builds available as a tech preview.
|
||||
|
||||
However, with the help of a Canary build, an end-user can test things way early in the process of development that can help find disastrous bugs.
|
||||
|
||||
Not just limited to end-user early testing, a canary build also makes things easier for a GNOME Web developer.
|
||||
|
||||
They no longer have to build WebKitGTK separately in order to implement and test a new feature.
|
||||
|
||||
Even though there was a Flatpak SDK available to ease the process for developers, it was still a time-consuming task.
|
||||
|
||||
Now, with that out of the way, the development pace can potentially improve as well.
|
||||
|
||||
### How to Get the Canary Build?
|
||||
|
||||
First, you need to add the WebKit SDK Flatpak remote using the commands below:
|
||||
|
||||
```
|
||||
flatpak --user remote-add --if-not-exists webkit https://software.igalia.com/flatpak-refs/webkit-sdk.flatpakrepo
|
||||
flatpak --user install https://nightly.gnome.org/repo/appstream/org.gnome.Epiphany.Canary.flatpakref
|
||||
```
|
||||
|
||||
Once done, you can install the Canary by using the [Flatpakref file][5] provided.
|
||||
|
||||
Testing a Canary build gives more users the ability to help GNOME Web developers in the process. So, it is definitely a much-needed addition to improve the development of the GNOME Web browser.
|
||||
|
||||
For more technical details, you might want to take a look at the [announcement post][6] by one of the developers.
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/gnome-web-canary/
|
||||
|
||||
作者:[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://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://wiki.gnome.org/Apps/Web/
|
||||
[2]: https://news.itsfoss.com/gnome-web-new-tab/
|
||||
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjY0MiIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[4]: https://webkitgtk.org
|
||||
[5]: https://nightly.gnome.org/repo/appstream/org.gnome.Epiphany.Canary.flatpakref
|
||||
[6]: https://base-art.net/Articles/introducing-the-gnome-web-canary-flavor/
|
@ -0,0 +1,75 @@
|
||||
[#]: subject: "It’s Time for Ubuntu to Opt for a Hybrid Rolling Release Model"
|
||||
[#]: via: "https://news.itsfoss.com/ubuntu-hybrid-release-model/"
|
||||
[#]: author: "Abhishek https://news.itsfoss.com/author/root/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
It’s Time for Ubuntu to Opt for a Hybrid Rolling Release Model
|
||||
======
|
||||
|
||||
Even if you are not an Ubuntu user, you probably are aware of its release model.
|
||||
|
||||
There is a [long term support (LTS) release][1] that comes every two year and gets supported for five years. In between the two LTS releases, we see three non-LTS releases that are released at an interval of six months.
|
||||
|
||||
The LTS version retains the same kernel (unless you opt for [HWE kernel][2]) and it also holds on to various software components to provide a stable production environment.
|
||||
|
||||
The non-LTS Ubuntu releases that come in between feature new features from Ubuntu, newer kernel, new desktop environment and newer version of various software available from Ubuntu repositories.
|
||||
|
||||
It is no secret that these non-LTS releases work as a ‘testing ground’ for the features that would eventually land in the LTS release.
|
||||
|
||||
And this is why I suggest to get rid of these intermediate releases and opt for a [rolling release][3] model between the LTS releases. Here me out, please.
|
||||
|
||||
### Go rolling in-between the LTS releases
|
||||
|
||||
The six monthly release schedule gives the Ubuntu developers a tight schedule to work on. It’s good in the way that keeps their objective in focus with a proper roadmap.
|
||||
|
||||
But it also builds additional pressure to deliver ‘more’ new features in every release. That cannot always happen if the timeframe is short. Remember how [Ubuntu had to drop GNOME 40 from 21.04][4] because the developers didn’t get enough time to work on it?
|
||||
|
||||
Also, it’s not that the end user (like you and me) gets a choice to stay with a non-LTS release. The support ends in nine months, which mean that even if you did not upgrade to the next non-LTS Ubuntu version immediately, you have to do it eventually. If it does not happen in six months, it has to in nine months.
|
||||
|
||||
I know you would say that upgrading Ubuntu version is simple. A few clicks, good internet speed and a potential backup will put you on the new Ubuntu version without much trouble.
|
||||
|
||||
And my questions is, why bother with that. A rolling release will be even simpler. Let the upgrades come between the LTS releases.
|
||||
|
||||
Developers release the new features when it is ready. Users get the upgrades with the system updates continually, instead of doing a ‘major upgrade’ every six or nine months.
|
||||
|
||||
See, the people who opt for non-LTS release are the ones who want new features. Let them get the new features through rolling releases. The LTS release schedule remains the same, coming every two years.
|
||||
|
||||
#### Bug testing? Get a testing branch like other rolling releases
|
||||
|
||||
When I say rolling, I do not mean rolling like Arch Linux. It should be rolling like Manjaro. In other words, roll out the upgrades after testing rather than just releasing them in the wild.
|
||||
|
||||
At present, the new Ubuntu versions have beta releases so that early adopters can test it and provide feedback to the developers. This can be achieved by keeping testing and stable branches, like many other rolling release distributions.
|
||||
|
||||
### Rolling release or not? What do you think?
|
||||
|
||||
I know that hardcore Ubuntu users look forward to every single release. The code name, the mascot, the artwork and the wallpapers, these are all part of Ubuntu’s legacy. Should we break with this legacy?
|
||||
|
||||
It’s just my opinion and I am interested to hear yours. Should Ubuntu opt for this hybrid rolling model or stick with the current one? What do you think?
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/ubuntu-hybrid-release-model/
|
||||
|
||||
作者:[Abhishek][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://news.itsfoss.com/author/root/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/long-term-support-lts/
|
||||
[2]: https://itsfoss.com/ubuntu-hwe-kernel/
|
||||
[3]: https://itsfoss.com/rolling-release/
|
||||
[4]: https://news.itsfoss.com/no-gnome-40-in-ubuntu-21-04/
|
@ -0,0 +1,86 @@
|
||||
[#]: subject: "Your one-on-one meeting doesn't have to be this way"
|
||||
[#]: via: "https://opensource.com/open-organization/21/8/one-on-one-meeting-tips"
|
||||
[#]: author: "Catherine Louis https://opensource.com/users/catherinelouis"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Your one-on-one meeting doesn't have to be this way
|
||||
======
|
||||
One-one-one meetings are opportunities for growth. But that's only
|
||||
possible if you're transparent and collaborative about them.
|
||||
![A hand reaching out.][1]
|
||||
|
||||
Whenever I'm speaking with colleagues and clients near the end of a quarter, I often hear from managers rushing to squeeze their one-on-one meetings with employees into tight deadlines. Every time I ask an employee if they've enjoyed their one-on-one with a manager, the answer is unanimously "no." And every time I ask a manager if they've enjoyed their one-on-one with an employee, the answer is unanimously "no, but I have to do it."
|
||||
|
||||
So what we have is a constantly recurring event that no one seems to prioritize, no one seems to enjoy, and no one seems to benefit from. And we choose to end every fiscal quarter like this.
|
||||
|
||||
But it doesn't have to be this way. By thinking and acting openly, we can reframe and reinvent our one-on-one meetings to be productive, beneficial, and even _enjoyable_.
|
||||
|
||||
Managers and other organizational leaders [bear their own set of responsibilities and can apply their own tactics for opening up one-on-one meetings][2]. In this article, I'll discuss what employees can do to ensure more open, honest, compelling, and fulfilling one-on-one meetings with their managers—and offer some examples of ways they can initiate the conversation.
|
||||
|
||||
### Be transparent about your goals
|
||||
|
||||
Be clear with your manager about the goals of your one-on-ones. This might sound strange; however, without structure and clear intent, these meetings can quickly go astray. Before the meeting, really think about what you want to accomplish and how your manager could help you achieve this. Which of your manager's more admirable skills and abilities could you benefit from learning more about? Are you in this role as a stepping stone for another position? Do you have a difficult time negotiating with certain stakeholders, and could your manager help with this? To decide what to prioritize in your one-on-ones, try this: Write today's date one year from now, then imagine the place where you want to be in your career. Using this vision as a starting point, work backward and craft goals you believe your manager can help you achieve on the road to getting where you'd like to be.
|
||||
|
||||
**What this sounds like:** "I'd really like for our one-on-ones to be a dedicated time with you for open-ended conversation, for coaching, mentoring for me to achieve my next goal of {X} to get to know one another better, to provide each other context, or even for venting."
|
||||
|
||||
And at the end of your _current_ one-on-one meeting, establish the goals of your _next_ one-on-one meeting and record them (see below) so you're both clear on what you'll need to prepare to discuss.
|
||||
|
||||
**What this sounds like:** "Given that you've provided me with a path forward, I think the focus of our meeting should be my increased network opportunities with this new contact that you will have provided me." Or, if you're stuck and don't sense an immediate opportunity for forward movement (sometimes the case with sticky problems) end your meeting with a question to establish clear goals: "What can we both do between now and our next meeting to make progress on this situation?"
|
||||
|
||||
So what we have is a constantly recurring event that no one seems to prioritize, no one seems to enjoy, and no one seems to benefit from. And we choose to end every fiscal quarter like this.
|
||||
|
||||
### Accelerate your meeting cadence
|
||||
|
||||
Change is easier when opportunities for feedback are more frequent. Ask your manager to let _you_ schedule one-on-one meetings with her, letting her know they'll happen more frequently than every quarter. Find your meeting cadence based on what is really happening in your work context. Always conclude your current one-on-one meeting by scheduling your next one. Soon you'll get into a nice rhythm. And try not to skip one-on-ones; instead of cancelling, reschedule them.
|
||||
|
||||
**What this sounds like:** "I'd love help with my career here at {company X}, and to do this I'd like to be able to access your calendar for guidance at the time I'll have the need."
|
||||
|
||||
To accelerate your feedback cadence even further, consider asking your manager to provide direct feedback in context rather than waiting to receive this feedback in a one-on-one at some later date. If you wait until the end of the quarter to hear feedback, there's very little you can learn, as you'll probably not remember what even happened to prompt the feedback you actually needed three months earlier.
|
||||
|
||||
**What this sounds like:** "Would you mind giving me direct feedback at the time you notice something? I like to learn immediately, in context, and if it's praise or criticism, please provide this feedback with me privately."
|
||||
|
||||
### Close your feedback loops
|
||||
|
||||
One-on-one meetings should be rich opportunities for mutual feedback. Before you've finished, don't forget to remind your managers what you need from _them_, too. And most importantly, make sure they follow through. Even when people are acting with the best intentions, they're still busy and important conversational threads that begin in meetings can get lost when everyone gets back to work. You know how it goes: You've had a fantastic one-on-one with your manager. You've discussed a sticky situation, and your manager says, "I have a great solution for this. I have a colleague working in a different department who I believe knows a great deal about this, and I promise to get back to you with more guidance before our next meeting next month." And then the next meeting happens and you've both forgotten all about it.
|
||||
|
||||
Keep an open, accessible, _shared record_ of what you've discussed at your one-on-one meetings and update this to include specific actions both you and your manager will take before you meet again. Reinforce your needs verbally; stress how important they are, and be clear that the focus of your next one-on-one will be the items you've already told your manager you need to do your best work.
|
||||
|
||||
**What this sounds like:** "Wow that would be great. It's really important to me. Let's write this down so we don't forget."
|
||||
|
||||
One-on-one meetings should be rich opportunities for mutual feedback. Before you've finished, don't forget to remind your managers what you need from them, too.
|
||||
|
||||
### Skip status updates
|
||||
|
||||
Don't let your one-on-one become another status meeting. Why?
|
||||
|
||||
* If the discussion concerns a product you're working on, others on your team would likely benefit from being part of it; if you're being updated now, you're a bottleneck for this information.
|
||||
* If you go down this path, you'll have no time to discuss the things you've already said you need to discuss (see above).
|
||||
* It's easy for your manager to listen, but it's also a way to avoid difficult conversations; attending a Scrum of Scrums meeting, for example, would be the place to hear updates.
|
||||
|
||||
|
||||
|
||||
**What this sounds like:** "Every team member updates their status daily just prior to the Daily Scrum and the status of the three teams can be heard in the Scrum of Scrums. I'd rather use this hour with you to get your coaching on my career, problems with negotiating with stakeholder Y, and feedback on my personal development progress. If we don't have time to do this now, can we reschedule?"
|
||||
|
||||
### Working for you?
|
||||
|
||||
One-on-one meetings should be productive and energizing. If they aren't, you might need to open them up a bit. Hopefully the ideas I've shared here can help you do just that. And perhaps you have your own tips for making your one-on-one meetings spectacular. I hope you'll share them if you do.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/21/8/one-on-one-meeting-tips
|
||||
|
||||
作者:[Catherine Louis][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/catherinelouis
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareer_job_rh1x_1.png?itok=b1dy5tlv (A hand reaching out.)
|
||||
[2]: https://opensource.com/open-organization/18/5/open-one-on-one-meetings-guide
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (zpl1025)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (YungeG)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,123 +0,0 @@
|
||||
[#]: subject: (3 essential Linux cheat sheets for productivity)
|
||||
[#]: via: (https://opensource.com/article/21/4/linux-cheat-sheets)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (YungeG)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
3 essential Linux cheat sheets for productivity
|
||||
======
|
||||
Download cheat sheets for sed, grep, and parted to integrate new
|
||||
processes into your work.
|
||||
![Hand putting a Linux file folder into a drawer][1]
|
||||
|
||||
Linux is famous for its commands. This is partially because nearly everything that Linux does can also be invoked from a terminal, but it's also that Linux as an operating system is highly modular. Its tools are designed to produce fairly specific results, and when you know a lot about a few commands, you can combine them in interesting ways for useful output. Learning Linux is equal parts learning commands and learning how to string those commands together in interesting combinations.
|
||||
|
||||
With so many Linux commands to learn, though, taking the first step can seem daunting. What command should you learn first? Which commands should you learn well, and which commands require only a passing familiarity? I've thought about these questions a lot, and I'm not convinced there's a universal answer. The "basic" commands are probably the same for anyone:
|
||||
|
||||
* `ls`
|
||||
* `cd`
|
||||
* `mv`
|
||||
|
||||
|
||||
|
||||
These amount to being able to navigate your Linux file system.
|
||||
|
||||
Beyond the basics, though, the "default" commands vary from industry to industry. Sysadmins need tools for [system introspection and monitoring][2]. Artists need tools for [media conversion][3] and [graphic processing][4]. Home users might want tools for [PDF processing][5], or [calendaring][6], or [document conversion][7]. The list goes on and on.
|
||||
|
||||
However, some Linux commands stand out as being particularly important—either because they're common low-level tools that everyone needs on occasion or they're all-purpose tools that anyone might find useful most of the time.
|
||||
|
||||
Here are three to add to your list.
|
||||
|
||||
### Sed
|
||||
|
||||
**Purpose:** The `sed` command is a good, all-purpose tool that any Linux user can benefit from knowing. On the surface, it's just a terminal-based "find and replace." That makes it great for quick and easy corrections across multiple documents. The `sed` command has saved me hours (or possibly cumulative days) of opening individual files, searching and replacing a word, saving the file, and closing the file. It alone justifies my investment in learning the Linux terminal. Once you get to know `sed` well, you're likely to discover a whole world of potential editing tricks that make your life easier.
|
||||
|
||||
**Strength:** The command's strength is in repetition. If you have just one file to edit, it's easy to open it and do a "find and replace" in a traditional [text editor][8]. However, when you're faced with five or 50 files, a good `sed` command (maybe combined with [GNU Parallel][9] for extra speed) can reclaim hours of your day.
|
||||
|
||||
**Weakness:** You have to balance the time you expect to spend making a change with how long it may take you to construct the right `sed` command. Simple edits with the common `sed 's/foo/bar/g` syntax are almost always worth the trivial amount of time it takes to type the command, but complex `sed` commands that utilize a hold space and any of the `ed` style subcommands can take serious concentration combined with several rounds of trial and error. It can be, as it turns out, better to do some edits the new-fashioned way.
|
||||
|
||||
**Cheat:** Download our [sed cheat sheet][10] for quick reference to its single-letter subcommands and an overview of its syntax.
|
||||
|
||||
### Grep
|
||||
|
||||
**Purpose:** The `grep` command comes from its admittedly clunky description: global regular expression print. In other words, `grep` prints to the terminal any matching pattern it finds in files (or other forms of input). That makes it a great search tool, especially adept at scrubbing through vast amounts of text.
|
||||
|
||||
You might use it to find URLs:
|
||||
|
||||
|
||||
```
|
||||
$ grep --only-matching \
|
||||
http\:\/\/.* example.txt
|
||||
```
|
||||
|
||||
You could use it to find a specific config option:
|
||||
|
||||
|
||||
```
|
||||
$ grep --line-number \
|
||||
foo= example.ini
|
||||
2:foo=true
|
||||
```
|
||||
|
||||
And of course, you can combine it with other commands:
|
||||
|
||||
|
||||
```
|
||||
$ grep foo= example.ini | cut -d= -f2
|
||||
true
|
||||
```
|
||||
|
||||
**Strength:** The `grep` command is a straightforward search command. If you've read the few examples above, then you've essentially learned the command. For even more flexibility, you can use its extended regular expression syntax.
|
||||
|
||||
**Weakness:** The problem with `grep` is also one of its strengths: It's just a search function. Once you've found what you're looking for, you might be faced with the larger question of what to do with it. Sometimes the answer is as easy as redirecting the output to a file, which becomes your filtered list of results. However, more complex use cases mean further processing with any number of commands like [awk][11], [curl][12] (incidentally, [we have a cheat sheet for curl][13], too), or any of the thousands of other options you have on a modern computer.
|
||||
|
||||
**Cheat:** Download our [grep cheat sheet][14] for a quick reference to its many options and regex syntax.
|
||||
|
||||
### Parted
|
||||
|
||||
**Purpose:** GNU `parted` isn't a daily-use command for most people, but it is one of the most powerful tools for hard-drive manipulation. The frustrating thing about hard drives is that you spend years ignoring them until you get a new one and have to set it up for your computer. It's only then that you remember that you have no idea how to best format your drive. That's when familiarity with `parted` can be useful. GNU `parted` can create disk labels and create, back up, and rescue partitions. In addition, it can provide you with lots of information about a drive and its layout and generally prepare a drive for a filesystem.
|
||||
|
||||
**Strength:** The reason I love `parted` over `fdisk` and similar tools is for its combination of an easy interactive mode and its fully noninteractive option. Regardless of how you choose to use `parted`, its commands follow a consistent syntax, and its help menus are well-written and informative. Better still, the command itself is _smart_. When partitioning a drive, you can specify sizes in anything from sectors to percentages, and `parted` does its best to figure out the finer points of partition table placement.
|
||||
|
||||
**Weakness:** It took me a long while to learn GNU `parted` after switching to Linux because, for a very long time, I didn't have a good understanding of how drives actually work. GNU `parted` and most terminal-based drive utilities assume you know what a partition is, that drives have sectors and need disk labels and partition tables that initially lack filesystems, and so on. There's a steep learning curve—not to the command so much as to the foundations of hard-drive technology, and GNU `parted` doesn't do much to bridge the potential gap. It's arguably not the command's job to step you through the process because there are [graphical applications][15] for that, but a workflow-focused option for GNU `parted` could be an interesting addition to the utility.
|
||||
|
||||
**Cheat:** Download our [parted cheat sheet][16] for a quick reference to its many subcommands and options.
|
||||
|
||||
### Learn more
|
||||
|
||||
These are some of my favorite commands, but the list is naturally biased to how I use my computer. I do a lot of shell scripting, so I make heavy use of `grep` to find configuration options, I use `sed` for text editing, and I use `parted` because when I'm working on multimedia projects, there are usually a lot of hard drives involved. You either already have, or you'll soon develop, your own workflows with your own favorite (or at least _frequent_) commands.
|
||||
|
||||
When I'm integrating new processes into my daily work, I create or download a cheat sheet (like the ones linked above), and then I practice. We all learn in our own way, though, so find what works best for you, and learn a new essential command. The more you learn about your most frequent commands, the more you can make them work harder for you.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/4/linux-cheat-sheets
|
||||
|
||||
作者:[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/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
|
||||
[2]: https://opensource.com/life/16/2/open-source-tools-system-monitoring
|
||||
[3]: https://opensource.com/article/17/6/ffmpeg-convert-media-file-formats
|
||||
[4]: https://opensource.com/article/17/8/imagemagick
|
||||
[5]: https://opensource.com/article/20/8/reduce-pdf
|
||||
[6]: https://opensource.com/article/19/4/calendar-git
|
||||
[7]: https://opensource.com/article/20/5/pandoc-cheat-sheet
|
||||
[8]: https://opensource.com/article/21/2/open-source-text-editors
|
||||
[9]: https://opensource.com/article/18/5/gnu-parallel
|
||||
[10]: https://opensource.com/downloads/sed-cheat-sheet
|
||||
[11]: https://opensource.com/article/20/9/awk-ebook
|
||||
[12]: https://www.redhat.com/sysadmin/social-media-curl
|
||||
[13]: https://opensource.com/article/20/5/curl-cheat-sheet
|
||||
[14]: https://opensource.com/downloads/grep-cheat-sheet
|
||||
[15]: https://opensource.com/article/18/11/partition-format-drive-linux#gui
|
||||
[16]: https://opensource.com/downloads/parted-cheat-sheet
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://www.debugpoint.com/2021/06/libreoffice-like-microsoft-office/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (piaoshi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,111 +0,0 @@
|
||||
[#]: subject: (Windows 11 Look Inspired by KDE Plasma and GNOME?)
|
||||
[#]: via: (https://www.debugpoint.com/2021/06/windows-11-inspiration-linux-kde-plasma/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Windows 11 Look Inspired by KDE Plasma and GNOME?
|
||||
======
|
||||
The images of the upcoming Windows 11 Operating system from Microsoft
|
||||
resemble a mixture of our beloved KDE Plasma and GNOME. How much they
|
||||
are similar? We try to find out.
|
||||
There’s a saying which I remember – ‘_Good artists copy. Great artists steal_‘. I don’t know the design team behind Windows 11, but it seems they are pretty good inspired by the Linux desktops. If you look at the Windows OS look over the years – from Windows XP to 7 to 10 – there is not much changed in terms of look and feel. Until now.
|
||||
|
||||
Windows OS have typically 5 to 7 years of life iterations with a new release. If you think about the options of customization Windows gives you, that remained the same over the years. Even the overall desktop experience in terms of Start Menu position, width, color – all remained constant.
|
||||
|
||||
But with the new look of Windows 11 – this is changing. Let me walk you through some of the screenshots I had a look at and how cunningly it is similar to the popular Linux [desktop environments][1] such as KDE Plasma and GNOME.
|
||||
|
||||
### Windows 11 Look Inspired by KDE Plasma and GNOME?
|
||||
|
||||
#### Start Menu and Taskbar
|
||||
|
||||
The traditional Start Menu and Taskbar theme changed in Windows 11. The Start menu and Taskbar icons are at the center of the taskbar (default view). It also gives you the option to move the taskbar icons and Start menu to the left via settings.
|
||||
|
||||
![Windows 11 – Start menu in light mode][2]
|
||||
|
||||
The overall approach and default color with icons remind me of the KDE Plasma taskbar and Launcher. The icons are polished and centered gives you a feel of Adwaita icons of GNOME while the taskbar looks like from KDE Plasma.
|
||||
|
||||
When you open the start menu, it gives you a different arrangement of the icons and options. Also, a search option at the top pops up when you start to type.
|
||||
|
||||
Now, look at the newly designed KDE Plasma launcher. I know, the spacing, the size of the icons, and sharpness are not the same. But you can see how they look surprisingly similar.
|
||||
|
||||
![KDE Plasma 5.22 Launcher in Light mode][3]
|
||||
|
||||
If you are using GNOME or Xfce desktop – with a little tweak of the [Arc menu][4], you can actually have them look exactly similar.
|
||||
|
||||
![Modified Arc Menu][5]
|
||||
|
||||
#### Window Decorations
|
||||
|
||||
Traditionally GNOME always had rounded corners for the standard window decorations. And in compared to that Windows always had sharp corners in windows – like forever until now. Well, with Windows 11, all the window decorations have rounded corners which looks good. The rounded corners concept is not a copyrighted design or new idea. Hence the question arises, why decide to go all rounded corner now? Is there any hidden purpose?
|
||||
|
||||
![Rounded Corners in Windows Explorer and Nautilus][6]
|
||||
|
||||
Oh, remember the application grid menu indicator in GNOME? The small dots tells you that how many pages of applications are there. It seems also to make its way to Windows 11 as well.
|
||||
|
||||
![Dots in paging][7]
|
||||
|
||||
#### Color Palette
|
||||
|
||||
Windows always had a “blue” based theme or any blue variant over the years. Although use has options to change the accent color of the taskbar, start menu background, and window title bars. But with that option, the color palette seems drastically changed with light and dark mode combination to give a more polished and eye-candy look to the Windows desktop. Probably another avenue of inspiration of nice color palette of Ubuntu, KDE, and other flavors.
|
||||
|
||||
[][8]
|
||||
|
||||
SEE ALSO: Windows 11 System Requirement is Turning Heads. Time to migrate to Linux?
|
||||
|
||||
#### Dark Mode
|
||||
|
||||
Windows 11 officially support dark mode/ or dark theme for the first time. Well, I will just leave it here with the below two screenshots. The left one is a dark mode of the Windows 11 start menu and the right one is the KDE Plasma with Breeze dark theme.
|
||||
|
||||
![Comparison of Windows 11 Start Menu and KDE Plasma][9]
|
||||
|
||||
#### New Desktop Widgets
|
||||
|
||||
Inspiration never stops it seems. Remember KDE Plasma’s widgets? Well, it is not a new concept, but it lands in Windows 11. Here’s a screenshot of the new widgets drawer. You can add, remove and scroll items here.
|
||||
|
||||
![Widgets menu][10]
|
||||
|
||||
These are just some of the items which caught my eye. Maybe there are more “inspirations” that “inspired” Windows 11 looks.
|
||||
|
||||
But the question is – why this is the perfect time to introduce all of these features and looks at once?
|
||||
|
||||
### Closing Notes
|
||||
|
||||
Honestly, when I first looked at them, it reminds me of KDE Plasma with Breeze theme in Dark mode. And with very few tweaks, you can make it look like Windows 11. That itself says about how they are similar in looks.
|
||||
|
||||
If you look at the entire desktop operating system landscape – the only players are Windows, Linux Desktops, and macOS. And until now, they all had a distinct signature in their looks. For example, macOS has its own different look which stands out from everyone else. Until now, Windows also had the same – the usual Start menu with the blue theme, etc. But with these new changes, Windows gives users the most customization options and closer to the Linux Desktop looks.
|
||||
|
||||
In my personal opinion, the Windows team should have come up with a different signature look than just being “inspired” by our beloved Linux Desktops.
|
||||
|
||||
I am not sure what the future holds, but it seems the “E-E-E” is in the works with full force.
|
||||
|
||||
Cheers.
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/06/windows-11-inspiration-linux-kde-plasma/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/category/desktop-environment
|
||||
[2]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Windows-11-Start-menu-in-light-mode.jpg
|
||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/KDE-Plasma-5.22-Launcher-in-Light-mode.jpg
|
||||
[4]: https://gitlab.com/LinxGem33/Arc-Menu
|
||||
[5]: https://www.debugpoint.com/blog/wp-content/uploads/2020/12/gnomecustomize2020-2-1024x576.jpg
|
||||
[6]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Rounded-Corners-in-Windows-Explorer-and-Nautilus-1024x716.jpg
|
||||
[7]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Dots-in-paging-1024x468.jpg
|
||||
[8]: https://www.debugpoint.com/2021/06/windows-11-system-requirement/
|
||||
[9]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Comparison-of-Windows-11-Start-Menu-and-KDE-Plasma-1024x505.jpg
|
||||
[10]: https://www.debugpoint.com/blog/wp-content/uploads/2021/06/Widgets-menu-1024x833.jpg
|
@ -1,95 +0,0 @@
|
||||
[#]: subject: (5 useful ways to manage Kubernetes with kubectl)
|
||||
[#]: via: (https://opensource.com/article/21/7/kubectl)
|
||||
[#]: author: (Alan Smithee https://opensource.com/users/alansmithee)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
5 useful ways to manage Kubernetes with kubectl
|
||||
======
|
||||
Learn kubectl to enhance how you interact with Kubernetes.
|
||||
![Ship captain sailing the Kubernetes seas][1]
|
||||
|
||||
Kubernetes is software to help you run lots of containers in an organized way. Aside from providing tools to manage (or [orchestrate][2]) the containers you run, Kubernetes also helps those containers scale out as needed. With Kubernetes as your central control panel (or _control plane_), you need a way to manage Kubernetes, and the tool for that job is kubectl. The `kubectl` command lets you control, maintain, analyze, and troubleshoot Kubernetes clusters. As with many tools using the `ctl` (short for "control") suffix, such as systemctl and sysctl, kubectl has purview over a broad array of functions and tasks, so you end up using it a lot if you're running Kubernetes. It's a big command with lots of options, so here are five common tasks that kubectl makes easy.
|
||||
|
||||
### 1\. List and describe resources
|
||||
|
||||
Containers, by design, tend to multiply. Under certain conditions, they can multiply rapidly. This can get overwhelming if the only way you have to see running containers is `podman ps` or `docker ps`. With `kubectl get` and `kubectl describe`, you can get information about what pods are running and the containers they're handling. What's more is that you can get just the information you need by using options like `--namespace` or `name` or `--selector`.
|
||||
|
||||
The `get` subcommand is useful for a lot more than just pods and containers. It has information about nodes, namespaces, deployments, services, and replicas.
|
||||
|
||||
### 2\. Create resources
|
||||
|
||||
If you've only ever created deployments through a web user interface (UI) like one provided by OpenShift, OKD, or Kubernetes, but you're looking to take control of your cluster from your Linux terminal instead, then get ready to use `kubectl create`. The `kubectl create` command doesn't just instantiate a new app deployment, though. There are lots of other components available in Kubernetes that you can create, such as services, quotas, and [CronJobs][3].
|
||||
|
||||
A CronJob in Kubernetes can create a transient pod meant to perform some task on a schedule of your choice. They're not difficult to set up. Here's a CronJob to have a BusyBox image echo "hello world" every minute:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl create cronjob \
|
||||
hello-world \
|
||||
\--image=busybox \
|
||||
\--schedule="*/1 * * * *" -- echo "hello world"
|
||||
```
|
||||
|
||||
### 3\. Edit files
|
||||
|
||||
You may have an understanding that objects in Kubernetes have accompanying configuration files, but rummaging through your filesystem to find the appropriate file can be troublesome. With `kubectl edit`, you can keep your mind on the objects and not on the files that define them. You can have `kubectl` find and open the file for you (it respects the `KUBE_EDITOR` environment variable, so you can set your editor to whatever you prefer):
|
||||
|
||||
|
||||
```
|
||||
$ KUBE_EDITOR=emacs \
|
||||
kubectl edit cronjob/hello-world
|
||||
```
|
||||
|
||||
### 4\. Trade files between containers
|
||||
|
||||
Newcomers to containers are often baffled by the concept of a shared system that they can't apparently access. They may learn about `exec` options in their container engine or in kubectl itself, but containers still can seem impervious when they can't just grab a file from or place a file into a container. Using the `kubectl cp` command, you can treat containers as if they were remote servers, making copying files to and from containers no more complex than an SSH command:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl cp foo my-pod:/tmp`
|
||||
```
|
||||
|
||||
### 5\. Apply changes
|
||||
|
||||
Making changes to Kubernetes objects can be done at any time with the `kubectl apply` command. All you have to do is point the command to a configuration file:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl apply -f ./mypod.json`
|
||||
```
|
||||
|
||||
Akin to running an Ansible playbook or a Bash script, `apply` makes it easy to "import" settings quickly into a running Kubernetes instance. For instance, the GitOps tool [ArgoCD][4] is surprisingly simple to install thanks to the `apply` subcommand:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl create namespace argocd
|
||||
$ kubectl apply -n argocd \
|
||||
-f <https://raw.githubusercontent.com/argoproj/argo-cd/vx.y.z/manifests/install.yaml>
|
||||
```
|
||||
|
||||
### Use kubectl
|
||||
|
||||
Kubectl is a powerful tool, and because it's a terminal command it can be scripted and used in many ways a web UI cannot. Learning kubectl is a great way to further your understanding of Kubernetes, containers, pods, and all the technologies that surround these important cloud innovations. [Download our kubectl cheat sheet][5] for a quick reference, complete with sample commands, to help you as you learn and remind you of the details once you're a pro.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/kubectl
|
||||
|
||||
作者:[Alan Smithee][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/alansmithee
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas)
|
||||
[2]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[3]: https://opensource.com/article/20/11/kubernetes-jobs-cronjobs
|
||||
[4]: https://argoproj.github.io/argo-cd/
|
||||
[5]: https://opensource.com/downloads/kubectl-cheat-sheet
|
@ -1,386 +0,0 @@
|
||||
[#]: subject: (Command line quick tips: wc, sort, sed and tr)
|
||||
[#]: via: (https://fedoramagazine.org/command-line-quick-tips-wc-sort-sed-and-tr/)
|
||||
[#]: author: (mahesh1b https://fedoramagazine.org/author/mahesh1b/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (perfiffer)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Command line quick tips: wc, sort, sed and tr
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Image by Ryan Lerch (CC BY-SA 4.0)
|
||||
|
||||
Linux distributions are great to use and they have some tricks under their sleeves which users may not be aware of. Let’s have a look at some command line utilities which really come in handy when you’re the guy that likes to stick with the terminal rather than using a GUI.
|
||||
|
||||
We all know that using a terminal is more efficient to use the system. In case you are editing or playing with text files on a terminal then these tools will surely make your life easy.
|
||||
|
||||
For this article let’s have a look at _wc_, _sort_, _tr_, and _sed_ commands.
|
||||
|
||||
## **wc**
|
||||
|
||||
wc is a utility whose name stands for “word count”. As the name suggests it will count the lines, words or byte count from any file.
|
||||
|
||||
Let’s see how it works:
|
||||
|
||||
```
|
||||
$ wc filename
|
||||
lines words characters filename
|
||||
```
|
||||
|
||||
So in output we get the total number of newlines in the file, total number of words, total number of characters, and the filename.
|
||||
|
||||
To get some specific output we have to use options:
|
||||
|
||||
* -c To print the byte counts
|
||||
* -l To print the newline counts
|
||||
* -w To print the word counts
|
||||
* -m To print the character counts
|
||||
|
||||
|
||||
|
||||
### wc demo
|
||||
|
||||
Let’s see it in action:
|
||||
|
||||
Here we start with a text file, _loremipsm.txt_. First, we print out the file and then use _wc_ on it.
|
||||
|
||||
```
|
||||
$ cat loremipsm.txt
|
||||
Linux is the best-known and most-used open source operating system.
|
||||
As an operating system, Linux is software that sits underneath all of the other software on a computer,
|
||||
receiving requests from those programs and replaying these requests to the computer's hardware.
|
||||
|
||||
$ wc loremipsm.txt
|
||||
3 41 268 loremipsm.txt
|
||||
```
|
||||
|
||||
Suppose I only want to see the byte count of the file:
|
||||
|
||||
```
|
||||
$ wc -c loremipsm.txt
|
||||
268 loremipsm.txt
|
||||
```
|
||||
|
||||
For the newline count of the file:
|
||||
|
||||
```
|
||||
$ wc -l loremipsm.txt
|
||||
3 loremipsm.txt
|
||||
```
|
||||
|
||||
To see the word count of the file:
|
||||
|
||||
```
|
||||
$ wc -w loremipsm.txt
|
||||
41 loremipsm.txt
|
||||
```
|
||||
|
||||
Now only the character count of the file:
|
||||
|
||||
```
|
||||
$ wc -m loremipsm.txt
|
||||
268 loremipsm.txt
|
||||
```
|
||||
|
||||
## **sort**
|
||||
|
||||
The _sort_ command is one of the most useful tools. It will sort the data in a file. Sorting is by either characters or numbers in ascending or descending order. It can also be used to sort or randomize the lines of files.
|
||||
|
||||
Using _sort_ can be very simple. All we need to do is provide the name of the file.
|
||||
|
||||
```
|
||||
$ sort filename
|
||||
```
|
||||
|
||||
By default it sorts the data in alphabetical order. One thing to note is that the _sort_ command just displays the sorted data. It does not overwrite the file.
|
||||
|
||||
Some useful options for _sort_:
|
||||
|
||||
* -r To sort the lines in the file in reverse order
|
||||
* -R To shuffle the lines in the file into random order
|
||||
* -o To save the output in another file
|
||||
* -k To sort as per specific column
|
||||
* -t To mention the field separator
|
||||
* -n To sort the data according to numerical value
|
||||
|
||||
|
||||
|
||||
### sort demo
|
||||
|
||||
Let’s use _sort_ in some short demos:
|
||||
|
||||
We have a file, _list.txt_, containing names and numeric values separated by commas.
|
||||
|
||||
First let’s print out the file and just do simple sorting.
|
||||
|
||||
```
|
||||
$ cat list.txt
|
||||
Cieran Wilks, 9
|
||||
Adelina Rowland, 4
|
||||
Hayden Mcfarlnd, 1
|
||||
Ananya Lamb, 5
|
||||
Shyam Head, 2
|
||||
Lauryn Fuents, 8
|
||||
Kristian Felix, 10
|
||||
Ruden Dyer, 3
|
||||
Greyson Meyers, 6
|
||||
Luther Cooke, 7
|
||||
|
||||
$ sort list.txt
|
||||
Adelina Rowland, 4
|
||||
Ananya Lamb, 5
|
||||
Cieran Wilks, 9
|
||||
Greyson Meyers, 6
|
||||
Hayden Mcfarlnd, 1
|
||||
Kristian Felix, 10
|
||||
Lauryn Fuents, 8
|
||||
Luther Cooke, 7
|
||||
Ruden Dyer, 3
|
||||
Shyam Head, 2
|
||||
```
|
||||
|
||||
Now sort the data in the reverse order.
|
||||
|
||||
```
|
||||
$ sort -r list.txt
|
||||
Shyam Head, 2
|
||||
Ruden Dyer, 3
|
||||
Luther Cooke, 7
|
||||
Lauryn Fuents, 8
|
||||
Kristian Felix, 10
|
||||
Hayden Mcfarlnd, 1
|
||||
Greyson Meyers, 6
|
||||
Cieran Wilks, 9
|
||||
Ananya Lamb, 5
|
||||
Adelina Rowland, 4
|
||||
```
|
||||
|
||||
Let’s shuffle the data.
|
||||
|
||||
```
|
||||
$ sort -R list.txt
|
||||
Cieran Wilks, 9
|
||||
Greyson Meyers, 6
|
||||
Adelina Rowland, 4
|
||||
Kristian Felix, 10
|
||||
Luther Cooke, 7
|
||||
Ruden Dyer, 3
|
||||
Lauryn Fuents, 8
|
||||
Hayden Mcfarlnd, 1
|
||||
Ananya Lamb, 5
|
||||
Shyam Head, 2
|
||||
```
|
||||
|
||||
Let’s make it more complex. This time we sort the data according to the second field, which is the numeric value, and save the output in another file using the -o option.
|
||||
|
||||
```
|
||||
$ sort -n -k2 -t ',' -o sorted_list.txt list.txt
|
||||
$ ls
|
||||
sorted_list.txt list.txt
|
||||
$ cat sorted_list.txt
|
||||
Hayden Mcfarlnd, 1
|
||||
Shyam Head, 2
|
||||
Ruden Dyer, 3
|
||||
Adelina Rowland, 4
|
||||
Ananya Lamb, 5
|
||||
Greyson Meyers, 6
|
||||
Luther Cooke, 7
|
||||
Lauryn Fuents, 8
|
||||
Cieran Wilks, 9
|
||||
Kristian Felix, 10
|
||||
```
|
||||
|
||||
Here we used -n to sort in numerical order, -k to specify the field to sort (2 in this case) -t to indicate the delimiter or field-separator (a comma) and -o to save the output in the file _sorted_list.txt_.
|
||||
|
||||
## **sed**
|
||||
|
||||
Sed is a stream editor that will filter and transform text in the output. This means we are not making changes in the file, only to the output. We can also save the changes in a new file if needed. Sed comes with a lot of options that are useful in filtering or editing the data.
|
||||
|
||||
The syntax for sed is:
|
||||
|
||||
```
|
||||
$ sed [OPTION] ‘PATTERN’ filename
|
||||
```
|
||||
|
||||
Some of the options used with sed:
|
||||
|
||||
* -n : To suppress the printing
|
||||
* p: To print the current pattern
|
||||
* d : To delete the pattern
|
||||
* q : To quit the sed script
|
||||
|
||||
|
||||
|
||||
### sed demo
|
||||
|
||||
Lets see _sed_ in action. We start with the file _data_ with the fields indicating number, name, age and operating system.
|
||||
|
||||
Printing the lines twice if they occur in a specific range of lines.
|
||||
|
||||
```
|
||||
$ cat data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
|
||||
$ sed '3,7 p' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
```
|
||||
|
||||
Here the operation is specified in single quotes indicating lines 3 through 7 and using ‘p’ to print the pattern found. The default behavior of sed is to print every line after parsing it. This means lines 3 through 7 appear twice because of the ‘p’ instruction.
|
||||
|
||||
So how can you print specific lines from the file? Use the ‘-n’ option to eliminate lines that do not match from the output.
|
||||
|
||||
```
|
||||
$ sed -n '3,7 p' data
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
```
|
||||
|
||||
Only lines 3 through 7 will appear using ‘-n’ .
|
||||
|
||||
Omitting specific lines from the file. This uses the ‘d’ to delete the lines from the output.
|
||||
|
||||
```
|
||||
$ sed '3 d' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
9 Mindy Howard 20 Mac
|
||||
|
||||
$ sed '5,9 d' data
|
||||
1 Vicky Grant 20 linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
```
|
||||
|
||||
Searching for a specific keyword in the file.
|
||||
|
||||
```
|
||||
$ sed -n '/linux/ p' data
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
|
||||
$ sed -n '/linux/I p' data
|
||||
1 Vicky Grant 20 Linux
|
||||
7 Freddie Dean 25 linux
|
||||
8 Ralph Martin 19 linux
|
||||
```
|
||||
|
||||
In these examples we have a regular expression which appears in ‘/ /’. If we have similar words in the file but not with proper case then we use the “I” to make the search case insensitive. Recall that the -n eliminates the lines that do not match from the output.
|
||||
|
||||
Replacing the words in the file.
|
||||
|
||||
```
|
||||
$ sed 's/linux/linus/' data
|
||||
1 Vicky Grant 20 Linux
|
||||
2 Nora Burton 19 Mac
|
||||
3 Willis Castillo 21 Windows
|
||||
4 Gilberto Mack 30 Windows
|
||||
5 Aubrey Hayes 17 windows
|
||||
6 Allan Snyder 21 mac
|
||||
7 Freddie Dean 25 linus
|
||||
8 Ralph Martin 19 linus
|
||||
9 Mindy Howard 20 Mac
|
||||
```
|
||||
|
||||
Here ‘s/ / /’ denotes that it is a regex. The located word and then the new word to replace it appear between the two ‘/’.
|
||||
|
||||
## **tr**
|
||||
|
||||
The _tr_ command will translate or delete characters. It can transform the lowercase letters to uppercase or vice versa, eliminate repeating characters, and delete specific characters.
|
||||
|
||||
One thing weird about _tr_ is that it does not take files as input like _wc_, _sort_ and _sed_ do. We use “|” (the pipe symbol) to provide input to the _tr_ command.
|
||||
|
||||
```
|
||||
$ cat filename | tr [OPTION]
|
||||
```
|
||||
|
||||
Some options used with _tr_:
|
||||
|
||||
* -d : To delete the characters in first set of output
|
||||
* -s : To replace the repeated characters with single occurrence
|
||||
|
||||
|
||||
|
||||
### tr demo
|
||||
|
||||
Now let’s use the _tr_ command with the file _letter_ to convert all the characters from lowercase to uppercase.
|
||||
|
||||
```
|
||||
$ cat letter
|
||||
Linux is too easy to learn,
|
||||
And you should try it too.
|
||||
|
||||
$ cat letter | tr 'a-z' 'A-Z'
|
||||
LINUX IS TOO EASY TO LEARN,
|
||||
AND YOU SHOULD TRY IT TOO.
|
||||
```
|
||||
|
||||
Here ‘a-z’ ‘A-Z’ denotes that we want to convert characters in the range from “a” to “z” from lowercase to uppercase.
|
||||
|
||||
Deleting the “o” character from the file.
|
||||
|
||||
```
|
||||
$ cat letter | tr -d 'o'
|
||||
Linux is t easy t learn,
|
||||
And yu shuld try it t.
|
||||
```
|
||||
|
||||
Squeezing the character “o” from the file means that if “o” is repeated in line then it will remove it and print it only once.
|
||||
|
||||
```
|
||||
$ cat letter | tr -s 'o'
|
||||
Linux is to easy to learn,
|
||||
And you should try it to.
|
||||
```
|
||||
|
||||
## **Conclusion**
|
||||
|
||||
This was a quick demonstration of the _wc_, _sort_, _sed_ and _tr_ commands. These commands make it easy to manipulate the text files on the terminal in a quick and efficient way. You may use the _man_ command to learn more about these commands.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/command-line-quick-tips-wc-sort-sed-and-tr/
|
||||
|
||||
作者:[mahesh1b][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/mahesh1b/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg
|
@ -1,84 +0,0 @@
|
||||
[#]: subject: (How to Install elementary Tweaks Tool)
|
||||
[#]: via: (https://www.debugpoint.com/2021/07/elementary-tweaks-install/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
How to Install elementary Tweaks Tool
|
||||
======
|
||||
This quick tutorial demonstrates the steps to install elementary Tweaks
|
||||
tool/Pantheon Tweaks Tool.
|
||||
The elementary Tweaks tool is a handy utility specially designed for [elementary OS][1]. It gives you various options to change certain settings for elementary. Although elementary provides most of the settings already, however, few Pantheon desktop tweaks are not available via standard settings. Hence, this tool. This is a similar tool like we have in GNOME called [GNOME Tweaks][2].
|
||||
|
||||
That said, installing this tool is straight forward. Although it’s a bit different in [elementary OS 6 Odin][3] than earlier versions such as elementary OS 5 Juno. From the elementary OS 6 Odin onwards, this tool is renamed as Pantheon Tweaks tool. Here’s how to install.
|
||||
|
||||
### Install elementary Tweaks Tool
|
||||
|
||||
The elementary OS doesn’t include the software-properties-common package, which is required for adding a PPA. If it is not install already, use the following command to install.
|
||||
|
||||
```
|
||||
sudo apt install software-properties-common
|
||||
```
|
||||
|
||||
#### elementary OS 6 Odin
|
||||
|
||||
The Tweak tool is renamed with a new name and being developed separately. It is called [Pantheon Tweaks][4]. And using the following commands you can install it.
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/pantheon-tweaks
|
||||
sudo apt install -y pantheon-tweaks
|
||||
```
|
||||
|
||||
#### elementary OS 5 Juno and below
|
||||
|
||||
If you are using elementary OS 5 June and below, you can install the earlier [elementary-tweaks][5] using the same PPA. Follow the below commands from terminal.
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/elementary-tweaks
|
||||
sudo apt install -y elementary-tweaks
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
After installation, you can run it via `Application Menu > System Settings > Tweaks`.
|
||||
|
||||
![tweak in settings][6]
|
||||
|
||||
In the Tweaks window, you can find several options to change and configure your elementary desktop.
|
||||
|
||||
![elementary tweaks after install – options][7]
|
||||
|
||||
For your information, this tool is just a front end to elementary desktop settings. You can very well change them via terminal provided you know the exact name or property. The settings you get in this tool can also be changed via `dconf` editor in `io.elementary` path.
|
||||
|
||||
[][8]
|
||||
|
||||
SEE ALSO: elementary OS 5.1 Hera Released. Here’s What’s New
|
||||
|
||||
Let me know in the comment box below, if you face any trouble installing, or using this tweak tool.
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/elementary-tweaks-install/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/tag/elementary
|
||||
[2]: https://www.debugpoint.com/2018/05/customize-your-ubuntu-desktop-using-gnome-tweak/
|
||||
[3]: https://www.debugpoint.com/2020/09/elementary-os-6-odin-new-features-release-date/
|
||||
[4]: https://github.com/pantheon-tweaks/pantheon-tweaks
|
||||
[5]: https://github.com/elementary-tweaks/elementary-tweaks
|
||||
[6]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/tweak-in-settings.png
|
||||
[7]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/elementary-tweaks-after-install-options.png
|
||||
[8]: https://www.debugpoint.com/2019/12/elementary-os-hera-released/
|
@ -1,80 +0,0 @@
|
||||
[#]: subject: (Use the Linux terminal to see what files are on your computer)
|
||||
[#]: via: (https://opensource.com/article/21/8/linux-list-files)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (piaoshi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Use the Linux terminal to see what files are on your computer
|
||||
======
|
||||
Learn how to use the ls command to list files in the terminal with this
|
||||
Linux tutorial.
|
||||
![List files on your computer][1]
|
||||
|
||||
To list files on a computer with a graphical interface, you usually open a file manager (**Files** on Linux, **Finder** on MacOS, **Windows Explorer** on Windows), and look at the files.
|
||||
|
||||
To list files in a terminal, you use the **ls** command to list all files in the current directory. The **pwd** commands tells you what directory you're currently in.
|
||||
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/home/tux
|
||||
$ ls
|
||||
example.txt
|
||||
Documents
|
||||
Downloads
|
||||
Music
|
||||
Pictures
|
||||
Templates
|
||||
Videos
|
||||
```
|
||||
|
||||
You can view hidden files with the **\--all** option:
|
||||
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/home/tux
|
||||
$ ls --all
|
||||
. Downloads
|
||||
.. .local
|
||||
.bashrc Music
|
||||
.config Pictures
|
||||
example.txt Templates
|
||||
Documents Videos
|
||||
```
|
||||
|
||||
As you can see, the first items listed are dots. The single dot is actually a meta location meaning _the folder you are currently in_. The two dots indicate that you can move back from this location. That is, you are in a folder in another folder. Once you start moving around within your computer, you can use that information to create shortcuts for yourself or to increase the specificity of your paths.
|
||||
|
||||
### Files and folders and how to tell the difference
|
||||
|
||||
You may notice that it's hard to tell a file from a folder. Some Linux distributions have some nice colors set up so that all folders are blue and the files are white and binary files are pink or green, and so on. If you don't see those colors, you can try **ls --color**. If you're color blind or on a display that doesn't provide colors, you can alternately use the **\--classify** option:
|
||||
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/home/tux/Downloads
|
||||
$ ls --classify
|
||||
android-info.txt
|
||||
cheat/
|
||||
test-script.sh*
|
||||
```
|
||||
|
||||
As you can see, folders are given a trailing slash (`/`) to denote that they are steps within your file system. Binary entities, like zip files and executable programs, are indicated swith an asterisk (`*`).
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/linux-list-files
|
||||
|
||||
作者:[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/ch01.svg__0.png?itok=98wPcbAc (List files on your computer)
|
168
sources/tech/20210803 Get started with Argo CD.md
Normal file
168
sources/tech/20210803 Get started with Argo CD.md
Normal file
@ -0,0 +1,168 @@
|
||||
[#]: subject: (Get started with Argo CD)
|
||||
[#]: via: (https://opensource.com/article/21/8/argo-cd)
|
||||
[#]: author: (Ayush Sharma https://opensource.com/users/ayushsharma)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Get started with Argo CD
|
||||
======
|
||||
Argo CD is a simple pull-based GitOps deployment tool that syncs
|
||||
Kubernetes manifest files with a cluster for easy, no-nonsense
|
||||
deployments.
|
||||
![Plumbing tubes in many directions][1]
|
||||
|
||||
In a typical push-based deployment, tools like Ansible and Jenkins connect directly to the server or cluster and execute the provisioning commands. This approach works well when the cluster is accessible on the network and there is direct connectivity between your deployment server and the destination server. For compliance or security reasons, connectivity between the deployment tool and the cluster may not be possible.
|
||||
|
||||
[Argo CD][2] is a pull-based deployment tool. It watches a remote Git repository for new or updated manifest files and synchronizes those changes with the cluster. By managing manifests in Git and syncing them with the cluster, you get all the advantages of a Git-based workflow (version control, pull-request reviews, transparency in collaboration, etc.) and a one-to-one mapping between what is in the Git repo and what is deployed in the cluster. This method is called GitOps.
|
||||
|
||||
In this tutorial, you will:
|
||||
|
||||
1. Install Argo CD on a Minikube installation
|
||||
2. Create a sample Argo CD application called `ayush-test-application` and link it with [my repo `ayush-sharma/example-assets`][3]
|
||||
3. Create an [Nginx deployment with three replicas][4]
|
||||
4. Ensure the new application shows up on the Argo CD dashboard and verify it using `kubectl`
|
||||
|
||||
|
||||
|
||||
### Install Argo CD
|
||||
|
||||
This tutorial uses Minikube version v1.21.0. If you don't have it, [download and install Minikube][5].
|
||||
|
||||
With Minikube up and running, you can install Argo CD. The Argo CD documentation contains detailed steps on how to [install and configure it for any cluster][6]. Once you've executed those steps, run `minikube tunnel` in a separate terminal window to ensure Minikube exposes the Argo CD server's load balancer endpoint on your local system. To verify this, run `kubectl get po -n argocd` and check if the `argo-server` service has an `EXTERNAL-IP:`
|
||||
|
||||
|
||||
```
|
||||
user@system ~ kubectl get svc -n argocd
|
||||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
argocd-dex-server ClusterIP 10.110.2.52 <none> 5556/TCP,5557/TCP,5558/TCP 3h32m
|
||||
argocd-metrics ClusterIP 10.100.73.57 <none> 8082/TCP 3h32m
|
||||
argocd-redis ClusterIP 10.104.11.24 <none> 6379/TCP 3h32m
|
||||
argocd-repo-server ClusterIP 10.100.132.53 <none> 8081/TCP,8084/TCP 3h32m
|
||||
argocd-server LoadBalancer 10.98.182.198 10.98.182.198 80:32746/TCP,443:31353/TCP 3h32m
|
||||
argocd-server-metrics ClusterIP 10.105.182.52 <none> 8083/TCP 3h32m
|
||||
```
|
||||
|
||||
Once the installation is complete and the load balancer is working, the Argo CD user interface (UI) will be accessible at the `EXTERNAL IP`.
|
||||
|
||||
![Argo CD home page][7]
|
||||
|
||||
(Ayush Sharma, [CC BY-SA 4.0][8])
|
||||
|
||||
### Create your first application
|
||||
|
||||
Before talking about Argo CD deployments, you need a Git repo with a Kubernetes (k8s) manifest file ready to deploy. I'm using my [public repo `example-assets`][3] with an Nginx deployment [manifest file in `/argocd/getting-started`][4].
|
||||
|
||||
The goal is to get Argo CD to listen to the k8s manifest file for changes and then sync them with the cluster it is deployed in (in this case, Minikube). You do this by creating an application containing information about the manifest files' source repo, destination cluster details, and synchronization policies.
|
||||
|
||||
Click `New App` on the top left to configure a new application. Since my destination Kubernetes server is the one Argo CD is installed on (Minikube), I left the server defaults as-is. These are the values I configured:
|
||||
|
||||
1. Application name: `ayush-test-application`
|
||||
2. Project: `default`
|
||||
3. Sync policy: `automated`
|
||||
4. Sync options: `prune: true; selfHeal: true`
|
||||
5. Source repository URL: `https://gitlab.com/ayush-sharma/example-assets.git`
|
||||
6. Source revision: `HEAD`
|
||||
7. Source path: `argocd/getting-started`
|
||||
8. Destination cluster URL: `https://kubernetes.default.svc`
|
||||
9. Destination namespace: `default`
|
||||
|
||||
|
||||
|
||||
To make things easier, you can click `EDIT AS YAML` on the top right and paste in:
|
||||
|
||||
|
||||
```
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: ayush-test-application
|
||||
spec:
|
||||
destination:
|
||||
name: 'default'
|
||||
namespace: default
|
||||
server: '<https://kubernetes.default.svc>'
|
||||
source:
|
||||
path: argocd/getting-started
|
||||
repoURL: '<https://gitlab.com/ayush-sharma/example-assets.git>'
|
||||
targetRevision: HEAD
|
||||
project: default
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
```
|
||||
|
||||
Your configuration should look like this:
|
||||
|
||||
![Argo CD application configuration][9]
|
||||
|
||||
(Ayush Sharma, [CC BY-SA 4.0][8])
|
||||
|
||||
After saving the configuration, your application should show up as a card on the home page. Since you specified the sync policy as `Automated`, your new application will begin syncing with the repo immediately.
|
||||
|
||||
![Argo CD application syncing][10]
|
||||
|
||||
(Ayush Sharma, [CC BY-SA 4.0][8])
|
||||
|
||||
### Create the Nginx deployment
|
||||
|
||||
In this tutorial, the manifest file is a standard Nginx deployment with three replicas. Once `ayush-test-application` completes syncing, Argo CD will display a nice graphical view of the deployment.
|
||||
|
||||
![Argo CD application deployment][11]
|
||||
|
||||
(Ayush Sharma, [CC BY-SA 4.0][8])
|
||||
|
||||
Verify the deployment using `kubectl get po`:
|
||||
|
||||
|
||||
```
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
nginx-deployment-585449566-584cj 1/1 Running 0 5m
|
||||
nginx-deployment-585449566-6qn2z 1/1 Running 0 5m
|
||||
nginx-deployment-585449566-d9fm2 1/1 Running 0 5m
|
||||
```
|
||||
|
||||
### Argo CD's advantages
|
||||
|
||||
Argo CD is a relatively lightweight approach to k8s deployments. I'm especially fond of the one-to-one relationship between what's in the repo and what's in the cluster, making incident management a lot simpler.
|
||||
|
||||
Another big advantage is that since the Git repo contains everything Argo CD requires, you could delete the entire Argo CD installation and set things up from scratch. This means bringing up a second identical cluster with your entire workload deployed is now more feasible and practical in the event of a catastrophic outage.
|
||||
|
||||
A third big advantage is fewer open ports. Argo CD pulls changes from a remote Git repo, so there's no need to define firewall rules and virtual private cloud (VPC) peering connections to get your deployment servers to connect with your cluster, which is one less point of entry. This reduces the attack surface area for your development, quality assurance (QA), and production servers significantly.
|
||||
|
||||
Since the Git repo and branch name are configurable, you can get creative with deployment models. For example, you could have two different Argo CDs running on two different QA and production clusters listening to the same repo's branch. This guarantees that the same manifest file is deployed on both clusters, ensuring QA and production environments contain the same codebase. Also, a single Argo CD is capable of targeting multiple servers, meaning a hub-and-spoke deployment model is possible, where one master Argo CD orchestrates deployments across multiple development, QA, and production clusters in different regions or environments.
|
||||
|
||||
Get creative with Argo CD, and don't forget to share your experiments with others.
|
||||
|
||||
* * *
|
||||
|
||||
_This article originally appeared on [Ayush Sharma's blog][12] under a [CC BY-SA 4.0][8] license._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/argo-cd
|
||||
|
||||
作者:[Ayush Sharma][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/ayushsharma
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plumbing_pipes_tutorial_how_behind_scenes.png?itok=F2Z8OJV1 (Plumbing tubes in many directions)
|
||||
[2]: https://argoproj.github.io/cd/
|
||||
[3]: https://gitlab.com/ayush-sharma/example-assets/-/tree/main/argocd/getting-started
|
||||
[4]: https://gitlab.com/ayush-sharma/example-assets/-/blob/main/argocd/getting-started/nginx-manifest.yml
|
||||
[5]: https://minikube.sigs.k8s.io/docs/start/
|
||||
[6]: https://argoproj.github.io/argo-cd/getting_started/
|
||||
[7]: https://opensource.com/sites/default/files/uploads/getting-started-with-argocd-application-page.png (Argo CD home page)
|
||||
[8]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[9]: https://opensource.com/sites/default/files/uploads/getting-started-with-argocd-creating-the-application.png (Argo CD application configuration)
|
||||
[10]: https://opensource.com/sites/default/files/uploads/getting-started-with-argocd-creating-ayush-test-application.png (Argo CD application syncing)
|
||||
[11]: https://opensource.com/sites/default/files/uploads/getting-started-with-argocd-successful-nginx-deployment.png (Argo CD application deployment)
|
||||
[12]: https://notes.ayushsharma.in/2021/07/getting-started-with-argocd
|
@ -1,113 +0,0 @@
|
||||
[#]: subject: (Mount Microsoft OneDrive in Linux With OneDriver GUI Tool)
|
||||
[#]: via: (https://itsfoss.com/onedriver/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Mount Microsoft OneDrive in Linux With OneDriver GUI Tool
|
||||
======
|
||||
|
||||
On Windows, Microsoft provides a [free cloud storage service][1] in the form of OneDrive. It comes integrated with Windows and you get 5 GB of free storage with your Microsoft account.
|
||||
|
||||
This works great on Windows but like Google, Microsoft also does not provide a native client for OneDrive on Linux desktop.
|
||||
|
||||
You can access your OneDrive data through browser, of course. In addition to that, there are some other ways to access OneDrive on Linux.
|
||||
|
||||
You can use a premium service like [Insync][2] or opt for a slightly more complicated command line approach with [rclone to use OneDrive on Linux][3].
|
||||
|
||||
Recently, I came across another tool that is slightly different and slightly easier to use. It’s unsurprisingly called OneDriver.
|
||||
|
||||
### OneDriver: Mount OneDrive on your Linux system
|
||||
|
||||
![OneDrive Linux illustration][4]
|
||||
|
||||
[OneDriver][5] is a free and open source tool that allows you to mount your OneDrive files on your Linux system.
|
||||
|
||||
Please keep in mind that it does not sync files in the same way OneDrive does on the Windows system. It mounts the OneDrive files on a local mount point instead. You access the files over the network.
|
||||
|
||||
However, it does provide a kind of hybrid approach here. The files you open in the mounted OneDrive also get downloaded on the system. Which means that you can access the opened files offline as well. The files become read-only if you are not connected to the internet.
|
||||
|
||||
If you make any changes to files locally, it gets reflected on the OneDrive if you are connected to the internet.
|
||||
|
||||
I did notice that in Nautilus file manager on GNOME, it downloads the images present in the current folder automatically. I was under the impression that they will only be downloaded when I open them.
|
||||
|
||||
Another thing is that Nautilus builds thumbnail cache initially. OneDriver may feel a little bit slower and resource consuming in the beginning, but it gets better eventually.
|
||||
|
||||
Oh! You can also mount multiple OneDrive accounts.
|
||||
|
||||
### Installing and using OneDriver
|
||||
|
||||
To install OneDriver on Ubuntu 20.04 (and Linux Mint 20 series), you can use this PPA by the developer of OneDriver:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:jstaf/onedriver
|
||||
sudo apt update
|
||||
sudo apt install onedriver
|
||||
```
|
||||
|
||||
For Ubuntu 21.04, you may use it by downloading the [DEB file from its PPA][6].
|
||||
|
||||
On Fedora, you can add this COPR:
|
||||
|
||||
```
|
||||
sudo dnf copr enable jstaf/onedriver
|
||||
sudo dnf install onedriver
|
||||
```
|
||||
|
||||
Arch users can find it in the AUR.
|
||||
|
||||
Once you install it, search for OneDriver in the menu and start it from here.
|
||||
|
||||
![Search for OneDriver][7]
|
||||
|
||||
On the first run, it gives a strange looking empty interface. Click on the + sign and choose a folder or create a new one where you’ll mount the OneDrive. In my case, I created a new folder named One_drive in my home directory.
|
||||
|
||||
![Click on + sign to add a mount point for OneDrive][8]
|
||||
|
||||
When you have selected the mount point, you will be asked to enter your Microsoft credential.
|
||||
|
||||
![one drive login][9]
|
||||
|
||||
![one drive permission][10]
|
||||
|
||||
Once you are successfully logged in, you can see your files from OneDrive in the mounted directory.
|
||||
|
||||
![OneDrive mounted in Linux][11]
|
||||
|
||||
Once you have done that, you can see your OneDrive account on the application interface. Click on the toggle button beside it to autostart OneDrive mounting after restart.
|
||||
|
||||
![Autostart OneDriver mounting][12]
|
||||
|
||||
Overall, OneDriver is a nice free utility for accessing OneDrive on Linux. It may not provide the complete sync facility like the [premium Insync service][13] but it works fine for limited needs.
|
||||
|
||||
If you use this nifty tool, do share your experience with it. If you like project, maybe give it a [star on GitHub][5].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/onedriver/
|
||||
|
||||
作者:[Abhishek Prakash][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/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/cloud-services-linux/
|
||||
[2]: https://itsfoss.com/use-onedrive-on-linux/
|
||||
[3]: https://itsfoss.com/use-onedrive-linux-rclone/
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-linux.png?resize=800%2C450&ssl=1
|
||||
[5]: https://github.com/jstaf/onedriver
|
||||
[6]: https://launchpad.net/~jstaf/+archive/ubuntu/onedriver/+packages
|
||||
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/search-for-onedriver.png?resize=798%2C214&ssl=1
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/onedriver-interface.png?resize=745%2C456&ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-login.png?resize=470%2C660&ssl=1
|
||||
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-permission.png?resize=470%2C660&ssl=1
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-mounted-in-linux.png?resize=800%2C491&ssl=1
|
||||
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/auto-start-onedriver.png?resize=602%2C499&ssl=1
|
||||
[13]: https://itsfoss.com/recommends/insync/
|
137
sources/tech/20210803 Set up a VPN server on your Linux PC.md
Normal file
137
sources/tech/20210803 Set up a VPN server on your Linux PC.md
Normal file
@ -0,0 +1,137 @@
|
||||
[#]: subject: (Set up a VPN server on your Linux PC)
|
||||
[#]: via: (https://opensource.com/article/21/8/openvpn-server-linux)
|
||||
[#]: author: (D. Greg Scott https://opensource.com/users/greg-scott)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (perfiffer)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Set up a VPN server on your Linux PC
|
||||
======
|
||||
The first step in building a VPN is setting up a VPN server.
|
||||
![Person drinking a hot drink at the computer][1]
|
||||
|
||||
Have you been connected to an untrusted network such as a hotel or café WiFi and need to securely browse the internet from your smartphone or laptop? By using a virtual private network (VPN), you can access that untrusted network anonymously and as safely as if you were on a private network.
|
||||
|
||||
VPN is an amazing tool for safeguarding private data. By using a VPN, you can connect to a private network on the internet while maintaining anonymity.
|
||||
|
||||
There are many VPN services available, and many people have found that the preferred option for securing private data when using untrusted networks is [OpenVPN][2].
|
||||
|
||||
OpenVPN creates an encrypted tunnel between two points, preventing a third party from accessing your network traffic data. By setting up your VPN server, you become your own VPN provider. Many popular VPN services use OpenVPN, so why tie your connection to a specific provider when you can have complete control yourself?
|
||||
|
||||
### Set up a Linux server
|
||||
|
||||
First, install a copy of Linux onto a spare PC. These examples use Fedora, but the steps are mostly the same no matter what Linux distribution you use.
|
||||
|
||||
Download a copy of the most recent Fedora ISO from the [Fedora project][3] website. Make a bootable USB drive, plug it into and boot your PC, and install the operating system. If you've never made a bootable USB drive, read about [Fedora Media Writer][4]. If you've never installed Linux, read about [installing Linux in three steps][5].
|
||||
|
||||
### Set up networking
|
||||
|
||||
After installing the Fedora operating system, log into the console or SSH session.
|
||||
|
||||
Apply the latest updates and reboot:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf update -y && reboot`
|
||||
```
|
||||
|
||||
Log in again and disable the firewall rules:
|
||||
|
||||
|
||||
```
|
||||
systemctl disable firewalld.service
|
||||
systemctl stop firewalld.service
|
||||
```
|
||||
|
||||
You may want to add appropriate firewall rules on this system for your internal network. If so, finish setting up and debugging OpenVPN with all firewall rules turned off, and then add your local firewall rules. For more information, read about [setting up firewalls on Linux][6].
|
||||
|
||||
### Set up IP addresses
|
||||
|
||||
You need a static IP address inside your local network. The commands below assume a Network Manager connection named `ens3` on a device named `ens3`. Your device and connection names might be different, so find them by opening an SSH session or the console and entering:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli connection show
|
||||
NAME UUID TYPE DEVICE
|
||||
ens3 39ad55bd-adde-384a-bb09-7f8e83380875 ethernet ens3
|
||||
```
|
||||
|
||||
You need to ensure that your remote people can find your VPN server. There are two ways to do this. You can set its IP address manually, or you can let your router do most of the work.
|
||||
|
||||
#### Configure an IP address manually
|
||||
|
||||
Set your static IP address, prefix, gateway, and DNS resolver with the following command but substituting your own IP addresses:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli connection modify ens3 ipv4.addresses 10.10.10.97/24
|
||||
$ sudo nmcli connection modify ens3 ipv4.gateway 10.10.10.1
|
||||
$ sudo nmcli connection modify ens3 ipv4.dns 10.10.10.10
|
||||
$ sudo nmcli connection modify ens3 ipv4.method manual
|
||||
$ sudo nmcli connection modify ens3 connection.autoconnect yes
|
||||
```
|
||||
|
||||
Set a hostname:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo hostnamectl set-hostname OVPNserver2020`
|
||||
```
|
||||
|
||||
If you run a local DNS server, you will want to set up a DNS entry with the hostname pointing to the VPN server IP Address.
|
||||
|
||||
Reboot and make sure the system has the correct networking information.
|
||||
|
||||
#### Configure an IP address in your router
|
||||
|
||||
You probably have a router on your network. You may have purchased it, or you may have gotten one from your internet service provider (ISP). Either way, your router probably has a built-in DHCP server that assigns an IP address to each device on your network. Your new server counts as a device on your network, so you may have noticed an IP address is assigned to it automatically.
|
||||
|
||||
The potential problem here is that your router doesn't guarantee that any device will ever get the same IP address after reconnecting. It does _try_ to keep the IP addresses consistent, but they can change depending on how many devices are connected at the time.
|
||||
|
||||
However, almost all routers have an interface allowing you to intercede and reserve IP addresses for specific devices.
|
||||
|
||||
![Router IP address settings][7]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][8])
|
||||
|
||||
There isn't a universal interface for routers, so search the interface of the router you own for **DHCP** or **Static IP address** options. Assign your server its own reserved IP address so that its network location remains the same no matter what.
|
||||
|
||||
### Access your server
|
||||
|
||||
By default, your router probably has a firewall built into it. This is normally good because you don't want someone outside your network to be able to brute force their way into any of your computers. However, you must allow traffic destined for your VPN server through your firewall, or else your VPN will be unreachable and, therefore, no use to you.
|
||||
|
||||
You will need at least one public static IP Address from your internet service provider. Set up the public side of your router with its static IP Address, and then put your OpenVPN server on the private side, with its own private static IP Address inside your network. OpenVPN uses UDP port 1194 by default. Configure your router to [port-forward][9] traffic for your public VPN IP Address on UDP port 1194 to UDP port 1194 on your OpenVPN server. If you decide to use a different UDP port, adjust the port number accordingly.
|
||||
|
||||
### Get ready for the next step
|
||||
|
||||
In this article, you installed and configured an operating system on your server, which is approximately half the battle. In the next article, you'll tackle installing and configuring OpenVPN itself. In the meantime, get familiar with your router and make sure you can reach your server from the outside world. But be sure to close the port forwarding after testing until your VPN is up and running.
|
||||
|
||||
* * *
|
||||
|
||||
_Parts of this article were adapted from D. Greg Scott's [blog][10] and have been republished with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/openvpn-server-linux
|
||||
|
||||
作者:[D. Greg Scott][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/greg-scott
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer)
|
||||
[2]: https://openvpn.net/
|
||||
[3]: http://getfedora.org
|
||||
[4]: https://opensource.com/article/20/10/fedora-media-writer
|
||||
[5]: https://opensource.com/article/21/2/linux-installation
|
||||
[6]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd
|
||||
[7]: https://opensource.com/sites/default/files/uploads/reserved-ip.jpg (Router IP address settings)
|
||||
[8]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[9]: https://opensource.com/article/20/9/firewall
|
||||
[10]: https://www.dgregscott.com/how-to-build-a-vpn-in-four-easy-steps-without-spending-one-penny/
|
@ -0,0 +1,89 @@
|
||||
[#]: subject: "Apps for daily needs part 3: image editors"
|
||||
[#]: via: "https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/"
|
||||
[#]: author: "Arman Arisman https://fedoramagazine.org/author/armanwu/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Apps for daily needs part 3: image editors
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Photo by [Brooke Cagle][2] on [Unsplash][3]
|
||||
|
||||
Image editors are applications that are liked and needed by many people, from professional designers, students, or for those who have certain hobbies. Especially in this digital era, more and more people need image editors for various reasons. This article will introduce some of the open source image editors that you can use on Fedora Linux. You may need to install the software mentioned. If you are unfamiliar with how to add software packages in Fedora Linux, see my earlier article [Things to do after installing Fedora 34 Workstation][4]. Here is a list of a few apps for daily needs in the image editors category.
|
||||
|
||||
### GIMP
|
||||
|
||||
GIMP (GNU Image Manipulation Program) is a raster graphics editor used for photo retouching, image composition, and image authoring. It has almost the same functionality as Adobe Photoshop. You can use GIMP to do a lot of the things you can do with Photoshop. Because of that, GIMP has become the most popular application as an open source alternative to Adobe Photoshop.
|
||||
|
||||
GIMP has a lot of features for manipulating images, especially for raster images. You can fix or change the color of your photos using GIMP. You can select a part of the image, crop it, and then merge it with other pieces of the image. GIMP also has many effects that you can apply to your images, including blur, shadow, noise, etc. Many people use GIMP to repair damaged photos, improve image quality, crop unwanted parts of images, create posters and various graphic design works, and much more. Moreover you can also add plugins and scripts in GIMP, making it even more fully featured.
|
||||
|
||||
![][5]
|
||||
|
||||
More information is available at this link: <https://www.gimp.org/>
|
||||
|
||||
* * *
|
||||
|
||||
### Inkscape
|
||||
|
||||
Inkscape is a popular open source application used to create and edit vector graphics. It is a feature-rich vector graphics editor which makes it competitive with other similar proprietary applications, such as Adobe Illustrator and Corel Draw. Because of that, many professional illustrators use it to create vector-based artwork.
|
||||
|
||||
You can use Inkscape for making artistic and technical illustrations, such as logos, diagrams, icons, desktop wallpapers, flowcharts, cartoons, and much more. Moreover, Inkscape can handle various graphic file formats. In addition, you can also add add-ons to make your work easier.
|
||||
|
||||
![][6]
|
||||
|
||||
More information is available at this link: <https://inkscape.org/>
|
||||
|
||||
* * *
|
||||
|
||||
### Krita
|
||||
|
||||
Krita looks like GIMP or Inkscape at first glance. But actually it is an application that is quite different, although it has some similar functions. Krita is an application for creating digital paintings like those made by artists. You can use Krita for making concept art, illustration, comics, texture, and matte paintings.
|
||||
|
||||
Krita has over 100 professionally made brushes that come preloaded. It also has a brush stabilizer feature with 3 different ways to smooth and stabilize your brush strokes. Moreover, you can customize your brushes with over 9 unique brush engines. Krita is the right application for those of you who like digital painting activities.
|
||||
|
||||
![][7]
|
||||
|
||||
More information is available at this link: <https://krita.org/en/>
|
||||
|
||||
* * *
|
||||
|
||||
### darktable
|
||||
|
||||
darktable is perfect for photographers or for those who want to improve the quality of their photos. darktable focuses more on image editing specifically on non-destructive post-production of raw images. Therefore, it provides professional color management that supports automatic display profile detection. In addition, you can also use darktable to handle multiple images with filtering and sorting features. So you can search your collections by tags, rating, color labels, and many more. It can import various image formats, such as JPEG, CR2, NEF, HDR, PFM, RAF, etc.
|
||||
|
||||
![][8]
|
||||
|
||||
More information is available at this link: <https://www.darktable.org/>
|
||||
|
||||
* * *
|
||||
|
||||
### Conclusion
|
||||
|
||||
This article presented four image editors as apps for your daily needs that you can use on Fedora Linux. Each application represents a sub-category of image editor applications. Actually there are many other image editors that you can use in Fedora Linux. You can also use RawTherapee or Photivo as a dartkable alternative. In addition there is Pinta as an alternative to GIMP, and MyPaint as an alternative to Krita. Hopefully this article can help you to choose the right image editors. If you have experience in using these applications, please share your experience in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/
|
||||
|
||||
作者:[Arman Arisman][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/armanwu/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-3-Graphics-816x345.jpg
|
||||
[2]: https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/meeting-on-cafe-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://fedoramagazine.org/things-to-do-after-installing-fedora-34-workstation/
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-gimp-1024x576.png
|
||||
[6]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-inkscape-1024x575.png
|
||||
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-krita-1024x592.png
|
||||
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-darktable-1024x583.png
|
194
sources/tech/20210804 Install OpenVPN on your Linux PC.md
Normal file
194
sources/tech/20210804 Install OpenVPN on your Linux PC.md
Normal file
@ -0,0 +1,194 @@
|
||||
[#]: subject: "Install OpenVPN on your Linux PC"
|
||||
[#]: via: "https://opensource.com/article/21/7/openvpn-router"
|
||||
[#]: author: "D. Greg Scott https://opensource.com/users/greg-scott"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Install OpenVPN on your Linux PC
|
||||
======
|
||||
After setting up a VPN server, the next step is installing and
|
||||
configuring OpenVPN.
|
||||
![Open ethernet cords.][1]
|
||||
|
||||
OpenVPN creates an encrypted tunnel between two points, preventing a third party from accessing your network traffic. By setting up your virtual private network (VPN) server, you become your own VPN provider. Many popular VPN services already use [OpenVPN][2], so why tie your connection to a specific provider when you can have complete control?
|
||||
|
||||
The [first article][3] in this series demonstrated how to set up and configure a Linux PC to serve as your OpenVPN server. It also discussed how to configure your router so that you can reach your VPN server from an outside network.
|
||||
|
||||
This second article demonstrates how to install the OpenVPN server software using steps customized from the [OpenVPN wiki][4].
|
||||
|
||||
### Install OpenVPN
|
||||
|
||||
First, install OpenVPN and the `easy-rsa` application (to help you set up authentication on your server) using your package manager. This example uses Fedora Linux; if you've chosen something different, use the appropriate command for your distribution:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install openvpn easy-rsa`
|
||||
```
|
||||
|
||||
This creates some empty directories:
|
||||
|
||||
* `/etc/openvpn`
|
||||
* `/etc/openvpn/client`
|
||||
* `/etc/openvpn/server`
|
||||
|
||||
|
||||
|
||||
If these aren't created during installation, create them manually.
|
||||
|
||||
### Set up authentication
|
||||
|
||||
OpenVPN depends on the `easy-rsa` scripts and should have its own copy of them. Copy the `easy-rsa` scripts and files:
|
||||
|
||||
|
||||
```
|
||||
$ sudo mkdir /etc/openvpn/easy-rsa
|
||||
$ sudo cp -rai /usr/share/easy-rsa/3/* \
|
||||
/etc/openvpn/easy-rsa/
|
||||
```
|
||||
|
||||
Authentication is important, and OpenVPN takes it very seriously. The theory is that if Alice needs to access private information inside Bob's company, it's vital that Bob makes sure Alice really is Alice. Likewise, Alice must make sure that Bob is really Bob. We call this mutual authentication.
|
||||
|
||||
Today's best practice checks an attribute from two of three possible factors:
|
||||
|
||||
* Something you have
|
||||
* Something you know
|
||||
* Something you are
|
||||
|
||||
|
||||
|
||||
There are lots of choices. This OpenVPN setup uses:
|
||||
|
||||
* **Certificates:** Something both the client and server have
|
||||
* **Certificate password:** Something the people know
|
||||
|
||||
|
||||
|
||||
Alice and Bob need help to mutually authenticate. Since they both trust Cathy, Cathy takes on a role called **certificate authority** (CA). Cathy attests that Alice and Bob both are who they claim to be. Because Alice and Bob both trust Cathy, now they also trust each other.
|
||||
|
||||
But what convinces Cathy that Alice and Bob really are Alice and Bob? Cathy's reputation in the community depends on getting this right, and so if she wants Danielle, Evan, Fiona, Greg, and others to also trust her, she will rigorously test Alice and Bob's claims. After Alice and Bob convince Cathy that they really are Alice and Bob, Cathy signs certificates for them to share with each other and the world.
|
||||
|
||||
How do Alice and Bob know Cathy—and not somebody impersonating her—signed the certificates? They use a technology called **public key cryptography:**
|
||||
|
||||
* Find a cryptography algorithm that encrypts with one key and decrypts with another.
|
||||
* Declare one key private and share the other key with the public.
|
||||
* Cathy shares her public key and a clear-text copy of her signature with the world.
|
||||
* Cathy encrypts her signature with her private key. Anyone can decrypt it with her public key.
|
||||
* If Cathy's decrypted signature matches the clear-text copy, Alice and Bob can trust Cathy really did sign it.
|
||||
|
||||
|
||||
|
||||
You use this same technology every time you buy goods and services online.
|
||||
|
||||
### Implement authentication
|
||||
|
||||
OpenVPN's [documentation][5] suggests setting up a CA on a separate system or at least a separate directory on the OpenVPN server. The documentation also suggests generating server and client certificates from the server and clients. Because this is a simple setup, you can use the OpenVPN server as its own CA and put the certificates and keys into specified directories on the server.
|
||||
|
||||
Generate certificates from the server and copy them to each client as part of client setup.
|
||||
|
||||
This implementation uses self-signed certificates. This works because the server trusts itself, and clients trust the server. Therefore, the server is the best CA to sign certificates.
|
||||
|
||||
From the OpenVPN server, set up the CA:
|
||||
|
||||
|
||||
```
|
||||
$ sudo mkdir /etc/openvpn/ca
|
||||
$ cd /etc/openvpn/ca
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa init-pki
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa build-ca
|
||||
```
|
||||
|
||||
Use an easy-to-remember but hard-to-guess passphrase.
|
||||
|
||||
Set up the server key pair and certificate request:
|
||||
|
||||
|
||||
```
|
||||
$ cd /etc/openvpn/server
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa init-pki
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa gen-req OVPNserver2020 nopass
|
||||
```
|
||||
|
||||
In this example, `OVPNServer2020` is whatever hostname you assigned your OpenVPN server in the first article in this series.
|
||||
|
||||
### Generate and sign certs
|
||||
|
||||
Now you must send a server request to the CA and generate and sign the server certificate.
|
||||
|
||||
This step essentially copies the request file from `/etc/openvpn/server/pki/reqs/OVPNserver2020.req` to `/etc/openvpn/ca/pki/reqs/OVPNserver2020.req` to prepare it for review and signing:
|
||||
|
||||
|
||||
```
|
||||
$ cd /etc/openvpn/ca
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa \
|
||||
import-req /etc/openvpn/server/pki/reqs/OVPNserver2020.req OVPNserver2020
|
||||
```
|
||||
|
||||
### Review and sign the request
|
||||
|
||||
You've generated a request, so now you must review and sign the certs:
|
||||
|
||||
|
||||
```
|
||||
$ cd /etc/openvpn/ca
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa \
|
||||
show-req OVPNserver2020
|
||||
```
|
||||
|
||||
Sign as the server:
|
||||
|
||||
|
||||
```
|
||||
$ cd /etc/openvpn/ca
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa \
|
||||
sign-req server OVPNserver2020
|
||||
```
|
||||
|
||||
Put a copy of the server and CA certificates where they belong for the config file to pick them up:
|
||||
|
||||
|
||||
```
|
||||
$ sudo cp /etc/openvpn/ca/pki/issued/OVPNserver2020.crt \
|
||||
/etc/openvpn/server/pki/
|
||||
$ sudo cp /etc/openvpn/ca/pki/ca.crt \
|
||||
/etc/openvpn/server/pki/
|
||||
```
|
||||
|
||||
Next, generate [Diffie-Hellman][6] parameters so that clients and the server can exchange session keys:
|
||||
|
||||
|
||||
```
|
||||
$ cd /etc/openvpn/server
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa gen-dh
|
||||
```
|
||||
|
||||
### Almost there
|
||||
|
||||
The next article in this series will demonstrate how to configure and start the OpenVPN server you just built.
|
||||
|
||||
* * *
|
||||
|
||||
_This article is based on D. Greg Scott's [blog][7] and is reused with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/openvpn-router
|
||||
|
||||
作者:[D. Greg Scott][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/greg-scott
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openwires_fromRHT_520_0612LL.png?itok=PqZi55Ab (Open ethernet cords.)
|
||||
[2]: https://openvpn.net/
|
||||
[3]: https://opensource.com/article/21/7/vpn-openvpn-part-1
|
||||
[4]: https://community.openvpn.net/openvpn/wiki
|
||||
[5]: https://openvpn.net/community-resources/
|
||||
[6]: https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
|
||||
[7]: https://www.dgregscott.com/how-to-build-a-vpn-in-four-easy-steps-without-spending-one-penny/
|
172
sources/tech/20210805 Configure your OpenVPN server on Linux.md
Normal file
172
sources/tech/20210805 Configure your OpenVPN server on Linux.md
Normal file
@ -0,0 +1,172 @@
|
||||
[#]: subject: "Configure your OpenVPN server on Linux"
|
||||
[#]: via: "https://opensource.com/article/21/7/openvpn-firewall"
|
||||
[#]: author: "D. Greg Scott https://opensource.com/users/greg-scott"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Configure your OpenVPN server on Linux
|
||||
======
|
||||
After you install OpenVPN, it's time to configure it.
|
||||
![Lock][1]
|
||||
|
||||
OpenVPN creates an encrypted tunnel between two points, preventing a third party from accessing your network traffic. By setting up your virtual private network (VPN) server, you become your own VPN provider. Many popular VPN services already use [OpenVPN][2], so why tie your connection to a specific provider when you can have complete control?
|
||||
|
||||
The [first article][3] in this series set up a server for your VPN, and the [second article][4] demonstrated how to install and configure the OpenVPN server software. This third article shows how to start OpenVPN with authentication in place.
|
||||
|
||||
To set up an OpenVPN server, you must:
|
||||
|
||||
* Create a configuration file.
|
||||
* Set the `sysctl` value `net.ipv4.ip_forward = 1` to enable routing.
|
||||
* Set up appropriate ownership for all configuration and authentication files to run the OpenVPN server daemon under a non-root account.
|
||||
* Set OpenVPN to start with the appropriate configuration file.
|
||||
* Configure your firewall.
|
||||
|
||||
|
||||
|
||||
### Configuration file
|
||||
|
||||
You must create a server config file in `/etc/openvpn/server/`. You can start from scratch if you want, and OpenVPN includes several sample configuration files to use as a starting point. Have a look in `/usr/share/doc/openvpn/sample/sample-config-files/` to see them all.
|
||||
|
||||
If you want to build a config file by hand, start with either `server.conf` or `roadwarrior-server.conf` (as appropriate), and place your config file in `/etc/openvpn/server`. Both files are extensively commented, so read the comments and decide which makes the most sense for your situation.
|
||||
|
||||
You can save time and aggravation by using my prebuilt server and client configuration file templates and `sysctl` file to turn on network routing. This configuration also includes customization to log connects and disconnects. It keeps logs on the OpenVPN server in `/etc/openvpn/server/logs`.
|
||||
|
||||
If you use my templates, you'll need to edit them to use your IP addresses and hostnames.
|
||||
|
||||
To use my prebuilt config templates, scripts, and `sysctl` to turn on IP forwarding, download my script:
|
||||
|
||||
|
||||
```
|
||||
$ curl \
|
||||
<https://www.dgregscott.com/ovpn/OVPNdownloads.sh> > \
|
||||
OVPNdownloads.sh
|
||||
```
|
||||
|
||||
Read the script to get an idea of what it does. Here's a quick overview of its actions:
|
||||
|
||||
* Creates the appropriate directories on your OpenVPN server
|
||||
* Downloads server and client config file templates from my website
|
||||
* Downloads my custom scripts and places them into the correct directory with correct permissions
|
||||
* Downloads `99-ipforward.conf` and places it into `/etc/sysctl.d` to turn on IP forwarding at the next boot
|
||||
* Sets up ownership for everything in `/etc/openvpn`
|
||||
|
||||
|
||||
|
||||
Once you're satisfied that you understand what the script does, make it executable and run it:
|
||||
|
||||
|
||||
```
|
||||
$ chmod +x OVPNdownloads.sh
|
||||
$ sudo ./OVPNdownloads.sh
|
||||
```
|
||||
|
||||
Here are the files it copies (notice the file ownership):
|
||||
|
||||
|
||||
```
|
||||
$ ls -al -R /etc/openvpn
|
||||
/etc/openvpn:
|
||||
total 12
|
||||
drwxr-xr-x. 4 openvpn openvpn 34 Apr 6 20:35 .
|
||||
drwxr-xr-x. 139 root root 8192 Apr 6 20:35 ..
|
||||
drwxr-xr-x. 2 openvpn openvpn 33 Apr 6 20:35 client
|
||||
drwxr-xr-x. 4 openvpn openvpn 56 Apr 6 20:35 server
|
||||
|
||||
/etc/openvpn/client:
|
||||
total 4
|
||||
drwxr-xr-x. 2 openvpn openvpn 33 Apr 6 20:35 .
|
||||
drwxr-xr-x. 4 openvpn openvpn 34 Apr 6 20:35 ..
|
||||
-rw-r--r--. 1 openvpn openvpn 1764 Apr 6 20:35 OVPNclient2020.ovpn
|
||||
|
||||
/etc/openvpn/server:
|
||||
total 4
|
||||
drwxr-xr-x. 4 openvpn openvpn 56 Apr 6 20:35 .
|
||||
drwxr-xr-x. 4 openvpn openvpn 34 Apr 6 20:35 ..
|
||||
drwxr-xr-x. 2 openvpn openvpn 59 Apr 6 20:35 ccd
|
||||
drwxr-xr-x. 2 openvpn openvpn 6 Apr 6 20:35 logs
|
||||
-rw-r--r--. 1 openvpn openvpn 2588 Apr 6 20:35 OVPNserver2020.conf
|
||||
|
||||
/etc/openvpn/server/ccd:
|
||||
total 8
|
||||
drwxr-xr-x. 2 openvpn openvpn 59 Apr 6 20:35 .
|
||||
drwxr-xr-x. 4 openvpn openvpn 56 Apr 6 20:35 ..
|
||||
-rwxr-xr-x. 1 openvpn openvpn 917 Apr 6 20:35 client-connect.sh
|
||||
-rwxr-xr-x. 1 openvpn openvpn 990 Apr 6 20:35 client-disconnect.sh
|
||||
|
||||
/etc/openvpn/server/logs:
|
||||
total 0
|
||||
drwxr-xr-x. 2 openvpn openvpn 6 Apr 6 20:35 .
|
||||
drwxr-xr-x. 4 openvpn openvpn 56 Apr 6 20:35 ..
|
||||
```
|
||||
|
||||
Here's the `99-ipforward.conf` file:
|
||||
|
||||
|
||||
```
|
||||
# Turn on IP forwarding. OpenVPN servers need to do routing
|
||||
net.ipv4.ip_forward = 1
|
||||
```
|
||||
|
||||
Edit `OVPNserver2020.conf` and `OVPNclient2020.ovpn` to include your IP addresses. Also, edit `OVPNserver2020.conf` to include your server certificate names from earlier. Later, you will rename and edit a copy of `OVPNclient2020.ovpn` for use with your client computers. The blocks that start with `***?` show you where to edit.
|
||||
|
||||
### File ownership
|
||||
|
||||
If you used the automated script from my website, file ownership is already in place. If not, you must ensure that your system has a user called `openvpn` that is a member of a group named `openvpn`. You must set the ownership of everything in `/etc/openvpn` to that user and group. It's safe to do this if you're unsure whether the user and group already exist because `useradd` will refuse to create a user with the same name as one that already exists:
|
||||
|
||||
|
||||
```
|
||||
$ sudo useradd openvpn
|
||||
$ sudo chown -R openvpn.openvpn /etc/openvpn
|
||||
```
|
||||
|
||||
### Firewall
|
||||
|
||||
If you decided not to disable the firewalld service in step 1, then your server's firewall service might not allow VPN traffic by default. Using the [`firewall-cmd` command][5], you can enable the OpenVPN service, which opens the necessary ports and routes traffic as necessary:
|
||||
|
||||
|
||||
```
|
||||
$ sudo firewall-cmd --add-service openvpn --permanent
|
||||
$ sudo firewall-cmd --reload
|
||||
```
|
||||
|
||||
No need to get lost in a maze of iptables!
|
||||
|
||||
### Start your server
|
||||
|
||||
You can now start your OpenVPN server. So that it starts automatically after a reboot, use the `enable` subcommand of `systemctl`:
|
||||
|
||||
|
||||
```
|
||||
`systemctl enable --now openvpn-server@OVPNserver2020.service`
|
||||
```
|
||||
|
||||
### Final steps
|
||||
|
||||
The fourth and final article in this article will demonstrate how to set up clients to connect to your OpenVPN from afar.
|
||||
|
||||
* * *
|
||||
|
||||
_This article is based on D. Greg Scott's [blog][6] and is reused with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/openvpn-firewall
|
||||
|
||||
作者:[D. Greg Scott][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/greg-scott
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock)
|
||||
[2]: https://openvpn.net/
|
||||
[3]: https://opensource.com/article/21/7/vpn-openvpn-part-1
|
||||
[4]: https://opensource.com/article/21/7/vpn-openvpn-part-2
|
||||
[5]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd
|
||||
[6]: https://www.dgregscott.com/how-to-build-a-vpn-in-four-easy-steps-without-spending-one-penny/
|
@ -0,0 +1,189 @@
|
||||
[#]: subject: "Installing Packages From External Repositories in Ubuntu [Explained]"
|
||||
[#]: via: "https://itsfoss.com/adding-external-repositories-ubuntu/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Installing Packages From External Repositories in Ubuntu [Explained]
|
||||
======
|
||||
|
||||
You have some ideas about installing packages in Ubuntu with apt command. Those packages come from Ubuntu’s repositories.
|
||||
|
||||
How about third-party or external repository? No, I am not talking about PPA here.
|
||||
|
||||
Sooner or later, you’ll come across installation instructions that goes in at least four lines. You install something called ‘apt-transport-https’ and then do something with gpg and sources list. After that, you install the package.
|
||||
|
||||
Can’t recall completely. Let me share an example for [installing the latest version Yarn on Ubuntu][1]:
|
||||
|
||||
```
|
||||
sudo apt install apt-transport-https curl
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list'
|
||||
sudo apt update && sudo apt install yarn
|
||||
```
|
||||
|
||||
You’ll often come across such installation method while installing programming tools directly from the developers.
|
||||
|
||||
Many people just follow the instructions without thinking twice about what’s going on here. Nothing wrong with that but knowing the process actually improves your knowledge on the matter and could also help in troubleshooting.
|
||||
|
||||
Let me explain the logic behind those lines.
|
||||
|
||||
### Understanding the procedure of installation from external repositories
|
||||
|
||||
Before you proceed, I highly recommend reading these two articles so that things are a bit more clear to you:
|
||||
|
||||
* [Concept of repositories in Ubuntu][2]
|
||||
* [Concept of PPA in Ubuntu][3]
|
||||
|
||||
|
||||
|
||||
To recall quickly, here’s a visual representation of repositories and [package manager in Linux][4].
|
||||
|
||||
![Illustration of repository and package manager][5]
|
||||
|
||||
The entire idea here is that you add a new, external repository to your system. This way, you’ll be able to download and install packages available from this new repository. If the repository provides an update on the package version, you get to update the installed package along with the system updates (apt update && apt upgrade).
|
||||
|
||||
So, how does this work? Let’s go through the lines one by one.
|
||||
|
||||
#### Part 1: Getting HTTPS support for apt
|
||||
|
||||
The first line is this:
|
||||
|
||||
```
|
||||
sudo apt install apt-transport-https curl
|
||||
```
|
||||
|
||||
Curl is a [tool for downloading files in Linux terminal][6]. The main part here is the installation of **apt-transport-https** and frankly speaking not needed anymore.
|
||||
|
||||
Confused? This apt-transport-https package allows your system to access repositories over the secure HTTPS protocol. By design, Ubuntu repositories use http, not https.
|
||||
|
||||
Take a look at the screenshot below. The https ones are the external repositories I have added into my system. Ubuntu repositories and PPA use http.
|
||||
|
||||
![][7]
|
||||
|
||||
In the older version of apt package manager, https support was not included. apt-transport-https package adds https support to apt. To add a repository that uses https, this package is installed first.
|
||||
|
||||
Did I not say it is not needed anymore? Yes because the newer versions of apt (higher than 1.5) support https and thus you do not need to install apt-transport-https anymore.
|
||||
|
||||
And yet you see this package mentioned in the instructions. This is more for legacy reasons or for really old distribution versions that might be using an older version of apt.
|
||||
|
||||
Now, you may wonder why Ubuntu repositories use http, not https when https is the secure protocol. Is it not a security risk? The next segment will answer that question.
|
||||
|
||||
#### Part 2: Adding GPG key of the remote repository
|
||||
|
||||
Linux repositories have this built-in GPG-key based security mechanism. Every repository added its public GPG key to your system’s trusted keys. The packages from the repositories are ‘signed’ by this GPG key and thanks to the stored public key, your system verifies that the package is coming from the repository.
|
||||
|
||||
If there is a [mismatch between the keys, your system will throw an error][8] instead of installing or updating packages from the said repository.
|
||||
|
||||
So far, so good. The next step is to add the public GPG key of the external repository to your Linux system so that it trusts the package from this repository.
|
||||
|
||||
```
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
```
|
||||
|
||||
In the above command, you download the GPG key from the given URL using curl. The option `sS` ensures that you don’t see the flooded output (silent mode) but shows the error (if any). The last `-` tells apt-key to take stdin instead of a file (which is the output of the curl command in this case).
|
||||
|
||||
The download key is added to the system with `apt-key add` command.
|
||||
|
||||
You can see the GPG keys added by various repositories in your system using the `apt-key list` command.
|
||||
|
||||
![List GPG keys][9]
|
||||
|
||||
That’s one way of adding the GPG key to the system. You’ll some other commands that my look slightly different but do the same job of adding the public key of the repository to your system.
|
||||
|
||||
```
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
|
||||
```
|
||||
|
||||
You’ll notice a warning that apt-key is deprecated. You could still use apt-key command till Ubuntu 22.04 but it will eventually be removed. Let’s not worry about it at the moment.
|
||||
|
||||
#### Part 3: Adding the external repository to your sources list
|
||||
|
||||
The next command adds a new entry into the sources list of your system. This way, your system will know that it has to check this repository for packages and updates.
|
||||
|
||||
```
|
||||
sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list'
|
||||
```
|
||||
|
||||
There is a file /etc/apt/sources.list that contains the details of the Ubuntu repositories. This file should not be touched. All the additional repositories should be placed in their own respective file (ending with .list convention) in the /etc/apt/sources.list.d directory.
|
||||
|
||||
![External repository should have their own sources list file in the /etc/apt/sources.list.d directory][10]
|
||||
|
||||
This makes package management easier. If you are removing a repository from the system, you just need to delete the corresponding sources file. No need to mess with the main sources.list file.
|
||||
|
||||
Let’s look at the command in a bit more detail.
|
||||
|
||||
```
|
||||
sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list'
|
||||
```
|
||||
|
||||
With sh, you are asking to run the command in a new shell, instead of the [subshell][11]. `-c` option tells the sh command to read the commands from the operand instead of standard input. Then it runs the echo command which basically adds line **deb <https://dl.yarnpkg.com/debian/> stable main** to /etc/apt/sources.list.d/yarn.list file (file will be created)
|
||||
|
||||
Now, there could be numerous ways you can create a .list file in the specified directory and add the line with repository details in it. You could use it like this as well:
|
||||
|
||||
```
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
```
|
||||
|
||||
You get the gist, right?
|
||||
|
||||
#### Part 4: Installing the application from newly added repository
|
||||
|
||||
So far, you have added the GPG key of the repository and the URL of the repository to the system.
|
||||
|
||||
But your system still does not know about the package available from this new repository. This is why you need to update the local cache of package metadata first with this command:
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
Your system will have the information about the packages available from the newly added repository and you can install the package now:
|
||||
|
||||
```
|
||||
sudo apt install yarn
|
||||
```
|
||||
|
||||
To save time, you can [run the two commands one after another in a single lin][12]e.
|
||||
|
||||
```
|
||||
sudo apt update && sudo apt install yarn
|
||||
```
|
||||
|
||||
The `&&` ensures that the second command only runs when the previous command completed without any error.
|
||||
|
||||
And thus the process completes.
|
||||
|
||||
### Did it make things clear or confused you even more?
|
||||
|
||||
I explained the logic behind the steps for using external repositories in Ubuntu. I hope you have a better understanding of the topic now, but it is also possible that too much detail could be confusing.
|
||||
|
||||
If things are still not clear or if you have additional questions, please let me know. If you notice technical inaccuracies, please let me know in the comment section.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/adding-external-repositories-ubuntu/
|
||||
|
||||
作者:[Abhishek Prakash][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/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/install-yarn-ubuntu/
|
||||
[2]: https://itsfoss.com/ubuntu-repositories/
|
||||
[3]: https://itsfoss.com/ppa-guide/#comments
|
||||
[4]: https://itsfoss.com/package-manager/
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-package-manager-explanation.png?resize=800%2C450&ssl=1
|
||||
[6]: https://itsfoss.com/download-files-from-linux-terminal/
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/apt-update-http-https.png?resize=800%2C527&ssl=1
|
||||
[8]: https://itsfoss.com/solve-gpg-error-signatures-verified-ubuntu/
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/07/list-apt-key-gpg-ubuntu.png?resize=800%2C547&ssl=1
|
||||
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/sources-list-ubuntu.png?resize=800%2C313&ssl=1
|
||||
[11]: https://linuxhandbook.com/subshell/
|
||||
[12]: https://itsfoss.com/run-multiple-commands-linux/
|
143
sources/tech/20210806 Access OpenVPN from a client computer.md
Normal file
143
sources/tech/20210806 Access OpenVPN from a client computer.md
Normal file
@ -0,0 +1,143 @@
|
||||
[#]: subject: "Access OpenVPN from a client computer"
|
||||
[#]: via: "https://opensource.com/article/21/7/openvpn-client"
|
||||
[#]: author: "D. Greg Scott https://opensource.com/users/greg-scott"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Access OpenVPN from a client computer
|
||||
======
|
||||
After building your own VPN on Linux, it's time to finally use it.
|
||||
![Woman programming][1]
|
||||
|
||||
OpenVPN creates an encrypted tunnel between two points, preventing a third party from accessing your network traffic. By setting up your virtual private network (VPN) server, you become your own VPN provider. Many popular VPN services already use [OpenVPN][2], so why tie your connection to a specific provider when you can have complete control yourself?
|
||||
|
||||
The [first article][3] in this series set up a server for your VPN, the [second article][4] demonstrated how to install and configure the OpenVPN server software, while the [third article][5] explained how to configure your firewall and start the OpenVPN server software. This fourth and final article demonstrates how to use your OpenVPN server from client computers. This is the reason you did all the work in the previous three articles!
|
||||
|
||||
### Create client certificates
|
||||
|
||||
Remember that the method of authentication for OpenVPN requires both the server and the client to _have_ something (certificates) and to _know_ something (a password). It's time to set that up.
|
||||
|
||||
First, create a client certificate and a private key for your client computer. On your OpenVPN server, generate a certificate request. It asks for a passphrase; make sure you remember it:
|
||||
|
||||
|
||||
```
|
||||
$ cd /etc/openvpn/ca
|
||||
$ sudo /etc/openvpn/easy-rsa/easyrsa \
|
||||
gen-req greglaptop
|
||||
```
|
||||
|
||||
In this example, `greglaptop` is the client computer for which this certificate is being created.
|
||||
|
||||
There's no need to import the request into the certificate authority (CA) because it's already there. Review it to make sure:
|
||||
|
||||
|
||||
```
|
||||
$ cd /etc/openvpn/ca
|
||||
$ /etc/openvpn/easy-rsa/easyrsa \
|
||||
show-req greglaptop
|
||||
```
|
||||
|
||||
You can sign as the client, too:
|
||||
|
||||
|
||||
```
|
||||
$ /etc/openvpn/easy-rsa/easyrsa \
|
||||
sign-req client greglaptop
|
||||
```
|
||||
|
||||
### Install the OpenVPN client software
|
||||
|
||||
On Linux, Network Manager may already have an OpenVPN client included. If not, you can install the plugin:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install NetworkManager-openvpn`
|
||||
```
|
||||
|
||||
On Windows, you must download and install the OpenVPN client from the OpenVPN download site. Launch the installer and follow the prompts.
|
||||
|
||||
### Copy certificates and private keys to the client
|
||||
|
||||
Now your client needs the authentication credentials you generated for it. You generated these on the server, so you must transport them over to your client. I tend to use SSH for this. On Linux, that's the `scp` command. On Windows, you can use [WinSCP][6] as administrator to pull the certificates and keys.
|
||||
|
||||
Assuming the client is named `greglaptop`, here are the file names and server locations:
|
||||
|
||||
|
||||
```
|
||||
/etc/openvpn/ca/pki/issued/greglaptop.crt
|
||||
/etc/openvpn/ca/pki/private/greglaptop.key
|
||||
/etc/openvpn/ca/pki/issued/ca.crt
|
||||
```
|
||||
|
||||
On Linux, copy these to the `/etc/pki/tls/certs/` directory. On Windows, copy them to the `C:\Program Files\OpenVPN\config` directory.
|
||||
|
||||
### Copy and customize the client configuration file
|
||||
|
||||
On Linux, you can either copy the `/etc/openvpn/client/OVPNclient2020.ovpn` file on the server to `/etc/NetworkManager/system-connections/`, or you can navigate to Network Manager in System Settings and add a VPN connection.
|
||||
|
||||
For the connection type, select **Certificates**. Point Network Manager to the certificates and keys you copied from the server.
|
||||
|
||||
![VPN displayed in Network Manager][7]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][8])
|
||||
|
||||
On Windows, run WinSCP as administrator to copy the client configuration template `/etc/openvpn/client/OVPNclient2020.ovpn` on the server to `C:\Program Files\OpenVPN\config` on the client. Then:
|
||||
|
||||
* Rename it to match the certificate above.
|
||||
* Change the names of the CA certificate, client certificate, and key to match the names copied above from the server.
|
||||
* Edit the IP information to match your network.
|
||||
|
||||
|
||||
|
||||
You need super administrative permissions to edit the client config files. The easiest way to get this might be to launch a CMD window as administrator and then launch Notepad from the administrator CMD window to edit the files.
|
||||
|
||||
### Connect your client to the server
|
||||
|
||||
On Linux, Network manager displays your VPN. Select it to connect.
|
||||
|
||||
|
||||
|
||||
![Add a VPN connection in Network Manager][9]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][8])
|
||||
|
||||
On Windows, start the OpenVPN graphical user interface (GUI). It produces a graphic in the Windows System Tray on the right side of the taskbar, usually in the lower-right corner of your Windows desktop. Right-click the graphic to connect, disconnect, or view the status.
|
||||
|
||||
For the first connection, edit the "remote" line of your client config file to use the _inside IP address_ of your OpenVPN server. Connect to the server from inside your office network by right-clicking on the OpenVPN GUI in the Windows System Tray and clicking **Connect**. Debug this connection. This should find and fix problems without any firewall issues getting in the way because both the client and server are on the same side of the firewall.
|
||||
|
||||
Next, edit the "remote" line of your client config file to use the _public IP address_ for your OpenVPN server. Bring the Windows client to an outside network and connect. Debug any issues.
|
||||
|
||||
### Connect securely
|
||||
|
||||
Congratulations! You have an OpenVPN network ready for your other client systems. Repeat the setup steps for the rest of your clients. You might even use Ansible to distribute certs and keys and keep them up to date.
|
||||
|
||||
* * *
|
||||
|
||||
_This article is based on D. Greg Scott's [blog][10] and is reused with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/openvpn-client
|
||||
|
||||
作者:[D. Greg Scott][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/greg-scott
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming)
|
||||
[2]: https://openvpn.net/
|
||||
[3]: https://opensource.com/article/21/7/vpn-openvpn-part-1
|
||||
[4]: https://opensource.com/article/21/7/vpn-openvpn-part-2
|
||||
[5]: https://opensource.com/article/21/7/vpn-openvpn-part-3
|
||||
[6]: https://winscp.net/eng/index.php
|
||||
[7]: https://opensource.com/sites/default/files/uploads/network-manager-profile.jpg (VPN displayed in Network Manager)
|
||||
[8]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[9]: https://opensource.com/sites/default/files/uploads/network-manager-connect.jpg (Add a VPN connection in Network Manager)
|
||||
[10]: https://www.dgregscott.com/how-to-build-a-vpn-in-four-easy-steps-without-spending-one-penny/
|
@ -0,0 +1,146 @@
|
||||
[#]: subject: "Change your Linux Desktop Wallpaper Every Hour [Here’s How]"
|
||||
[#]: via: "https://www.debugpoint.com/2021/08/change-wallpaper-every-hour/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Change your Linux Desktop Wallpaper Every Hour [Here’s How]
|
||||
======
|
||||
This shell script styli.sh helps to change your Linux desktop wallpaper
|
||||
in every hour automatically and with several options.GNOMEXfceKDE
|
||||
PlasmaSway
|
||||
A nice wallpaper to start your day with, your desktop is refreshing. But it is very cumbersome to find wallpaper, then saving and eventually set as wallpaper. All these steps can be done by this script called [styli.sh][1].
|
||||
|
||||
### styli.sh – Change your Linux Desktop Wallpaper Every Hour
|
||||
|
||||
This is a shell script which you can download from GitHub. When runs, it fetches the wallpapers from popular Subreddits from Reddit and set it as your wallpaper.
|
||||
|
||||
This script works with all popular desktop environments such as GNOME, KDE Plasma, Xfce and Sway window manager.
|
||||
|
||||
It is loaded with features, and you can run the script with via crontab in every and get a fresh wallpaper in a specific interval.
|
||||
|
||||
### Download and Install, Run
|
||||
|
||||
Open a terminal and clone the GitHub repo. You need to install [feh][2] and git if not installed.
|
||||
|
||||
```
|
||||
git clone https://github.com/thevinter/styli.sh
|
||||
cd styli.sh
|
||||
```
|
||||
|
||||
To set a random wallpaper, run below as per your desktop environment.
|
||||
|
||||
![Change your Linux Desktop Wallpaper Every Hour using styli.sh][3]
|
||||
|
||||
```
|
||||
./styli.sh -g
|
||||
```
|
||||
|
||||
```
|
||||
./styli.sh -x
|
||||
```
|
||||
|
||||
```
|
||||
./styli.sh -k
|
||||
```
|
||||
|
||||
```
|
||||
./styli.sh -y
|
||||
```
|
||||
|
||||
### Change every hour
|
||||
|
||||
To change background every hour, run the following command –
|
||||
|
||||
```
|
||||
crontab -e
|
||||
```
|
||||
|
||||
And add the following to the opened file. Don’t forget to change the script path.
|
||||
|
||||
```
|
||||
@hourly script/path/styli.sh
|
||||
```
|
||||
|
||||
### Change the subreddits
|
||||
|
||||
In the source directory, there is a file called subreddits. It is filled up with some standard subreddits. If you want some more, just add the Subreddit names at the end of the file.
|
||||
|
||||
### More Config options
|
||||
|
||||
The types of wallpapers, size, can also be set. These are some unique configuration option of this script.
|
||||
|
||||
> To set a random 1920×1080 background
|
||||
> ./styli.sh
|
||||
>
|
||||
> To specify a desired width or height
|
||||
> ./styli.sh -w 1080 -h 720
|
||||
> ./styli.sh -w 2560
|
||||
> ./styli.sh -h 1440
|
||||
>
|
||||
> To set a wallpaper based on a search term
|
||||
> ./styli.sh -s island
|
||||
> ./styli.sh -s “sea sunset”
|
||||
> ./styli.sh -s sea -w 1080
|
||||
>
|
||||
> To get a random wallpaper from one of the set subreddits
|
||||
> NOTE: The width/height/search parameters DON’T work with reddit
|
||||
> ./styli.sh -l reddit
|
||||
>
|
||||
> To get a random wallpaper from a custom subreddit
|
||||
> ./styli.sh -r
|
||||
> ./styli.sh -r wallpaperdump
|
||||
>
|
||||
> To use the builtin feh –bg options
|
||||
> ./styli.sh -b
|
||||
> ./styli.sh -b bg-scale -r widescreen-wallpaper
|
||||
>
|
||||
> To add custom feh flags
|
||||
> ./styli.sh -c
|
||||
> ./styli.sh -c –no-xinerama -r widescreen-wallpaper
|
||||
>
|
||||
> To automatically set the terminal colors
|
||||
> ./styli.sh -p
|
||||
>
|
||||
> To use nitrogen instead of feh
|
||||
> ./styli.sh -n
|
||||
>
|
||||
> To update > 1 screens using nitrogen
|
||||
> ./styli.sh -n -m
|
||||
>
|
||||
> Choose a random background from a directory
|
||||
> ./styli.sh -d /path/to/dir
|
||||
|
||||
### Closing Notes
|
||||
|
||||
A unique and handy script, low on memory and can directly fetch images in an interval – like an hour. And make your desktop look [fresh and productive][4] all the time. If you do not like the wallpaper, you can simply run the script from the terminal again to cycle through.
|
||||
|
||||
[][5]
|
||||
|
||||
SEE ALSO: List of All Default Ubuntu Official Wallpapers [Gallery]
|
||||
|
||||
Do you like this script? Or do you know anything like this for wallpaper switcher? Let me know in the comment box below.
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/08/change-wallpaper-every-hour/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://github.com/thevinter/styli.sh
|
||||
[2]: https://feh.finalrewind.org/
|
||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/Change-your-Linux-Desktop-Wallpaper-Every-Hour-using-styli.sh_.jpg
|
||||
[4]: https://www.debugpoint.com/category/themes
|
||||
[5]: https://www.debugpoint.com/2019/09/a-list-of-all-default-ubuntu-official-wallpapers-gallery/
|
224
sources/tech/20210806 Use OpenCV on Fedora Linux - part 2.md
Normal file
224
sources/tech/20210806 Use OpenCV on Fedora Linux - part 2.md
Normal file
@ -0,0 +1,224 @@
|
||||
[#]: subject: "Use OpenCV on Fedora Linux ‒ part 2"
|
||||
[#]: via: "https://fedoramagazine.org/use-opencv-on-fedora-linux-part-2/"
|
||||
[#]: author: "Onuralp SEZER https://fedoramagazine.org/author/thunderbirdtr/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Use OpenCV on Fedora Linux ‒ part 2
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Cover image excerpted from Starry Night by [Vincent van Gogh][2], Public domain, via Wikimedia Commons
|
||||
|
||||
Welcome back to the OpenCV series where we explore how to make use of OpenCV on Fedora Linux. [The first article][3] covered the basic functions and use cases of OpenCV. In addition to that you learned about loading images, color mapping, and the difference between BGR and RGB color maps. You also learned how to separate and merge color channels and how to convert to different color spaces. This article will cover basic image manipulation and show you how to perform image transformations including:
|
||||
|
||||
* **Accessing individual image pixels**
|
||||
* **Modifying a range of image pixels**
|
||||
* **Cropping**
|
||||
* **Resizing**
|
||||
* **Flipping**
|
||||
|
||||
|
||||
|
||||
### Accessing individual pixels
|
||||
|
||||
```
|
||||
import cv2
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# Read image as gray scale.
|
||||
img = cv2.imread(cv2.samples.findFile("gradient.png"),0)
|
||||
# Set color map to gray scale for proper rendering.
|
||||
plt.imshow(img, cmap='gray')
|
||||
# Print img pixels as 2D Numpy Array
|
||||
print(img)
|
||||
# Show image with Matplotlib
|
||||
plt.show()
|
||||
```
|
||||
|
||||
![][4]
|
||||
|
||||
To access a pixel in a numpy matrix, you have to use matrix notation such as matrix[**r**,**c**], where the **r** is the row number and **c** is the column number. Also note that the matrix is 0-indexed. If you want to access the first pixel, you need to specify matrix[0,0]. The following example prints one black pixel from top-left and one white pixel from top-right-corner.
|
||||
|
||||
```
|
||||
# print the first pixel
|
||||
print(img[0,0])
|
||||
# print the white pixel to the top right corner
|
||||
print(img[0,299])
|
||||
```
|
||||
|
||||
### Modifying a range of image pixels
|
||||
|
||||
You can modify the values of pixels using the same notation described above.
|
||||
|
||||
```
|
||||
gr_img = img.copy()
|
||||
|
||||
# Modify pixel one by one
|
||||
#gr_img[20,20] = 200
|
||||
#gr_img[20,21] = 200
|
||||
#gr_img[20,22] = 200
|
||||
#gr_img[20,23] = 200
|
||||
#gr_img[20,24] = 200
|
||||
# ...
|
||||
|
||||
# Modify pixel between 20-80 pixel range
|
||||
gr_img[20:80,20:80] = 200
|
||||
|
||||
plt.imshow(gr_img, cmap='gray')
|
||||
print(gr_img)
|
||||
plt.show()
|
||||
```
|
||||
|
||||
![][5]
|
||||
|
||||
### Cropping images
|
||||
|
||||
Cropping an image is achieved by selecting a specific (pixel) region of the image.
|
||||
|
||||
```
|
||||
import cv2 as cv
|
||||
import matplotlib.pyplot as plt
|
||||
img = cv.imread(cv.samples.findFile("starry_night.jpg"),cv.IMREAD_COLOR)
|
||||
img_rgb = cv.cvtColor(img, cv.COLOR_BGR2RGB)
|
||||
fig, (ax1, ax2) = plt.subplots(1,2)
|
||||
ax1.imshow(img_rgb)
|
||||
ax1.set_title('Before Crop')
|
||||
ax2.imshow(img_rgb[200:400, 300:600])
|
||||
ax2.set_title('After Crop')
|
||||
plt.show()
|
||||
```
|
||||
|
||||
![][6]
|
||||
|
||||
### Resizing images
|
||||
|
||||
**Syntax:** _dst = cv.resize( src, dsize[, dst[, fx[, fy[, interpolation]]]] )_
|
||||
|
||||
The _resize_ function resizes the _src_ image down to or up to the specified size. The size and type are derived from the values of _src_, _dsize_,_fx_, and _fy_.
|
||||
|
||||
The _resize_ function has two required arguments:
|
||||
|
||||
* **src:** input image
|
||||
* **dsize:** output image size
|
||||
|
||||
|
||||
|
||||
Optional arguments that are often used include:
|
||||
|
||||
* **fx:** The scale factor along the horizontal axis. When this is 0, the factor is computed as _dsize.width/src.cols_.
|
||||
* **fy:** The scale factor along the vertical axis. When this is 0, the factor is computed as _dsize.height/src.rows_.
|
||||
|
||||
|
||||
|
||||
```
|
||||
import cv2 as cv
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
img = cv.imread(cv.samples.findFile("starry_night.jpg"), cv.IMREAD_COLOR)
|
||||
img_rgb = cv.cvtColor(img, cv.COLOR_BGR2RGB)
|
||||
|
||||
plt.figure(figsize=[18, 5])
|
||||
plt.subplot(1, 3, 1) # row 1, column 3, count 1
|
||||
|
||||
cropped_region = img_rgb[200:400, 300:600]
|
||||
resized_img_5x = cv.resize(cropped_region, None, fx=5, fy=5)
|
||||
plt.imshow(resized_img_5x)
|
||||
plt.title("Resize Cropped Image with Scale 5X")
|
||||
|
||||
width = 200
|
||||
height = 300
|
||||
dimension = (width, height)
|
||||
resized_img = cv.resize(img_rgb, dsize=dimension, interpolation=cv.INTER_AREA)
|
||||
|
||||
plt.subplot(1, 3, 2)
|
||||
plt.imshow(resized_img)
|
||||
plt.title("Resize Image with Custom Size")
|
||||
|
||||
desired_width = 500
|
||||
aspect_ratio = desired_width / img_rgb.shape[1]
|
||||
desired_height = int(resized_img.shape[0] * aspect_ratio)
|
||||
dim = (desired_width, desired_height)
|
||||
resized_cropped_region = cv.resize(img_rgb, dsize=dim, interpolation=cv.INTER_AREA)
|
||||
|
||||
plt.subplot(1, 3, 3)
|
||||
plt.imshow(resized_cropped_region)
|
||||
plt.title("Keep Aspect Ratio - Resize Image")
|
||||
plt.show()
|
||||
```
|
||||
|
||||
![][7]
|
||||
|
||||
### Flipping images
|
||||
|
||||
**Syntax:** _dst = cv.flip( src, flipCode )_
|
||||
|
||||
* **dst:** output array of the same size and type as _src_.
|
||||
|
||||
|
||||
|
||||
The _flip_ function flips the array in one of three different ways.
|
||||
|
||||
The _flip_ function has two required arguments:
|
||||
|
||||
* **src:** the input image
|
||||
* **flipCode:** a flag to specify how to flip the image
|
||||
* Use **0** to flip the image on the x-axis.
|
||||
* Use a positive value (for example, **1**) to flip the image on the y-axis.
|
||||
* Use a negative value (for example, **-1**) to flip the image on both axes.
|
||||
|
||||
|
||||
|
||||
```
|
||||
import cv2 as cv
|
||||
import matplotlib.pyplot as plt
|
||||
img = cv.imread(cv.samples.findFile("starry_night.jpg"),cv.IMREAD_COLOR)
|
||||
img_rgb = cv.cvtColor(img, cv.COLOR_BGR2RGB)
|
||||
|
||||
img_rgb_flipped_horz = cv.flip(img_rgb, 1)
|
||||
img_rgb_flipped_vert = cv.flip(img_rgb, 0)
|
||||
img_rgb_flipped_both = cv.flip(img_rgb, -1)
|
||||
|
||||
plt.figure(figsize=[18,5])
|
||||
plt.subplot(141);plt.imshow(img_rgb_flipped_horz);plt.title("Horizontal Flip");
|
||||
plt.subplot(142);plt.imshow(img_rgb_flipped_vert);plt.title("Vertical Flip");
|
||||
plt.subplot(143);plt.imshow(img_rgb_flipped_both);plt.title("Both Flipped");
|
||||
plt.subplot(144);plt.imshow(img_rgb);plt.title("Original");
|
||||
plt.show()
|
||||
```
|
||||
|
||||
![][8]
|
||||
|
||||
### Further information
|
||||
|
||||
More details about OpenCV are available in the [documentation][9].
|
||||
|
||||
Thank you.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/use-opencv-on-fedora-linux-part-2/
|
||||
|
||||
作者:[Onuralp SEZER][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/thunderbirdtr/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/08/starry-night-2-816x345.jpg
|
||||
[2]: https://commons.wikimedia.org/wiki/File:Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg
|
||||
[3]: https://fedoramagazine.org/use-opencv-on-fedora-linux-part-1/
|
||||
[4]: https://fedoramagazine.org/wp-content/uploads/2021/06/image-8.png
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2021/06/image-9.png
|
||||
[6]: https://fedoramagazine.org/wp-content/uploads/2021/06/image-11-1024x408.png
|
||||
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/resize_img-1024x338.png
|
||||
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/flip_image_cv-1024x250.png
|
||||
[9]: https://docs.opencv.org/4.5.2/index.html
|
102
sources/tech/20210807 How to Install Java on Fedora Linux.md
Normal file
102
sources/tech/20210807 How to Install Java on Fedora Linux.md
Normal file
@ -0,0 +1,102 @@
|
||||
[#]: subject: "How to Install Java on Fedora Linux"
|
||||
[#]: via: "https://itsfoss.com/install-java-fedora/"
|
||||
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Install Java on Fedora Linux
|
||||
======
|
||||
|
||||
Love it or hate it, it is difficult to avoid Java.
|
||||
|
||||
Java is still a very popular programming language taught in the schools and used in the enterprises.
|
||||
|
||||
If you want to use a Java-based tool or program in Java, you’ll need to have Java on your system.
|
||||
|
||||
This becomes confusing because there are so many technical terms around java.
|
||||
|
||||
* Java Development Kit (JDK) for creating Java programs
|
||||
* Java Runtime Environment (JRE) or Java Virtual Machine (JVM) for running Java programs
|
||||
|
||||
|
||||
|
||||
On top of that, you’ll come across [OpenJDK][1] and [Oracle Java SE][2]. OpenJDK is what is recommended because it is open source. If you have exclusive need then only you should go for Oracle Java SE.
|
||||
|
||||
There is one more thing here. Even OpenJDK has several versions available. At the time of writing this article, Fedora 34 has OpenJDK 1.8, OpenJDK 11 and OpenJDK 16 available.
|
||||
|
||||
It is up to you to decide which Java version you want.
|
||||
|
||||
### Installing Java on Fedora Linux
|
||||
|
||||
First thing first, check if Java is already installed and which version it is. I am not kidding. Fedora usually comes with Java preinstalled.
|
||||
|
||||
To check, use the following command:
|
||||
|
||||
```
|
||||
java -version
|
||||
```
|
||||
|
||||
As you can see in the screenshot below, I have Java 11 (OpenJDK 11) installed on my Fedora system.
|
||||
|
||||
![Check Java version][3]
|
||||
|
||||
Let’s say you want to install another version of Java. You may check the available options with the following command:
|
||||
|
||||
```
|
||||
sudo dnf search openjdk
|
||||
```
|
||||
|
||||
The sudo here is not required but it will refresh the metadata for sudo user which will eventually help when you install another version of Java.
|
||||
|
||||
The above command will show a huge output with plenty of similar looking packages. You have to focus on the initial few words to understand the different versions available.
|
||||
|
||||
![Available Java versions in Fedora][4]
|
||||
|
||||
For example, to install Java 8 (OpenJDK 1.8), the package name should be java-1.8.0-openjdk.x86_64 or java-1.8.0-openjdk. Use it to install it:
|
||||
|
||||
```
|
||||
sudo dnf install java-1.8.0-openjdk.x86_64
|
||||
```
|
||||
|
||||
![Install Java Fedora][5]
|
||||
|
||||
That’s good. Now you have both Java 11 and Java 8 installed on your system. But how will you use one of them?
|
||||
|
||||
#### Switch Java version on Fedora
|
||||
|
||||
Your Java version in use remains the same unless you explicitly change it. Use this command to list the installed Java versions on your system:
|
||||
|
||||
```
|
||||
sudo alternatives --config java
|
||||
```
|
||||
|
||||
You’ll notice a number before the Java versions. The + sign before the Java versions indicate the current Java version in use.
|
||||
|
||||
You can specify the number to switch the Java version. So, in the example below, if I enter 2, it will change the Java version on the system from Java 11 to Java 8.
|
||||
|
||||
![Switching between installed Java versions][6]
|
||||
|
||||
That’s all you need to do for installing Java on Fedora.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-java-fedora/
|
||||
|
||||
作者:[Abhishek Prakash][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/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://openjdk.java.net/
|
||||
[2]: https://www.oracle.com/java/technologies/javase-downloads.html
|
||||
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/check-java-version-fedora.png?resize=800%2C271&ssl=1
|
||||
[4]: https://itsfoss.com/wp-content/uploads/2021/08/available-java-versions-fedora-800x366.webp
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/install-java-fedora.png?resize=800%2C366&ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/switch-java-versions-fedora.png?resize=800%2C513&ssl=1
|
@ -0,0 +1,87 @@
|
||||
[#]: subject: "Remove files and folders in the Linux terminal"
|
||||
[#]: via: "https://opensource.com/article/21/8/remove-files-linux-terminal"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Remove files and folders in the Linux terminal
|
||||
======
|
||||
Learn to safely remove files and folders in the Linux terminal.
|
||||
![Removing files][1]
|
||||
|
||||
To remove a file on a computer using a graphical interface, you usually drag a file or a folder to a "trash" or "recycle" bin. Alternately, you might be able to select the file or folder you want to remove, right-click, and select **Delete**.
|
||||
|
||||
When removing a file or folder in the terminal, there is no trash bin, at least by default. On a graphical desktop, the Trash is a protected directory so that users don't accidentally trash the Trash, or move it from its default location and lose track of it. The Trash is just a highly managed folder, so you can make your own Trash folder for use in your terminal.
|
||||
|
||||
### Setting up a trash bin for the terminal
|
||||
|
||||
Create a directory called **Trash** in your home directory:
|
||||
|
||||
|
||||
```
|
||||
`$ mkdir ~/Trash`
|
||||
```
|
||||
|
||||
### Removing a file
|
||||
|
||||
When you want to remove a file or folder, use the **mv** command to move a file or directory to your Trash:
|
||||
|
||||
|
||||
```
|
||||
`$ mv example.txt ~/Trash`
|
||||
```
|
||||
|
||||
### Deleting a file or folder permanently
|
||||
|
||||
When you're ready to remove a file or folder from your system permanently, you can use the **rm** command to erase all of the data in your Trash folder. By directing the **rm** command to an asterisk (`*`), you delete all files and folders inside the **Trash** folder without deleting the **Trash** folder itself. If you accidentally delete the **Trash** folder, however, you can just recreate it because directories are easy and free to create.
|
||||
|
||||
|
||||
```
|
||||
`$ rm --recursive ~/Trash/*`
|
||||
```
|
||||
|
||||
### Removing an empty directory
|
||||
|
||||
Deleting an empty directory has the special command **rmdir**, which only removes an empty directory, protecting you from recursive mistakes.
|
||||
|
||||
|
||||
```
|
||||
$ mkdir full
|
||||
$ touch full/file.txt
|
||||
$ rmdir full
|
||||
rmdir: failed to remove 'full/': Directory not empty
|
||||
|
||||
$ mkdir empty
|
||||
$ rmdir empty
|
||||
```
|
||||
|
||||
### Better trash
|
||||
|
||||
There are [commands for trashing files][2] that aren't included by default in your terminal, but that you can install from a software repository. They make it even easier to trash files, because they manage and use the very same Trash folder you use on your desktop.
|
||||
|
||||
|
||||
```
|
||||
$ trash ~/example.txt
|
||||
$ trash --list
|
||||
example.txt
|
||||
$ trash --empty
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/remove-files-linux-terminal
|
||||
|
||||
作者:[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/ch01s10.svg_.png?itok=p07au80e (Removing files)
|
||||
[2]: https://www.redhat.com/sysadmin/recover-file-deletion-linux
|
@ -0,0 +1,172 @@
|
||||
[#]: subject: "stow: Your Package Manager When You Can't Use Your Package Manager"
|
||||
[#]: via: "https://theartofmachinery.com/2021/08/08/stow_as_package_manager.html"
|
||||
[#]: author: "Simon Arneaud https://theartofmachinery.com"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
stow: Your Package Manager When You Can't Use Your Package Manager
|
||||
======
|
||||
|
||||
[GNU `stow`][1] is an underrated tool. Generically, it helps maintain a unified tree of files that come from different sources. More concretely, I use a bunch of software (D compilers, various tools) that I install manually instead of through my system’s package manager (for various reasons). `stow` makes that maintainable by letting me cleanly add/remove packages and switch between versions. Here’s how it’s done.
|
||||
|
||||
### The ~/local/ directory
|
||||
|
||||
The idea is simple: you `stow` install all personal software inside a `local/` directory inside your home directory. The resulting directory structure looks the same as if you installed the software normally to the filesystem root, so you’ll end up with `~/local/bin` and `~/local/lib` directories, etc.
|
||||
|
||||
Setting up the `local/` directory for use with `stow` is easy. The main thing you need is a `local/` directory in your home directory, with a `stow/` subdirectory to store package archives:
|
||||
|
||||
```
|
||||
$ mkdir -p ~/local/stow
|
||||
```
|
||||
|
||||
If you’re installing programs into your `local/` directory, you probably want to add `local/bin` to your `PATH` so you can easily use programs there like other programs. You can add this to the end of your `~/.profile` file (or whatever init file is used by your shell):
|
||||
|
||||
```
|
||||
PATH="$HOME/local/bin:$PATH"
|
||||
```
|
||||
|
||||
### Downloading and installing tarball packages
|
||||
|
||||
I like [`tsv-utils`][2], a handy collection of tools for data analysis on the command line. It’s not in the normal package managers I use, but there are pre-compiled tarball archives available. Here’s how to use them with `stow`.
|
||||
|
||||
First, switch to your `stow` archive directory:
|
||||
|
||||
```
|
||||
$ cd ~/local/stow
|
||||
```
|
||||
|
||||
Then download the tarball and extract it:
|
||||
|
||||
```
|
||||
$ wget https://github.com/eBay/tsv-utils/releases/download/v2.2.0/tsv-utils-v2.2.0_linux-x86_64_ldc2.tar.gz
|
||||
$ tar xf tsv-utils-v2.2.0_linux-x86_64_ldc2.tar.gz
|
||||
```
|
||||
|
||||
You’ll now have a directory containing all the package files:
|
||||
|
||||
```
|
||||
$ tree tsv-utils-v2.2.0_linux-x86_64_ldc2
|
||||
tsv-utils-v2.2.0_linux-x86_64_ldc2
|
||||
├── LICENSE.txt
|
||||
├── ReleasePackageReadme.txt
|
||||
├── bash_completion
|
||||
│ └── tsv-utils
|
||||
├── bin
|
||||
│ ├── csv2tsv
|
||||
│ ├── keep-header
|
||||
│ ├── number-lines
|
||||
│ ├── tsv-append
|
||||
│ ├── tsv-filter
|
||||
│ ├── tsv-join
|
||||
│ ├── tsv-pretty
|
||||
│ ├── tsv-sample
|
||||
│ ├── tsv-select
|
||||
│ ├── tsv-split
|
||||
│ ├── tsv-summarize
|
||||
│ └── tsv-uniq
|
||||
└── extras
|
||||
└── scripts
|
||||
├── tsv-sort
|
||||
└── tsv-sort-fast
|
||||
|
||||
4 directories, 17 files
|
||||
```
|
||||
|
||||
You can delete the `.tar.gz` archive if you want.
|
||||
|
||||
Now you can install the package into `local/` with `stow`:
|
||||
|
||||
```
|
||||
$ stow tsv-utils-v2.2.0_linux-x86_64_ldc2
|
||||
```
|
||||
|
||||
That creates a bunch of symbolic links inside the parent directory (`~/local/`) pointing to files and directories inside the package directory (`~/local/stow/tsv-utils-v2.2.0_linux-x86_64_ldc2`).
|
||||
|
||||
If you’ve set your `PATH` (you might need to restart your shell), you’ll now be able to run `tsv-utils` commands normally:
|
||||
|
||||
```
|
||||
$ tsv-summarize --help
|
||||
Synopsis: tsv-summarize [options] file [file...]
|
||||
|
||||
tsv-summarize runs aggregation operations on fields in tab-separated value
|
||||
files. Operations can be run against the full input data or grouped by key
|
||||
fields. Fields can be specified either by field number or field name. Use
|
||||
'--help-verbose' for more detailed help.
|
||||
|
||||
Options:
|
||||
|
||||
[*snip*]
|
||||
```
|
||||
|
||||
# Removing and upgrading packages
|
||||
|
||||
Okay, `stow`’s algorithm for managing symbolic links is neat, but so far there’s no practical benefit over extracting the tarball directly into `local/`. `stow` shines when you’re maintaining your package collection. For example, if you decide to uninstall `tsv-utils` later, you just need to switch to the archive directory and run `stow` again with the `-D` flag:
|
||||
|
||||
```
|
||||
$ cd ~/local/stow
|
||||
$ stow -D tsv-utils-v2.2.0_linux-x86_64_ldc2
|
||||
```
|
||||
|
||||
That will cleanly remove `tsv-utils` from the `local/` directory without breaking any other installed packages. Try doing that after extracting the tarball directly to `local/`.
|
||||
|
||||
The package directory inside the `stow/` directory will remain, but you can delete that too, if you want, of course.
|
||||
|
||||
`stow` doesn’t manage versions, so upgrading packages means uninstalling the old package and installing the new package. `stow` detects when packages collide (e.g., they both include a file called `bin/tsv-summarize`), so you can only install one version at a time. However, you can keep as many archive directories as you like in `stow/`, allowing you to easily switch back and forth between versions if you need to.
|
||||
|
||||
### Building packages from source
|
||||
|
||||
Not all software comes precompiled. Sometimes you’re experimenting with your own custom version. If you want to use source packages with `stow`, you just need to figure out how to make the source package install to a directory in your `stow/` directory, instead of your filesystem root.
|
||||
|
||||
Suppose I want to install my own version of the [GraphicsMagick][3] image processing tools. This will be a two-stage process. First I’ll need to download and extract the source somewhere (I keep a `src/` directory for third-party source code).
|
||||
|
||||
```
|
||||
$ cd ~/src
|
||||
$ wget -O GraphicsMagick-1.3.36.tar.gz https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/1.3.36/GraphicsMagick-1.3.36.tar.gz/download
|
||||
$ tar xf GraphicsMagick-1.3.36.tar.gz
|
||||
$ cd GraphicsMagick-1.3.36
|
||||
```
|
||||
|
||||
GraphicsMagick uses a GNU-style build system using `autotools`. `configure` scripts take a `--prefix` option that sets the installation root.
|
||||
|
||||
```
|
||||
$ ./configure --prefix="$HOME/local/stow/GraphicsMagick-1.3.36"
|
||||
$ make install
|
||||
```
|
||||
|
||||
The installation step automatically creates the `stow/GraphicsMagick-1.3.36/` directory. Now I just need to install the built package with `stow`.
|
||||
|
||||
```
|
||||
$ cd ~/local/stow
|
||||
$ stow GraphicsMagick-1.3.36
|
||||
$ gm version
|
||||
GraphicsMagick 1.3.36 20201226 Q8 http://www.GraphicsMagick.org/
|
||||
Copyright (C) 2002-2020 GraphicsMagick Group.
|
||||
Additional copyrights and licenses apply to this software.
|
||||
See http://www.GraphicsMagick.org/www/Copyright.html for details.
|
||||
|
||||
[*snip*]
|
||||
```
|
||||
|
||||
### Other uses
|
||||
|
||||
This is my personal favourite usage of `stow`, but it’s just a generic tool for merging multiple filesystem trees in a maintainable way. Some people use it to manage their `/etc/` configuration files, for example. If you try it out, I’m sure you can find other use cases.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://theartofmachinery.com/2021/08/08/stow_as_package_manager.html
|
||||
|
||||
作者:[Simon Arneaud][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://theartofmachinery.com
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.gnu.org/software/stow/
|
||||
[2]: https://github.com/eBay/tsv-utils
|
||||
[3]: http://www.graphicsmagick.org/
|
@ -0,0 +1,97 @@
|
||||
[#]: subject: "How to Enable Minimize, Maximize Window Buttons in elementary OS"
|
||||
[#]: via: "https://www.debugpoint.com/2021/08/enable-minimize-maximize-elementary/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Enable Minimize, Maximize Window Buttons in elementary OS
|
||||
======
|
||||
This is how you can enable the Minimize, Maximize window buttons in
|
||||
elementary OS.
|
||||
Many people (mostly new users to elementary OS) asks these questions in various forums:
|
||||
|
||||
1. How do I enable minimize buttons in elementary OS?
|
||||
2. How to I enable restore, minimize, maximize?
|
||||
3. Is it possible to bring back the minimize and maximize buttons?
|
||||
|
||||
|
||||
|
||||
And they are completely valid questions, and It’s okay to ask questions. Right? This guide to help them to get those buttons in elementary OS.
|
||||
|
||||
The Pantheon desktop which is used by elementary OS does not come with default standard window buttons. The reason primarily being a different concept of handling user behavior and activities via Dock and Application menu. Arguably, this design or implementation of this behavior mimics macOS.
|
||||
|
||||
That said, many users prefers the window buttons because it is a “muscle-memory'” thing and some migrated from other desktop environments, even windows.
|
||||
|
||||
Although elementary doesn’t provide you this as a default settings, you can still enable it. Here’s how.
|
||||
|
||||
### Enable minimize maximize Buttons – elementary OS
|
||||
|
||||
Open a terminal and install the software properties common which is required for adding a PPA. By default, this package is not installed in elementary OS (don’t ask me why, seriously?).
|
||||
|
||||
```
|
||||
sudo apt install software-properties-common
|
||||
```
|
||||
|
||||
#### elementary OS 6 Odin
|
||||
|
||||
The Tweak tool is renamed with a new name and being developed separately. It is called [Pantheon Tweaks][1]. And using the following commands you can install it.
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/pantheon-tweaks
|
||||
sudo apt install -y pantheon-tweaks
|
||||
```
|
||||
|
||||
#### elementary OS 5 Juno and below
|
||||
|
||||
If you are using elementary OS 5 June and below, you can install the earlier [elementary-tweaks][2] using the same PPA. Follow the below commands from terminal.
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/elementary-tweaks
|
||||
sudo apt install -y elementary-tweaks
|
||||
```
|
||||
|
||||
#### Change the settings
|
||||
|
||||
* After installation, click on the Application at the top bar and open System Settings.
|
||||
In the **System settings** window, click on **Tweaks** under Personal section.
|
||||
* In the Tweaks window, go to **Appearance** section.
|
||||
* Under **Window** Controls, select **Layout: Windows**.
|
||||
|
||||
|
||||
|
||||
![enable minimize maximize buttons elementary OS][3]
|
||||
|
||||
* And you should have the minimized, maximize and close button on the right side of the top window bar.
|
||||
|
||||
|
||||
|
||||
There are other combinations as well, such as Ubuntu, macOS, etc. You can choose whatever you feel like:
|
||||
|
||||
![Other Options of Window buttons in elementary][4]
|
||||
|
||||
This step completes the guide. There are other options in gsettings which you may try to use, but the window manager gala recently removed those options. Hence, they may not work at the moment.
|
||||
|
||||
I hope this guide helps you to enable minimize maximize buttons elementary OS. Let me know in the comment box below if you need any help.
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/08/enable-minimize-maximize-elementary/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://github.com/pantheon-tweaks/pantheon-tweaks
|
||||
[2]: https://github.com/elementary-tweaks/elementary-tweaks
|
||||
[3]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/enable-minimize-maximize-buttons-elementary-OS-1024x501.png
|
||||
[4]: https://www.debugpoint.com/blog/wp-content/uploads/2021/08/Other-Options-of-Window-buttons-in-elementary.jpg
|
@ -0,0 +1,589 @@
|
||||
[#]: subject: "NMState: A declarative networking config tool"
|
||||
[#]: via: "https://fedoramagazine.org/nmstate-a-declarative-networking-config-tool/"
|
||||
[#]: author: "Maurizio Garcia https://fedoramagazine.org/author/malgnuz/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
NMState: A declarative networking config tool
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Comic excerpted from photo by [Bee Felten-Leidel][2] on [Unsplash][3]
|
||||
|
||||
This article describes and demonstrates NMState, a network manager that uses a declarative approach to configure hosts. This means you define the desired configuration state through an API and the tool applies the configuration through a provider.
|
||||
|
||||
### Configuration approaches: imperative vs declarative
|
||||
|
||||
Networking management can be a very complex task depending on the size and diversity of the environment. In the early days of IT, networking management relied on manual procedures performed by network administrators over networking devices. Nowadays, Infrastructure as Code (IaC) allows automation of those tasks in a different way. There are, essentially two approaches: imperative or declarative.
|
||||
|
||||
In an imperative approach you define “how” you will arrive at a desired configuration state. The declarative paradigm defines “what” is the desired configuration state, so it does not shape which steps are required nor in which order they must be performed. This approach is currently gathering more adepts and you can find it on most of the management and orchestration tools currently used.
|
||||
|
||||
### NMState: a declarative tool
|
||||
|
||||
NMState is a network manager that allows you to configure hosts following a declarative approach. It means you define the desired configuration state through a northbound declarative API and this tool applies the configuration through a southbound provider.
|
||||
|
||||
Currently the only provider supported by NMState is NetworkManager, which is the main service to address networking capabilities on Fedora Linux. However, the development life cycle of NMState will add other providers gradually.
|
||||
|
||||
For further information regarding NMState please visit either its project [site][4] or github [repository][5].
|
||||
|
||||
### Installation
|
||||
|
||||
NMState is available on Fedora Linux 29+ and requires NetworkManager 1.26 or later installed and running on the system. The following shows the installation on Fedora Linux 34:
|
||||
|
||||
```
|
||||
$ sudo dnf -y install nmstate
|
||||
…
|
||||
output omitted
|
||||
…
|
||||
Installed:
|
||||
NetworkManager-config-server-1:1.30.4-1.fc34.noarch gobject-introspection-1.68.0-3.fc34.x86_64 nispor-1.0.1-2.fc34.x86_64 nmstate-1.0.3-2.fc34.noarch
|
||||
python3-gobject-base-3.40.1-1.fc34.x86_64 python3-libnmstate-1.0.3-2.fc34.noarch python3-nispor-1.0.1-2.fc34.noarch python3-varlink-30.3.1-2.fc34.noarch
|
||||
|
||||
Complete!
|
||||
```
|
||||
|
||||
At this point you can use _nmstatectl_ as a command line tool for NMState. Please refer to either _nmstatectl –help_ or _man nmstatectl_ for further information about this tool.
|
||||
|
||||
### Using NMstate
|
||||
|
||||
Start by checking the NMState version installed in the system:
|
||||
|
||||
```
|
||||
$ nmstatectl version
|
||||
1.0.3
|
||||
```
|
||||
|
||||
Check the current configuration of a networking interface, e.g. the _eth0_ configuration:
|
||||
|
||||
```
|
||||
$ nmstatectl show eth0
|
||||
2021-06-29 10:28:21,530 root DEBUG NetworkManager version 1.30.4
|
||||
2021-06-29 10:28:21,531 root DEBUG Async action: Retrieve applied config: ethernet eth0 started
|
||||
2021-06-29 10:28:21,531 root DEBUG Async action: Retrieve applied config: ethernet eth1 started
|
||||
2021-06-29 10:28:21,532 root DEBUG Async action: Retrieve applied config: ethernet eth0 finished
|
||||
2021-06-29 10:28:21,533 root DEBUG Async action: Retrieve applied config: ethernet eth1 finished
|
||||
---
|
||||
dns-resolver:
|
||||
config: {}
|
||||
running:
|
||||
search: []
|
||||
server:
|
||||
- 192.168.122.1
|
||||
route-rules:
|
||||
config: []
|
||||
routes:
|
||||
config: []
|
||||
running:
|
||||
- destination: fe80::/64
|
||||
metric: 100
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth0
|
||||
table-id: 254
|
||||
- destination: 0.0.0.0/0
|
||||
metric: 100
|
||||
next-hop-address: 192.168.122.1
|
||||
next-hop-interface: eth0
|
||||
table-id: 254
|
||||
- destination: 192.168.122.0/24
|
||||
metric: 100
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth0
|
||||
table-id: 254
|
||||
interfaces:
|
||||
- name: eth0
|
||||
type: ethernet
|
||||
state: up
|
||||
ipv4:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: 192.168.122.238
|
||||
prefix-length: 24
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
dhcp: true
|
||||
ipv6:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: fe80::c3c9:c4f9:75b1:a570
|
||||
prefix-length: 64
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
autoconf: true
|
||||
dhcp: true
|
||||
lldp:
|
||||
enabled: false
|
||||
mac-address: 52:54:00:91:E4:4E
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
As you can see above the networking configuration shows four main sections:
|
||||
|
||||
* **dns-resolver**: this section has the nameserver configuration for this interface.
|
||||
* **route-rules**: it states the routing rules.
|
||||
* **routes**: it includes both dynamic and static routes.
|
||||
* **Interfaces**: this section describes both ipv4 and ipv6 settings.
|
||||
|
||||
|
||||
|
||||
### Modify the configuration
|
||||
|
||||
You can modify the desired configuration state in two modes:
|
||||
|
||||
* **Interactive**: editing the interface configuration through _nmstatectl edit_. This command invokes the text editor defined by the environment variable EDITOR so the network state can be edited in yaml format. After finishing the edition NMState will apply the new network configuration unless there are syntax errors.
|
||||
|
||||
|
||||
* **File-based**: applying the interface configuration using _nmstatectl apply_ which imports a desired configuration state from a yaml or json file earlier created.
|
||||
|
||||
|
||||
|
||||
The following sections show you how to change the networking configuration using NMState. These changes can be disruptive to the system so the recommendation is to perform these tasks on a test system or guest VM till you get a better understanding of NMState.
|
||||
|
||||
The test system in use herehas two Ethernet interfaces: _eth0_ and _eth1_:
|
||||
|
||||
```
|
||||
$ ip -br -4 a
|
||||
lo UNKNOWN 127.0.0.1/8
|
||||
eth0 UP 192.168.122.238/24
|
||||
eth1 UP 192.168.122.108/24
|
||||
```
|
||||
|
||||
#### Example of interactive configuration mode:
|
||||
|
||||
```
|
||||
Change the MTU of eth0 interface to 9000 bytes using the nmstatectl edit command as follows (all changes are in bold):
|
||||
```
|
||||
|
||||
```
|
||||
$ sudo nmstatectl edit eth0
|
||||
|
||||
---
|
||||
dns-resolver:
|
||||
config: {}
|
||||
running:
|
||||
search: []
|
||||
server:
|
||||
- 192.168.122.1
|
||||
route-rules:
|
||||
config: []
|
||||
routes:
|
||||
config: []
|
||||
running:
|
||||
- destination: fe80::/64
|
||||
metric: 100
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth0
|
||||
table-id: 254
|
||||
- destination: 0.0.0.0/0
|
||||
metric: 100
|
||||
next-hop-address: 192.168.122.1
|
||||
next-hop-interface: eth0
|
||||
table-id: 254
|
||||
- destination: 192.168.122.0/24
|
||||
metric: 100
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth0
|
||||
table-id: 254
|
||||
interfaces:
|
||||
- name: eth0
|
||||
type: ethernet
|
||||
state: up
|
||||
ipv4:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: 192.168.122.123
|
||||
prefix-length: 24
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
dhcp: true
|
||||
ipv6:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: fe80::c3c9:c4f9:75b1:a570
|
||||
prefix-length: 64
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
autoconf: true
|
||||
dhcp: true
|
||||
lldp:
|
||||
enabled: false
|
||||
mac-address: 52:54:00:91:E4:4E
|
||||
mtu: 9000
|
||||
```
|
||||
|
||||
After saving and exiting the edito, NMState applies the new network desired state:
|
||||
|
||||
```
|
||||
2021-06-29 11:29:05,726 root DEBUG Nmstate version: 1.0.3
|
||||
2021-06-29 11:29:05,726 root DEBUG Applying desire state: {'dns-resolver': {'config': {}, 'running': {'search': [], 'server': ['192.168.122.1']}}, 'route-rules': {'config': []}, 'routes': {'config': [], 'running': [{'destination': 'fe80::/64', 'metric': 102, 'next-hop-address': '', 'next-hop-interface': 'eth0', 'table-id': 254}, {'destination': '0.0.0.0/0', 'metric': 102, 'next-hop-address': '192.168.122.1', 'next-hop-interface': 'eth0', 'table-id': 254}, {'destination': '192.168.122.0/24', 'metric': 102, 'next-hop-address': '', 'next-hop-interface': 'eth0', 'table-id': 254}]}, 'interfaces': [{'name': 'eth0', 'type': 'ethernet', 'state': 'up', 'ipv4': {'enabled': True, 'address': [{'ip': '192.168.122.238', 'prefix-length': 24}], 'auto-dns': True, 'auto-gateway': True, 'auto-route-table-id': 0, 'auto-routes': True, 'dhcp': True}, 'ipv6': {'enabled': True, 'address': [{'ip': 'fe80::5054:ff:fe91:e44e', 'prefix-length': 64}], 'auto-dns': True, 'auto-gateway': True, 'auto-route-table-id': 0, 'auto-routes': True, 'autoconf': True, 'dhcp': True}, 'lldp': {'enabled': False}, 'mac-address': '52:54:00:91:E4:4E', 'mtu': 9000}]}
|
||||
--- output omitted ---
|
||||
2021-06-29 11:29:05,760 root DEBUG Async action: Update profile uuid:2bdee700-f62b-365a-bd1d-69d9c31a9f0c iface:eth0 type:ethernet started
|
||||
2021-06-29 11:29:05,792 root DEBUG Async action: Update profile uuid:2bdee700-f62b-365a-bd1d-69d9c31a9f0c iface:eth0 type:ethernet finished
|
||||
```
|
||||
|
||||
Now, use both the _ip_ command and also the _eth0_ configuration file to check that the _MTU_ of _eth0_ is 9000 bytes.
|
||||
|
||||
```
|
||||
$ ip link show eth0
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
|
||||
link/ether 52:54:00:91:e4:4e brd ff:ff:ff:ff:ff:ff
|
||||
altname enp1s0
|
||||
|
||||
$ sudo cat /etc/NetworkManager/system-connections/eth0.nmconnection
|
||||
[sudo] password for admin:
|
||||
[connection]
|
||||
id=eth0
|
||||
uuid=2bdee700-f62b-365a-bd1d-69d9c31a9f0c
|
||||
type=ethernet
|
||||
interface-name=eth0
|
||||
lldp=0
|
||||
permissions=
|
||||
|
||||
[ethernet]
|
||||
cloned-mac-address=52:54:00:91:E4:4E
|
||||
mac-address-blacklist=
|
||||
mtu=9000
|
||||
|
||||
[ipv4]
|
||||
dhcp-client-id=mac
|
||||
dhcp-timeout=2147483647
|
||||
dns-search=
|
||||
method=auto
|
||||
|
||||
[ipv6]
|
||||
addr-gen-mode=eui64
|
||||
dhcp-duid=ll
|
||||
dhcp-iaid=mac
|
||||
dhcp-timeout=2147483647
|
||||
dns-search=
|
||||
method=auto
|
||||
ra-timeout=2147483647
|
||||
|
||||
[proxy]
|
||||
```
|
||||
|
||||
#### Example of file-based configuration mode:
|
||||
|
||||
Let’s use the file-based approach to set a new config state. In this case disable the IPv6 configuration in _eth1_ interface.
|
||||
|
||||
First, create a yaml file to define the desired state of the _eth1_ interface. Use _nmstatectl show_ to save the current settings then _nmstatectl edit_ to disable IPv6. Again, all changes are in bold and deletions are shown with strike-through:
|
||||
|
||||
```
|
||||
$ nmstatectl show eth1 > eth1.yaml
|
||||
|
||||
$ vi eth1.yaml
|
||||
---
|
||||
dns-resolver:
|
||||
config: {}
|
||||
running:
|
||||
search: []
|
||||
server:
|
||||
- 192.168.122.1
|
||||
route-rules:
|
||||
config: []
|
||||
routes:
|
||||
config: []
|
||||
running:
|
||||
- destination: fe80::/64
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 0.0.0.0/0
|
||||
metric: 101
|
||||
next-hop-address: 192.168.122.1
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 192.168.122.0/24
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
interfaces:
|
||||
- name: eth1
|
||||
type: ethernet
|
||||
state: up
|
||||
ipv4:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: 192.168.122.108
|
||||
prefix-length: 24
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
dhcp: true
|
||||
ipv6:
|
||||
enabled: false
|
||||
address:
|
||||
- ip: fe80::5054:ff:fe3c:9b04
|
||||
prefix-length: 64
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
autoconf: true
|
||||
dhcp: true
|
||||
lldp:
|
||||
enabled: false
|
||||
mac-address: 52:54:00:3C:9B:04
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
After saving the new configuration, use it to apply the new state:
|
||||
|
||||
```
|
||||
$ sudo nmstatectl apply eth1.yaml
|
||||
|
||||
2021-06-29 12:17:21,531 root DEBUG Nmstate version: 1.0.3
|
||||
2021-06-29 12:17:21,531 root DEBUG Applying desire state: {'dns-resolver': {'config': {}, 'running': {'search': [], 'server': ['192.168.122.1']}}, 'route-rules': {'config': []}, 'routes': {'config': [], 'running': [{'destination': 'fe80::/64', 'metric': 101, 'next-hop-address': '', 'next-hop-interface': 'eth1', 'table-id': 254}, {'destination': '0.0.0.0/0', 'metric': 101, 'next-hop-address': '192.168.122.1', 'next-hop-interface': 'eth1', 'table-id': 254}, {'destination': '192.168.122.0/24', 'metric': 101, 'next-hop-address': '', 'next-hop-interface': 'eth1', 'table-id': 254}]}, 'interfaces': [{'name': 'eth1', 'type': 'ethernet', 'state': 'up', 'ipv4': {'enabled': True, 'address': [{'ip': '192.168.122.108', 'prefix-length': 24}], 'auto-dns': True, 'auto-gateway': True, 'auto-route-table-id': 0, 'auto-routes': True, 'dhcp': True}, 'ipv6': {'enabled': False}, 'lldp': {'enabled': False}, 'mac-address': '52:54:00:3C:9B:04', 'mtu': 1500}]}
|
||||
--- output omitted ---
|
||||
2021-06-29 12:17:21,582 root DEBUG Async action: Update profile uuid:5d7244cb-673d-3b88-a675-32e31fad4347 iface:eth1 type:ethernet started
|
||||
2021-06-29 12:17:21,587 root DEBUG Async action: Update profile uuid:5d7244cb-673d-3b88-a675-32e31fad4347 iface:eth1 type:ethernet finished
|
||||
--- output omitted ---
|
||||
Desired state applied:
|
||||
---
|
||||
dns-resolver:
|
||||
config: {}
|
||||
running:
|
||||
search: []
|
||||
server:
|
||||
- 192.168.122.1
|
||||
route-rules:
|
||||
config: []
|
||||
routes:
|
||||
config: []
|
||||
running:
|
||||
- destination: fe80::/64
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 0.0.0.0/0
|
||||
metric: 101
|
||||
next-hop-address: 192.168.122.1
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 192.168.122.0/24
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
interfaces:
|
||||
- name: eth1
|
||||
type: ethernet
|
||||
state: up
|
||||
ipv4:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: 192.168.122.108
|
||||
prefix-length: 24
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
dhcp: true
|
||||
ipv6:
|
||||
enabled: false
|
||||
lldp:
|
||||
enabled: false
|
||||
mac-address: 52:54:00:3C:9B:04
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
You can check that the _eth1_ interface does not have any IPv6 configured:
|
||||
|
||||
```
|
||||
$ ip -br a
|
||||
lo UNKNOWN 127.0.0.1/8 ::1/128
|
||||
eth0 UP 192.168.122.238/24 fe80::5054:ff:fe91:e44e/64
|
||||
eth1 UP 192.168.122.108/24
|
||||
|
||||
$ sudo cat /etc/NetworkManager/system-connections/eth1.nmconnection
|
||||
[connection]
|
||||
id=eth1
|
||||
uuid=5d7244cb-673d-3b88-a675-32e31fad4347
|
||||
type=ethernet
|
||||
interface-name=eth1
|
||||
lldp=0
|
||||
permissions=
|
||||
|
||||
[ethernet]
|
||||
cloned-mac-address=52:54:00:3C:9B:04
|
||||
mac-address-blacklist=
|
||||
mtu=1500
|
||||
|
||||
[ipv4]
|
||||
dhcp-client-id=mac
|
||||
dhcp-timeout=2147483647
|
||||
dns-search=
|
||||
method=auto
|
||||
|
||||
[ipv6]
|
||||
addr-gen-mode=eui64
|
||||
dhcp-duid=ll
|
||||
dhcp-iaid=mac
|
||||
dns-search=
|
||||
method=disabled
|
||||
|
||||
[proxy]
|
||||
```
|
||||
|
||||
#### Applying changes temporarily
|
||||
|
||||
An interesting feature of NMState allows you to configure a desired networking state temporarily. In case you are satisfied with the configuration you can commit it afterwards. Otherwise it will rollback when the timeout expires (default is 60 sec).
|
||||
|
||||
Modify the _eth1_ configuration from the previous example so it has an IPv4 static address instead of getting it dynamically by DHCP.
|
||||
|
||||
```
|
||||
$ vi eth1.yaml
|
||||
|
||||
---
|
||||
dns-resolver:
|
||||
config: {}
|
||||
running:
|
||||
search: []
|
||||
server:
|
||||
- 192.168.122.1
|
||||
route-rules:
|
||||
config: []
|
||||
routes:
|
||||
config: []
|
||||
running:
|
||||
- destination: fe80::/64
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 0.0.0.0/0
|
||||
metric: 101
|
||||
next-hop-address: 192.168.122.1
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 192.168.122.0/24
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
interfaces:
|
||||
- name: eth1
|
||||
type: ethernet
|
||||
state: up
|
||||
ipv4:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: 192.168.122.110
|
||||
prefix-length: 24
|
||||
auto-dns: true
|
||||
auto-gateway: true
|
||||
auto-route-table-id: 0
|
||||
auto-routes: true
|
||||
dhcp: false
|
||||
ipv6:
|
||||
enabled: false
|
||||
lldp:
|
||||
enabled: false
|
||||
mac-address: 52:54:00:3C:9B:04
|
||||
mtu: 1500
|
||||
```
|
||||
|
||||
Now, apply this config temporarily using the option _no-commit_ so it will be valid only for 30 seconds. This can be done adding the option _–timeout_. Meanwhile, we will run the _ip -br a_ command three times to see how the IPv4 address configured in _eth1_ interface changes and then the configuration rolls back.
|
||||
|
||||
```
|
||||
$ ip -br a && sudo nmstatectl apply --no-commit --timeout 30 eth1.yaml && sleep 10 && ip -br a && sleep 25 && ip -br a
|
||||
lo UNKNOWN 127.0.0.1/8 ::1/128
|
||||
eth0 UP 192.168.122.238/24 fe80::5054:ff:fe91:e44e/64
|
||||
eth1 UP 192.168.122.108/24
|
||||
2021-06-29 17:29:18,266 root DEBUG Nmstate version: 1.0.3
|
||||
2021-06-29 17:29:18,267 root DEBUG Applying desire state: {'dns-resolver': {'config': {}, 'running': {'search': [], 'server': ['192.168.122.1']}}, 'route-rules': {'config': []}, 'routes': {'config': [], 'running': [{'destination': 'fe80::/64', 'metric': 101, 'next-hop-address': '', 'next-hop-interface': 'eth1', 'table-id': 254}, {'destination': '0.0.0.0/0', 'metric': 101, 'next-hop-address': '192.168.122.1', 'next-hop-interface': 'eth1', 'table-id': 254}, {'destination': '192.168.122.0/24', 'metric': 101, 'next-hop-address': '', 'next-hop-interface': 'eth1', 'table-id': 254}]}, 'interfaces': [{'name': 'eth1', 'type': 'ethernet', 'state': 'up', 'ipv4': {'enabled': True, 'address': [{'ip': '192.168.122.110', 'prefix-length': 24}], 'dhcp': False}, 'ipv6': {'enabled': False}, 'lldp': {'enabled': False}, 'mac-address': '52:54:00:3C:9B:04', 'mtu': 1500}]}
|
||||
--- output omitted ---
|
||||
Desired state applied:
|
||||
---
|
||||
dns-resolver:
|
||||
config: {}
|
||||
running:
|
||||
search: []
|
||||
server:
|
||||
- 192.168.122.1
|
||||
route-rules:
|
||||
config: []
|
||||
routes:
|
||||
config: []
|
||||
running:
|
||||
- destination: fe80::/64
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 0.0.0.0/0
|
||||
metric: 101
|
||||
next-hop-address: 192.168.122.1
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
- destination: 192.168.122.0/24
|
||||
metric: 101
|
||||
next-hop-address: ''
|
||||
next-hop-interface: eth1
|
||||
table-id: 254
|
||||
interfaces:
|
||||
- name: eth1
|
||||
type: ethernet
|
||||
state: up
|
||||
ipv4:
|
||||
enabled: true
|
||||
address:
|
||||
- ip: 192.168.122.110
|
||||
prefix-length: 24
|
||||
dhcp: false
|
||||
ipv6:
|
||||
enabled: false
|
||||
lldp:
|
||||
enabled: false
|
||||
mac-address: 52:54:00:3C:9B:04
|
||||
mtu: 1500
|
||||
Checkpoint: NetworkManager|/org/freedesktop/NetworkManager/Checkpoint/7
|
||||
lo UNKNOWN 127.0.0.1/8 ::1/128
|
||||
eth0 UP 192.168.122.238/24 fe80::5054:ff:fe91:e44e/64
|
||||
eth1 UP 192.168.122.110/24
|
||||
lo UNKNOWN 127.0.0.1/8 ::1/128
|
||||
eth0 UP 192.168.122.238/24 fe80::5054:ff:fe91:e44e/64
|
||||
eth1 UP 192.168.122.108/24
|
||||
```
|
||||
|
||||
As you can see from above, the _eth1_ IP address changed temporarily from 192.168.122.108 to 192.168.122.110 and then it returned to 192.168.122.108 after the timeout expired.
|
||||
|
||||
### Conclusion
|
||||
|
||||
NMState is a declarative networking configuration tool that currently applies the desired networking configuration state in a host through the NetworkManager API. This state can be defined either interactively using a text editor or with a file-based approach creating a yaml or json file.
|
||||
|
||||
This kind of tool provides Infrastructure as Code, it allows the automation of networking tasks and also reduces potential misconfigurations or unstable networking scenarios that could arise using legacy configuration methods.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/nmstate-a-declarative-networking-config-tool/
|
||||
|
||||
作者:[Maurizio Garcia][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/malgnuz/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/magic-816x345.jpg
|
||||
[2]: https://unsplash.com/@marigard?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/magic?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://nmstate.io/
|
||||
[5]: https://github.com/nmstate/nmstate
|
215
sources/tech/20210809 Parsing command options in Lua.md
Normal file
215
sources/tech/20210809 Parsing command options in Lua.md
Normal file
@ -0,0 +1,215 @@
|
||||
[#]: subject: "Parsing command options in Lua"
|
||||
[#]: via: "https://opensource.com/article/21/8/parsing-commands-lua"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Parsing command options in Lua
|
||||
======
|
||||
My favorite way to solve the problem of parsing in Lua is alt-getopt.
|
||||
![Woman sitting in front of her laptop][1]
|
||||
|
||||
When you enter a command into your terminal, there are usually [options][2], also called _switches_ or _flags_, that you can use to modify how the command runs. This is a useful convention defined by the [POSIX specification][3], so as a programmer, it's helpful to know how to detect and parse options.
|
||||
|
||||
As with most languages, there are several ways to solve the problem of parsing options in Lua. My favorite is [alt-getopt][4].
|
||||
|
||||
### Installing
|
||||
|
||||
The easiest way to obtain and use **alt-getopt** in your code is to [install it with LuaRocks][5]. For most use-cases, you probably want to install it into your local project directory:
|
||||
|
||||
|
||||
```
|
||||
$ mkdir local
|
||||
$ luarocks --tree=local install alt-getopt
|
||||
Installing <https://luarocks.org/alt-getopt-0.X.Y-1.src.rock>
|
||||
[...]
|
||||
alt-getopt 0.X.Y-1 is now installed in /tux/myproject/local (license: MIT/X11)
|
||||
```
|
||||
|
||||
Alternately, you can download the code from [GitHub][6].
|
||||
|
||||
### Adding a library to your Lua code
|
||||
|
||||
Assuming you've installed the library locally, then you can define your Lua package path and then `require` the **alt-getopt** package:
|
||||
|
||||
|
||||
```
|
||||
package.path = package.path .. ';local/share/lua/5.1/?.lua'
|
||||
|
||||
local alt_getopt = require("alt_getopt")
|
||||
```
|
||||
|
||||
If you've installed it to a known system location, you can omit the `package.path` line (because Lua already knows to look for system-wide libraries.)
|
||||
|
||||
Now you're set to parse options in Lua.
|
||||
|
||||
### Option parsing in Lua
|
||||
|
||||
The first thing you must do to parse options is to define the valid options your application can accept. The **alt_getopt** library sees all options primarily as short options, meaning that you define options as single letters. You can add long versions later.
|
||||
|
||||
When you define valid options, you create a list delimited by colons (`:`), which is interpreted by the `get_opts` function provided by **alt-getopts**.
|
||||
|
||||
First, create some variables to represent the options. The variables `short_opt` and `optarg` represent the short option and the option argument. These are arbitrary variable names, so you can call them anything (as long as it's a valid name for a variable).
|
||||
|
||||
The table `long_opts` must exist, but I find it easiest to define the values of the long options after you've decided on the short options, so leave it empty for now.
|
||||
|
||||
|
||||
```
|
||||
local long_opts = {}
|
||||
|
||||
local short_opt
|
||||
local optarg
|
||||
```
|
||||
|
||||
With those variables declared, you can iterate over the arguments provided by the user, checking to see whether any argument matches your approved list of valid short options.
|
||||
|
||||
If a valid option is found, you use the `pairs` function in Lua to extract the value of the option.
|
||||
|
||||
To create an option that accepts no argument of its own but is either _on_ or _off_ (often called a _switch_), you place the short option you want to define to the right of a colon (`:`) character.
|
||||
|
||||
In this example, I've created a loop to check for the short option `-a`, which is a switch:
|
||||
|
||||
|
||||
```
|
||||
short_opt,optarg = alt_getopt.get_opts (arg, ":a", long_opts)
|
||||
local optvalues = {}
|
||||
for k,v in pairs (short_opt) do
|
||||
table.insert (optvalues, "value of " .. k .. " is " .. v .. "\n")
|
||||
end
|
||||
|
||||
table.sort (optvalues)
|
||||
io.write (table.concat (optvalues))
|
||||
|
||||
for i = optarg,#arg do
|
||||
io.write (string.format ("ARGV [%s] = %s\n", i, arg [i]))
|
||||
end
|
||||
```
|
||||
|
||||
At the end of this sample code, I included a for-loop to iterate over any remaining arguments in the command because anything not detected as a valid option must be an argument (probably a file name, URI, or whatever it is that your application operates upon).
|
||||
|
||||
Test the code:
|
||||
|
||||
|
||||
```
|
||||
$ lua test.lua -a
|
||||
value of a is 1
|
||||
```
|
||||
|
||||
The test script has successfully detected the option `-a`, and has assigned it a value of **1** to represent that it does exist.
|
||||
|
||||
Try it again with an extra argument:
|
||||
|
||||
|
||||
```
|
||||
$ lua test.lua -a hello
|
||||
value of a is 1
|
||||
ARGV [2] = hello
|
||||
```
|
||||
|
||||
### Options with arguments
|
||||
|
||||
Some options require an argument all their own. For instance, you might want to allow the user to point your application to a custom configuration file, set an attribute to a color, or set the resolution of a graphic. In **alt_getopt**, options that accept arguments are placed on the left of the colon (`:`) in the short options list.
|
||||
|
||||
|
||||
```
|
||||
`short_opt,optarg = alt_getopt.get_opts (arg, "c:a", long_opts)`
|
||||
```
|
||||
|
||||
Test the code:
|
||||
|
||||
|
||||
```
|
||||
$ lua test.lua -a -c my.config
|
||||
value of a is 1
|
||||
value of c is my.config
|
||||
```
|
||||
|
||||
Try it again, this time with a spare argument:
|
||||
|
||||
|
||||
```
|
||||
$ lua test.lua -a -c my.config hello
|
||||
value of a is 1
|
||||
value of c is my.config
|
||||
ARGV [4] = hello
|
||||
```
|
||||
|
||||
### Long options
|
||||
|
||||
Short options are great for power users, but they don't tend to be very memorable. You can create a table of long options that point to short options so users can learn long options before abbreviating their commands with single-letter options.
|
||||
|
||||
|
||||
```
|
||||
local long_opts = {
|
||||
alpha = "a",
|
||||
config = "c"
|
||||
}
|
||||
```
|
||||
|
||||
Users now have the choice between long and short options:
|
||||
|
||||
|
||||
```
|
||||
$ lua test.lua --config my.config --alpha hello
|
||||
value of a is 1
|
||||
value of c is my.config
|
||||
ARGV [4] = hello
|
||||
```
|
||||
|
||||
### Option parsing
|
||||
|
||||
Here's the full demonstration code for your reference:
|
||||
|
||||
|
||||
```
|
||||
#!/usr/bin/env lua
|
||||
package.path = package.path .. ';local/share/lua/5.1/?.lua'
|
||||
|
||||
local alt_getopt = require("alt_getopt")
|
||||
|
||||
local long_opts = {
|
||||
alpha = "a",
|
||||
config = "c"
|
||||
}
|
||||
|
||||
local short_opt
|
||||
local optarg
|
||||
|
||||
short_opt,optarg = alt_getopt.get_opts (arg, "c:a", long_opts)
|
||||
local optvalues = {}
|
||||
for k,v in pairs (short_opt) do
|
||||
table.insert (optvalues, "value of " .. k .. " is " .. v .. "\n")
|
||||
end
|
||||
|
||||
table.sort (optvalues)
|
||||
io.write (table.concat (optvalues))
|
||||
|
||||
for i = optarg,#arg do
|
||||
io.write (string.format ("ARGV [%s] = %s\n", i, arg [i]))
|
||||
end
|
||||
```
|
||||
|
||||
There are further examples in the project's Git repository. Including options for your users is an important feature for any application, and Lua makes it easy to do. There are other libraries aside from **alt_getopt**, but I find this one easy and quick to use.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/parsing-commands-lua
|
||||
|
||||
作者:[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_women_computing_4.png?itok=VGZO8CxT (Woman sitting in front of her laptop)
|
||||
[2]: https://opensource.com/article/21/7/linux-terminal-basics#options
|
||||
[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
|
||||
[4]: https://luarocks.org/modules/mpeterv/alt-getopt
|
||||
[5]: https://opensource.com/article/19/11/getting-started-luarocks
|
||||
[6]: https://github.com/cheusov/lua-alt-getopt
|
@ -0,0 +1,130 @@
|
||||
[#]: subject: "What is Firefox Multi-Account Containers? Why and How to Use It?"
|
||||
[#]: via: "https://itsfoss.com/firefox-containers/"
|
||||
[#]: author: "Hunter Wittenborn https://itsfoss.com/author/hunter/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
What is Firefox Multi-Account Containers? Why and How to Use It?
|
||||
======
|
||||
|
||||
As the needs of users who use various programs on their devices becomes increasingly complex, the programs themselves are also needing to follow suit to keep up with the demand that users are wanting and expecting.
|
||||
|
||||
Something that I find I need on a daily basis is an easy way to be able to stay logged in to multiple accounts inside my web browser at the same time. I _could_ just log in and out of each of my accounts as needed, but this becomes extremely tedious when I’m moving across multiple accounts in a short period of time.
|
||||
|
||||
Originally, I was using Google Chrome’s ability to have multiple accounts, which worked, but was a tad too tedious to manage, and it felt a bit clunky to create an entire new Google account just to do what I considered something that should be able to be done from a _single_ account.
|
||||
|
||||
This is the point where I moved to Firefox’s Multi-Account Containers feature. Not only is it so much more flexible than my setup on Google Chrome, but I am also using something that is created by my browser’s developers themselves, making for an overall smoother and simpler experience.
|
||||
|
||||
![Illustration of containers in Firefox][1]
|
||||
|
||||
### What is Multi-Account Container in Firefox?
|
||||
|
||||
Mutli-Account Containers also works tremendously well if you want to separate parts of your digital life from each other. When you are using containers, your browsing activity from one container is not shared with other containers. This isolation means that you can log into two separate accounts on the same website in different containers. Your login session, site preference and tracking data will be confined to the container where you used a certain website.
|
||||
|
||||
What other advantage does it have? Imagine you were shopping on Amazon or some other e-commerce. You browsed a few items but did not buy anything. Now if you browse the web, you’ll see ads related to products you browsed. Some websites show ads despite ad-blockers. With containers, you can separate your shopping websites with other websites.
|
||||
|
||||
Let me share another example with you. Firefox provides a Facebook container by default. This container includes Facebook, Messenger and Instagram websites by default. This means when you open any of these three websites, they are opened in ‘Facebook container’. Thus, Facebook won’t be able to track your activity on other websites.
|
||||
|
||||
This is one of the [Firefox features that not many people know or use][2].
|
||||
|
||||
### Using Multi-Account Containers
|
||||
|
||||
Installing Firefox Multi-Account containers is an extremely simple process, and only takes a few clicks.
|
||||
|
||||
First, head over to the [extension’s page][3] on the Firefox Add-ons website. The only thing you need to do after that is click the `Add to Firefox` button.
|
||||
|
||||
![][4]
|
||||
|
||||
And you’re done! Now we can get straight into actually using the new extension.
|
||||
|
||||
If you didn’t notice already, there should now be a new icon to the right of your search bar:
|
||||
|
||||
![][5]
|
||||
|
||||
This is the icon that you’ll use to interact with Firefox Multi-Account containers. If you then click the icon, you’ll be greeted with a little menu:
|
||||
|
||||
![][6]
|
||||
|
||||
With that, let’s try some examples out so we can see how Multi-Account Containers actually works.
|
||||
|
||||
#### Setting up the container
|
||||
|
||||
First off, we need to make a container. We can do this by going to `Manage Containers -> New Container` in the Multi-Account Containers menu.
|
||||
|
||||
![][7]
|
||||
|
||||
![][8]
|
||||
|
||||
Next, enter the name for the new container, and select a color and icon. Then, hit `OK` to save the new container.
|
||||
|
||||
![][9]
|
||||
|
||||
And that’s it! We can now go back to the main menu to open a new tab inside the new container:
|
||||
|
||||
![][10]
|
||||
|
||||
You will also notice that the new tab has some styling to denote that it’s running inside of a container:
|
||||
|
||||
![][11]
|
||||
|
||||
#### Watching the container work in action
|
||||
|
||||
Let’s now look at what the container actually does when you use it.
|
||||
|
||||
We’re going to go to the Linode manager website in a normal browser tab, where I’m currently signed in:
|
||||
|
||||
![][12]
|
||||
|
||||
Let’s now try opening the same page inside our Firefox container, at which point I’m redirected to the Linode login screen:
|
||||
|
||||
![][13]
|
||||
|
||||
Why was I redirected? Because now I am not logged in. That’s one of the joys of Firefox containers: be able to be signed in inside of one browser session, and then enter a container, and it’s like you’ve never visited the site before.
|
||||
|
||||
If you were to sign in to a website within the container however, you would stay signed in while vising websites from the container. You could also use this feature to sign in to a website from inside the container, thus keeping all the data from that site away from your normal browser data.
|
||||
|
||||
Note
|
||||
|
||||
Things like your browser history itself will still be exposed to your normal browser session. The container feature simply provides a way to separate things like signed-in accounts as mentioned in this article.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
Mutli-Account Containers prove to be a wonderful feature for those who are conscious about their privacy, or just want to really try to get stringent on the security of their systems.
|
||||
|
||||
For example, you could sign in to your Google account inside of a container, and Google would never know who you whenever you aren’t inside the container.
|
||||
|
||||
And then lastly, this extension is just a great choice for people who want to sign into to multiple accounts at once, without resorting to making separate browser accounts for each thing you want to use.
|
||||
|
||||
And there you go, that’s the premise of Firefox’s Multi-Account Containers.
|
||||
|
||||
Need any help getting everything going, or just got a general question? Feel free to leave any of it in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/firefox-containers/
|
||||
|
||||
作者:[Hunter Wittenborn][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/hunter/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/Firefox-container.png?resize=800%2C450&ssl=1
|
||||
[2]: https://itsfoss.com/firefox-useful-features/
|
||||
[3]: https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search
|
||||
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-install-page.png?resize=800%2C366&ssl=1
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-searchbar-icon-1.png?resize=800%2C48&ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-main-menu.png?resize=302%2C474&ssl=1
|
||||
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-manage-containers-1.png?resize=291%2C402&ssl=1
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-new-container.png?resize=290%2C399&ssl=1
|
||||
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-new-container-itsfoss.png?resize=292%2C401&ssl=1
|
||||
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-opening-new-container.png?resize=290%2C398&ssl=1
|
||||
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-new-container-styling.png?resize=800%2C370&ssl=1
|
||||
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-linode.png?resize=800%2C114&ssl=1
|
||||
[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/firefox-containers-linode-login.png?resize=800%2C405&ssl=1
|
@ -1,136 +0,0 @@
|
||||
[#]: subject: (How the ARPANET Protocols Worked)
|
||||
[#]: via: (https://twobithistory.org/2021/03/08/arpanet-protocols.html)
|
||||
[#]: author: (Two-Bit History https://twobithistory.org)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (Lin-vy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
|
||||
ARPANET 协议是如何工作的
|
||||
======
|
||||
|
||||
ARPANET 通过证明可以使用标准化协议连接完全不同的制造商的计算机,永远改变了计算。 在我的[关于 ARPANET 的历史意义的帖子][1]中,我提到了其中的一些协议,但没有详细描述它们。所以我想仔细看看它们。也想看看那些早期协议的设计有多少保留到了我们今天使用的协议中。
|
||||
|
||||
ARPANET 协议像我们现代的互联网协议,是通过分层形式来组织的。[1][2] 较高层协议运行在较低层协议之上。如今的 TCP/IP 套件有 5 层(物理层、链路层、网络层、传输层、以及应用层),但是这个 ARPANET 仅有 3 层或者可能 4 层,这取决于你怎样计算它们。
|
||||
|
||||
我将会解释每一层是如何工作的,但首先,你需要知道谁在 ARPANET 中是构建了些什么,以及还需要了解为什么要分层。
|
||||
|
||||
### 短暂的历史背景
|
||||
|
||||
ARPANET 由美国联邦政府资助,确切的说是位于美国国防部的高级研究计划属(因此命名为 “ ARPANET ” )。美国政府并没有直接建设这个网络;而是,把这项工作外包给了位于波士顿的一家名为 Bolt, Beranek, and Newman, 的咨询公司,通常更多时候被称为 BBN。
|
||||
|
||||
相反, BBN 承担了实现这个网络的大部分任务,但不是全部。 BBN 所做的是设计和维护一台称为接口消息处理机或简称 IMP 的机器。这个 IMP 是一种定制的 Honeywell 小型计算机,它们被分配给那些想要接入这个 ARPANET 的遍及全国各地的各个站点。它们充当通往 ARPANET 的网关为每个站点提供多达四台主机的连接支持。它基本上是一台路由器。BBN 能控制在 IMP 上运行的软件,把数据包从一个 IMP 转发到另一个 IMP ,但是该公司无法直接控制那些将要连接到 IMP 上并且成为 ARPANET 网络中实际主机的机器。
|
||||
|
||||
那些主机被网络中作为终端用户的计算机科学家们所控制。位于遍及全国各地的主机站点中的这些计算机科学家们,他们负责编写允许主机之间相互通信的软件。而 IMP 赋予主机之间互相发送消息的能力,但是那并没有多大用处除非主机之间能商定一种用于消息的格式。为了解决这个问题,一群杂七杂八的人员组成了网络工作组,其中有大部分是来自各个站点的研究生,该组力求指定主机计算机使用的协议。
|
||||
|
||||
因此,如果你设想通过 ARPANET 进行一次成功的网络互动,(例如发送一封电子邮件),使这些互动成功的一些工程由一组人负责(BBN),然而其他的一些工程则由另一组人负责(网络工作组和在每个站点的工程师们)。这种有组织,有保障的情景或许对推动采用分层的方法来管理 ARPANET 网络中的协议起到很大的作用,这反过来又影响了TCP/IP的分层方式。
|
||||
|
||||
|
||||
### 好的,回到协议上来
|
||||
|
||||
![ARPANET Network Stack][3] _ARPANET 协议层次结构_
|
||||
|
||||
协议层被组织成一个层次结构,在最底部是 “ level 0. ” [2][4] 这在某种意义上是不算数的,因为在 ARPANET 中这层完全由 BBN 控制,所以不需要标准协议。level 0 的作用是管理数据在 IMP 之间如何传输。在 BBN 内部,有管理 IMP 如何做到这一点的规则;在 BBN 之外,IMP 子网是一个黑匣子,它只会传送你提供的任意数据。因此,level 0 是一个没有真正协议的层,就公开已知和商定的规则集而言,它的存在可以被运行在 ARPANET 的主机上的软件忽略。粗略地说,它处理相当于当今使用的 TCP/IP 套件的物理层、链路层和网络层下的所有内容,甚至还包括相当多的传输层,这是我将在这篇文章的末尾回来讨论的内容。
|
||||
|
||||
“ level 1 ” 层在 ARPANET 的主机和它们所连接的 IMP 之间建立了接口。如果你愿意可以认为它是为 BBN 构建的 “ level 0 ” 层的黑匣子使用的一个应用程序接口。 当时它也被称为 IMP-Host 协议。 必须编写和发布该协议,因为在首次建立 ARPANET 网络时,每个主机站点都必须编写自己的软件来与 IMP 连接。 除非 BBN 给他们一些指导,否则他们不会知道如何做到这一点。
|
||||
|
||||
BBN 在一份名为 [BBN Report 1822][5] 的冗长文件中指定了 IMP-Host 协议。 随着 ARPANET 的发展,该文件多次被修订; 我将在这里大致描述 IMP-Host 协议最初设计时的工作方式。 根据 BBN 的规则,主机可以将长度不超过 8095 位的消息传递给它们的 IMP,并且每条消息都有一个包含目标主机号和链路识别号的头部字段。[3][6] IMP 将检查指定的主机号,然后尽职尽责地将消息转发到网络中。 当从远端主机接收到消息时,接收 IMP 在将消息传递给本地主机之前会把目标主机号替换为源主机号。 实际上在 IMP 之间传递的内容并不是消息——IMP 将消息分解成更小的数据包以便通过网络传输——但该细节对主机来说是不可见的。
|
||||
|
||||
|
||||
![1969 Host-IMP Leader][7]_Host-IMP 消息头部格式, 截至 1969. 图标来自 [BBN Report 1763][8]_
|
||||
|
||||
链路号的取值范围为 0 到 255 ,它有两个作用。一是更高级别的协议可以利用它在网络上的任何两台主机之间建立多个通信信道,因为可以想象得到,在任何时刻都有可能存在多个本地用户与同一个目标主机进行通信的场景(换句话说,链路号允许在主机之间进行多路通信。)二是它也被用在 “ level 1 ” 层去控制主机之间发送的大量流量,以防止高性能计算机压制低性能计算机的情况出现。按照最初的设计,这个 IMP-Host 协议限制每台主机在某一时刻通过某条链路仅发送一条消息。一旦某台主机沿着某条链路发送了一条消息给远端主机后,在它沿着该链路发送下一条消息之前,必须等待接收一条来自远端的 IMP 的特别类型的消息,叫做 RFNM(请求下一条消息)。针对这个体系的后期修订,为了改善它的性能,允许一台主机在给定的时刻传送多达8条消息给另一台主机。.[4][9]
|
||||
|
||||
“ level 2 ” 层才是事情真正开始变得有趣的地方,因为这一层和在它上面的那一层由 BBN 和国防部全部留给学者们和网络工作组自己去研发。 “ level 2 ” 层包括了 Host-Host 协议,这个协议在 RFC9 中第一次被草拟并且在 RFC54 中第一次被官方指定。更多可读的 Host-Host 协议的解释在 [ ARPANET 协议手册][10] 中被给出。
|
||||
|
||||
“ Host-Host 协议 ” 管理主机之间如何创建和管理链接。链接是某个主机上的写套接字和另一个主机上的读套接字之间的一个单向的数据管道。“ 套接字 ” 的概念是在 “ level-1 ” 层的有限的链路设施(记住链路号只是那 256 个值中的一个)之上被引入的,是为了给程序提供寻找运行在远端主机上的特定进程地址的一种方式。“ 读套接字 ” 是用偶数表示的,而“写套接字”是用奇数表示的;套接字是 “ 读 ” 还是 “ 写 ” 被称为套接字的 “性别”。并没有类似于 TCP 协议那样的 “ 端口号 ” 机制,链接的打开、维持以及关闭操作是通过主机之间使用 “ 链路 0 ” 发送指定格式的 Host-Host 控制消息来实现的,这也是 “ 链路0 ” 被保留的目的。一旦控制消息在“链路 0”上被交换来建立起一个连接后,就可以使用接收端挑选的另一个链路号来发送进一步的数据消息。
|
||||
|
||||
Host-Host控制消息一般通过 3 个字母型的助记符来表示。当两个主机交换一条 STR(发送端到接收端)消息和一条配对的 RTS(接收端到发送端)消息后,就建立起了一条链接。——这些控制消息都被称为请求链接消息。链接能够被 CLS (关闭)控制消息关闭。存在更进一步的控制信息能够改变从发送端到接收端发送消息的速率。从而需要确保较快的主机不会压制较慢的主机。在 “ level 1 ” 层上的协议提供了流量控制的功能,但对 “ level 2 ” 层来说显然是不够的;我怀疑这是因为从远端 IMP 接收到的 RFNM 只能保证远端 IMP 已经传送该消息到目标主机,不能保证目标主机已经全部处理了该消息。 还有 INR(接收端中断)、INS(发送端中断)控制消息,它们主要是被高层协议使用。
|
||||
|
||||
更高级别的协议都位于 “ level 3 ” ,这层是 ARPANET 的应用层。Telnet 协议,它提供到另一台主机的一个虚拟电传链接,其可能是这些协议中最重要的。但在这层中也有许多其他协议,例如用于传输文件的 FTP 协议和各种用于发送email的实验协议。
|
||||
|
||||
在这一层中有一个不同于其他的协议:初始链接协议(ICP)。ICP被认为是一个 “ level-3 ” 层协议,但实际上它是一种 “ level-2.5 ” 层协议,因为其他 “ level-3 ” 层协议都依赖它。ICP的存在是因为 “ level 2 ” 层的 Host-Host 协议提供的链接只是单向的,但大多数的应用需要一个双向(列如:全双工)的链接来做任何有趣的事情。要使得运行在某个主机上的客户端能够链接到另一个主机上长时间运行的服务进程, ICP 定义了两个步骤。第一步是建立一个从服务端到客户端的单向链接,通过使用服务端进程的众所周知的 socket 号来实现。第二步服务端通过建立的这个链接发送一个新的 socket 号给客户端。到那时,那个存在的链接就会被丢弃,然后有另外两个新的链接会被开启,它们是基于传输的 socket 号建立的“读”链接和基于传输的 socket 号加 1 的 “ 写 ” 链接。这个小插曲是大多数事务的一个前提——比如它是建立 Telnet 链接的第一步。
|
||||
|
||||
以上是我们对 ARPANET 协议层次结构的提升。你们可能一直期待我在某个时候提一下 “ Network Control Protocol ” 。在我坐下来去研究这篇贴子和我的最后一篇贴子之前,我坚定的认为 ARPANET 运行在一个叫做 NCP 的协议之上。那个首字母缩略词有时用来指代整个 ARPANET 协议,这可能就是我为什么有这个想法的原因。举个例子,[RFC801][11] 讨论了将 ARPANET 从 “ NCP ” 过渡到 “ TCP ” 的方式,这使 NCP 听起来像是一个等同TCP的 ARPANET 协议。但是对于 ARPANET 来说,从来都没有一个叫 “ Network Control Protocol ” 的东西(即使[大英百科全书是这样认为的][12]),我怀疑人们错误地将 “ NCP ” 解释为 “ Network Control Protocol ” ,而实际上它代表的是 “ Network Control Pragram ” 。网络控制程序是一个运行在各个主机上的内核级别的程序,主要负责处理网络通信,等同于现如今操作系统中的 TCP/IP 协议栈。用在 RFC 801 的 “ NCP ” 是一种转喻,而不是协议。
|
||||
|
||||
### 与TCP/IP的比较
|
||||
|
||||
ARPANET 协议以后都会被 TCP/IP 协议替换(但 Telnet 和 FTP 协议除外,因为它们很容易就能在 TCP 上适配运行)。然而 ARPANET 协议都基于这么一个假设就是网络是由一个单一实体(BBN)来构建和管理的。 TCP/IP 协议套件是为具有可变性和不可靠性的互联的网络而设计的。这就导致了现代协议套件和 ARPANET 协议有明显的不同,比如我们现在怎样区分网络层和传输层。在 ARPANET 中部分由 IMP 实现的类似传输层的功能现在完全由在网络边界的主机负责。
|
||||
|
||||
我发现关于ARPANET协议最有趣的事情是现在在 TCP 中的传输层的功能有多少在 ARPANET 上经历了一个糟糕的青春期。我不是一个网络专家,因此我拿出大学时的网络课本(Kurose and Ross, let’s go),他们对传输层通常负责什么给出了一个非常好的概述。总结一下他们的解释,一个传输层协议必须至少做到以下几点。这里的 “ segment ” 在 ARPANET 上基本等同于 “ message ” 作为术语被使用:
|
||||
|
||||
* 提供进程之间的传送服务,而不仅仅是主机之间的(传输层多路复用和多路分解)
|
||||
* 在每个段的基础上提供完整性检查(即确保传输过程中没有数据损坏)
|
||||
|
||||
像 TCP 那样,传输层也能够提供可靠的数据传输,这意味着:
|
||||
|
||||
* “段” 是按顺序被传送的
|
||||
* 不会丢失任何 “段”
|
||||
* “段” 的传送速度不会太快以至于被接收端丢弃(流量控制)
|
||||
|
||||
似乎在 ARPANET 上关于如何进行多路复用和多路分解以便进程可以通信存在一些混淆—— BBN 在 IMP-Host 层引入了链路号来做到这一点,但结果证明在 Host-Host 层上无论如何套接字号都是必要的。然后链路号只是用于 IMP-Host 级别的流量控制,但 BBN 似乎后来放弃了它,转而支持在唯一的主机对之间进行流量控制,这意味着链路号开始时只是作为这个重载的东西基本上变成了遗迹。 TCP 现在使用端口代替,分别对每一个 TCP 链接进行流量控制。进程间的多路复用和多路分解完全在 TCP 内部进行,不会像 ARPANET 一样泄露到较低层去。
|
||||
|
||||
同样有趣的是,鉴于 Kurose 和 Ross 如何开发 TCP 背后的想法,ARPANET 开始于 Kurose 和 Ross 所调用的一个严谨的 “stop-and-wait” 方法,以便在 IMP-Host 层上进行可靠的数据传输。这个 “stop-and-wait” 方法发送一个 “段” 然后就拒绝再去发送更多 “段” ,直到一个最近发送的 “段” 的确认被接收到为止。这是一种简单的方法,但这意味着只有一个 “段” 在整个网络中运行,从而导致协议非常缓慢——这就是为什么 Kurose 和 Ross 将 “stop-and-wait” 仅仅作为在通往功能齐全的传输层协议的路上的垫脚石的原因。在 ARPANET 上,“stop-and-wait” 是一段时间的工作方式,因为在 IMP–Host 层,必须接收下一条消息的请求以响应每条发出的消息,然后才能发送任何进一步的消息。客观的说 ,BBN 起初认为这对于提供主机之间的流量控制是必要的,因此减速是故意的。正如我已经提到的,为了更好的性能,RFNM 的要求后来放宽松了,而且 IMP 也开始向消息中添加序列号和保持对传输中的消息的 “窗口” 的跟踪,这或多或少与如今 TCP 的实现如出一辙。[5][13]
|
||||
|
||||
ARPANET 表明,如果你能让每个人都遵守一些基本规则,异构计算系统之间的通信是可能的。正如我先前所说的,那个是 ARPANET 的最重要的遗产。但是我希望通过这次仔细研究的哪些基本规则所透露的是有多少 ARPANET 协议影响了我们如今所用的协议。在主机和 IMP 之间分担传输层职责的方式上肯定有很多笨拙之处,有时候是冗余的。回想起来,主机之间一开始只能通过给出的任意链路在某刻只发送一条消息,这真的很有趣。 但是 ARPANET 实验是一个独特的机会,可以通过实际构建和操作网络来学习这些经验,当到了是时候升级到我们今天所知的互联网时,似乎这些经验变得很有用。
|
||||
|
||||
_如果你喜欢这篇贴子,更喜欢每四周发布一次的方式!那么在Twitter上关注[@TwoBitHistory][14] 或者订阅[RSS提要][15],以确保你知道新帖子的发布时间。_
|
||||
|
||||
_以前在 TwoBitHistory 上…_
|
||||
|
||||
> Trying to get back on this horse!
|
||||
>
|
||||
>
|
||||
> 我最近的贴子是我的一些关于为什么ARPANET是一个如此重要的突破的看法(当然,是令人惊讶和新颖的),并重点关注ARPANET被首次展示的发布会:<https://t.co/8SRY39c3St>
|
||||
>
|
||||
> — TwoBitHistory (@TwoBitHistory) [2021年2月7日][16]
|
||||
|
||||
1. 协议分层是网络工作组发明的。 这个论点是在[ RFC 871][17] 中提出的。分层也是 BBN 如何在主机和 IMP 之间划分职责的自然延伸,因此 BBN 也值得称赞。 [↩︎][18]
|
||||
|
||||
2. The “level” 是被网络工作组使用的术语。 详见[RFC 100][19] [↩︎][20]
|
||||
|
||||
3. 在 IMP-Host 协议的后续版本中,扩展了头部字段,并且将链路号升级为消息 ID。 但是 Host-Host 协议仅仅继续使用消息 ID 字段的高位 8 位,并将其视为链路号。 请参阅 [ARPANET 协议手册][10]的 “ Host-Host ” 协议部分。[↩︎][21]
|
||||
4. John M. McQuillan 和 David C. Walden。 “ARPA 网络设计决策”,第 284页,<https://www.walden-family.com/public/whole-paper.pdf>。 2021 年 3 月 8 日访问。[↩︎][22]
|
||||
5. 同上。[↩︎][23]
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://twobithistory.org/2021/03/08/arpanet-protocols.html
|
||||
|
||||
作者:[Two-Bit History][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Lin-vy](https://github.com/Lin-vy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://twobithistory.org
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://twobithistory.org/2021/02/07/arpanet.html
|
||||
[2]: tmp.szauPoOKtk#fn:1
|
||||
[3]: https://twobithistory.org/images/arpanet-stack.png
|
||||
[4]: tmp.szauPoOKtk#fn:2
|
||||
[5]: https://walden-family.com/impcode/BBN1822_Jan1976.pdf
|
||||
[6]: tmp.szauPoOKtk#fn:3
|
||||
[7]: https://twobithistory.org/images/host-imp-1969.png
|
||||
[8]: https://walden-family.com/impcode/1969-initial-IMP-design.pdf
|
||||
[9]: tmp.szauPoOKtk#fn:4
|
||||
[10]: http://mercury.lcs.mit.edu/~jnc/tech/arpaprot.html
|
||||
[11]: https://tools.ietf.org/html/rfc801
|
||||
[12]: https://www.britannica.com/topic/ARPANET
|
||||
[13]: tmp.szauPoOKtk#fn:5
|
||||
[14]: https://twitter.com/TwoBitHistory
|
||||
[15]: https://twobithistory.org/feed.xml
|
||||
[16]: https://twitter.com/TwoBitHistory/status/1358487195905064960?ref_src=twsrc%5Etfw
|
||||
[17]: https://tools.ietf.org/html/rfc871
|
||||
[18]: tmp.szauPoOKtk#fnref:1
|
||||
[19]: https://www.rfc-editor.org/info/rfc100
|
||||
[20]: tmp.szauPoOKtk#fnref:2
|
||||
[21]: tmp.szauPoOKtk#fnref:3
|
||||
[22]: tmp.szauPoOKtk#fnref:4
|
||||
[23]: tmp.szauPoOKtk#fnref:5
|
@ -0,0 +1,95 @@
|
||||
[#]: subject: (5 useful ways to manage Kubernetes with kubectl)
|
||||
[#]: via: (https://opensource.com/article/21/7/kubectl)
|
||||
[#]: author: (Alan Smithee https://opensource.com/users/alansmithee)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
用 kubectl 管理 Kubernetes 的 5 种有用方法
|
||||
======
|
||||
学习kubectl,提升你与 Kubernetes 的互动方式。
|
||||
![Ship captain sailing the Kubernetes seas][1]
|
||||
|
||||
Kubernetes 是帮助你以有组织的方式运行大量容器的软件。除了提供工具来管理(或[编排][2])运行的容器,Kubernetes 还帮助这些容器根据需要进行扩展。有了 Kubernetes 作为你的中央控制面板(或称 _control plane_),你需要一种方法来管理 Kubernetes,而这项工作的工具就是 kubectl。`kubectl` 命令让你控制、维护、分析和排除 Kubernetes 集群的故障。与许多使用 `ctl`(“控制”的缩写)后缀的工具一样,如 systemctl 和 sysctl,kubectl 拥有大量的功能和任务权限,所以如果你正在运行 Kubernetes,你最终会经常使用它。它是一个有很多选项的大命令,所以下面是 kubectl 使之变得简单的五个常见任务。
|
||||
|
||||
### 1\. 列出并描述资源
|
||||
|
||||
按照设计,容器往往会成倍增加。在某些条件下,它们可以快速增加。如果你只能通过 `podman ps`或 `docker ps` 来查看正在运行的容器,这可能会让你不知所措。通过 `kubectl get` 和 `kubectl describe`,你可以获得关于哪些 pod 正在运行以及它们正在处理的容器的信息。更重要的是,你可以通过使用 `--namespace` 或 `name` 或 `--selector`等选项,只获得你需要的信息。
|
||||
|
||||
`get` 子命令不仅仅对 pod 和容器有用。它有关于节点、命名空间、部署、服务和复制的信息。
|
||||
|
||||
### 2\. 创建资源
|
||||
|
||||
如果你只通过类似 OpenShift、OKD 或 Kubernetes 提供的 Web 用户界面(UI)创建过部署,但你想从 Linux 终端控制你的集群,那么可以使用 `kubectl create`。`kubectl create` 命令并不只是实例化一个新的应用部署。Kubernetes 中还有很多其他组件可以创建,比如服务、配额和 [CronJob][3]。
|
||||
|
||||
Kubernetes 中的 CronJob 可以创建一个临时的 pod,用来在你选择的时间表上执行一些任务。它们并不难设置。下面是一个 CronJob,让一个 BusyBox 镜像每分钟响应 “hello world”。
|
||||
|
||||
|
||||
```
|
||||
$ kubectl create cronjob \
|
||||
hello-world \
|
||||
\--image=busybox \
|
||||
\--schedule="*/1 * * * *" -- echo "hello world"
|
||||
```
|
||||
|
||||
### 3\. 编辑文件
|
||||
|
||||
你可能了解 Kubernetes 中的对象都有相应的配置文件,但在文件系统中查找相应的文件可能很麻烦。有了 `kubectl edit`,你可以把注意力放在对象上,而不是定义它们的文件上。你可以让 `kubectl` 为你找到并打开文件(它遵循 `KUBE_EDITOR` 环境变量,所以你可以把编辑器设置成你喜欢的)。
|
||||
|
||||
|
||||
```
|
||||
$ KUBE_EDITOR=emacs \
|
||||
kubectl edit cronjob/hello-world
|
||||
```
|
||||
|
||||
### 4\. 容器之间的交换文件
|
||||
|
||||
初次接触容器的人往往对他们直接无法访问的共享系统的概念感到困惑。他们可能会在容器引擎或 kubectl 中了解到 `exec` 选项,但当他们不能从容器中获取文件或将文件放入容器中时,容器仍然会显得不透明。使用 `kubectl cp` 命令,你可以把容器当做远程服务器,使复制文件到容器或从容器复制文件不比 SSH 命令更复杂:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl cp foo my-pod:/tmp`
|
||||
```
|
||||
|
||||
### 5\. 应用更改
|
||||
|
||||
对 Kubernetes 对象进行修改,可以在任何时候通过 `kubectl apply` 命令完成。你所要做的就是将该命令指向一个配置文件:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl apply -f ./mypod.json`
|
||||
```
|
||||
|
||||
类似于运行 Ansible playbook 或 Bash 脚本,`apply` 使得快速“导入”设置到运行中的 Kubernetes 实例很容易。例如,GitOps 工具 [ArgoCD][4] 由于 `apply` 子命令,安装起来出奇地简单:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl create namespace argocd
|
||||
$ kubectl apply -n argocd \
|
||||
-f <https://raw.githubusercontent.com/argoproj/argo-cd/vx.y.z/manifests/install.yaml>
|
||||
```
|
||||
|
||||
### 使用 kubectl
|
||||
|
||||
Kubectl 是一个强大的工具,由于它是一个终端命令,它可以写成脚本,并以许多 Web UI 无法实现的方式使用。学习 kubectl 是进一步了解 Kubernetes、容器、pod 以及围绕这些重要的云计算创新的所有技术的一个好方法。[下载我们的 kubectl 速查表][5],以获得快速参考,其中包括命令示例,以帮助你学习,并在你成为专家后提醒你注意细节。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/7/kubectl
|
||||
|
||||
作者:[Alan Smithee][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/alansmithee
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas)
|
||||
[2]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[3]: https://opensource.com/article/20/11/kubernetes-jobs-cronjobs
|
||||
[4]: https://argoproj.github.io/argo-cd/
|
||||
[5]: https://opensource.com/downloads/kubectl-cheat-sheet
|
@ -0,0 +1,80 @@
|
||||
[#]: subject: (How to Install elementary Tweaks Tool)
|
||||
[#]: via: (https://www.debugpoint.com/2021/07/elementary-tweaks-install/)
|
||||
[#]: author: (Arindam https://www.debugpoint.com/author/admin1/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (imgradeone)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
如何安装 elementary 优化工具
|
||||
======
|
||||
|
||||
> 这篇快速教程演示了如何安装 elementary / Pantheon 优化工具。
|
||||
|
||||
elementary 优化工具(elementary Tweaks Tool)是专为 [elementary OS][1] 设计的实用工具。它提供了一些用于修改 elementary 设置的选项。虽然 elementary 已经提供了绝大多数选项,但还有一小部分的 Pantheon 桌面优化是不能直接通过普通设置修改的,因此这个工具才得以诞生。这个工具与 GNOME 中的 [GNOME Tweaks][2] 有些相似。
|
||||
|
||||
也就是说,安装这个工具其实十分简单,只是 [elementary OS 6 Odin][3] 与早期版本(例如 elementary OS 5 Juno)存在一些区别。从 elementary OS 6 Odin 开始,这个工具已经重命名为 Pantheon 优化工具(Pantheon Tweaks Tool)。下面是安装步骤。
|
||||
|
||||
### 安装 elementary 优化工具
|
||||
|
||||
elementary OS 并没有内置用于添加 PPA 的 software-properties-common 软件包。如果您还没有安装此软件包,请使用如下命令安装。
|
||||
|
||||
```
|
||||
sudo apt install software-properties-common
|
||||
```
|
||||
|
||||
#### elementary OS 6 Odin
|
||||
|
||||
该版本的优化工具已经改名,并且独立于原版开发。它的名称是 [Pantheon Tweaks][4]。您可以使用如下命令安装它。
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/pantheon-tweaks
|
||||
sudo apt install -y pantheon-tweaks
|
||||
```
|
||||
|
||||
#### elementary OS 5 Juno and below
|
||||
|
||||
如果您正在使用 elementary OS 5 Juno 或者更旧的版本,您可以使用同一 PPA 安装早期版本的 [elementary-tweaks][5]。在终端输入以下命令即可安装。
|
||||
|
||||
```
|
||||
sudo add-apt-repository -y ppa:philip.scott/elementary-tweaks
|
||||
sudo apt install -y elementary-tweaks
|
||||
```
|
||||
|
||||
### 使用方法
|
||||
|
||||
安装完成后,您可以在 `应用程序菜单 > 系统设置 > Tweaks` 中使用此工具。
|
||||
|
||||
![设置中的 Tweaks(优化)选项][6]
|
||||
|
||||
在 Tweaks 窗口,您可以修改一些选项,配置您的 elementary 桌面。
|
||||
|
||||
![安装完成后的 elementary 优化工具 —— 选项][7]
|
||||
|
||||
顺便提示一下,这款工具仅仅是 elementary 桌面设置的前端。如果您知道准确的名称或属性,您可以直接在终端中修改配置。您在这款优化工具中获得的选项也可以在 `dconf` 编辑器中查找 `io.elementary` 路径以修改。
|
||||
|
||||
如果您在安装或使用优化工具时遇到了一些问题,您可以在评论区留言。
|
||||
|
||||
* * *
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/2021/07/elementary-tweaks-install/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[imgradeone](https://github.com/imgradeone)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.debugpoint.com/tag/elementary
|
||||
[2]: https://www.debugpoint.com/2018/05/customize-your-ubuntu-desktop-using-gnome-tweak/
|
||||
[3]: https://www.debugpoint.com/2020/09/elementary-os-6-odin-new-features-release-date/
|
||||
[4]: https://github.com/pantheon-tweaks/pantheon-tweaks
|
||||
[5]: https://github.com/elementary-tweaks/elementary-tweaks
|
||||
[6]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/tweak-in-settings.png
|
||||
[7]: https://www.debugpoint.com/blog/wp-content/uploads/2021/07/elementary-tweaks-after-install-options.png
|
@ -2,29 +2,29 @@
|
||||
[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-july-2021/)
|
||||
[#]: author: (Jakub Kadlčík https://fedoramagazine.org/author/frostyx/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
4 cool new projects to try in Copr from July 2021
|
||||
COPR 仓库中 4 个很酷的新项目(2021.07)
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Copr is a [collection][2] of personal repositories for software that isn’t carried in Fedora Linux. Some software doesn’t conform to standards that allow easy packaging. Or it may not meet other Fedora Linux standards, despite being free and open-source. Copr can offer these projects outside the Fedora Linux set of packages. Software in Copr isn’t supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software.
|
||||
COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。
|
||||
|
||||
This article presents a few new and interesting projects in Copr. If you’re new to using Copr, see the [Copr User Documentation][3] for how to get started.
|
||||
本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。
|
||||
|
||||
## [][4] Wike
|
||||
|
||||
[Wike][5] is a Wikipedia reader for the GNOME Desktop with search integration in the GNOME Shell. It provides distraction-free access to the [online encyclopedia][6]. The interface is minimalistic but it supports switching an article between multiple languages, bookmarks, article table of contents, dark mode, and more.
|
||||
[Wike][5] 是一个用于 GNOME 桌面的维基百科阅读器,在 GNOME Shell 中集成了搜索功能。它提供了对[在线百科全书][6]的无干扰访问。它的界面很简约,但它支持在多种语言之间切换文章、书签、文章目录、黑暗模式等。
|
||||
|
||||
![][7]
|
||||
|
||||
### [][8] Installation instructions
|
||||
### [][8] 安装说明
|
||||
|
||||
The [repo][9] currently provides Wike for Fedora 33, 34, and Fedora Rawhide. To install it, use these commands:
|
||||
该[仓库]][9]目前在 Fedora 33、34 和 Fedora Rawhide 提供 Wike。要安装它,请使用这些命令:
|
||||
|
||||
```
|
||||
sudo dnf copr enable xfgusta/wike
|
||||
@ -33,20 +33,20 @@ sudo dnf install wike
|
||||
|
||||
## [][10] DroidCam
|
||||
|
||||
We are living through confusing times, being isolated at our homes, and the majority of our interactions with friends and coworkers take place on some video conference platform. Don’t waste your money on an overpriced webcam if you carry one in your pocket already. [DroidCam][11] lets you pair your phone with a computer and use it as a dedicated webcam. The connection made through a USB cable or over WiFi. DroidCam provides remote control of the camera and allows zooming, using autofocus, toggling the LED light, and other convenient features.
|
||||
我们正生活在一个混乱的时代,被隔离在家中,我们与朋友和同事的大部分互动都发生在一些视频会议平台上。如果你已经有一部手机,就不要把钱浪费在价格过高的网络摄像头上。[DroidCam][11] 让你将手机与电脑配对,并将其作为专用网络摄像头使用。通过 USB 线或通过 WiFi 进行连接。DroidCam 提供对摄像头的远程控制,并允许缩放、使用自动对焦、切换 LED 灯和其他便利功能。
|
||||
|
||||
![][12]
|
||||
|
||||
### [][13] Installation instructions
|
||||
### [][13] 安装说明
|
||||
|
||||
The [repo][14] currently provides DroidCam for Fedora 33 and 34. Before installing it, please update your system and reboot, or make sure you are running the latest kernel version and have an appropriate version of _kernel-headers_ installed.
|
||||
该[仓库][14]目前为在 Fedora 33 和 34 中提供 DroidCam。在安装之前,请更新你的系统并重新启动,或者确保你运行的是最新的内核版本,并安装了适当版本的 _kernel-headers_。
|
||||
|
||||
```
|
||||
sudo dnf update
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
Droidcam depends on _v4l2loopback_ which must be installed manually from the [RPM Fusion Free repository][15].
|
||||
Droidcam 依赖 _v4l2loopback_,必须从 [RPM Fusion 免费仓库][15]手动安装。
|
||||
|
||||
```
|
||||
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||
@ -54,7 +54,7 @@ sudo dnf install v4l2loopback
|
||||
sudo modprobe v4l2loopback
|
||||
```
|
||||
|
||||
Now install the _droidcam_ package:
|
||||
现在安装 _droidcam_ 软件包:
|
||||
|
||||
```
|
||||
sudo dnf copr enable meeuw/droidcam
|
||||
@ -63,17 +63,17 @@ sudo dnf install droidcam
|
||||
|
||||
## [][16] Nyxt
|
||||
|
||||
[Nyxt][17] is a keyboard-oriented, infinitely extensible web browser designed for power users. It was heavily inspired by Emacs and as such is implemented and configured in Common Lisp providing familiar key-bindings ([Emacs][18], [vi][19], [CUA][20]).
|
||||
[Nyxt][17] 是一个面向键盘、可无限扩展的网络浏览器,专为高级用户设计。它在很大程度上受到 Emacs 的启发,因此用 Common Lisp 实现和配置,提供熟悉的按键绑定([Emacs][18]、[vi][19]、[CUA][20])。
|
||||
|
||||
Other killer features that cannot be missed are a built-in REPL, [tree history][21], [buffers instead of tabs][22], and [so much more][17].
|
||||
其他不能错过的杀手锏是一个内置的 REPL、[树形历史][21]、[缓冲区代替标签][22],还有[更多][17]。
|
||||
|
||||
Nyxt is web engine agnostic so don’t worry about pages rendering in unexpected ways.
|
||||
Nyxt 与网络引擎无关,所以不用担心页面会以意外的方式呈现。
|
||||
|
||||
![][23]
|
||||
|
||||
### [][24] Installation instructions
|
||||
### [][24] 安装说明
|
||||
|
||||
The [repo][25] currently provides Nyxt for Fedora 33, 34, and Fedora Rawhide. To install it, use these commands:
|
||||
该[仓库][25]目前为 Fedora 33、34 和 Fedora Rawhide 提供 Nyxt。要安装它,请使用这些命令:
|
||||
|
||||
```
|
||||
sudo dnf copr enable teervo/nyxt
|
||||
@ -82,22 +82,22 @@ sudo dnf install nyxt
|
||||
|
||||
## [][26] Bottom
|
||||
|
||||
[Bottom][27] is a system monitor with a customizable interface and multitude of features, It took inspiration from [gtop][28], [gotop][29], and [htop][30]. As such, it supports [processes][31] monitoring, [CPU][32], [RAM][33], and [network][34] usage monitoring. Besides those, it also provides more exotic widgets such as [disk capacity][35] usage, [temperature sensors][36], and [battery][37] usage.
|
||||
[Bottom][27] 是一个具有可定制界面和多种功能的系统监控器,它从 [gtop][28]、[gotop][29] 和 [htop][30] 获得灵感。因此,它支持[进程][31]监控、[CPU][32]、[RAM][33]和[网络][34]使用监控。除了这些,它还提供了更多奇特的小部件,如[磁盘容量][35]使用情况,[温度传感器][36],和[电池][37]使用情况。
|
||||
|
||||
Bottom utilizes the screen estate very efficiently thanks to the customizable layout of widgets as well as the [possibility to focus on just one widget and maximizing it][38].
|
||||
由于小部件的可自定义布局以及[可以只关注一个小部件并最大化它][38],Bottom 可以非常有效地利用屏幕空间。
|
||||
|
||||
![][39]
|
||||
|
||||
### [][40] Installation instructions
|
||||
### [][40] 安装说明
|
||||
|
||||
The [repo][41] currently provides Bottom for Fedora 33, 34, and Fedora Rawhide. It is also available for EPEL 7 and 8. To install it, use these commands:
|
||||
该[仓库][41]提供为 Fedora 33、34 和 Fedora Rawhide 提供 Bottom。它也可用于 EPEL 7 和 8。要安装它,请使用这些命令:
|
||||
|
||||
```
|
||||
sudo dnf copr enable opuk/bottom
|
||||
sudo dnf install bottom
|
||||
```
|
||||
|
||||
Use _btm_ command to run the program.
|
||||
使用 _btm_ 命令来运行该程序。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -105,7 +105,7 @@ via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-july-2021
|
||||
|
||||
作者:[Jakub Kadlčík][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -0,0 +1,76 @@
|
||||
[#]: subject: (Use the Linux terminal to see what files are on your computer)
|
||||
[#]: via: (https://opensource.com/article/21/8/linux-list-files)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (piaoshi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
使用 Linux 终端查看你的电脑上有哪些文件
|
||||
======
|
||||
通过这个 Linux 教程学习如何使用 ls 命令在终端中列出文件。
|
||||
![List files on your computer][1]
|
||||
|
||||
要在有图形界面的计算机上列出文件,你通常可以打开一个文件管理器(Linux 上的 **Files**,MacOS 上的 **访达**,Windows 上的 **文件资源管理器**)来查看文件。
|
||||
|
||||
要在终端中列出文件,你可以使用 **ls** 命令来列出当前目录中的所有文件。而 **pwd** 命令可以告诉你当前所在的目录。
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/home/tux
|
||||
$ ls
|
||||
example.txt
|
||||
Documents
|
||||
Downloads
|
||||
Music
|
||||
Pictures
|
||||
Templates
|
||||
Videos
|
||||
```
|
||||
|
||||
你可以通过 **\--all** 选项看到隐藏文件。
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/home/tux
|
||||
$ ls --all
|
||||
. Downloads
|
||||
.. .local
|
||||
.bashrc Music
|
||||
.config Pictures
|
||||
example.txt Templates
|
||||
Documents Videos
|
||||
```
|
||||
|
||||
如你所见,列出的前两项是点。单个点实际上是一个元位置,代表 _你当前所在的文件夹_ 。两个点表示你可以从当前位置返回的上级目录。也就是说,当前目录在另一个文件夹中。当你在计算机目录间移动时,你就可以利用这些元位置为自己创建快捷方式,或者增加你的路径的独特性。
|
||||
|
||||
### 文件和文件夹以及如何区分它们
|
||||
|
||||
你可能会注意到,文件和文件夹是很难区分的。一些 Linux 发行版有一些漂亮的颜色设置,比如所有的文件夹都是蓝色的,文件是白色的,二进制文件是粉色或绿色的,等等。如果你没有看到这些颜色,你可以试试 **ls --color**。如果你有色盲症或者使用的不是彩色显示器,你可以使用 **\--classify** 选项替代:
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/home/tux/Downloads
|
||||
$ ls --classify
|
||||
android-info.txt
|
||||
cheat/
|
||||
test-script.sh*
|
||||
```
|
||||
|
||||
你会发现,文件夹末尾加了一个斜杠(`/`),以表示它们是文件系统中的某一级目录。而二进制文件,如压缩文件和可执行程序,用星号(`*`)标记。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/linux-list-files
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[piaoshi](https://github.com/piaoshi)
|
||||
校对:[校对者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/ch01.svg__0.png?itok=98wPcbAc (List files on your computer)
|
@ -0,0 +1,113 @@
|
||||
[#]: subject: (Mount Microsoft OneDrive in Linux With OneDriver GUI Tool)
|
||||
[#]: via: (https://itsfoss.com/onedriver/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
用 OneDriver GUI 工具在 Linux 中安装微软 OneDrive
|
||||
======
|
||||
|
||||
在 Windows 上,微软提供了一个[免费云存储服务][1] OneDrive。它与 Windows 集成,你可以通过你的微软账户获得 5GB 的免费存储空间。
|
||||
|
||||
这在 Windows 上很好用,但和谷歌一样,微软也没有在 Linux 桌面上提供 OneDrive 的本地客户端。
|
||||
|
||||
当然,你可以通过浏览器访问你的 OneDrive 数据。除此以外,还有一些其他的方法可以在 Linux 上访问 OneDrive。
|
||||
|
||||
你可以使用像 [Insync][2] 这样的高级服务,或者选择用 [rclone 在 Linux 上使用 OneDrive][3] 这种稍微复杂的命令行方式。
|
||||
|
||||
最近,我发现了另一个工具,它稍有不同,使用起来也更简单。不出所料,它叫 OneDriver。
|
||||
|
||||
### OneDriver:在你的 Linux 系统上挂载 OneDrive
|
||||
|
||||
![OneDrive Linux illustration][4]
|
||||
|
||||
[OneDriver][5] 是一个免费的开源工具,允许你在 Linux 系统上挂载 OneDrive 文件。
|
||||
|
||||
请记住,它不会像 OneDrive 在 Windows 系统上那样同步文件。它将 OneDrive 文件挂载在本地的挂载点上。你通过网络访问这些文件。
|
||||
|
||||
然而,它确实提供了一种混合方法。你在挂载的 OneDrive 中打开的文件也被下载到系统中。这意味着,你也可以离线访问打开的文件。如果你没有连接到互联网,这些文件将成为只读。
|
||||
|
||||
如果你在本地对文件做任何修改,如果你连接到互联网,它就会反映到 OneDrive 上。
|
||||
|
||||
我注意到,在 GNOME 上的 Nautilus 文件管理器中,它会自动下载当前文件夹中的图像。在我的印象中,它们只有在我打开它们时才会被下载。
|
||||
|
||||
另一件事是,Nautilus 最初建立了缩略图缓存。OneDriver 在开始的时候可能会觉得有点慢,有点耗费资源,但最终会好起来。
|
||||
|
||||
哦!你也可以挂载多个 OneDrive 账户。
|
||||
|
||||
### 安装和使用 OneDriver
|
||||
|
||||
要在 Ubuntu 20.04(和 Linux Mint 20 系列)上安装 OneDriver,你可以使用 OneDriver 开发者的这个 PPA:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:jstaf/onedriver
|
||||
sudo apt update
|
||||
sudo apt install onedriver
|
||||
```
|
||||
|
||||
对于 Ubuntu 21.04,你可以下载[其 PPA 中的 DEB 文件][6]来使用它。
|
||||
|
||||
在 Fedora 上,你可以添加这个 COPR:
|
||||
|
||||
```
|
||||
sudo dnf copr enable jstaf/onedriver
|
||||
sudo dnf install onedriver
|
||||
```
|
||||
|
||||
Arch 用户可以在 AUR 中找到它。
|
||||
|
||||
安装后,在菜单中搜索 OneDriver,然后从这里启动它。
|
||||
|
||||
![Search for OneDriver][7]
|
||||
|
||||
首次运行时,它会给出一个奇怪的空界面。点击 “+” 号,选择一个文件夹或创建一个新的文件夹,在那里你将挂载 OneDrive。在我的例子中,我在我的家目录下创建了一个名为 One_drive 的新文件夹。
|
||||
|
||||
![Click on + sign to add a mount point for OneDrive][8]
|
||||
|
||||
当你选择了挂载点后,你会被要求输入你的微软凭证。
|
||||
|
||||
![one drive login][9]
|
||||
|
||||
![one drive permission][10]
|
||||
|
||||
登陆后,你可以在挂载的目录中看到 OneDrive 的文件。
|
||||
|
||||
![OneDrive mounted in Linux][11]
|
||||
|
||||
完成这些后,你可以在应用界面上看到你的 OneDrive 账户。点击旁边的勾按钮,以在重启后自动挂载 OneDrive。
|
||||
|
||||
![Autostart OneDriver mounting][12]
|
||||
|
||||
总的来说,OneDriver 是一个可以在 Linux 上访问 OneDrive 的不错的免费工具。它可能无法像[高级 Insync 服务][13]那样提供完整的同步设施,但对于有限的需求来说,它做得不错。
|
||||
|
||||
如果你使用这个漂亮的工具,请分享你的使用经验。如果你喜欢这个项目,也许可以给它一个 [GitHub 上的关注][5]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/onedriver/
|
||||
|
||||
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/cloud-services-linux/
|
||||
[2]: https://itsfoss.com/use-onedrive-on-linux/
|
||||
[3]: https://itsfoss.com/use-onedrive-linux-rclone/
|
||||
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-linux.png?resize=800%2C450&ssl=1
|
||||
[5]: https://github.com/jstaf/onedriver
|
||||
[6]: https://launchpad.net/~jstaf/+archive/ubuntu/onedriver/+packages
|
||||
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/search-for-onedriver.png?resize=798%2C214&ssl=1
|
||||
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/onedriver-interface.png?resize=745%2C456&ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-login.png?resize=470%2C660&ssl=1
|
||||
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-permission.png?resize=470%2C660&ssl=1
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/one-drive-mounted-in-linux.png?resize=800%2C491&ssl=1
|
||||
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/auto-start-onedriver.png?resize=602%2C499&ssl=1
|
||||
[13]: https://itsfoss.com/recommends/insync/
|
@ -0,0 +1,53 @@
|
||||
[#]: subject: (Use the Linux terminal to navigate throughout your computer)
|
||||
[#]: via: (https://opensource.com/article/21/8/navigate-linux-directories)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (piaoshi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
使用 Linux 终端浏览你的计算机
|
||||
======
|
||||
学习在 Linux 终端中从一个目录切换到另一个目录。
|
||||
![Move around your computer][1]
|
||||
|
||||
要在图形界面中浏览你的计算机上的文件夹,你可能习惯于打开一个窗口来“进入”你的计算机,然后双击一个文件夹,再双击一个子文件夹,如此反复。你也可以使用箭头按钮或按键来回溯。
|
||||
|
||||
而要在终端中浏览你的计算机,你可以利用 **cd** 命令。你可以使用 **cd ..** 回到 _上一级_ 目录,或者使用 **cd ./另一个/文件夹的/路径** 来跳过许多文件夹进入一个特定的位置。
|
||||
|
||||
你在互联网上已经使用的 URL 的概念,实际上直接来自 [POSIX][2]。当你浏览某个网站的一个特定页面时,比如 `http://www.example.com/tutorials/lesson2.html`,你实际上做的是进入 `/var/www/imaginarysite/tutorials/` 目录,并打开一个叫 `classic2.html` 的文件。当然,你是在网络浏览器中打开它的,浏览器会将所有那些看起来奇怪的 HTML 代码解释成漂亮的文本和图片。但这两者的思路是完全一样的。
|
||||
|
||||
如果你把你的计算机看成是互联网(或者把互联网看成是计算机会更合适),那么你就能理解如何在你的文件夹和文件中遨游了。如果从你的用户文件夹(你的家目录,或简记为 `~`)开始,那么你想切换到的文件夹都是相对于这个文件夹而言的:
|
||||
|
||||
```
|
||||
$ cd ~/Documents
|
||||
$ pwd
|
||||
/home/tux/Documents
|
||||
|
||||
$ cd ..
|
||||
$ pwd
|
||||
/home/tux
|
||||
```
|
||||
|
||||
这需要一些练习,但一段时间后,它会变得比你打开和关闭窗口、点击返回按钮和文件夹图标快得多。
|
||||
|
||||
### 用 Tab 键自动补全
|
||||
|
||||
键盘上的 **Tab** 键可以自动补全你开始输入的文件夹和文件的名字。如果你要 **cd** 到 `~/Documents` 文件夹,那么你只需要输入 `cd ~/Doc`,然后按 **Tab** 键即可。你的 Shell 会自动补全 `uments`。这不仅仅是一个令人愉快的便利工具,它也是一种防止错误的方法。如果你按下 **Tab** 键而没有任何东西自动补全,那么可能你 _认为_ 存在于某个位置的文件或文件件实际上并不存在。即使有经验的 Linux 用户也会试图切换到一个当前目录下不存在的文件夹,所以你可以经常使用 **pwd** 和 **ls** 命令来确认你确实在你认为你在的目录、以及你的当前目录确实包含了你认为它包含的文件。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/navigate-linux-directories
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[piaoshi](https://github.com/piaoshi)
|
||||
校对:[校对者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/ch01s04.svg_.png?itok=bC8Bcapk (Move around your computer)
|
||||
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
|
52
translated/tech/20210804 Move files in the Linux terminal.md
Normal file
52
translated/tech/20210804 Move files in the Linux terminal.md
Normal file
@ -0,0 +1,52 @@
|
||||
[#]: subject: (Move files in the Linux terminal)
|
||||
[#]: via: (https://opensource.com/article/21/8/move-files-linux)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
在 Linux 终端中移动文件
|
||||
======
|
||||
使用 mv 命令将一个文件从一个位置移动到另一个位置。
|
||||
![Moving files][1]
|
||||
|
||||
要在有图形界面的计算机上移动一个文件,你要打开该文件当前所在的文件夹,然后打开另一个窗口到你想把文件移到的文件夹。最后,你把文件从一个窗口拖到另一个窗口。
|
||||
|
||||
要在终端中移动文件,你可以使用 **mv** 命令将文件从一个位置移动到另一个位置。
|
||||
|
||||
|
||||
```
|
||||
$ mv example.txt ~/Documents
|
||||
|
||||
$ ls ~/Documents
|
||||
example.txt
|
||||
```
|
||||
|
||||
在这个例子中,你已经把 **example.txt** 从当前文件夹移到了 **Documents** 文件夹中。
|
||||
|
||||
只要你知道一个文件在__哪里__,又想把它移到_哪里_去,你就可以把文件从任何地方移动到任何地方,而不管你在哪里。与在一系列窗口中浏览你电脑上的所有文件夹以找到一个文件,然后打开一个新窗口到你想让该文件去的地方,再拖动该文件相比,这可以大大节省时间。
|
||||
|
||||
默认情况下,**mv** 命令完全按照它被告知的那样做:它将一个文件从一个位置移动到另一个位置。如果在目标位置已经存在一个同名的文件,它将被覆盖。为了防止文件在没有警告的情况下被覆盖,请使用 **\--interactive**(或简写 **-i**)选项。
|
||||
|
||||
|
||||
```
|
||||
$ mv -i example.txt ~/Documents
|
||||
mv: overwrite '/home/tux/Documents/example.txt'?
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/move-files-linux
|
||||
|
||||
作者:[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/ch01s05.svg_.png?itok=PgKQEDZ7 (Moving files)
|
Loading…
Reference in New Issue
Block a user