mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-28 23:20:10 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
d67e1162b0
@ -1,31 +1,31 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11983-1.html)
|
||||
[#]: subject: (Converting between uppercase and lowercase on the Linux command line)
|
||||
[#]: via: (https://www.networkworld.com/article/3529409/converting-between-uppercase-and-lowercase-on-the-linux-command-line.html)
|
||||
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
|
||||
|
||||
在 Linux 命令行中转换大小写
|
||||
======
|
||||
转换文本的大小写可能非常繁琐,尤其是当你要避免无意间的拼写错误时。幸运的是,Linux 提供了一些命令,可以使工作变得非常容易。
|
||||
[andy.brandon50][1] [(CC BY-SA 2.0)][2]
|
||||
|
||||
有很多方法可以在 Linux 命令行中将文本从小写更改为大写,反之亦然。实际上,你有一组这样的命令可以选择。这篇文章检验了一些最佳的命令来完成这项工作,以及你该如何让它们正常工作。
|
||||
> 转换文本的大小写可能非常繁琐,尤其是当你要避免无意间的拼写错误时。幸运的是,Linux 提供了一些命令,可以使工作变得非常容易。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202003/11/095821df7u8nlyfyyydqvf.jpg)
|
||||
|
||||
有很多方法可以在 Linux 命令行中将文本从小写更改为大写,反之亦然。实际上,有一组这样的命令可以选择。这篇文章检验了一些最佳的命令来完成这项工作,以及你该如何让它们正常工作。
|
||||
|
||||
### 使用 tr
|
||||
|
||||
**tr** (translate) 命令是在命令行或脚本中最容易使用的命令之一。如果你要确定要一串大写字符串,你只需将它传给 **tr**,如下所示:
|
||||
`tr`(translate)命令是在命令行或脚本中最容易使用的命令之一。如果你要确定要一串大写字符串,你只需将它传给 `tr`,如下所示:
|
||||
|
||||
```
|
||||
$ echo Hello There | tr [:lower:] [:upper:]
|
||||
HELLO THERE
|
||||
```
|
||||
|
||||
[[Get regularly scheduled insights by signing up for Network World newsletters.]][3]
|
||||
|
||||
下面是一个在脚本中使用这个命令的例子,当你要确保添加到文件中的所有文本都使用大写形式以保持一致性时:
|
||||
下面是一个在脚本中使用这个命令的例子,当你要确保添加到文件中的所有文本都使用大写形式以保持一致性时(LCTT 译注:这里输入部门名称作为示例):
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
@ -35,25 +35,23 @@ read dept
|
||||
echo $dept | tr [:lower:] [:upper:] >> depts
|
||||
```
|
||||
|
||||
将顺序切换为[:upper:] [:lower:] 会产生相反的效果,将所有部门名称都转换为小写:
|
||||
将顺序切换为 `[:upper:] [:lower:]` 会产生相反的效果,将所有大写的部门名称都转换为小写:
|
||||
|
||||
```
|
||||
echo $dept | tr [:upper:] [:lower:] >> depts
|
||||
```
|
||||
|
||||
同样,你可以使用 **sed** 命令的 **A-Z** 和 **a-z** 字符串完成相同的操作:
|
||||
同样,你可以使用 `sed` 命令的 `A-Z` 和 `a-z` 字符串完成相同的操作:
|
||||
|
||||
```
|
||||
echo $dept | tr a-z A-Z >> depts
|
||||
```
|
||||
|
||||
毫无疑问,反转 a-z 和 A-Z 字符串的顺序将产生相反的效果,将文本全部变为小写。
|
||||
毫无疑问,反转 `a-z` 和 `A-Z` 字符串的顺序将产生相反的效果,将文本全部变为小写。
|
||||
|
||||
### 使用 awk
|
||||
|
||||
**awk** 命令可让你使用它的 **toupper** 和 **tolower** 选项执行相同的操作。上例脚本中的命令可以用这种方式代替:
|
||||
|
||||
[][4]
|
||||
`awk` 命令可让你使用它的 `toupper` 和 `tolower` 选项执行相同的操作。上例脚本中的命令可以用这种方式代替:
|
||||
|
||||
```
|
||||
echo $dept | awk '{print toupper($0)}' >> depts
|
||||
@ -67,13 +65,13 @@ echo $dept | awk '{print tolower($0)}' >> depts
|
||||
|
||||
### 使用 sed
|
||||
|
||||
**sed** (流编辑器)命令也可用于切换大小写。它与上面显示的两个命令中的第一个具有相同的效果。
|
||||
`sed`(stream editor)命令也可用于切换大小写。它与上面显示的两个命令中的第一个具有相同的效果。
|
||||
|
||||
```
|
||||
echo $dept | sed 's/[a-z]/\U&/g' >> depts
|
||||
```
|
||||
|
||||
从大写字母切换到小写字母只需将行尾附近的 **U** 替换为 **L**。
|
||||
从大写字母切换到小写字母只需将行尾附近的 `U` 替换为 `L`。
|
||||
|
||||
```
|
||||
echo $dept | sed 's/[A-Z]/\L&/g' >> depts
|
||||
@ -81,7 +79,7 @@ echo $dept | sed 's/[A-Z]/\L&/g' >> depts
|
||||
|
||||
### 操作文件中的文本
|
||||
|
||||
**awk** 和 **sed**都能更改整个文件的文本大小写。因此,你发现你的老板需要部门所有名字的小写么?没问题。只需带上文件名运行以下命令:
|
||||
`awk` 和 `sed` 都能更改整个文件的文本大小写。因此,你发现你的老板需要所有部门名称的小写么?没问题。只需带上文件名运行以下命令:
|
||||
|
||||
```
|
||||
$ awk '{print tolower($0)}' depts
|
||||
@ -90,22 +88,22 @@ billing
|
||||
bookkeeping
|
||||
```
|
||||
|
||||
如果要覆盖 **depts** 文件,而不仅仅是以小写形式显示,则需要执行以下操作:
|
||||
如果要覆盖 `depts` 文件,而不仅仅是以小写形式显示,则需要执行以下操作:
|
||||
|
||||
```
|
||||
$ awk '{print tolower($0)}' depts > depts-
|
||||
$ mv depts- depts
|
||||
```
|
||||
|
||||
但是,使用 **sed** 进行更改,你可以避免最后一步,因为 **sed** 可以“原地”编辑文件,如下所示,文件完整,但文本全部小写:
|
||||
但是,使用 `sed` 进行更改,你可以避免最后一步,因为 `sed` 可以“原地”编辑文件,如下所示,文件完整,但文本全部小写:
|
||||
|
||||
```
|
||||
$ sed 's/[A-Z]/\L&/g' depts
|
||||
```
|
||||
|
||||
### 仅首字母大写
|
||||
### 仅将首字母转换为大写
|
||||
|
||||
要仅将字符串中单词的首字母大写,那么可以执行以下操作:
|
||||
要仅将字符串中单词的首字母转换为大写,那么可以执行以下操作:
|
||||
|
||||
```
|
||||
$ echo design \& engineering| sed -e "s/\b\(.\)/\u\1/g"
|
||||
@ -118,18 +116,18 @@ Design & Engineering
|
||||
|
||||
当要更改文本以使只有首字母大写时,这更具挑战性。假设你正在处理一个工作人员姓名列表,并且希望以正常的“名 姓”方式对其格式化。
|
||||
|
||||
##### 使用 sed
|
||||
#### 使用 sed
|
||||
|
||||
你可以使用更复杂的 **sed** 命令来确保以下结果:
|
||||
你可以使用更复杂的 `sed` 命令来确保以下结果:
|
||||
|
||||
```
|
||||
$ echo design \& ENGINEERING | sed 's/\b\([[:alpha:]]\)\([[:alpha:]]*\)\b/\u\1\L\2/g'
|
||||
Design & Engineering
|
||||
```
|
||||
|
||||
##### 使用 python
|
||||
#### 使用 Python
|
||||
|
||||
如果你已安装 python,你可以运行这样的命令,它还可以设置文本格式,以便每个单词只有首字母大写,并且它可能比上面显示的 **sed** 命令更易于解析:
|
||||
如果你已安装 Python,你可以运行这样的命令,它还可以设置文本格式,以便每个单词只有首字母大写,并且它可能比上面显示的 `sed` 命令更易于解析:
|
||||
|
||||
```
|
||||
$ echo -n "design & engineering" | python3 -c "import sys; print(sys.stdin.read().title())"
|
||||
@ -138,8 +136,6 @@ Design & Engineering
|
||||
|
||||
有多种方法可以在大小写之间更改文本格式。哪种方法效果最好取决于你要处理的是单个字符串还是整个文件,以及想要的最终结果。
|
||||
|
||||
加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3529409/converting-between-uppercase-and-lowercase-on-the-linux-command-line.html
|
||||
@ -147,15 +143,15 @@ via: https://www.networkworld.com/article/3529409/converting-between-uppercase-a
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.flickr.com/photos/54027476@N07/4999959929
|
||||
[1]:https://images.idgesg.net/images/article/2019/04/alphabetic_letters_characters_language_by_andybrandon50_cc_by-sa_2-0_1500x1000-100794409-large.jpg
|
||||
[2]: https://creativecommons.org/licenses/by-sa/2.0/legalcode
|
||||
[3]: https://www.networkworld.com/newsletters/signup.html
|
||||
[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage)
|
||||
[5]: https://www.facebook.com/NetworkWorld/
|
||||
[6]: https://www.linkedin.com/company/network-world
|
||||
[6]: https://www.linkedin.com/company/network-world
|
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-11982-1.html)
|
||||
[#]: subject: (Session: An Open Source Private Messenger That Doesn’t Need Your Phone Number)
|
||||
[#]: via: (https://itsfoss.com/session-messenger/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
@ -18,7 +18,7 @@ Signal 作为一款私人通信应用,正在变得愈发流行。而我们下
|
||||
|
||||
对于私人通信服务来说,有没有既能保护通信安全性,又尊重用户跨平台隐私的集大成者呢?很多注重个人隐私的用户似乎都在寻找这个问题的答案。
|
||||
|
||||
最近,我留意到 [Loki Foundation][3] 开发的一款叫做 [Session][2] 的开源通信应用。从技术上来说,Session 是另一款[开源、加密的通信应用 Signal][4] 的一个复刻。
|
||||
最近,我留意到 [Loki 基金会][3]开发的一款叫做 [Session][2] 的开源通信应用。从技术上来说,Session 是另一款[开源、加密的通信应用 Signal][4] 的一个复刻。
|
||||
|
||||
在本文中,我会讲述我自己使用 Session 的体验,以及 Session 的一些主要功能。
|
||||
|
||||
@ -34,7 +34,7 @@ Session 在这个领域中算是一款比较新的应用了,因此我还会在
|
||||
|
||||
在 Signal 或者其它类似的通信应用中,用户都需要提供手机号码才得以成功注册。注重隐私的用户们都认为这样的做法会潜藏着巨大的安全隐患。
|
||||
|
||||
而使用 Session 则简单得多。在 PC 或手机上安装应用之后,只需要点击“<ruby>创建账号<rt>Create Account</rt></ruby>”,无须提供手机号码,它就会生成一个类似 **05652245af9a8bfee4f5a8138fd5c……..** 这样的随机且唯一的 Session ID。
|
||||
而使用 Session 则简单得多。在 PC 或手机上安装应用之后,只需要点击“<ruby>创建账号<rt>Create Account</rt></ruby>”,无须提供手机号码,它就会生成一个类似 05652245af9a8bfee4f5a8138fd5c..... 这样的随机且唯一的 Session ID。
|
||||
|
||||
此后,把 Session ID 分享给想要添加的联系人就可以了。Session 还支持二维码,其他人可以通过扫描二维码添加你的 Session ID 为好友。
|
||||
|
||||
@ -62,14 +62,12 @@ Session 在这个领域中算是一款比较新的应用了,因此我还会在
|
||||
|
||||
最基本的选项包括:
|
||||
|
||||
* **消息有效期**:你可以控制一条消息在接收者阅读前的保留时长
|
||||
* **已读回执**:消息发送者可以知晓你已经阅读该消息
|
||||
|
||||
|
||||
* **消息有效期**:你可以控制一条消息在接收者阅读前的保留时长
|
||||
* **已读回执**:消息发送者可以知晓你已经阅读该消息
|
||||
|
||||
#### Session 使用去中心化网络保护你的元数据
|
||||
|
||||
尽管 Session 不使用<ruby>端对端<rt>peer-to-peer</rt></ruby>技术,但它也不适用中心化的服务器。
|
||||
尽管 Session 不使用<ruby>端对端<rt>peer-to-peer</rt></ruby>技术,但它也不使用中心化的服务器。
|
||||
|
||||
Session 采用了去中心化的架构实现消息的传输和路由。如果你不熟悉这方面的内容,可以关注 Session 的官方博客,尝试了解[中心化网络和去中心化网络的区别][11],以及它的实际工作原理。
|
||||
|
||||
@ -85,11 +83,11 @@ Session 采用了去中心化的架构实现消息的传输和路由。如果你
|
||||
|
||||
另外,你也可以在它的 [Github 发布页面][14] 获取到对应的 .deb 安装文件。
|
||||
|
||||
[下载 Session][12]
|
||||
- [下载 Session][12]
|
||||
|
||||
### 我使用 Session 的体验
|
||||
|
||||
我在各种平台上都试用过 Session,其中在 PC 上我使用了 Pop!_OS 19.10 的 .AppImage 文件运行这个应用。
|
||||
我在各种平台上都试用过 Session,其中在 PC 上我使用了 Pop!\_OS 19.10 的 .AppImage 文件运行这个应用。
|
||||
|
||||
总的来说,使用的体验很不错,用户界面也没有出现问题。
|
||||
|
||||
@ -99,11 +97,9 @@ Session 采用了去中心化的架构实现消息的传输和路由。如果你
|
||||
|
||||
当然,我也发现了一些需要改进的地方:
|
||||
|
||||
* 在接受好友请求时会出现延迟
|
||||
* 设备间连接的方式不太直观
|
||||
* 当你在不同的设备上使用同一个 Session ID 向同一个人回复消息时,对方会收到两个不同的对话
|
||||
|
||||
|
||||
* 在接受好友请求时会出现延迟
|
||||
* 设备间连接的方式不太直观
|
||||
* 当你在不同的设备上使用同一个 Session ID 向同一个人回复消息时,对方会收到两个不同的对话
|
||||
|
||||
### 总结
|
||||
|
||||
@ -119,7 +115,7 @@ via: https://itsfoss.com/session-messenger/
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -128,7 +124,7 @@ via: https://itsfoss.com/session-messenger/
|
||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-app.jpg?ssl=1
|
||||
[2]: https://getsession.org/
|
||||
[3]: https://loki.foundation/
|
||||
[4]: https://itsfoss.com/signal-messaging-app/
|
||||
[4]: https://linux.cn/article-11764-1.html
|
||||
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-create.jpg?ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/session-application-id.jpg?ssl=1
|
||||
[7]: https://en.wikipedia.org/wiki/Blockchain
|
@ -0,0 +1,74 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Containers vs. VMs, Istio in production, and more industry news)
|
||||
[#]: via: (https://opensource.com/article/20/3/survey-istio-industry-news)
|
||||
[#]: author: (Tim Hildred https://opensource.com/users/thildred)
|
||||
|
||||
Containers vs. VMs, Istio in production, and more industry news
|
||||
======
|
||||
A weekly look at open source community and industry trends.
|
||||
![Person standing in front of a giant computer screen with numbers, data][1]
|
||||
|
||||
As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update.
|
||||
|
||||
## [Tech adoption in the cloud native world: Containers and more][2]
|
||||
|
||||
> * Adoption of containers in production rose to from 73% in 2018 to 84% in 2019. Among this group, those running at least 250 containers rose from 46% in 2018 to 58% in 2019. From 2017 to 2019, the number of respondents with more than 50 machines (physical or virtual) in their fleet rose from 77% in 2017 to 81% in 2019.
|
||||
> * Implication: Container adoption appears to have mitigated the growth of VMs that need to be managed. However, be wary of claims that the raw number of machines being managed will decline.
|
||||
>
|
||||
|
||||
|
||||
**The impact**: It intuitively makes sense that virtual machine growth would slow down as container use grows; there are lots of containers being deployed inside VMs to take advantage of the best features of both, and lots of apps that won't be containerized any time soon (looking at you legacy enterprise monoliths).
|
||||
|
||||
## [Everything we learned running Istio in production][3]
|
||||
|
||||
> At HelloFresh we organize our teams into squads and tribes. Each tribe has their own Kubernetes namespace. As mentioned above, we enabled sidecar injection namespace by namespace then application by application. Before enabling applications for Istio we held workshops so that squads understood the changes happening to their application. Since we employ the model of “you build it, you own it”, this allows teams to understand traffic flows when troubleshooting. Not only that, it also raised the knowledge bar within the company. We also created Istio related [OKR’s][4] to track our progress and reach our Istio adoption goals.
|
||||
|
||||
**The impact**: The parts of technology adoption that aren't technology adoption are ignored at your own peril.
|
||||
|
||||
## [Aether: the first open source edge cloud platform][5]
|
||||
|
||||
> Aether is bringing together projects that have been under development and operating in their own sandbox, and under that framework ONF is trying to support a diversity of edge services on a converged platform, Sloane explained. ONF’s various projects will remain separate and continue to be consumable separately, but Aether is its attempt to bring multiple capabilities together to simplify private edge cloud operations for enterprises.
|
||||
>
|
||||
> "We think we’re creating a new collaborative place where the industry and community can come together to help drive some maybe consolidation and critical mass behind a common platform that can then help common functionality proliferate in these edge clouds," he said.
|
||||
|
||||
**The impact**: The problems being solved with technology today are too complex to be solved with a single technology. The business problems being solved on top of that require focus on the truly, value-adding. Taken together, businesses need to find ways to collaborate on their shared needs and compete on what makes them unique in the market. You couldn't find a better way to do that than open source.
|
||||
|
||||
## [Women in cloud careers are challenging the narrative][6]
|
||||
|
||||
> "As cloud is a relatively new technology, my experience of [being a 'woman in tech'][7] may not be typical, as the cloud industry is extremely diverse," Yordanova says. "In fact, my team has an equal gender split with a real mix of personalities, cultures and strengths from people who grew up with this technology."
|
||||
|
||||
**The impact**: One thing I like to think about is the idea of leapfrogging; that you might be able to skip a certain step or stage in a process because the circumstance that caused its existence in the first place no longer applies. The cloud era didn't have as long a period with static stereotypes of who made it and who it was for, so maybe it carries less of the baggage of some previous generations of technology?
|
||||
|
||||
## [How StarlingX shines in the starry sky of open source projects in China][8]
|
||||
|
||||
> Our team is in China, so one of our missions is to help the Chinese community to develop the software, contribute code, documentation, and more. Most of the StarlingX project meetings are held late at night in China, so the presence and participation for the Chinese community members are quite challenging. To overcome these obstacles, together with other community members (like friends in 99cloud) in China, we made some initiatives, such as engaging with other Chinese community members at the meet-ups, hands-on workshops ad-hoc tech meetings in Chinese, translating some documents to Chinese, and continuously interacting in WeChat groups (just like a 24/7 on-call services for and by everyone)
|
||||
|
||||
**The impact**: As Chinese contributions to open source projects continue to grow this seems like a situation that is likely to reverse, or at least equalize. It doesn't really make sense that "learn English" should be a pre-requisite to participating in the open source development process.
|
||||
|
||||
_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/3/survey-istio-industry-news
|
||||
|
||||
作者:[Tim Hildred][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/thildred
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data)
|
||||
[2]: https://thenewstack.io/cncf-survey-snapshot-tech-adoption-in-the-cloud-native-world/
|
||||
[3]: https://engineering.hellofresh.com/everything-we-learned-running-istio-in-production-part-1-51efec69df65
|
||||
[4]: https://en.wikipedia.org/wiki/OKR
|
||||
[5]: https://www.sdxcentral.com/articles/news/onf-projects-coalesce-for-enterprise-edge-cloud/2020/03/
|
||||
[6]: https://www.cloudpro.co.uk/leadership/cloud-essentials/8446/how-women-in-cloud-are-challenging-the-narrative
|
||||
[7]: https://www.itpro.co.uk/business-strategy/33301/diversity-not-a-company-priority-claim-nearly-half-of-women-in-tech
|
||||
[8]: https://superuser.openstack.org/articles/starlingx-community-interview-how-starlingx-shines-in-the-starry-sky-of-open-source-projects-in-china/
|
@ -1,190 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Three Ways to Exclude/Hold/Prevent a Specific Package from an apt Upgrade)
|
||||
[#]: via: (https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Three Ways to Exclude/Hold/Prevent a Specific Package from an apt Upgrade
|
||||
======
|
||||
|
||||
Sometimes you may accidentally update packages that are not updated due to some application dependency.
|
||||
|
||||
This is always the case during the entire system update or automatic package upgrade process.
|
||||
|
||||
If this happens, it may break the application function.
|
||||
|
||||
This creates a serious problem and you need to spend a lot of time fixing the problem.
|
||||
|
||||
See the following article if you want to **[Exclude Specific Packages from Yum Update][1]**
|
||||
|
||||
How to avoid this kind of situation?
|
||||
|
||||
How do I exclude packages from apt-get update?
|
||||
|
||||
Yes, it can be done using the following three methods on Debian and Ubuntu systems.
|
||||
|
||||
* **[apt-mark Command][2]**
|
||||
* **[dpkg Command][3]**
|
||||
* aptitude Command
|
||||
|
||||
|
||||
|
||||
We will show in detail each.
|
||||
|
||||
### Method-1: How to Exclude Packages Update on Debian/Ubuntu System Using the apt-mark Command
|
||||
|
||||
The apt-mark is used to mark/unmark a package as being automatically installed.
|
||||
|
||||
The Hold option is used to mark a package as blocked, which prevents the package from being automatically installed, upgraded, or removed.
|
||||
|
||||
The unhold option is used to cancel a previously set hold on a package to allow all actions to be repeated.
|
||||
|
||||
Run the following command to hold the given package using the **apt-mark** command.
|
||||
|
||||
```
|
||||
$ sudo apt-mark hold nano
|
||||
nano set on hold.
|
||||
```
|
||||
|
||||
Once you have hold some packages, run the following apt-mark command to view them.
|
||||
|
||||
```
|
||||
$ sudo apt-mark showhold
|
||||
nano
|
||||
```
|
||||
|
||||
This will show that the **“nano”** package will not be upgraded when you perform a full system update.
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
|
||||
Reading package lists… Done
|
||||
Building dependency tree
|
||||
Reading state information… Done
|
||||
Calculating upgrade… Done
|
||||
The following packages have been kept back:
|
||||
nano
|
||||
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
|
||||
```
|
||||
|
||||
Run the following command to unhold the “nano” package using the apt-mark command.
|
||||
|
||||
```
|
||||
$ sudo apt-mark unhold nano
|
||||
Canceled hold on nano.
|
||||
```
|
||||
|
||||
### Method-2: How to Exclude Packages Update on Debian/Ubuntu System Using the dpkg Command
|
||||
|
||||
The dpkg command is a CLI tool to install, build, remove and manage Debian packages. The primary and more user-friendly front-end for dpkg is aptitude.
|
||||
|
||||
Run the following command to block a given package using the dpkg command.
|
||||
|
||||
**Syntax:**
|
||||
|
||||
```
|
||||
$ echo "package_name hold" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
Run the below dpkg command to hold the **“apache2”** package.
|
||||
|
||||
```
|
||||
$ echo "apache2 hold" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
Once you have hold some packages, run the following command to view them.
|
||||
|
||||
```
|
||||
$ sudo dpkg --get-selections | grep "hold"
|
||||
apache2 hold
|
||||
```
|
||||
|
||||
It will show that the **“apache2”** package will not be upgraded when you perform a full system update.
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
|
||||
Reading package lists… Done
|
||||
Building dependency tree
|
||||
Reading state information… Done
|
||||
Calculating upgrade… Done
|
||||
The following packages have been kept back:
|
||||
apache2
|
||||
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
|
||||
```
|
||||
|
||||
Run the following command to unhold the given package using the dpkg command.
|
||||
|
||||
**Syntax:**
|
||||
|
||||
```
|
||||
$ echo "package_name install" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
Run the following command to unhold the “apache2” package using the dpkg command.
|
||||
|
||||
```
|
||||
$ echo "apache2 install" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
### Method-3: How to Exclude Packages Update on Debian/Ubuntu System Using the aptitude Command
|
||||
|
||||
The aptitude command is a text-based package management interface to the Debian and it’s derivative.
|
||||
|
||||
It allows the user to view a list of packages and to perform package management tasks such as installing, upgrading, and removing packages. Actions may be performed from a visual interface or from the command-line.
|
||||
|
||||
Run the following command to hold the given package using the aptitude command.
|
||||
|
||||
```
|
||||
$ sudo aptitude hold python3
|
||||
```
|
||||
|
||||
Once you have hold some packages, run the following aptitude command to view them.
|
||||
|
||||
```
|
||||
$ sudo dpkg --get-selections | grep "hold"
|
||||
or
|
||||
$ sudo apt-mark showhold
|
||||
|
||||
python3
|
||||
```
|
||||
|
||||
This will show that the **“python3”** package will not be upgraded when you perform a full system update.
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
|
||||
Reading package lists… Done
|
||||
Building dependency tree
|
||||
Reading state information… Done
|
||||
Calculating upgrade… Done
|
||||
The following packages have been kept back:
|
||||
python3
|
||||
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
|
||||
```
|
||||
|
||||
Run the following command to unhold the **“python3”** package using the apt-mark command.
|
||||
|
||||
```
|
||||
$ sudo aptitude unhold python3
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/
|
||||
[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[3]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,190 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Three Ways to Exclude/Hold/Prevent a Specific Package from an apt Upgrade)
|
||||
[#]: via: (https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
从 apt 升级中排除/保留/阻止特定软件包的三种方法
|
||||
======
|
||||
|
||||
有时,由于某些应用依赖性,你可能会意外更新未更新的软件包。
|
||||
|
||||
在整个系统更新或自动包升级过程中一直会发生。
|
||||
|
||||
如果发生这种情况,可能会破坏应用的功能。
|
||||
|
||||
这会造成严重的问题,你需要花费大量时间来解决问题。
|
||||
|
||||
如果你要**[从 Yum Update 中排除特定软件包][1]**,请参考它。
|
||||
|
||||
如何避免这种情况?
|
||||
|
||||
如何从 apt-get 更新中排除软件包?
|
||||
|
||||
是的,可以在 Debian 和 Ubuntu 系统上使用以下三种方法来完成。
|
||||
|
||||
* **[apt-mark 命令][2]**
|
||||
* **[dpkg 命令][3]**
|
||||
* aptitude 命令
|
||||
|
||||
|
||||
|
||||
我们将分别详细展示。
|
||||
|
||||
### 方法 1:如何使用 apt-mark 命令排除 Debian/Ubuntu 系统上的软件包更新
|
||||
|
||||
apt-mark 用于将软件包标记/取消标记为自动安装。
|
||||
|
||||
hold 选项用于将软件包标记为已阻止,以防止软件包被自动安装、升级或删除。
|
||||
|
||||
unhold 选项用于取消软件包的先前设置,以允许重复执行所有操作。
|
||||
|
||||
运行以下命令以使用 apt-mark 命令保留指定的软件包。
|
||||
|
||||
```
|
||||
$ sudo apt-mark hold nano
|
||||
nano set on hold.
|
||||
```
|
||||
|
||||
保留软件包后,请运行以下 apt-mark 命令查看它们。
|
||||
|
||||
```
|
||||
$ sudo apt-mark showhold
|
||||
nano
|
||||
```
|
||||
|
||||
这表明在执行完整的系统更新时,不会升级 **“nano”** 包。
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
|
||||
Reading package lists… Done
|
||||
Building dependency tree
|
||||
Reading state information… Done
|
||||
Calculating upgrade… Done
|
||||
The following packages have been kept back:
|
||||
nano
|
||||
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
|
||||
```
|
||||
|
||||
运行以下命令,使用 apt-mark 命令取消对 “nano” 包的保留。
|
||||
|
||||
```
|
||||
$ sudo apt-mark unhold nano
|
||||
Canceled hold on nano.
|
||||
```
|
||||
|
||||
### 方法 2:如何使用 dpkg 命令在 Debian/Ubuntu 系统上排除软件包更新
|
||||
|
||||
dpkg 命令是一个 CLI 工具,用于安装,构建,删除和管理 Debian 软件包。dpkg 的主要且更用户友好的前端是 aptitude。
|
||||
|
||||
运行以下命令使用 dpkg 命令阻止给定的软件包。
|
||||
|
||||
**语法:**
|
||||
|
||||
```
|
||||
$ echo "package_name hold" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
运行以下 dpkg 命令以保留 **“apache2”** 包。
|
||||
|
||||
```
|
||||
$ echo "apache2 hold" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
保留软件包后,请运行以下命令查看它们。
|
||||
|
||||
```
|
||||
$ sudo dpkg --get-selections | grep "hold"
|
||||
apache2 hold
|
||||
```
|
||||
|
||||
它会显示在执行完整的系统更新时,不会升级 **“apache2”** 包。
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
|
||||
Reading package lists… Done
|
||||
Building dependency tree
|
||||
Reading state information… Done
|
||||
Calculating upgrade… Done
|
||||
The following packages have been kept back:
|
||||
apache2
|
||||
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
|
||||
```
|
||||
|
||||
运行以下命令,使用 dpkg 命令取消对指定软件包的保留。
|
||||
|
||||
**语法:**
|
||||
|
||||
```
|
||||
$ echo "package_name install" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
运行以下命令,使用 dpkg 命令取消保留 “apache2” 包。
|
||||
|
||||
```
|
||||
$ echo "apache2 install" | sudo dpkg --set-selections
|
||||
```
|
||||
|
||||
### 方法 3:如何使用 aptitude 命令排除 Debian/Ubuntu 系统上的软件包更新
|
||||
|
||||
aptitude 命令是 Debian 及其衍生版本的基于文本的软件包管理界面。
|
||||
|
||||
它允许用户查看软件包列表并执行软件包管理任务,例如安装、升级和删除软件包。它可以从可视界面或命令行执行操作。
|
||||
|
||||
运行以下命令,使用 aptitude 命令保留指定的软件包。
|
||||
|
||||
```
|
||||
$ sudo aptitude hold python3
|
||||
```
|
||||
|
||||
保留某些软件包后,请运行以下 aptitude 命令查看它们。
|
||||
|
||||
```
|
||||
$ sudo dpkg --get-selections | grep "hold"
|
||||
或者
|
||||
$ sudo apt-mark showhold
|
||||
|
||||
python3
|
||||
```
|
||||
|
||||
这表明在执行完整的系统更新时,不会升级 **“python3”** 软件包。
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
|
||||
Reading package lists… Done
|
||||
Building dependency tree
|
||||
Reading state information… Done
|
||||
Calculating upgrade… Done
|
||||
The following packages have been kept back:
|
||||
python3
|
||||
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
|
||||
```
|
||||
|
||||
使用 apt-mark 命令运行以下命令以解除对 **“python3”** 软件包的保留。
|
||||
|
||||
```
|
||||
$ sudo aptitude unhold python3
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/
|
||||
[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[3]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/
|
Loading…
Reference in New Issue
Block a user