mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
5068e9bae4
@ -1,56 +1,50 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (scvoet)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13115-1.html)
|
||||
[#]: subject: (Where are all the IoT experts going to come from?)
|
||||
[#]: via: (https://www.networkworld.com/article/3404489/where-are-all-the-iot-experts-going-to-come-from.html)
|
||||
[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/)
|
||||
|
||||
物联网专家都从何而来?
|
||||
======
|
||||
物联网 (IoT) 的快速发展催生了对跨职能专家进行培养的需求,这些专家可以将传统的网络和基础设施专业知识与数据库和报告技能相结合。
|
||||
|
||||
> 物联网(IoT)的快速发展催生了对跨职能专家进行培养的需求,这些专家可以将传统的网络和基础设施专业知识与数据库和报告技能相结合。
|
||||
|
||||
![Kevin \(CC0\)][1]
|
||||
|
||||
如果物联网 (IoT) 要实现其宏伟的诺言,它将需要大量聪明、熟练、**训练有素**的工人军团来实现这一切。而现在,这些人将从何而来尚不清楚。
|
||||
如果物联网(IoT)要实现其宏伟的诺言,它将需要大量聪明、熟练、**训练有素**的工人军团来实现这一切。而现在,这些人将从何而来尚不清楚。
|
||||
|
||||
这就是我为什么有兴趣同资产优化软件公司 [AspenTech][2] 的产品管理、R&D 研发高级总监基思·弗林 (Keith Flynn) 通邮件,他说,当处理大量属于物联网范畴的新技术时,你需要能够理解如何配置技术和解释数据的人。弗林认为,现有的教育机构对物联网特定课程的需求越来越大,这同时也给了以物联网为重点,提供了完善课程的新私立学院机会。
|
||||
这就是我为什么有兴趣同资产优化软件公司 [AspenTech][2] 的产品管理、研发高级总监 Keith Flynn 通邮件的原因,他说,当处理大量属于物联网范畴的新技术时,你需要能够理解如何配置技术和解释数据的人。Flynn 认为,现有的教育机构对物联网特定课程的需求越来越大,这同时也给了以物联网为重点,提供了完善课程的新私立学院机会。
|
||||
|
||||
弗林跟我说,“在未来物联网项目将与如今普遍的数据管理和自动化项目有着巨大的不同......未来需要更全面的技能和交叉交易能力,这样我们才会说同一种语言。”
|
||||
Flynn 跟我说,“在未来,物联网项目将与如今普遍的数据管理和自动化项目有着巨大的不同……未来需要更全面的技能和交叉交易能力,这样我们才会说同一种语言。”
|
||||
|
||||
**【参见: [有雄心壮志的I T 专业人才应该争取的 20 个热门职位][3]】**
|
||||
|
||||
弗林补充说,随着物联网每年增长 30%,将不再依赖于几个特定的技能,“从传统的部署技能(如网络和基础设施)到数据库和报告技能,坦白说,甚至是基础数据科学,都将需要一起理解和使用。”
|
||||
Flynn 补充说,随着物联网每年增长 30%,将不再依赖于几个特定的技能,“从传统的部署技能(如网络和基础设施)到数据库和报告技能,坦白说,甚至是基础数据科学,都将需要一起理解和使用。”
|
||||
|
||||
### 召集所有物联网顾问
|
||||
|
||||
弗林预测,“受过物联网教育的人的第一个大机会将会是在咨询领域,随着咨询公司对行业趋势的适应或淘汰......有受过物联网培训的员工将有助于他们在物联网项目中的定位,并在新的业务线中提出要求——物联网咨询。”
|
||||
Flynn 预测,“受过物联网教育的人的第一个大机会将会是在咨询领域,随着咨询公司对行业趋势的适应或淘汰……有受过物联网培训的员工将有助于他们在物联网项目中的定位,并在新的业务线中提出要求——物联网咨询。”
|
||||
|
||||
对初创企业和小型公司而言,这个问题尤为严重。“组织越大,他们越有可能雇佣到不同技术类别的人”弗林这样说到,“但对于较小的组织和较小的物联网项目来说,你则需要一个能同时兼顾的人。”
|
||||
对初创企业和小型公司而言,这个问题尤为严重。“组织越大,他们越有可能雇佣到不同技术类别的人”Flynn 这样说到,“但对于较小的组织和较小的物联网项目来说,你则需要一个能同时兼顾的人。”
|
||||
|
||||
两者兼而有之?还是**一应俱全?**物联网“需要将所有知识和技能组合在一起”,弗林说到,“并不是所有技能都是全新的,只是在此之前从来没有被归纳在一起或放在一起教授过。”
|
||||
|
||||
**【[想在技术领域提升自己的事业?这个全面的在线课程会教您该怎么做。][4]】**
|
||||
两者兼而有之?还是**一应俱全?**物联网“需要将所有知识和技能组合在一起”,Flynn 说到,“并不是所有技能都是全新的,只是在此之前从来没有被归纳在一起或放在一起教授过。”
|
||||
|
||||
### 未来的物联网专家
|
||||
|
||||
弗林表示,真正的物联网专业技术是从基础的仪器仪表和电气技能开始的,这能帮助工人发明新的无线发射器或提升技术,以提高电池寿命和功耗。
|
||||
Flynn 表示,真正的物联网专业技术是从基础的仪器仪表和电气技能开始的,这能帮助工人发明新的无线发射器或提升技术,以提高电池寿命和功耗。
|
||||
|
||||
“IT 技能,如网络、IP 寻址、子网掩码、蜂窝和卫星也是物联网的关键需求”,弗林说。他还认为物联网需要数据库管理技能和云管理和安全专业知识,“特别是当高级过程控制 (APC) 将传感器数据直接发送到数据库和数据湖等事情成为常态时。”
|
||||
“IT 技能,如网络、IP 寻址、子网掩码、蜂窝和卫星也是物联网的关键需求”,Flynn 说。他还认为物联网需要数据库管理技能和云管理和安全专业知识,“特别是当高级过程控制(APC)将传感器数据直接发送到数据库和数据湖等事情成为常态时。”
|
||||
|
||||
### 物联网专家又从何而来?
|
||||
|
||||
弗林说,标准化的正规教育课程将是确保毕业生或证书持有者掌握一套正确技能的最佳途径。他甚至还列出了一个样本课程。“按时间顺序开始,从基础知识开始,比如[电气&仪表]E&I和测量。然后讲授网络知识,数据库管理和云计算课程都应在此之后开展。这个学位甚至可以循序渐进至现有的工程课程中,这可能需要两年时间......来完成物联网部分的学业。”
|
||||
Flynn 说,标准化的正规教育课程将是确保毕业生或证书持有者掌握一套正确技能的最佳途径。他甚至还列出了一个样本课程。“按时间顺序开始,从基础知识开始,比如 [电气仪表] 和测量。然后讲授网络知识,数据库管理和云计算课程都应在此之后开展。这个学位甚至可以循序渐进至现有的工程课程中,这可能需要两年时间……来完成物联网部分的学业。”
|
||||
|
||||
虽然企业培训也能发挥作用,但实际上却是“说起来容易做起来难”,弗林这样警告,“这些培训需要针对组织的具体努力而推动。”
|
||||
虽然企业培训也能发挥作用,但实际上却是“说起来容易做起来难”,Flynn 这样警告,“这些培训需要针对组织的具体努力而推动。”
|
||||
|
||||
当然,现在市面上已经有了[大量的在线物联网培训课程和证书课程][5]。但追根到底,这一工作全都依赖于工人自身的推断。
|
||||
当然,现在市面上已经有了 [大量的在线物联网培训课程和证书课程][5]。但追根到底,这一工作全都依赖于工人自身的推断。
|
||||
|
||||
“在这个世界上,随着科技不断改变行业,提升技能是非常重要的”,弗林说,“如果这种提升技能的推动力并不是来源于你的雇主,那么在线课程和认证将会是提升你自己很好的一个方式。我们只需要创建这些课程......我甚至可以预见组织将与提供这些课程的高等教育机构合作,让他们的员工更好地开始。当然,物联网课程的挑战在于它需要不断发展以跟上科技的发展。”
|
||||
|
||||
**【有关物联网的更多信息,请参阅[在网络上确保物联网安全的提醒][6],我们的[最强大的物联网公司][7]列表,并了解[工业物联网][8]。 | 通过[注册网络世界新闻通讯][9]定期获取见解。】**
|
||||
|
||||
参与[脸书][10]和[领英][11]上的网络世界社区,对最重要的话题进行评论。
|
||||
“在这个世界上,随着科技不断改变行业,提升技能是非常重要的”,Flynn 说,“如果这种提升技能的推动力并不是来源于你的雇主,那么在线课程和认证将会是提升你自己很好的一个方式。我们只需要创建这些课程……我甚至可以预见组织将与提供这些课程的高等教育机构合作,让他们的员工更好地开始。当然,物联网课程的挑战在于它需要不断发展以跟上科技的发展。”
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -59,7 +53,7 @@ via: https://www.networkworld.com/article/3404489/where-are-all-the-iot-experts-
|
||||
作者:[Fredric Paul][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Percy (@scvoet)](https://github.com/scvoet)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,18 +1,18 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13116-1.html)
|
||||
[#]: subject: (How to tell if implementing your Python code is a good idea)
|
||||
[#]: via: (https://opensource.com/article/19/12/zen-python-implementation)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
如何判断实现你的 Python 代码是否是个好主意?
|
||||
如何判断你的 Python 代码实现是否合适?
|
||||
======
|
||||
|
||||
> 这是 Python 之禅特别系列的一部分,重点介绍第十七和十八条原则:困难和容易。
|
||||
|
||||
!["开发人员和运营经理两个人之间的砖墙"][1]
|
||||
![](https://img.linux.net.cn/data/attachment/album/202102/14/120518rjkwvjs76p9d1911.jpg)
|
||||
|
||||
一门语言并不是抽象存在的。每一个语言功能都必须用代码来实现。承诺一些功能是很容易的,但实现起来就会很麻烦。复杂的实现意味着更多潜在的 bug,甚至更糟糕的是,会带来日复一日的维护负担。
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
|
||||
### <ruby>如果一个实现难以解释,那就是个坏思路<rt>If the implementation is hard to explain, it's a bad idea</rt></ruby>
|
||||
|
||||
编程语言最重要的是可预测性。有时我们用抽象的编程模型来解释某个结构的语义,而这些模型与实现并不完全对应。然而,最好的解释只是*解释实现*。
|
||||
编程语言最重要的是可预测性。有时我们用抽象的编程模型来解释某个结构的语义,而这些模型与实现并不完全对应。然而,最好的释义就是*解释该实现*。
|
||||
|
||||
如果该实现很难解释,那就意味着这个途径是不可能的。
|
||||
如果该实现很难解释,那就意味着这条路行不通。
|
||||
|
||||
### <ruby>如果一个实现易于解释,那它可能是一个好思路<rt>If the implementation is easy to explain, it may be a good idea</rt></ruby>
|
||||
|
@ -1,34 +1,30 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "rakino"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13112-1.html"
|
||||
[#]: subject: "LaTeX Typesetting – Part 1 (Lists)"
|
||||
[#]: via: "https://fedoramagazine.org/latex-typesetting-part-1/"
|
||||
[#]: author: "Earl Ramirez https://fedoramagazine.org/author/earlramirez/"
|
||||
|
||||
LaTeX 排版——第 1 部分:列表
|
||||
LaTeX 排版(1):列表
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
本系列基于前文 [Typeset your docs with LaTex and TeXstudio on Fedora][2] 和 [LaTeX 101 for beginners][3],本文即系列的第一部分是关于 LaTeX 列表的。
|
||||
|
||||
|
||||
本系列基于前文《[在 Fedora 上用 LaTex 和 TeXstudio 排版你的文档][2]》和《[LaTeX 基础][3]》,本文即系列的第一部分,是关于 LaTeX 列表的。
|
||||
|
||||
### 列表类型
|
||||
|
||||
LaTeX 中的列表是封闭的环境,列表中的每个项目可以取一行文字到一个完整的段落。在 LaTeX 中有三种列表类型:
|
||||
|
||||
* **itemize**: <ruby>无序列表<rt>unordered list</rt></ruby>/<ruby>项目符号列表<rt>bullet list</rt></ruby>
|
||||
* **enumerate**: <ruby>有序列表<rt>ordered list</rt></ruby>
|
||||
* **description**: <ruby>描述列表<rt>descriptive list</rt></ruby>
|
||||
|
||||
|
||||
* `itemize`:<ruby>无序列表<rt>unordered list</rt></ruby>/<ruby>项目符号列表<rt>bullet list</rt></ruby>
|
||||
* `enumerate`:<ruby>有序列表<rt>ordered list</rt></ruby>
|
||||
* `description`:<ruby>描述列表<rt>descriptive list</rt></ruby>
|
||||
|
||||
### 创建列表
|
||||
|
||||
要创建一个列表,需要在每个项目前加上控制序列 \\_item_,并在项目清单前后分别加上控制序列 \\_begin_{<类型>} 和 \\_end_{<类型>}(将其中的 <类型> 替换为将要使用的列表类型),如下例:
|
||||
要创建一个列表,需要在每个项目前加上控制序列 `\item`,并在项目清单前后分别加上控制序列 `\begin{<类型>}` 和 `\end`{<类型>}`(将其中的 `<类型>` 替换为将要使用的列表类型),如下例:
|
||||
|
||||
#### itemize(无序列表)
|
||||
|
||||
@ -67,11 +63,11 @@ LaTeX 中的列表是封闭的环境,列表中的每个项目可以取一行
|
||||
|
||||
### 列表项目间距
|
||||
|
||||
可以通过在导言区加入 \\_usepackage{enumitem}_ 来自定义默认的间距,宏包 _enumitem_ 启用了选项 _noitemsep_ 和控制序列 \\_itemsep_ ,可以在列表中使用他们,如下例所示:
|
||||
可以通过在导言区加入 `\usepackage{enumitem}` 来自定义默认的间距,宏包 `enumitem` 启用了选项 `noitemsep` 和控制序列 `\itemsep`,可以在列表中使用它们,如下例所示:
|
||||
|
||||
#### 使用选项 noitemsep
|
||||
|
||||
将选项 _noitemsep_ 封闭在方括号内,并同下文所示放在控制序列 \\_begin_ 之后,该选项将移除默认的间距。
|
||||
将选项 `noitemsep` 封闭在方括号内,并同下文所示放在控制序列 `\begin` 之后,该选项将移除默认的间距。
|
||||
|
||||
```
|
||||
\begin{itemize}[noitemsep]
|
||||
@ -85,7 +81,7 @@ LaTeX 中的列表是封闭的环境,列表中的每个项目可以取一行
|
||||
|
||||
#### 使用控制序列 \itemsep
|
||||
|
||||
控制序列 \\_itemsep_ 必须以一个数字作为后缀,用以表示列表项目之间应该有多少空间。
|
||||
控制序列 `\itemsep` 必须以一个数字作为后缀,用以表示列表项目之间应该有多少空间。
|
||||
|
||||
```
|
||||
\begin{itemize} \itemsep0.75pt
|
||||
@ -152,21 +148,21 @@ LaTeX 最多最多支持四层嵌套列表,如下例:
|
||||
|
||||
**enumerate(有序列表)** | **itemize(无序列表)**
|
||||
---|---
|
||||
\alph* (小写字母) | $\bullet$ (Bullet)
|
||||
\Alph* (大写字母) | $\cdot$ (Period)
|
||||
\arabic* (阿拉伯数字) | $\diamond$ (Diamond)
|
||||
\roman* (小写罗马数字) | $\ast$ (Asterisk)
|
||||
\Roman* (大写罗马数字) | $\circ$ (Circle)
|
||||
| $-$ (Dash)
|
||||
`\alph*` (小写字母) | `$\bullet$` (●)
|
||||
`\Alph*` (大写字母) | `$\cdot$` (•)
|
||||
`\arabic*` (阿拉伯数字) | `$\diamond$` (◇)
|
||||
`\roman*` (小写罗马数字) | `$\ast$` (✲)
|
||||
`\Roman*` (大写罗马数字) | `$\circ$` (○)
|
||||
| `$-$` (-)
|
||||
|
||||
### 按嵌套深度划分的默认样式
|
||||
|
||||
**嵌套深度** | **enumerate(有序列表)** | **itemize(无序列表)**
|
||||
---|---|---
|
||||
1 | 阿拉伯数字 | Bullet
|
||||
2 | 小写字母 | Dash
|
||||
3 | 小写罗马数字 | Asterisk
|
||||
4 | 大写字母 | Period
|
||||
1 | 阿拉伯数字 | (●)
|
||||
2 | 小写字母 | (-)
|
||||
3 | 小写罗马数字 | (✲)
|
||||
4 | 大写字母 | (•)
|
||||
|
||||
### 设置列表样式
|
||||
|
||||
@ -191,7 +187,7 @@ LaTeX 最多最多支持四层嵌套列表,如下例:
|
||||
|
||||
#### 方式一:为各项目单独设置
|
||||
|
||||
将需要的样式名称封闭在方括号内,并放在控制序列 \\_item_ 之后,如下例:
|
||||
将需要的样式名称封闭在方括号内,并放在控制序列 `\item` 之后,如下例:
|
||||
|
||||
```
|
||||
% 方式一
|
||||
@ -208,7 +204,7 @@ LaTeX 最多最多支持四层嵌套列表,如下例:
|
||||
|
||||
#### 方式二:为整个列表设置
|
||||
|
||||
将需要的样式名称以 _label=_ 前缀并封闭在方括号内,放在控制序列 _\begin_ 之后,如下例:
|
||||
将需要的样式名称以 `label=` 前缀并封闭在方括号内,放在控制序列 `\begin` 之后,如下例:
|
||||
|
||||
```
|
||||
% 方式二
|
||||
@ -221,7 +217,7 @@ LaTeX 最多最多支持四层嵌套列表,如下例:
|
||||
|
||||
#### 方式三:为整个文档设置
|
||||
|
||||
该方式将改变整个文档的默认样式。使用 \\_renewcommand_ 来设置项目标签的值,下例分别为四个嵌套深度的项目标签设置了不同的样式。
|
||||
该方式将改变整个文档的默认样式。使用 `\renewcommand` 来设置项目标签的值,下例分别为四个嵌套深度的项目标签设置了不同的样式。
|
||||
|
||||
```
|
||||
% 方式三
|
||||
@ -244,7 +240,7 @@ via: https://fedoramagazine.org/latex-typesetting-part-1/
|
||||
作者:[Earl Ramirez][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[rakino](https://github.com/rakino)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (Chao-zhi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13110-1.html)
|
||||
[#]: subject: (Give Your GNOME Desktop a Tiling Makeover With Material Shell GNOME Extension)
|
||||
[#]: via: (https://itsfoss.com/material-shell/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
@ -10,91 +10,87 @@
|
||||
使用 Material Shell 扩展将你的 GNOME 桌面打造成平铺式风格
|
||||
======
|
||||
|
||||
平铺式窗口的特性吸引了很多人的追捧。也许是因为他很好看,也许是因为对于 [linux 快捷键 ][1] 玩家他能提高效率。又或者是因为使用不同寻常的平铺式窗口是一种挑战。
|
||||
平铺式窗口的特性吸引了很多人的追捧。也许是因为它很好看,也许是因为它能提高 [Linux 快捷键][1] 玩家的效率。又或者是因为使用不同寻常的平铺式窗口是一种新奇的挑战。
|
||||
|
||||
![Tiling Windows in Linux | Image Source][2]
|
||||
|
||||
从 i3 到 [Sway][3],linux 桌面拥有各种各样的平铺式窗口管理器。配置一个平铺式窗口管理器需要一个陡峭的学习曲线。
|
||||
从 i3 到 [Sway][3],Linux 桌面拥有各种各样的平铺式窗口管理器。配置一个平铺式窗口管理器需要一个陡峭的学习曲线。
|
||||
|
||||
这就是为什么像 [Regolith desktop][4] 这样的项目会存在,它给你提供一个已经配置好的平铺式桌面。所以你不需要做大多的准备就可以直接开始使用。
|
||||
这就是为什么像 [Regolith 桌面][4] 这样的项目会存在,给你预先配置好的平铺桌面,让你可以更轻松地开始使用平铺窗口。
|
||||
|
||||
让我给你介绍一个相似的项目 ——Material Shell。它可以让你用上平铺式桌面,甚至比 [Regolith][5] 还简单。
|
||||
让我给你介绍一个类似的项目 —— Material Shell。它可以让你用上平铺式桌面,甚至比 [Regolith][5] 还简单。
|
||||
|
||||
### Material Shell 扩展:将 GNOME 桌面转变成平铺式窗口管理器
|
||||
|
||||
[Material Shell][6] 是一个 GNOME 扩展,这就是它最好的点。这意味着你不需要注销并登陆其他桌面环境。你只需要启用或关闭这个扩展就可以自如的切换你的工作环境。
|
||||
[Material Shell][6] 是一个 GNOME 扩展,这就是它最好的地方。这意味着你不需要注销并登录其他桌面环境。你只需要启用或关闭这个扩展就可以自如的切换你的工作环境。
|
||||
|
||||
我会列出 Material Shell 的各种特性,但是也许视频更容易让你理解:
|
||||
|
||||
[Subscribe to our YouTube channel for more Linux videos][7]
|
||||
- [video](https://youtu.be/Wc5mbuKrGDE)
|
||||
|
||||
这个项目叫做 Material Shell 是因为他遵循 [Material Design][8] 原则。因此这个应用拥有一个美观的界面。这就是他最重要的一个特性。
|
||||
这个项目叫做 Material Shell 是因为它遵循 [Material Design][8] 原则。因此这个应用拥有一个美观的界面。这就是它最重要的一个特性。
|
||||
|
||||
#### 直观的界面
|
||||
|
||||
Material Shell 添加了一个左侧面板,可以快速访问。在此面板上,您可以在底部找到系统托盘,在顶部找到搜索和工作区。
|
||||
Material Shell 添加了一个左侧面板,以便快速访问。在此面板上,你可以在底部找到系统托盘,在顶部找到搜索和工作区。
|
||||
|
||||
所有新打开的应用都会添加到当前工作区中。您也可以创建新的工作区并切换到该工作区,以将正在运行的应用分类。其实这就是工作区最初的意义。
|
||||
所有新打开的应用都会添加到当前工作区中。你也可以创建新的工作区并切换到该工作区,以将正在运行的应用分类。其实这就是工作区最初的意义。
|
||||
|
||||
在 Material Shell 中,每个工作区都可以显示为具有多个应用程序的行列,而不是包含多个应用程序的程序框。
|
||||
|
||||
#### 平铺式窗口
|
||||
|
||||
在工作区中,你可以看到所有打开的应用程序都在顶部。默认情况下,应用程序会像在 GNOME desktop 中那样铺满整个屏幕。你可以使用右上角的布局改变器来改变布局,将其分成两半、多列或多个应用网格。
|
||||
在工作区中,你可以一直在顶部看到所有打开的应用程序。默认情况下,应用程序会像在 GNOME 桌面中那样铺满整个屏幕。你可以使用右上角的布局改变器来改变布局,将其分成两半、多列或多个应用网格。
|
||||
|
||||
这段视频一目了然的显示了以上所有功能:
|
||||
|
||||
<!-- 丢了个视频链接,我不知道怎么添加 -->
|
||||
- [video](https://player.vimeo.com/video/460050750?dnt=1&app_id=122963)
|
||||
|
||||
#### 固定布局和工作区
|
||||
|
||||
Material Shell 会记住你打开的工作区和窗口,这样你就不必重新组织你的布局。这是一个很好的特性,因为如果您对应用程序的位置有要求的话,它可以节省时间。
|
||||
Material Shell 会记住你打开的工作区和窗口,这样你就不必重新组织你的布局。这是一个很好的特性,因为如果你对应用程序的位置有要求的话,它可以节省时间。
|
||||
|
||||
#### 热建/快捷键
|
||||
|
||||
像任何平铺窗口管理器一样,您可以使用键盘快捷键在应用程序和工作区之间切换。
|
||||
像任何平铺窗口管理器一样,你可以使用键盘快捷键在应用程序和工作区之间切换。
|
||||
|
||||
* `Super+W` 切换到上个工作区;
|
||||
* `Super+S` 切换到下个工作区;
|
||||
* `Super+A` 切换到左边的窗口;
|
||||
* `Super+D` 切换到右边的窗口;
|
||||
* `Super+1`,`Super+2` … `Super+0` 切换到某个指定的工作区;
|
||||
* `Super+1`、`Super+2` … `Super+0` 切换到某个指定的工作区;
|
||||
* `Super+Q` 关闭当前窗口;
|
||||
* `Super+[MouseDrag]` 移动窗口;
|
||||
* `Super+[鼠标拖动]` 移动窗口;
|
||||
* `Super+Shift+A` 将当前窗口左移;
|
||||
* `Super+Shift+D` 将当前窗口右移;
|
||||
* `Super+Shift+W` 将当前窗口上移;
|
||||
* `Super+Shift+S` 将当前窗口下移。
|
||||
|
||||
|
||||
* `Super+Shift+W` 将当前窗口移到上个工作区;
|
||||
* `Super+Shift+S` 将当前窗口移到下个工作区。
|
||||
|
||||
### 安装 Material Shell
|
||||
|
||||
警告!
|
||||
> 警告!
|
||||
>
|
||||
> 对于大多数用户来说,平铺式窗口可能会导致混乱。你最好先熟悉如何使用 GNOME 扩展。如果你是 Linux 新手或者你害怕你的系统发生翻天覆地的变化,你应当避免使用这个扩展。
|
||||
|
||||
对于大多数用户来说,平铺式窗口可能会导致混乱。你最好先熟悉如何使用 GNOME 扩展。如果你是 Linux 新手或者你害怕你的系统发生翻天覆地的变化,你应当避免使用这个扩展。
|
||||
Material Shell 是一个 GNOME 扩展。所以,请 [检查你的桌面环境][9],确保你运行的是 GNOME 3.34 或者更高的版本。
|
||||
|
||||
Material Shell 是一个 GNOME 扩展。所以,请你[检查你的桌面环境 ][9] 确保它是 _**GNOME 3.34 或者更高的版本**_。
|
||||
除此之外,我注意到在禁用 Material Shell 之后,它会导致 Firefox 的顶栏和 Ubuntu 的坞站消失。你可以在 GNOME 的“扩展”应用程序中禁用/启用 Ubuntu 的坞站扩展来使其变回原来的样子。我想这些问题也应该在系统重启后消失,虽然我没试过。
|
||||
|
||||
我还想补充一点,平铺窗口可能会让许多用户感到困惑。
|
||||
|
||||
除此之外,我注意到在禁用 Material Shell 之后,它会导致 Firefox 和 Ubuntu dock 的顶栏消失。你可以在 GNOME 的扩展应用程序中禁用/启用 Ubuntu 的 dock 扩展来使其变回原来的样子。我想这些问题也应该在系统重启后消失,虽然我没试过。
|
||||
|
||||
我希望你知道[如何使用 GNOME 扩展 ][10]。最简单的办法就是[在浏览器中打开这个链接 ][11],安装 GNOME 扩展浏览器插件并且启用 Material Shell 扩展。
|
||||
我希望你知道 [如何使用 GNOME 扩展][10]。最简单的办法就是 [在浏览器中打开这个链接][11],安装 GNOME 扩展浏览器插件,然后启用 Material Shell 扩展即可。
|
||||
|
||||
![][12]
|
||||
|
||||
如果你不喜欢这个扩展,你也可以在同样的链接中禁用它。或者在 GNOME 扩展程序中禁用它。
|
||||
如果你不喜欢这个扩展,你也可以在同样的链接中禁用它。或者在 GNOME 的“扩展”应用程序中禁用它。
|
||||
|
||||
![][13]
|
||||
|
||||
**使不使用平铺式**
|
||||
### 用不用平铺式?
|
||||
|
||||
我使用多个电脑屏幕,我发现 Material Shell 不适用于多个屏幕的情况。这是开发者将来可以改进的地方。
|
||||
|
||||
除了这个毛病以外,Material Shell 是个让你开始使用平铺式窗口的好东西。如果你尝试了 Material Shell 并且喜欢它,请通过[给它一个星或在 GitHub 上赞助它 ][14] 来鼓励这个项目。
|
||||
除了这个毛病以外,Material Shell 是个让你开始使用平铺式窗口的好东西。如果你尝试了 Material Shell 并且喜欢它,请 [在 GitHub 上给它一个星标或赞助它][14] 来鼓励这个项目。
|
||||
|
||||
由于某些原因,平铺窗户越来越受欢迎。最近发布的 [Pop OS 20.04][15] 也增加了平铺窗口的功能。
|
||||
由于某些原因,平铺窗户越来越受欢迎。最近发布的 [Pop OS 20.04][15] 也增加了平铺窗口的功能。有一个类似的项目叫 PaperWM,也是这样做的。
|
||||
|
||||
但正如我前面提到的,平铺布局并不适合所有人,它可能会让很多人感到困惑。
|
||||
|
||||
@ -107,7 +103,7 @@ via: https://itsfoss.com/material-shell/
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[Chao-zhi](https://github.com/Chao-zhi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,45 +1,46 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13113-1.html)
|
||||
[#]: subject: (3 wishes for open source productivity in 2021)
|
||||
[#]: via: (https://opensource.com/article/21/1/productivity-wishlist)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
|
||||
|
||||
2021 年开源生产力的 3 个愿望
|
||||
======
|
||||
2021年,开源世界可以拓展的有很多。这是我特别感兴趣的三个领域。
|
||||
|
||||
> 2021年,开源世界可以拓展的有很多。这是我特别感兴趣的三个领域。
|
||||
|
||||
![Looking at a map for career journey][1]
|
||||
|
||||
在前几年,这个年度系列涵盖了单个的应用。今年,我们除了关注 2021 年的策略外,还将关注一体化解决方案。欢迎来到 2021 年 21 天生产力的最后一天。
|
||||
|
||||
我们已经到了另外一个系列的结尾处。因此,让我们谈谈我希望在 2021 年看到的更多事情。
|
||||
我们已经到了又一个系列的结尾处。因此,让我们谈谈我希望在 2021 年看到的更多事情。
|
||||
|
||||
### 断网
|
||||
|
||||
![Large Lego set built by the author][2]
|
||||
|
||||
我是在假期期间制作的(Kevin Sonney, [CC BY-SA 4.0][3])
|
||||
*我在假期期间制作的(Kevin Sonney, [CC BY-SA 4.0][3])*
|
||||
|
||||
对_许多_人来说,2020 年是非常困难的一年。疫情大流行、各种政治事件、24 小时新闻报道等等,都对我们的精神健康造成了伤害。虽然我谈到了[抽出时间进行自我护理][4],但我只提到了断网:也就是关闭提醒、手机、平板等,暂时无视这个世界。我公司的一位经理居然告诉我们,如果放假或休息一天,就把所有与工作有关的东西都关掉(除非我们在值班)。我最喜欢的“断网”活动之一就是听音乐和搭建大而复杂的乐高。
|
||||
对*许多、许多的*人来说,2020 年是非常困难的一年。疫情大流行、各种政治事件、24 小时的新闻轰炸等等,都对我们的精神健康造成了伤害。虽然我确实谈到了 [抽出时间进行自我护理][4],但我只是想断网:也就是关闭提醒、手机、平板等,暂时无视这个世界。我公司的一位经理实际上告诉我们,如果放假或休息一天,就把所有与工作有关的东西都关掉(除非我们在值班)。我最喜欢的“断网”活动之一就是听音乐和搭建大而复杂的乐高。
|
||||
|
||||
### 可访问性
|
||||
|
||||
尽管我谈论的许多技术都是任何人都可以做的,但是软件方面的可访问性都有一定难度。自迁移之初以来,Linux 和开源世界在辅助技术方面已经走了很长一段路。但是,仍然有太多的应用和系统不会考虑有些用户没有与设计者相同的能力。我一直在关注这一领域的发展,因为每个人都应该能够访问事物。
|
||||
尽管我谈论的许多技术都是任何人都可以做的,但是软件方面的可访问性都有一定难度。相对于自由软件运动之初,Linux 和开源世界在辅助技术方面已经有了长足发展。但是,仍然有太多的应用和系统不会考虑有些用户没有与设计者相同的能力。我一直在关注这一领域的发展,因为每个人都应该能够访问事物。
|
||||
|
||||
### 更多的一体化选择
|
||||
|
||||
![JPilot all in one organizer software interface][5]
|
||||
|
||||
JPilot(Kevin Sonney, [CC BY-SA 4.0][3])
|
||||
*JPilot(Kevin Sonney, [CC BY-SA 4.0][3])*
|
||||
|
||||
在 FOSS 世界中,一体化的个人信息管理解决方案远没有商业软件世界中那么多。总体趋势是使用单独的应用,它们必须通过配置来相互通信或通过中介服务(如 CalDAV 服务器)。移动市场在很大程度上推动了这一趋势,但我仍然向往像 [JPilot][6] 这样无需额外插件或服务就能完成几乎所有我需要的事情的日子。
|
||||
|
||||
|
||||
非常感谢大家阅读这个年度系列。如果你认为我错过了什么,或者明年需要注意什么,请在下方评论。
|
||||
|
||||
就像我在[生产力炼金术][7]上说的那样,尽最大努力保持生产力!
|
||||
就像我在 [生产力炼金术][7] 上说的那样,尽最大努力保持生产力!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -48,7 +49,7 @@ via: https://opensource.com/article/21/1/productivity-wishlist
|
||||
作者:[Kevin Sonney][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/) 荣誉推出
|
||||
|
255
published/20210204 A hands-on tutorial of SQLite3.md
Normal file
255
published/20210204 A hands-on tutorial of SQLite3.md
Normal file
@ -0,0 +1,255 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "amwps290"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13117-1.html"
|
||||
[#]: subject: "A hands-on tutorial of SQLite3"
|
||||
[#]: via: "https://opensource.com/article/21/2/sqlite3-cheat-sheet"
|
||||
[#]: author: "Klaatu https://opensource.com/users/klaatu"
|
||||
|
||||
SQLite3 实践教程
|
||||
======
|
||||
|
||||
> 开始使用这个功能强大且通用的数据库吧。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202102/14/131146jsx2kvyobwxwswct.jpg)
|
||||
|
||||
应用程序经常需要保存数据。无论你的用户是创建简单的文本文档、复杂的图形布局、游戏进度还是错综复杂的客户和订单号列表,软件通常都意味着生成数据。有很多方法可以存储数据以供重复使用。你可以将文本转储为 INI、[YAML][2]、XML 或 JSON 等配置格式,可以输出原始的二进制数据,也可以将数据存储在结构化数据库中。SQLite 是一个自包含的、轻量级数据库,可轻松创建、解析、查询、修改和传输数据。
|
||||
|
||||
- 下载 [SQLite3 备忘录][3]
|
||||
|
||||
SQLite 专用于 [公共领域][4],[从技术上讲,这意味着它没有版权,因此不需要许可证][5]。如果你需要许可证,则可以 [购买所有权担保][6]。SQLite 非常常见,大约有 1 万亿个 SQLite 数据库正在使用中。在每个基于 Webkit 的 Web 浏览器,现代电视机,汽车多媒体系统以及无数其他软件应用程序中,Android 和 iOS 设备, macOS 和 Windows 10 计算机,大多数 Linux 系统上都包含多个这种数据库。
|
||||
|
||||
总而言之,它是用于存储和组织数据的一个可靠而简单的系统。
|
||||
|
||||
### 安装
|
||||
|
||||
你的系统上可能已经有 SQLite 库,但是你需要安装其命令行工具才能直接使用它。在 Linux上,你可能已经安装了这些工具。该工具提供的命令是 `sqlite3` (而不仅仅是 sqlite)。
|
||||
|
||||
如果没有在你的 Linux 或 BSD 上安装 SQLite,你则可以从软件仓库中或 ports 树中安装 SQLite,也可以从源代码或已编译的二进制文件进行[下载并安装][7]。
|
||||
|
||||
在 macOS 或 Windows 上,你可以从 [sqlite.org][7] 下载并安装 SQLite 工具。
|
||||
|
||||
### 使用 SQLite
|
||||
|
||||
通过编程语言与数据库进行交互是很常见的。因此,像 Java、Python、Lua、PHP、Ruby、C++ 以及其他编程语言都提供了 SQLite 的接口(或“绑定”)。但是,在使用这些库之前,了解数据库引擎的实际情况以及为什么你对数据库的选择很重要是有帮助的。本文向你介绍 SQLite 和 `sqlite3` 命令,以便你熟悉该数据库如何处理数据的基础知识。
|
||||
|
||||
### 与 SQLite 交互
|
||||
|
||||
你可以使用 `sqlite3` 命令与 SQLite 进行交互。 该命令提供了一个交互式的 shell 程序,以便你可以查看和更新数据库。
|
||||
|
||||
```
|
||||
$ sqlite3
|
||||
SQLite version 3.34.0 2020-12-01 16:14:00
|
||||
Enter ".help" for usage hints.
|
||||
Connected to a transient in-memory database.
|
||||
Use ".open FILENAME" to reopen on a persistent database.
|
||||
sqlite>
|
||||
```
|
||||
|
||||
该命令将使你处于 SQLite 的子 shell 中,因此现在的提示符是 SQLite 的提示符。你以前使用的 Bash 命令在这里将不再适用。你必须使用 SQLite 命令。要查看 SQLite 命令列表,请输入 `.help`:
|
||||
|
||||
```
|
||||
sqlite> .help
|
||||
.archive ... Manage SQL archives
|
||||
.auth ON|OFF SHOW authorizer callbacks
|
||||
.backup ?DB? FILE Backup DB (DEFAULT "main") TO FILE
|
||||
.bail ON|off Stop after hitting an error. DEFAULT OFF
|
||||
.binary ON|off Turn BINARY output ON OR off. DEFAULT OFF
|
||||
.cd DIRECTORY CHANGE the working directory TO DIRECTORY
|
||||
[...]
|
||||
```
|
||||
|
||||
这些命令中的其中一些是二进制的,而其他一些则需要唯一的参数(如文件名、路径等)。这些是 SQLite Shell 的管理命令,不是用于数据库查询。数据库以结构化查询语言(SQL)进行查询,许多 SQLite 查询与你从 [MySQL][8] 和 [MariaDB][9] 数据库中已经知道的查询相同。但是,数据类型和函数有所不同,因此,如果你熟悉另一个数据库,请特别注意细微的差异。
|
||||
|
||||
### 创建数据库
|
||||
|
||||
启动 SQLite 时,可以打开内存数据库,也可以选择要打开的数据库:
|
||||
|
||||
```
|
||||
$ sqlite3 mydatabase.db
|
||||
```
|
||||
|
||||
如果还没有数据库,则可以在 SQLite 提示符下创建一个数据库:
|
||||
|
||||
```
|
||||
sqlite> .open mydatabase.db
|
||||
```
|
||||
|
||||
现在,你的硬盘驱动器上有一个空文件,可以用作 SQLite 数据库。 文件扩展名 `.db` 是任意的。你也可以使用 `.sqlite` 或任何你想要的后缀。
|
||||
|
||||
### 创建一个表
|
||||
|
||||
数据库包含一些<ruby>表<rt>table</rt></ruby>,可以将其可视化为电子表格。有许多的行(在数据库中称为<ruby>记录<rt>record</rt></ruby>)和列。行和列的交集称为<ruby>字段<rt>field</rt></ruby>。
|
||||
|
||||
结构化查询语言(SQL)以其提供的内容而命名:一种以可预测且一致的语法查询数据库内容以接收有用的结果的方法。SQL 读起来很像普通的英语句子,即使有点机械化。当前,你的数据库是一个没有任何表的空数据库。
|
||||
|
||||
你可以使用 `CREATE` 来创建一个新表,你可以和 `IF NOT EXISTS` 结合使用。以便不会破坏现在已有的同名的表。
|
||||
|
||||
你无法在 SQLite 中创建一个没有任何字段的空表,因此在尝试 `CREATE` 语句之前,必须考虑预期表将存储的数据类型。在此示例中,我将使用以下列创建一个名为 `member` 的表:
|
||||
|
||||
* 唯一标识符
|
||||
* 人名
|
||||
* 记录创建的时间和日期
|
||||
|
||||
#### 唯一标识符
|
||||
|
||||
最好用唯一的编号来引用记录,幸运的是,SQLite 认识到这一点,创建一个名叫 `rowid` 的列来为你自动实现这一点。
|
||||
|
||||
无需 SQL 语句即可创建此字段。
|
||||
|
||||
#### 数据类型
|
||||
|
||||
对于我的示例表中,我正在创建一个 `name` 列来保存 `TEXT` 类型的数据。为了防止在没有指定字段数据的情况下创建记录,可以添加 `NOT NULL` 指令。
|
||||
|
||||
用 `name TEXT NOT NULL` 语句来创建。
|
||||
|
||||
SQLite 中有五种数据类型(实际上是 _储存类别_):
|
||||
|
||||
* `TEXT`:文本字符串
|
||||
* `INTEGER`:一个数字
|
||||
* `REAL`:一个浮点数(小数位数无限制)
|
||||
* `BLOB`:二进制数据(例如,.jpeg 或 .webp 图像)
|
||||
* `NULL`:空值
|
||||
|
||||
#### 日期和时间戳
|
||||
|
||||
SQLite 有一个方便的日期和时间戳功能。它本身不是数据类型,而是 SQLite 中的一个函数,它根据所需的格式生成字符串或整数。 在此示例中,我将其保留为默认值。
|
||||
|
||||
创建此字段的 SQL 语句是:`datestamp DATETIME DEFAULT CURRENT_TIMESTAMP`。
|
||||
|
||||
### 创建表的语句
|
||||
|
||||
在 SQLite 中创建此示例表的完整 SQL:
|
||||
|
||||
```
|
||||
sqlite> CREATE TABLE
|
||||
...> IF NOT EXISTS
|
||||
...> member (name TEXT NOT NULL,
|
||||
...> datestamp DATETIME DEFAULT CURRENT_TIMESTAMP);
|
||||
```
|
||||
|
||||
在此代码示例中,我在语句的分句后按了回车键。以使其更易于阅读。除非以分号(`;`)终止,否则 SQLite 不会运行你的 SQL 语句。
|
||||
|
||||
你可以使用 SQLite 命令 `.tables` 验证表是否已创建:
|
||||
|
||||
```
|
||||
sqlite> .tables
|
||||
member
|
||||
```
|
||||
|
||||
### 查看表中的所有列
|
||||
|
||||
你可以使用 `PRAGMA` 语句验证表包含哪些列和行:
|
||||
|
||||
```
|
||||
sqlite> PRAGMA table_info(member);
|
||||
0|name|TEXT|1||0
|
||||
1|datestamp|DATETIME|0|CURRENT_TIMESTAMP|0
|
||||
```
|
||||
|
||||
### 数据输入
|
||||
|
||||
你可以使用 `INSERT` 语句将一些示例数据填充到表中:
|
||||
|
||||
```
|
||||
> INSERT INTO member (name) VALUES ('Alice');
|
||||
> INSERT INTO member (name) VALUES ('Bob');
|
||||
> INSERT INTO member (name) VALUES ('Carol');
|
||||
> INSERT INTO member (name) VALUES ('David');
|
||||
```
|
||||
|
||||
查看表中的数据:
|
||||
|
||||
```
|
||||
> SELECT * FROM member;
|
||||
Alice|2020-12-15 22:39:00
|
||||
Bob|2020-12-15 22:39:02
|
||||
Carol|2020-12-15 22:39:05
|
||||
David|2020-12-15 22:39:07
|
||||
```
|
||||
|
||||
#### 添加多行数据
|
||||
|
||||
现在创建第二个表:
|
||||
|
||||
```
|
||||
> CREATE TABLE IF NOT EXISTS linux (
|
||||
...> distro TEXT NOT NULL);
|
||||
```
|
||||
|
||||
填充一些示例数据,这一次使用小的 `VALUES` 快捷方式,因此你可以在一个命令中添加多行。关键字 `VALUES` 期望以括号形式列出列表,而用多个逗号分隔多个列表:
|
||||
|
||||
```
|
||||
> INSERT INTO linux (distro)
|
||||
...> VALUES ('Slackware'), ('RHEL'),
|
||||
...> ('Fedora'),('Debian');
|
||||
```
|
||||
|
||||
### 修改表结构
|
||||
|
||||
你现在有两个表,但是到目前为止,两者之间没有任何关系。它们每个都包含独立的数据,但是可能你可能需要将第一个表的成员与第二个表中列出的特定项相关联。
|
||||
|
||||
为此,你可以为第一个表创建一个新列,该列对应于第二个表。由于两个表都设计有唯一标识符(这要归功于 SQLite 的自动创建),所以连接它们的最简单方法是将其中一个的 `rowid` 字段用作另一个的选择器。
|
||||
|
||||
在第一个表中创建一个新列,以存储第二个表中的值:
|
||||
|
||||
```
|
||||
> ALTER TABLE member ADD os INT;
|
||||
```
|
||||
|
||||
使用 `linux` 表中的唯一标识符作为 `member` 表中每一条记录中 `os` 字段的值。因为记录已经存在。因此你可以使用 `UPDATE` 语句而不是使用 `INSERT` 语句来更新数据。需要特别注意的是,你首先需要选中特定的一行来然后才能更新其中的某个字段。从句法上讲,这有点相反,更新首先发生,选择匹配最后发生:
|
||||
|
||||
```
|
||||
> UPDATE member SET os=1 WHERE name='Alice';
|
||||
```
|
||||
|
||||
对 `member` 表中的其他行重复相同的过程。更新 `os` 字段,为了数据多样性,在四行记录上分配三种不同的发行版(其中一种加倍)。
|
||||
|
||||
### 联接表
|
||||
|
||||
现在,这两个表相互关联,你可以使用 SQL 显示关联的数据。数据库中有多种 _联接方式_,但是一旦掌握了基础知识,就可以尝试所有的联接形式。这是一个基本联接,用于将 `member` 表的 `os` 字段中的值与 linux 表的 `rowid` 字段相关联:
|
||||
|
||||
```
|
||||
> SELECT * FROM member INNER JOIN linux ON member.os=linux.rowid;
|
||||
Alice|2020-12-15 22:39:00|1|Slackware
|
||||
Bob|2020-12-15 22:39:02|3|Fedora
|
||||
Carol|2020-12-15 22:39:05|3|Fedora
|
||||
David|2020-12-15 22:39:07|4|Debian
|
||||
```
|
||||
|
||||
`os` 和 `rowid` 字段形成了关联。
|
||||
|
||||
在一个图形应用程序中,你可以想象 `os` 字段是一个下拉选项菜单,其中的值是 `linux` 表中 `distro` 字段中的数据。将相关的数据集通过唯一的字段相关联,可以确保数据的一致性和有效性,并且借助 SQL,你可以在以后动态地关联它们。
|
||||
|
||||
### 了解更多
|
||||
|
||||
SQLite 是一个非常有用的自包含的、可移植的开源数据库。学习以交互方式使用它是迈向针对 Web 应用程序进行管理或通过编程语言库使用它的重要的第一步。
|
||||
|
||||
如果你喜欢 SQLite,也可以尝试由同一位作者 Richard Hipp 博士的 [Fossil][10]。
|
||||
|
||||
在学习和使用 SQLite 时,有一些常用命令可能会有所帮助,所以请立即下载我们的 [SQLite3 备忘单][3]!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/sqlite3-cheat-sheet
|
||||
|
||||
作者:[Klaatu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[amwps290](https://github.com/amwps290)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/klaatu
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP "Cheat Sheet cover image"
|
||||
[2]: https://www.redhat.com/sysadmin/yaml-beginners
|
||||
[3]: https://opensource.com/downloads/sqlite-cheat-sheet
|
||||
[4]: https://sqlite.org/copyright.html
|
||||
[5]: https://directory.fsf.org/wiki/License:PublicDomain
|
||||
[6]: https://www.sqlite.org/purchase/license?
|
||||
[7]: https://www.sqlite.org/download.html
|
||||
[8]: https://www.mysql.com/
|
||||
[9]: https://mariadb.org/
|
||||
[10]: https://opensource.com/article/20/11/fossil
|
@ -0,0 +1,124 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (18 ways to differentiate open source products from upstream suppliers)
|
||||
[#]: via: (https://opensource.com/article/21/2/differentiating-products-upstream-suppliers)
|
||||
[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux)
|
||||
|
||||
18 ways to differentiate open source products from upstream suppliers
|
||||
======
|
||||
Open source products must create enough differentiated value that
|
||||
customers will voluntarily pay for them versus another (or free)
|
||||
product.
|
||||
![Tips and gears turning][1]
|
||||
|
||||
In the first three parts of this series, I explored [open source as a supply chain][2], [what a product is][3], and [what product managers do][4]. In this fourth article, I'll look at a plethora of methods to differentiate open source software products from their upstream open source projects.
|
||||
|
||||
Since open source projects are essentially information products, these methods are likely to apply to many information-related products (think YouTube creators) that have a component of value given away for free. Product managers have to get creative when the information and material to build your product is freely available to users.
|
||||
|
||||
### Creating and capturing value
|
||||
|
||||
Product managers are responsible for creating solutions that attract and retain customers. To create a customer, they must provide value in exchange for money. Like a good salesperson, a product manager should never feel guilty about charging for their product (see [_How to sell an open source product_][5] by John Mark Walker).
|
||||
|
||||
Products built on open source are fundamentally no different than any other products or service. They must create value for customers. In fact, they must create enough value that customers will voluntarily pay a price that is sufficient to pay for the development costs and return a profit. These products must also be differentiated from competing products and services, as well as upstream projects.
|
||||
|
||||
![Inputs for creating value][6]
|
||||
|
||||
(Scott McCarty, [CC BY-SA 4.0][7])
|
||||
|
||||
While products built on open source software are not fundamentally different from other products and services, there are some differences. First, some of the development costs are defrayed among all open source contributors. These costs can include code, testing, documentation, hardware, project hosting costs, etc. But even when development costs are defrayed in open source, costs are incurred by the vendor that productizes the code. These can include employee costs for research, analysis, security, performance testing, certification processes (e.g., collaborating with hardware vendors, cloud providers, etc.), and of course, sales and marketing.
|
||||
|
||||
![Inputs for solving market problems][8]
|
||||
|
||||
(Scott McCarty, [CC BY-SA 4.0][7])
|
||||
|
||||
Successful open source products must be able to charge a cost that is sufficient to pay for the defrayed upstream open source contributions (development costs) and the downstream productization costs (vendor costs). Stated another way, products can only charge a sufficient price if they create value that can only be captured by customers paying for them. That might sound harsh, but it's a reality for all products. There's a saying in product management: Pray to pay doesn't work. With that said, don't be too worried. There are ethical ways to capture value.
|
||||
|
||||
### Types of value
|
||||
|
||||
Fundamentally, there are two types of value: proprietary and non-proprietary. Proprietary is a bad word in open source software, but an attractive word in manufacturing, finance, and other industries. Many financial companies will highlight their proprietary algorithms and the same with drug companies and manufacturing processes. In software, proprietary value is often thought to be completely incongruous with free and open source software. People often assume proprietary value is a binary decision. It’s difficult for people to imagine proprietary value in the context of open source software without being artificially constrained by a license. However, as we’ll attempt to demonstrate, it’s not so clear cut.
|
||||
|
||||
From an open source product management perspective, you can define proprietary value as anything that would be very difficult or nearly impossible for the customer to recreate themselves—or something the potential customer doesn't believe they can recreate. Commodity value is the opposite of proprietary. Commodity value is value the customer believes they could construct (or reconstruct) given enough time and money.
|
||||
|
||||
Reconstructing commodity value instead of purchasing it makes sense only if it's cheaper or easier than buying a product. Stated another way, a good product should save a customer money compared to building the solution themselves. It's in this cost gap that open source products exist and thrive.
|
||||
|
||||
With products built, or mostly built, on an open source supply chain, customers retain the "build versus buy" decision and can stop paying at any time. This is often true with open core products as well. As long as the majority of the supply chain is open source, the customer likely could rebuild a few components to get what they need. The open source product manager's job is the same as for any other product or service: to create and retain customers by providing value worth paying for.
|
||||
|
||||
### Differentiators for open source product managers
|
||||
|
||||
Like any artist, a product manager traffics in value as their medium. They must price and package their product. They must constantly strive to differentiate their product against competitors in the marketplace and the upstream projects that are suppliers to that product. However, the supply chain is but one tool a product manager can use to differentiate and create a customer.
|
||||
|
||||
This is a less-than-exhaustive list that should give you some ideas about how product managers can differentiate their products and create value. As you read through the list, think deeply about whether a customer could recreate the value of each given enough time, money, and willpower.
|
||||
|
||||
* **Supply chain:** Selecting the upstream suppliers is important. The upstream community's health is a selling point over products based on competing upstream projects. A perfect example of this kind of differentiation is with products such as OpenShift, Docker EE, and Mesosphere, which respectively rely on Kubernetes, Swarm, and Apache Mesos as upstream suppliers. Similar to how electric cars are replacing gasoline engines, the choice of technology and its supplier provide differentiation.
|
||||
|
||||
* **Quality engineering:** Upstream continuous integration and continuous delivery (CI/CD) and user testing are wonderful bases for building a product. However, it's critical to ensure that the downstream product, often made up of multiple upstream projects, works well together with specific versions of all the components. Testing the entire solution together applies as much to differentiating from upstream suppliers as it does from competitive products. Customers want products that just work.
|
||||
|
||||
* **Industry certifications:** Specific classes of customers, such as government, financial services, transportation, manufacturing, and telecom, often have certification requirements. Typically, these are related to security or auditing and are often quite expensive. Certifications are great because they differentiate the product from competitors and upstream.
|
||||
|
||||
* **Hardware or cloud provider certifications:** The dirty secret of cheap hardware is that it changes all the time. Often this hardware has new capabilities with varying levels of maturity. Hardware certifications provide a level of confidence that the software will run well on a specific piece of hardware or cloud virtual machine. They also provide a level of assurance that the product company and the platform on which it is certified to run are committing to make it work well together. A potential customer could always vet hardware themselves, but they often don't have deep relationships with hardware vendors and cloud providers, making it difficult to demand fixes and patches.
|
||||
|
||||
* **Ecosystem:** This represents access to a plethora of add-on solutions from third-party vendors. Again, the ecosystem provides some assurance that all the entities work together to make things work well. Small companies would likely find it difficult or impossible to demand that individual software vendors certify their privately built platforms. Integrations like these are usually quite expensive for an individual user and are best defrayed across a product's customers.
|
||||
|
||||
* **Lifecycle:** Upstream projects are great because they move quickly and innovate. But many different versions of many different upstream projects can go into a single product's supply chain. Ensuring that all the versions of the different upstream projects work together over a given lifecycle is a lot of work. A longer lifecycle gives customers time to get a return on investment. Stated another way, users spend a lot of time and money planning and rolling out software. A product's lifecycle commitment ensures that customers can use the software and receive value from their investment for a reasonable amount of time.
|
||||
|
||||
* **Packaging and distribution:** Once a vendor commits to supporting a product for a given lifecycle (e.g., five years), they must also commit to providing packaging and distribution during that time. Both products and cloud services need to provide customers the ability to plan a roadmap, execute a rollout, and expand over the desired lifecycle, so packages or services need to remain available for customer use.
|
||||
|
||||
* **Documentation:** This is often overlooked by both open source projects and vendors. Aligning product documentation to the product lifecycle, versus the upstream supplier documentation, is extremely important. It's also important to document the entire solution working together, whether that's installation or use cases for end users. It's beneficial for customers to have documentation that applies to the specific combination of components they are using.
|
||||
|
||||
* **Security:** Closely related to the product lifecycle, vendors must commit to providing security during the time the product is supported. This includes analyzing code, scoring vulnerabilities, patching those vulnerabilities, and verifying that they are patched. This is a particularly opportune area for products to differentiate themselves from upstream suppliers. It really is value creation through data.
|
||||
|
||||
* **Performance:** Also closely related to product lifecycle, vendors must commit to providing performance testing, tuning recommendations, and sometimes even backporting performance improvements during the product's lifecycle. This is another opportune area for products.
|
||||
|
||||
* **Indemnification:** This is essentially insurance in case the company using the software is sued by a patent troll. Often, the corporate legal team just won't have the skill set needed to defend themselves. While potential customers could pay a third party for legal services, would they know the software as well?
|
||||
|
||||
* **Compute resources:** You simply can't get access to compute resources without paying for them. There are free trials, but sustained usage always requires paying, either through a cloud provider or by buying hardware. In fact, this is one of the main differentiated values provided by infrastructure as a service (IaaS) and software as a service (SaaS) cloud providers. This is quite differentiated from upstream suppliers because they will never have the budget to provide free compute, storage, and network.
|
||||
|
||||
* **Consulting:** Access to operational knowledge to set up and use the software may be a differentiator. Clearly, a company can hire the talent, given enough budget and willpower, but talent can be difficult to find. In fact, one might argue that software vendors have a much better chance of attracting the top talent, essentially creating a talent vacuum for users trying to reconstruct the value themselves.
|
||||
|
||||
* **Training:** Similar to consulting, the company that wrote, configured, released, and operated the software at scale often knows how to use it best. Again, a customer could hire the talent given enough budget and willpower.
|
||||
|
||||
* **Operational knowledge:** IaaS and SaaS solutions often provide this kind of value. Similarly, knowledge bases and connected experiences that analyze an installed environment's configuration to provide the user with insights (e.g., OpenShift, Red Hat Insights) can provide this value. Operational knowledge is similar to training and consulting.
|
||||
|
||||
* **Support:** This includes the ability to call for help or file support tickets and is similar to training, consulting, and operational knowledge. Support is often a crutch for open source product managers; again, customers can often recreate their own support organizations, depending on where they want to strategically invest budget and people, especially for level one and level two support. Level three support (e.g., kernel programmers) might be harder to hire.
|
||||
|
||||
* **Proprietary code:** This is code that's not released under an open source license. A customer could always build a software development team and augment the open core code with the missing features they need. For the vendor, proprietary code has the downside of creating an unnatural competition between the upstream open source supplier and the downstream product. Furthermore, this unnatural split between open source and proprietary code does not provide the customer more value. It always feels like value is being unnaturally held back. I would argue that this is a very suboptimal form of value capture.
|
||||
|
||||
* **Brand:** Brand equity is not easily measurable. It really comes down to a general level of trust. The customer needs to believe that the solution provider can and will help them when they need it. It's slow to build a brand and easy to lose it. Careful thought might reveal that the same is true with internal support organizations in a company. Users will quickly lose trust in internal support organizations, and it can take years to build it back up.
|
||||
|
||||
|
||||
|
||||
|
||||
Reading through the list, do you think a potential customer could recreate the value of almost any of these items? The answer is almost assuredly yes. This is true with almost any product feature or capability, whether it's open source or even proprietary. Cloud providers build their own CPUs and hardware, and delivery companies (e.g., UPS, Amazon, etc.) sometimes build their own vehicles. Whether it makes sense to build or buy all depends on the business and its specific needs.
|
||||
|
||||
### Add value in the right places
|
||||
|
||||
The open source licensing model led to an explosion in the availability of components that can be assembled into a software product. Stated another way, it formed a huge supply chain of software. Product managers can create products from a completely open source supply chain (e.g., Red Hat, Chef, SUSE, etc.), or mix and match open source and proprietary technology (e.g., open core like Sourcefire or SugarCRM). Choosing a fully open source versus open core methodology should not be confused with solving a business problem. Customers only buy products that solve their problems.
|
||||
|
||||
Enterprise open source products are solutions to problems, much like a vehicle sold by an auto manufacturer. The product manager for an open source product determines the requirements, things like the lifecycle (number of years), security (important certifications), performance (important workloads), and ecosystem (partners). Some of these requirements can be met by upstream suppliers (open source projects); some cannot.
|
||||
|
||||
An open source product is a composition of value consumed through a supply chain of upstream vendors and new value added by the company creating it. This new value combined with the consumed value is often worth more together and sold at a premium. It's the responsibility of product teams (including engineering, quality, performance, security, legal, etc.) to add new value in the right places, at the right times, to make their open source products worth the price customers pay versus building out the infrastructure necessary to assemble, maintain, and support the upstream components themselves.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/differentiating-products-upstream-suppliers
|
||||
|
||||
作者:[Scott McCarty][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/fatherlinux
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/gears_devops_learn_troubleshooting_lightbulb_tips_520.png?itok=HcN38NOk (Tips and gears turning)
|
||||
[2]: https://opensource.com/article/20/10/open-source-supply-chain
|
||||
[3]: https://opensource.com/article/20/10/defining-product-open-source
|
||||
[4]: https://opensource.com/article/20/11/open-source-product-teams
|
||||
[5]: https://opensource.com/article/20/6/sell-open-source-software
|
||||
[6]: https://opensource.com/sites/default/files/uploads/creatingvalue1.png (Inputs for creating value)
|
||||
[7]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[8]: https://opensource.com/sites/default/files/uploads/creatingvalue2.png (Inputs for solving market problems)
|
128
sources/talk/20210212 How to adopt DevSecOps successfully.md
Normal file
128
sources/talk/20210212 How to adopt DevSecOps successfully.md
Normal file
@ -0,0 +1,128 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to adopt DevSecOps successfully)
|
||||
[#]: via: (https://opensource.com/article/21/2/devsecops)
|
||||
[#]: author: (Mike Calizo https://opensource.com/users/mcalizo)
|
||||
|
||||
How to adopt DevSecOps successfully
|
||||
======
|
||||
Integrating security throughout the software development lifecycle is
|
||||
important, but it's not always easy.
|
||||
![Target practice][1]
|
||||
|
||||
Adopting [DevOps][2] can help an organization transform and speed how its software is delivered, tested, and deployed to production. This is the well-known "DevOps promise" that has led to such a large surge in adoption.
|
||||
|
||||
We've all heard about the many successful DevOps implementations that changed how an organization approaches software innovation, making it fast and secure through agile delivery to get [ahead of competitors][3]. This is where we see DevOps' promises achieved and delivered.
|
||||
|
||||
But on the flipside, some DevOps adoptions cause more issues than benefits. This is the DevOps dilemma where DevOps fails to deliver on its promises.
|
||||
|
||||
There are many factors involved in an unsuccessful DevOps implementation, and a major one is security. A poor security culture usually happens when security is left to the end of the DevOps adoption process. Applying existing security processes to DevOps can delay projects, cause frustrations within the team, and create financial impacts that can derail a project.
|
||||
|
||||
[DevSecOps][4] was designed to avoid this very situation. Its purpose "is to build on the mindset that 'everyone is responsible for security…'" It also makes security a consideration at all levels of DevOps adoption.
|
||||
|
||||
### The DevSecOps process
|
||||
|
||||
Before DevOps and DevSecOps, the app security process looked something like the image below. Security came late in the software delivery process, after the software was accepted for production.
|
||||
|
||||
![Old software development process with security at the end][5]
|
||||
|
||||
(Michael Calizo, [CC BY-SA 4.0][6])
|
||||
|
||||
Depending on the organization's security profile and risk appetite, the application might even bypass security reviews and processes during acceptance. At that point, the security review becomes an audit exercise to avoid unnecessary project delays.
|
||||
|
||||
![Security as audit in software development][7]
|
||||
|
||||
(Michael Calizo, [CC BY-SA 4.0][6])
|
||||
|
||||
The DevSecOps [manifesto][8] says that the reason to integrate security into dev and ops at all levels is to implement security with less friction, foster innovation, and make sure security and data privacy are not left behind.
|
||||
|
||||
Therefore, DevSecOps encourages security practitioners to adapt and change their old, existing security processes and procedures. This may be sound easy, but changing processes, behavior, and culture is always difficult, especially in large environments.
|
||||
|
||||
The DevSecOps principle's basic requirement is to introduce a security culture and mindset across the entire application development and deployment process. This means old security practices must be replaced by more agile and flexible methods so that security can iterate and adapt to the fast-changing environment. According to the DevSecOps manifesto, security needs to "operate like developers to make security and compliance available to be consumed as services."
|
||||
|
||||
DevSecOps should look like the figure below, where security is embedded across the delivery cycle and can iterate every time there is a need for change or adjustment.
|
||||
|
||||
![DevSecOps considers security throughout development][9]
|
||||
|
||||
(Michael Calizo, [CC BY-SA 4.0][6])
|
||||
|
||||
### Common DevSecOps obstacles
|
||||
|
||||
Any time changes are introduced, people find faults or issues with the new process. This is natural human behavior. The fear and inconvenience associated with learning new things are always met with adverse reactions; after all, humans are creatures of habit.
|
||||
|
||||
Some common obstacles in DevSecOps adoption include:
|
||||
|
||||
* **Vendor-defined DevOps/DevSecOps:** This means principles and processes are focused on product offerings, and the organization won't be able to build the approach. Instead, they will be limited to what the vendor provides.
|
||||
* **Nervous people managers:** The fear of losing control is a real problem when change happens. Often, anxiety affects people managers' decision-making.
|
||||
* **If ain't broke, don't fix it:** This is a common mindset, and you really can't blame people for thinking this way. But the idea that the old way will survive despite new ways of delivering software and solutions must be challenged. To adapt to the agile application lifecycle, you need to change the processes to support the speed and agility it requires.
|
||||
* **The Netflix and Uber effect:** Everybody knows that Netflix and Uber have successfully implemented DevSecOps; therefore, many organizations want to emulate them. Because they have a different culture than your organization, simply emulating them won't work.
|
||||
* **Lack of measurement:** DevOps and DevSecOps transformation must be measured against set goals. Metrics might include software delivery performance or overall organization performance over time.
|
||||
* **Checklist-driven security:** By using a checklist, the security team follows the same old, static, and inflexible processes that are neither useful nor applicable to modern technologies that developers use to make software delivery lean and agile. The introduction of the "[as code][10]" approach requires security people to learn how to code.
|
||||
* **Security as a special team:** This is especially true in organizations transitioning from the old ways of delivering software, where security is a separate entity, to DevOps. Because of the separations, trust is questionable among devs, ops, and security. This will cause the security team to spend unnecessary time reviewing and governing DevOps processes and building pipelines instead of working closely with developers and ops teams to improve the software delivery flow.
|
||||
|
||||
|
||||
|
||||
### How to adopt DevSecOps successfully
|
||||
|
||||
Adopting DevSecOps is not easy, but being aware of common obstacles and challenges is key to your success.
|
||||
|
||||
Clearly, the biggest and most important change an organization needs to make is its culture. Cultural change usually requires executive buy-in, as a top-down approach is necessary to convince people to make a successful turnaround. You might hope that executive buy-in makes cultural change follow naturally, but don't expect smooth sailing—executive buy-in alone is not enough.
|
||||
|
||||
To help accelerate cultural change, the organization needs leaders and enthusiasts that will become agents of change. Embed these people in the dev, ops, and security teams to serve as advocates and champions for culture change. This will also establish a cross-functional team that will share successes and learnings with other teams to encourage wider adoption.
|
||||
|
||||
Once that is underway, the organization needs a DevSecOps use-case to start with, something small with a high potential for success. This enables the team to learn, fail, and succeed without affecting the organization's core business.
|
||||
|
||||
The next step is to identify and agree on the definition of success. The DevSecOps adoption needs to be measurable; to do that, you need a dashboard that shows metrics such as:
|
||||
|
||||
* Lead time for a change
|
||||
* Deployment frequency
|
||||
* Mean time to restore
|
||||
* Change failure
|
||||
|
||||
|
||||
|
||||
These metrics are a critical requirement to be able to identify processes and other things that require improvement. It's also a tool to declare if an adoption is a win or a bust. This methodology is called [event-driven transformation][11].
|
||||
|
||||
### Conclusion
|
||||
|
||||
When implemented properly, DevOps enables an organization to deliver software to production quickly and gain advantages over competitors. DevOps allows it to fail small and recover faster by enabling flexibility and efficiency to go to market early.
|
||||
|
||||
In summary, DevOps and DevSecOps adoption needs:
|
||||
|
||||
* Cultural change
|
||||
* Executive buy-in
|
||||
* Leaders and enthusiasts to act as evangelists
|
||||
* Cross-functional teams
|
||||
* Measurable indicators
|
||||
|
||||
|
||||
|
||||
Ultimately, the solution to the DevSecOps dilemma relies on cultural change to make the organization better.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/devsecops
|
||||
|
||||
作者:[Mike Calizo][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/mcalizo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/target-security.png?itok=Ca5-F6GW (Target practice)
|
||||
[2]: https://opensource.com/resources/devops
|
||||
[3]: https://www.imd.org/research-knowledge/articles/the-battle-for-digital-disruption-startups-vs-incumbents/
|
||||
[4]: http://www.devsecops.org/blog/2015/2/15/what-is-devsecops
|
||||
[5]: https://opensource.com/sites/default/files/uploads/devsecops_old-process.png (Old software development process with security at the end)
|
||||
[6]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[7]: https://opensource.com/sites/default/files/uploads/devsecops_security-as-audit.png (Security as audit in software development)
|
||||
[8]: https://www.devsecops.org/
|
||||
[9]: https://opensource.com/sites/default/files/uploads/devsecops_process.png (DevSecOps considers security throughout development)
|
||||
[10]: https://www.oreilly.com/library/view/devopssec/9781491971413/ch04.html
|
||||
[11]: https://www.openshift.com/blog/exploring-a-metrics-driven-approach-to-transformation
|
102
sources/talk/20210213 5 reasons why I love coding on Linux.md
Normal file
102
sources/talk/20210213 5 reasons why I love coding on Linux.md
Normal file
@ -0,0 +1,102 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (5 reasons why I love coding on Linux)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-programming)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
5 reasons why I love coding on Linux
|
||||
======
|
||||
Linux is a great platform for programming—it's logical, easy to see the
|
||||
source code, and very efficient.
|
||||
![Terminal command prompt on orange background][1]
|
||||
|
||||
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different ways to use Linux. Here I'll explain why so many programmers choose Linux.
|
||||
|
||||
When I first started using Linux, it was for its excellent multimedia support because I worked in film production. We found that the typical proprietary video editing applications couldn't handle most of the footage we were pulling from pretty much any device that could record an image. At the time, I wasn't aware that Linux had a reputation as an operating system for servers and programmers. The more I did on Linux, the more I wanted to control every aspect of it. And in the end, I discovered that a computer was at its most powerful when its user could "speak" its language. Within a few years of switching to Linux, I was scripting unattended video edits, stringing together audio files, bulk editing photos, and anything else I could imagine and then invent a solution for. It didn't take long for me to understand why programmers loved Linux, but it was Linux that taught me to love programming.
|
||||
|
||||
It turns out that Linux is an excellent platform for programmers, both new and experienced. It's not that you _need_ Linux to program. There are successful developers on all different kinds of platforms. However, Linux has much to offer developers. Here are a few things I've found useful.
|
||||
|
||||
### Foundations of logic
|
||||
|
||||
Linux is built around [automation][2]. It's very intentional that staple applications on Linux can at the very least launch from a terminal with additional options, and often they can even be used entirely from the terminal. This idea is sometimes mistaken as a primitive computing model because people mistakenly believe that writing software that operates from a terminal is just doing the bare minimum to get a working application. This is an unfortunate misunderstanding of how code works, but it's something many of us are guilty of from time to time. We think _more_ is always better, so an application containing 1,000 lines of code must be 100 times better than one with ten lines of code, right? The truth is that all things being equal, the application with greater flexibility is preferable, regardless of how that translates to lines of code.
|
||||
|
||||
On Linux, a process that might take you an hour when done manually can literally be reduced to one minute with the right terminal command, and possibly less when parsed out to [GNU Parallel][3]. This phenomenon requires a shift in how you think about what a computer does. For instance, if your task is to add a cover image to 30 PDF files, you might think this is a sensible workflow:
|
||||
|
||||
1. Open a PDF in a PDF editor
|
||||
2. Open the front cover
|
||||
3. Append a PDF to the end of the cover file
|
||||
4. Save the file as a new PDF
|
||||
5. Repeat this process for each old PDF (but do not duplicate this process for each new PDF)
|
||||
|
||||
|
||||
|
||||
It's mostly common sense stuff, and while it's painfully repetitive, it does get the job done. On Linux, however, you're able to work smarter than that. The thought process is similar: First, you devise the steps required for a successful result. After some research, you'd find out about the `pdftk-java` command, and you'd discover a simple solution:
|
||||
|
||||
|
||||
```
|
||||
$ pdftk A=cover.pdf B=document_1.pdf \
|
||||
cat A B \
|
||||
output doc+cover_1.pdf
|
||||
```
|
||||
|
||||
Once you've proven to yourself that the command works on one document, you take time to learn about looping options, and you settle on a parallel operation:
|
||||
|
||||
|
||||
```
|
||||
$ find ~/docs/ -name "*.pdf" | \
|
||||
parallel pdftk A=cover.pdf B={} \
|
||||
cat A B \
|
||||
output {.}.cover.pdf
|
||||
```
|
||||
|
||||
It's a slightly different way of thinking because the "code" you write processes data differently than the enforced linearity you're used to. However, getting out of your old linear way of thinking is important for writing actual code later, and it has the side benefit of empowering you to compute smarter.
|
||||
|
||||
### Code connections
|
||||
|
||||
No matter what platform you're programming for when you write code, you're weaving an intricate latticework of invisible connections between many different files. In all but the rarest cases, code draws from headers and relies on external libraries to become a complete program. This happens on any platform, but Linux tends to encourage you to understand this for yourself, rather than blindly trusting the platform's development kit to take care of it for you.
|
||||
|
||||
Now, there's nothing wrong with trusting a development kit to resolve _library_ and _include_ paths. On the contrary, that kind of abstraction is a luxury you should enjoy. However, if you never understand what's happening, then it's a lot harder to override the process when you need to do something that a dev kit doesn't know about or to troubleshoot problems when they arise.
|
||||
|
||||
This translates across platforms, too. You can develop code on Linux that you intend to run on Linux as well as other operating systems, and your understanding of how code compiles helps you hit your targets.
|
||||
|
||||
Admittedly, you don't learn these lessons just by using Linux. It's entirely possible to blissfully code in a good IDE and never give a thought to what version of a library you have installed or where the development headers are located. However, Linux doesn't hide anything from you. It's easy to dig down into the system, locate the important parts, and read the code they contain.
|
||||
|
||||
### Existing code
|
||||
|
||||
Knowing where headers and libraries are located is useful, but having them to reference is yet another added bonus to programming on Linux. On Linux, you get to see the source code of basically anything you want (excluding applications that aren't open source but that run on Linux). The benefit here cannot be overstated. As you learn more about programming in general or about programming something new to you, you can learn a lot by referring to existing code on your Linux system. Many programmers have learned how to code by reading other people's open source code.
|
||||
|
||||
On proprietary systems, you might find developer documentation with code samples in it. That's great because documentation is important, but it pales in comparison to locating the exact functionality you want to implement and then finding the source code demonstrating how it was done in an application you use every day.
|
||||
|
||||
### Direct access to peripherals
|
||||
|
||||
Something I often took for granted after developing code for media companies using Linux is access to peripherals. For instance, when connecting a video camera to Linux, you can pull incoming data from **/dev/video0** or similar. Everything's in **/dev**, and it's always the shortest path between two points to get there.
|
||||
|
||||
That's not the case on other platforms. Connecting to systems outside of the operating system is often a maze of SDKs, restricted libraries, and sometimes NDAs. This, of course, varies depending on what you're programming for, but it's hard to beat Linux's simple and predictable interface.
|
||||
|
||||
### Abstraction layers
|
||||
|
||||
Conversely, Linux also provides a healthy set of abstraction layers for when direct access or manual coding ends up creating more work than you want to do. There are conveniences found in Qt and Java, and there are whole stacks like Pulse Audio, Pipewire, and gstreamer. Linux _wants_ you to be able to code, and it shows.
|
||||
|
||||
### Add to this list
|
||||
|
||||
There are more reasons that make coding on Linux a pleasure. Some are broad concepts and others are overly-specific details that have saved me hours of frustration. Linux is a great place to be, no matter what platform you're targeting. Whether you're just learning about programming or you're a coder looking for a new digital home, there's no better workspace for programming than Linux.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-programming
|
||||
|
||||
作者:[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/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background)
|
||||
[2]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[3]: https://opensource.com/article/18/5/gnu-parallel
|
@ -0,0 +1,112 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How open source provides students with real-world experience)
|
||||
[#]: via: (https://opensource.com/article/21/2/open-source-student)
|
||||
[#]: author: (Laura Novich https://opensource.com/users/laura-novich)
|
||||
|
||||
How open source provides students with real-world experience
|
||||
======
|
||||
Contributing to open source gives students the real-world experience
|
||||
required to land a good job.
|
||||
![Woman sitting in front of her computer][1]
|
||||
|
||||
In the movie _The Secret of My Success_, Brantley Foster (played by Michael J. Fox) expresses the exact thought that goes through every new graduate's mind: "How can I get any experience until I get a job that _gives_ me experience?"
|
||||
|
||||
The hardest thing to do when starting a new career is to get experience. Often this creates a paradox. How do you get work with no experience, and how do you get experience with no work?
|
||||
|
||||
In the open source software world, this conundrum is a bit less daunting because your experience is what you make of it. By working with open source projects sponsored by open source software (OSS) companies, you gain experience working on projects you like for companies that make you feel important, and then you use that experience to help find employment.
|
||||
|
||||
Most companies would never allow newbies to touch their intellectual property and collateral without signing a non-disclosure agreement (NDA) or going through some kind of training or security check. However, when your source code is open and anyone in the world can contribute to it (in addition to copy it and use it), this is no longer an issue. In fact, open source companies embrace their contributors and create communities where students can easily get their feet wet and find their way in coding, testing, and documentation. Most open source companies depend on the contributions of others to get work done. This means the contributors work for free simply because they want to. For students, it translates into an unpaid internship and getting some real-world experience.
|
||||
|
||||
At [Our Best Words][2], we decided to run a pilot project to see if our students could work in an open source documentation project and find the experience beneficial to jumpstarting their new careers in technical communication.
|
||||
|
||||
![GitLab screenshot][3]
|
||||
|
||||
(Laura Novich, [CC BY-SA 4.0][4])
|
||||
|
||||
I was the initiator and point of contact for the project, and I approached several companies. The company that gave us the most positive response was [GitLab][5]. GitLab is a company that creates software for Git repository management, issue tracking, and continuous integration/continuous delivery (CI/CD) pipeline management. Its software is used by hundreds of thousands of organizations worldwide, and in 2019, it announced it achieved $100 million in annual recurring revenue.
|
||||
|
||||
GitLab's [Mike Jang][6] connected me with [Marcin Sedlak-Jakubowski][7] and [Marcia Dias Ramos][8], who are located closer to OBW's offices in Israel. We met to hammer out the details, and everyone had their tasks to launch the pilot in mid-September. Mike, Marcia, and Marcin hand-picked 19 issues for the students to solve. Each issue was tagged _Tich-Tov-only_ for OBW students, and any contributor who was not an OBW student was not allowed to work on the issue.
|
||||
|
||||
To prepare the students, I held several demonstrations with GitLab. The students had never used the software before, and some were quite nervous. As the backbone of GitLab is Git, a software tool the students were already familiar with, it wasn't too hard to learn. Following the demonstrations, I sent the students a link to a Google Drive folder with tutorials, a FAQ, and other valuable resources.
|
||||
|
||||
The issues the students were assigned came from GitLab's documentation. The documentation is written in Markdown and is checked with a linter (a static code analysis tool) called Vale. The students' assignments were to fix issues that the Vale linter found. The changes included fixing spelling, grammar, usage, and voice. In some cases, entire pages had to be rewritten.
|
||||
|
||||
As I wanted this project to run smoothly and successfully, we decided to limit the pilot to seven of our 14 students. This allowed me to manage the project more closely and to make sure each student had only two to three issues to handle during the two-month time period of the project.
|
||||
|
||||
![GitLab repo][9]
|
||||
|
||||
(Laura Novich, [CC BY-SA 4.0][4])
|
||||
|
||||
The OBW students who were part of this project (with links to their GitLab profiles) were:
|
||||
|
||||
* [Aaron Gorsuch][10]
|
||||
* [Anna Lester][11]
|
||||
* [Avi Chazen][12]
|
||||
* [Ela Greenberg][13]
|
||||
* [Rachel Gottesman][14]
|
||||
* [Stefanie Saffern][15]
|
||||
* [Talia Novich][16]
|
||||
|
||||
|
||||
|
||||
We worked mostly during September and October and wrapped up the project in November. Every issue the students had was put on a Kanban board. We had regular standup meetings, where we discussed what we were doing and any issues causing difficulty. There were many teachable moments where I would help with repository issues, troubleshooting merge requests, and helping the students understand technical writing theories in practice.
|
||||
|
||||
![Kanban board][17]
|
||||
|
||||
(Laura Novich, [CC BY-SA 4.0][4])
|
||||
|
||||
November came faster than we expected and looking back, the project ended way too quickly. About midway in, I collected feedback from Marcin, Marcia, and Mike, and they told me their experience was positive. They told us that once we were done, we could take on more issues than the original allotment assigned to the group, if we wanted.
|
||||
|
||||
One student, Rachel Gottesman, did just that. She completed 33 merge requests and helped rewrite pages of GitLab's documentation. She was so instrumental for the 13.7 release that [GitLab announced][18] that Rachel is the MVP for the release! We at OBW couldn't be more thrilled! _Congratulations, Rachel!_
|
||||
|
||||
![Rachel Gottesman's GitLab MVP award][19]
|
||||
|
||||
(Laura Novich, [CC BY-SA 4.0][4])
|
||||
|
||||
Rachel's name appears [on GitLab's MVP page][20].
|
||||
|
||||
We are gearing up for our new year and a new course. We plan to run this project again as part of our [Software Documentation for Technical Communication Professionals][21] course.
|
||||
|
||||
* * *
|
||||
|
||||
_This article originally appeared on [Our Best Words Blog][22] and is republished with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/open-source-student
|
||||
|
||||
作者:[Laura Novich][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/laura-novich
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_2.png?itok=JPlR5aCA (Woman sitting in front of her computer)
|
||||
[2]: https://ourbestwords.com/
|
||||
[3]: https://opensource.com/sites/default/files/uploads/gitlab.png (GitLab screenshot)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://about.gitlab.com/
|
||||
[6]: https://www.linkedin.com/in/mijang/
|
||||
[7]: https://www.linkedin.com/in/marcin-sedlak-jakubowski-91143a124/
|
||||
[8]: https://www.linkedin.com/in/marciadiasramos/
|
||||
[9]: https://opensource.com/sites/default/files/uploads/gitlab_obw_repo.png (GitLab repo)
|
||||
[10]: https://gitlab.com/aarongor
|
||||
[11]: https://gitlab.com/Anna-Lester
|
||||
[12]: https://gitlab.com/avichazen
|
||||
[13]: https://gitlab.com/elagreenberg
|
||||
[14]: https://gitlab.com/gottesman.rachelg
|
||||
[15]: https://gitlab.com/stefaniesaffern
|
||||
[16]: https://gitlab.com/TaliaNovich
|
||||
[17]: https://opensource.com/sites/default/files/uploads/kanban.png (Kanban board)
|
||||
[18]: https://release-13-7.about.gitlab-review.app/releases/2020/12/22/gitlab-13-7-released/
|
||||
[19]: https://opensource.com/sites/default/files/uploads/rachelgottesmanmvp.png (Rachel Gottesman's GitLab MVP award)
|
||||
[20]: https://about.gitlab.com/community/mvp/
|
||||
[21]: https://ourbestwords.com/training-courses/skills-courses/
|
||||
[22]: https://ourbestwords.com/topic/blog/
|
@ -1,55 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Namespaces are the shamash candle of the Zen of Python)
|
||||
[#]: via: (https://opensource.com/article/19/12/zen-python-namespaces)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
Namespaces are the shamash candle of the Zen of Python
|
||||
======
|
||||
This is part of a special series about the Zen of Python focusing on one
|
||||
bonus principle: namespaces.
|
||||
![Person programming on a laptop on a building][1]
|
||||
|
||||
Hanukkah famously has eight nights of celebration. The Hanukkah menorah, however, has nine candles: eight regular candles and a ninth that is always offset. It is called the **shamash** or **shamos**, which loosely translates to meaning "servant" or "janitor."
|
||||
|
||||
The shamos is the candle that lights all the others: it is the only candle whose fire can be used, not just watched. As we wrap up our series on the Zen of Python, I see how namespaces provide a similar service.
|
||||
|
||||
### Namespaces in Python
|
||||
|
||||
Python uses namespaces for everything. Though simple, they are sparse data structures—which is often the best way to achieve a goal.
|
||||
|
||||
> A _namespace_ is a mapping from names to objects.
|
||||
>
|
||||
> — [Python.org][2]
|
||||
|
||||
Modules are namespaces. This means that correctly predicting module semantics often just requires familiarity with how Python namespaces work. Classes are namespaces. Objects are namespaces. Functions have access to their local namespace, their parent namespace, and the global namespace.
|
||||
|
||||
The simple model, where the **.** operator accesses an object, which in turn will usually, but not always, do some sort of dictionary lookup, makes Python hard to optimize, but easy to explain.
|
||||
|
||||
Indeed, some third-party modules take this guideline and run with it. For example, the** [variants][3]** package turns functions into namespaces of "related functionality." It is a good example of how the [Zen of Python][4] can inspire new abstractions.
|
||||
|
||||
### In conclusion
|
||||
|
||||
Thank you for joining me on this Hanukkah-inspired exploration of [my favorite language][5]. Go forth and meditate on the Zen until you reach enlightenment.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/12/zen-python-namespaces
|
||||
|
||||
作者:[Moshe Zadka][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/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building)
|
||||
[2]: https://docs.python.org/3/tutorial/classes.html
|
||||
[3]: https://pypi.org/project/variants/
|
||||
[4]: https://www.python.org/dev/peps/pep-0020/
|
||||
[5]: https://opensource.com/article/19/10/why-love-python
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (amwps290)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,214 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Create and Manage Archive Files in Linux)
|
||||
[#]: via: (https://www.linux.com/news/how-to-create-and-manage-archive-files-in-linux-2/)
|
||||
[#]: author: (LF Training https://training.linuxfoundation.org/announcements/how-to-create-and-manage-archive-files-in-linux/)
|
||||
|
||||
How to Create and Manage Archive Files in Linux
|
||||
======
|
||||
|
||||
_By Matt Zand and Kevin Downs_
|
||||
|
||||
In a nutshell, an archive is a single file that contains a collection of other files and/or directories. Archive files are typically used for a transfer (locally or over the internet) or make a backup copy of a collection of files and directories which allow you to work with only one file (if compressed, it has a lower size than the sum of all files within it) instead of many. Likewise, archives are used for software application packaging. This single file can be easily compressed for ease of transfer while the files in the archive retain the structure and permissions of the original files.
|
||||
|
||||
We can use the tar tool to create, list, and extract files from archives. Archives made with tar are normally called “tar files,” “tar archives,” or—since all the archived files are rolled into one—“tarballs.”
|
||||
|
||||
This tutorial shows how to use tar to create an archive, list the contents of an archive, and extract the files from an archive. Two common options used with all three of these operations are ‘-f’ and ‘-v’: to specify the name of the archive file, use ‘-f’ followed by the file name; use the ‘-v’ (“verbose”) option to have tar output the names of files as they are processed. While the ‘-v’ option is not necessary, it lets you observe the progress of your tar operation.
|
||||
|
||||
For the remainder of this tutorial, we cover 3 topics: 1- Create an archive file, 2- List contents of an archive file, and 3- Extract contents from an archive file. We conclude this tutorial by surveying 6 practical questions related to archive file management. What you take away from this tutorial is essential for performing tasks related to [cybersecurity][1] and [cloud technology][2].
|
||||
|
||||
### 1- Creating an Archive File
|
||||
|
||||
To create an archive with tar, use the ‘-c’ (“create”) option, and specify the name of the archive file to create with the ‘-f’ option. It’s common practice to use a name with a ‘.tar’ extension, such as ‘my-backup.tar’. Note that unless specifically mentioned otherwise, all commands and command parameters used in the remainder of this article are used in lowercase. Keep in mind that while typing commands in this article on your terminal, you need not type the $ prompt sign that comes at the beginning of each command line.
|
||||
|
||||
Give as arguments the names of the files to be archived; to create an archive of a directory and all of the files and subdirectories it contains, give the directory’s name as an argument.
|
||||
|
||||
* *To create an archive called ‘project.tar’ from the contents of the ‘project’ directory, type:
|
||||
|
||||
$ _tar -cvf project.tar project_
|
||||
|
||||
This command creates an archive file called ‘project.tar’ containing the ‘project’ directory and all of its contents. The original ‘project’ directory remains unchanged.
|
||||
|
||||
Use the ‘-z’ option to compress the archive as it is being written. This yields the same output as creating an uncompressed archive and then using gzip to compress it, but it eliminates the extra step.
|
||||
|
||||
* *To create a compressed archive called ‘project.tar.gz’ from the contents of the ‘project’ directory, type:
|
||||
|
||||
$ _tar -zcvf project.tar.gz project_
|
||||
|
||||
This command creates a compressed archive file, ‘project.tar.gz’, containing the ‘project’ directory and all of its contents. The original ‘project’ directory remains unchanged.
|
||||
|
||||
**NOTE:** While using the ‘-z’ option, you should specify the archive name with a ‘.tar.gz’ extension and not a ‘.tar’ extension, so the file name shows that the archive is compressed. Although not required, it is a good practice to follow.
|
||||
|
||||
Gzip is not the only form of compression. There is also bzip2 and and xz. When we see a file with an extension of xz we know it has been compressed using xz. When we see a file with the extension of .bz2 we can infer it was compressed using bzip2. We are going to steer away from bzip2 as it is becoming unmaintained and focus on xz. When compressing using xz it is going to take longer for the files to compressed. However, it is typically worth the wait as the compression is much more effective, meaning the resulting file will usually be smaller than other compression methods used. Even better is the fact that decompression, or expanding the file, is not much different between the different methods of compression. Below we see an example of how to utilize xz when compressing a file using tar
|
||||
|
||||
$ _tar -Jcvf project.tar.xz project_
|
||||
|
||||
We simply switch -z for gzip to uppercase -J for xz. Here are some outputs to display the differences between the forms of compression:
|
||||
|
||||
![][3]
|
||||
|
||||
![][4]
|
||||
|
||||
As you can see xz does take the longest to compress. However it does the best job of reducing files size, so it’s worth the wait. The larger the file is the better the compression becomes too!
|
||||
|
||||
### 2- Listing Contents of an Archive File
|
||||
|
||||
To list the contents of a tar archive without extracting them, use tar with the ‘-t’ option.
|
||||
|
||||
* *To list the contents of an archive called ‘project.tar’, type:
|
||||
|
||||
$ _tar -tvf project.tar_ * *
|
||||
|
||||
This command lists the contents of the ‘project.tar’ archive. Using the ‘-v’ option along with the ‘-t’ option causes tar to output the permissions and modification time of each file, along with its file name—the same format used by the ls command with the ‘-l’ option.
|
||||
|
||||
* *To list the contents of a compressed archive called ‘project.tar.gz’, type:
|
||||
|
||||
$ _tar -tvf project.tar_
|
||||
|
||||
* *3- Extracting contents from an Archive File
|
||||
|
||||
To extract (or _unpack_) the contents of a tar archive, use tar with the ‘-x’ (“extract”) option.
|
||||
|
||||
* *To extract the contents of an archive called ‘project.tar’, type:
|
||||
|
||||
$ _tar -xvf project.tar_
|
||||
|
||||
This command extracts the contents of the ‘project.tar’ archive into the current directory.
|
||||
|
||||
If an archive is compressed, which usually means it will have a ‘.tar.gz’ or ‘.tgz’ extension, include the ‘-z’ option.
|
||||
|
||||
* *To extract the contents of a compressed archive called ‘project.tar.gz’, type:
|
||||
|
||||
$ _tar -zxvf project.tar.gz_
|
||||
|
||||
**NOTE:** If there are files or subdirectories in the current directory with the same name as any of those in the archive, those files will be overwritten when the archive is extracted. If you don’t know what files are included in an archive, consider listing the contents of the archive first.
|
||||
|
||||
Another reason to list the contents of an archive before extracting them is to determine whether the files in the archive are contained in a directory. If not, and the current directory contains many unrelated files, you might confuse them with the files extracted from the archive.
|
||||
|
||||
To extract the files into a directory of their own, make a new directory, move the archive to that directory, and change to that directory, where you can then extract the files from the archive.
|
||||
|
||||
Now that we have learned how to create an Archive file and list/extract its contents, we can move on to discuss the following 9 practical questions that are frequently asked by Linux professionals.
|
||||
|
||||
* Can we add content to an archive file without unpacking it?
|
||||
|
||||
|
||||
|
||||
Unfortunately, once a file has been compressed there is no way to add content to it. You would have to “unpack” it or extract the contents, edit or add content, and then compress the file again. If it’s a small file this process will not take long. If it’s a larger file then be prepared for it to take a while.
|
||||
|
||||
* Can we delete content from an archive file without unpacking it?
|
||||
|
||||
|
||||
|
||||
This depends on the version of tar being used. Newer versions of tar will support a –delete.
|
||||
|
||||
For example, let’s say we have files file1 and file2 . They can be removed from file.tar with the following:
|
||||
|
||||
_$ tar -vf file.tar –delete file1 file2_
|
||||
|
||||
To remove a directory dir1:
|
||||
|
||||
_$ tar -f file.tar –delete dir1/*_
|
||||
|
||||
* What are the differences between compressing a folder and archiving it?
|
||||
|
||||
|
||||
|
||||
The simplest way to look at the difference between archiving and compressing is to look at the end result. When you archive files you are combining multiple files into one. So if we archive 10 100kb files you will end up with one 1000kb file. On the other hand if we compress those files we could end up with a file that is only a few kb or close to 100kb.
|
||||
|
||||
* How to compress archive files?
|
||||
|
||||
|
||||
|
||||
As we saw above you can create and archive files using the tar command with the cvf options. To compress the archive file we made there are two options; run the archive file through compression such as gzip. Or use a compression flag when using the tar command. The most common compression flags are- z for gzip, -j for bzip and -J for xz. We can see the first method below:
|
||||
|
||||
_$ gzip file.tar_
|
||||
|
||||
Or we can just use a compression flag when using the tar command, here we’ll see the gzip flag “z”:
|
||||
|
||||
_$ tar -cvzf file.tar /some/directory_
|
||||
|
||||
* How to create archives of multiple directories and/or files at one time?
|
||||
|
||||
|
||||
|
||||
It is not uncommon to be in situations where we want to archive multiple files or directories at once. And it’s not as difficult as you think to tar multiple files and directories at one time. You simply supply which files or directories you want to tar as arguments to the tar command:
|
||||
|
||||
_$ tar -cvzf file.tar file1 file2 file3_
|
||||
|
||||
or
|
||||
|
||||
_$ tar -cvzf file.tar /some/directory1 /some/directory2_
|
||||
|
||||
* How to skip directories and/or files when creating an archive?
|
||||
|
||||
|
||||
|
||||
You may run into a situation where you want to archive a directory or file but you don’t need certain files to be archived. To avoid archiving those files or “exclude” them you would use the –exclude option with tar:
|
||||
|
||||
_$ tar –exclude ‘/some/directory’ -cvf file.tar /home/user_
|
||||
|
||||
So in this example /home/user would be archived but it would exclude the /some/directory if it was under /home/user. It’s important that you put the –exclude option before the source and destination as well as to encapsulate the file or directory being excluded with single quotation marks.
|
||||
|
||||
### Summary
|
||||
|
||||
The tar command is useful for creating backups or compressing files you no longer need. It’s good practice to back up files before changing them. If something doesn’t work how it’s intended to after the change you will always be able to revert back to the old file. Compressing files no longer in use helps keep systems clean and lowers the disk space usage. There are other utilities available but tar has reigned supreme for its versatility, ease of use and popularity.
|
||||
|
||||
### Resources
|
||||
|
||||
If you like to learn more about Linux, reading the following articles and tutorials are highly recommended:
|
||||
|
||||
* [Comprehensive Review of Linux File System Architecture and Management][5]
|
||||
* [Comprehensive Review of How Linux File and Directory System Works][6]
|
||||
* [Comprehensive list of all Linux OS distributions][7]
|
||||
* [Comprehensive list of all special purpose Linux distributions][8]
|
||||
* [Linux System Admin Guide- Best Practices for Making and Managing Backup Operations][9]
|
||||
* [Linux System Admin Guide- Overview of Linux Virtual Memory and Disk Buffer Cache][10]
|
||||
* [Linux System Admin Guide- Best Practices for Monitoring Linux Systems][11]
|
||||
* [Linux System Admin Guide- Best Practices for Performing Linux Boots and Shutdowns][12]
|
||||
|
||||
|
||||
|
||||
### About the Authors
|
||||
|
||||
**Matt Zand** is a serial entrepreneur and the founder of 3 tech startups: [DC Web Makers][13], [Coding Bootcamps][14] and [High School Technology Services][15]. He is a leading author of [Hands-on Smart Contract Development with Hyperledger Fabric][16] book by O’Reilly Media. He has written more than 100 technical articles and tutorials on blockchain development for Hyperledger, Ethereum and Corda R3 platforms. At DC Web Makers, he leads a team of blockchain experts for consulting and deploying enterprise decentralized applications. As chief architect, he has designed and developed blockchain courses and training programs for Coding Bootcamps. He has a master’s degree in business management from the University of Maryland. Prior to blockchain development and consulting, he worked as senior web and mobile App developer and consultant, angel investor, business advisor for a few startup companies. You can connect with him on LI: <https://www.linkedin.com/in/matt-zand-64047871>
|
||||
|
||||
**Kevin Downs** is Red Hat Certified System Administrator or RHCSA. At his current job at IBM as Sys Admin, he is in charge of administering hundreds of servers running on different Linux distributions. He is a Lead Linux Instructor at [Coding Bootcamps][17] where he has authored [5 self-paced Courses][18].
|
||||
|
||||
The post [How to Create and Manage Archive Files in Linux][19] appeared first on [Linux Foundation – Training][20].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/news/how-to-create-and-manage-archive-files-in-linux-2/
|
||||
|
||||
作者:[LF Training][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://training.linuxfoundation.org/announcements/how-to-create-and-manage-archive-files-in-linux/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://learn.coding-bootcamps.com/p/essential-practical-guide-to-cybersecurity-for-system-admin-and-developers
|
||||
[2]: https://learn.coding-bootcamps.com/p/introduction-to-cloud-technology
|
||||
[3]: https://training.linuxfoundation.org/wp-content/uploads/2020/12/Linux1-300x94.png
|
||||
[4]: https://training.linuxfoundation.org/wp-content/uploads/2020/12/Linux2-300x110.png
|
||||
[5]: https://blockchain.dcwebmakers.com/blog/linux-os-file-system-architecture-and-management.html
|
||||
[6]: https://coding-bootcamps.com/linux/filesystem/index.html
|
||||
[7]: https://myhsts.org/tutorial-list-of-all-linux-operating-system-distributions.php
|
||||
[8]: https://coding-bootcamps.com/list-of-all-special-purpose-linux-distributions.html
|
||||
[9]: https://myhsts.org/tutorial-system-admin-best-practices-for-managing-backup-operations.php
|
||||
[10]: https://myhsts.org/tutorial-how-linux-virtual-memory-and-disk-buffer-cache-work.php
|
||||
[11]: https://myhsts.org/tutorial-system-admin-best-practices-for-monitoring-linux-systems.php
|
||||
[12]: https://myhsts.org/tutorial-best-practices-for-performing-linux-boots-and-shutdowns.php
|
||||
[13]: https://blockchain.dcwebmakers.com/
|
||||
[14]: http://coding-bootcamps.com/
|
||||
[15]: https://myhsts.org/
|
||||
[16]: https://www.oreilly.com/library/view/hands-on-smart-contract/9781492086116/
|
||||
[17]: https://coding-bootcamps.com/
|
||||
[18]: https://learn.coding-bootcamps.com/courses/author/758905
|
||||
[19]: https://training.linuxfoundation.org/announcements/how-to-create-and-manage-archive-files-in-linux/
|
||||
[20]: https://training.linuxfoundation.org/
|
@ -1,124 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (mengxinayan)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (10 ways to get started with open source in 2021)
|
||||
[#]: via: (https://opensource.com/article/21/1/getting-started-open-source)
|
||||
[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo)
|
||||
|
||||
10 ways to get started with open source in 2021
|
||||
======
|
||||
If you're new to open source, 2020's top 10 articles about getting
|
||||
started will help guide your path.
|
||||
![Looking at a map for career journey][1]
|
||||
|
||||
Opensource.com exists to educate the world about everything open source, from new tools and frameworks to scaling communities. We aim to make open source more accessible to anyone who wants to use or contribute to it.
|
||||
|
||||
Getting started in open source can be hard, so we regularly share tips and advice on how you can get involved. If you want to learn Python, help fight COVID-19, or join the Kubernetes community, we've got you covered.
|
||||
|
||||
To help you begin, we curated the 10 most popular articles on getting started in open source we published in 2020. We hope they'll inspire you to learn something new in 2021.
|
||||
|
||||
### A beginner's guide to web scraping with Python
|
||||
|
||||
Want to learn Python through doing, not reading? In this tutorial, Julia Piaskowski guides you through her first [web scraping project in Python][2]. She shows how to access webpage content with Python library requests.
|
||||
|
||||
Julia walks through each step, from installing Python 3 to cleaning web scraping results with pandas. Aided by screenshots galore, she explains how to scrape with an end goal in mind.
|
||||
|
||||
The section on extracting relevant content is especially helpful; she doesn't mince words when saying this can be tough. But, like the rest of the article, she guides you through each step.
|
||||
|
||||
### A beginner's guide to SSH for remote connections on Linux
|
||||
|
||||
If you've never opened a secure shell (SSH) before, the first time can be confusing. In this tutorial, Seth Kenlon shows how to [configure two computers for SSH connections][3] and securely connect them without a password.
|
||||
|
||||
From four key phrases you should know to steps for activating SSH on each host, Seth explains every step of making SSH connections. He includes advice on finding your computer's IP address, creating an SSH key, and verifying your access to a remote machine.
|
||||
|
||||
### 5 steps to learn any programming language
|
||||
|
||||
If you know one programming language, you can [learn them all][4]. That's the premise of this article by Seth Kenlon, which argues that knowing some basic programming logic can scale across languages.
|
||||
|
||||
Seth shares five things programmers look for when considering a new language to learn to code in. Syntax, built-ins, and parsers are among the five, and he accompanies each with steps to take action.
|
||||
|
||||
The key argument uniting them all? Once you know the theory of how code works, it scales across languages. Nothing is too hard for you to learn.
|
||||
|
||||
### Contribute to open source healthcare projects for COVID-19
|
||||
|
||||
Did you know that an Italian hospital saved COVID-19 patients' lives by 3D printing valves for reanimation devices? It's one of many ways open source contributors [built solutions for the pandemic][5] in 2020.
|
||||
|
||||
In this article, Joshua Pearce shares several ways to volunteer with open source projects addressing COVID-19. While Project Open Air is the largest, Joshua explains how you can also work on a wiki for an open source ventilator, write open source COVID-19 medical supply requirements, test an open source oxygen concentrator prototype, and more.
|
||||
|
||||
### Advice for getting started with GNOME
|
||||
|
||||
GNOME is one of the most popular Linux desktops, but is it right for you? This article shares [advice from GNOME][6] users interspersed with Opensource.com's take on this topic.
|
||||
|
||||
Want some inspiration for configuring your desktop? This article includes links to get started with GNOME extensions, installing Dash to Dock, using the GNOME Tweak tool, and more.
|
||||
|
||||
After all that, you might decide that GNOME still isn't for you—and that's cool. You'll find links to other Linux desktops and window managers at the end.
|
||||
|
||||
### 3 reasons to contribute to open source now
|
||||
|
||||
As of June 2020, GitHub hosted more than 180,000 public repositories. It's never been easier to join the open source community, but does that mean you should? In this article, Opensource.com Correspondent Jason Blais [shares three reasons][7] to take the plunge.
|
||||
|
||||
Contributing to open source can boost your confidence, resume, and professional network. Jason explains how to leverage your contributions in helpful detail, from sharing how to add open source contributions on your LinkedIn profile to turning these contributions into paid roles. There's even a list of great projects for first-time contributors at the end.
|
||||
|
||||
### 4 ways I contribute to open source as a Linux systems administrator
|
||||
|
||||
Sysadmins are the unsung heroes of open source. They do lots of work behind the code that's deeply valuable but often unseen.
|
||||
|
||||
In this article, Elizabeth K. Joseph explains how she [improves open source projects][8] as a Linux sysadmin. User support, hosting project resources, and finding new website environments are just a few ways she leaves communities better than she found them.
|
||||
|
||||
Perhaps the most crucial contribution of all? Documentation! Elizabeth got her start in open source rewriting a quickstart guide for a project she used. Submitting bugs and patch reports to projects you use often is an ideal way to get involved.
|
||||
|
||||
### 6 ways to contribute to an open source alternative to Slack
|
||||
|
||||
Mattermost is a popular platform for teams that want an open source messaging system. Its active, vibrant community is a key plus that keeps users loyal to the product, especially those with experience in Go, React, and DevOps.
|
||||
|
||||
If you'd like to [contribute to Mattermost][9], Jason Blais explains how. Consider this article your Getting Started documentation: Blais shares steps to take, organized by six types of contributions you can make.
|
||||
|
||||
Whether you'd like to build an integration or localize your language, this article shares how to get going.
|
||||
|
||||
### How to contribute to Kubernetes
|
||||
|
||||
I walked into Open Source Summit 2018 in Vancouver young and unaware of Kubernetes. After the keynotes, I walked out of the ballroom a changed-yet-confused woman. It's not hyperbole to say that Kubernetes has changed open source for good: It's tough to find a more popular, impactful project.
|
||||
|
||||
If you'd like to contribute, IBM Engineer Tara Gu explains [how she got started.][10] This recap of her lightning talk at All Things Open 2019 includes a video of the talk she gave in person. At a conference. Remember those…?
|
||||
|
||||
### How anyone can contribute to open source software in their job
|
||||
|
||||
Necessity is the mother of invention, especially in open source. Many folks build open source solutions to their own problems. But what happens when developers miss the mark by building products without gathering feedback from their target users?
|
||||
|
||||
Product and design teams often fill this gap in enterprises. What should developers do if such roles don't exist on their open source teams?
|
||||
|
||||
In this article, Catherine Robson explains how open source teams [can collect feedback][11] from their target users. It's written for folks who want to share their work experiences with developers, thus contributing their feedback to open source projects.
|
||||
|
||||
The steps Catherine outlines will help you share your insights with open source teams and play a key role helping teams build better products.
|
||||
|
||||
### What do you want to learn?
|
||||
|
||||
What would you like to know about getting started in open source? Please share your suggestions for article topics in the comments. And if you have a story to share to help others get started in open source, please consider [writing an article][12] for Opensource.com.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/1/getting-started-open-source
|
||||
|
||||
作者:[Lauren Maffeo][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[萌新阿岩](https://github.com/mengxinayan)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/lmaffeo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/career_journey_road_gps_path_map_520.png?itok=PpL6jJgY (Looking at a map for career journey)
|
||||
[2]: https://opensource.com/article/20/5/web-scraping-python
|
||||
[3]: https://opensource.com/article/20/9/ssh
|
||||
[4]: https://opensource.com/article/20/10/learn-any-programming-language
|
||||
[5]: https://opensource.com/article/20/3/volunteer-covid19
|
||||
[6]: https://opensource.com/article/20/6/gnome-users
|
||||
[7]: https://opensource.com/article/20/6/why-contribute-open-source
|
||||
[8]: https://opensource.com/article/20/7/open-source-sysadmin
|
||||
[9]: https://opensource.com/article/20/7/mattermost
|
||||
[10]: https://opensource.com/article/20/1/contributing-kubernetes-all-things-open-2019
|
||||
[11]: https://opensource.com/article/20/10/open-your-job
|
||||
[12]: https://opensource.com/how-submit-article
|
@ -1,272 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (amwps290)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (A hands-on tutorial of SQLite3)
|
||||
[#]: via: (https://opensource.com/article/21/2/sqlite3-cheat-sheet)
|
||||
[#]: author: (Klaatu https://opensource.com/users/klaatu)
|
||||
|
||||
A hands-on tutorial of SQLite3
|
||||
======
|
||||
Get started with this incredibly powerful and common database. Download
|
||||
the SQLite cheat sheet.
|
||||
![Cheat Sheet cover image][1]
|
||||
|
||||
Applications very often save data. Whether your users create simple text documents, complex graphic layouts, game progress, or an intricate list of customers and order numbers, software usually implies that data is being generated. There are many ways to store data for repeated use. You can dump text to configuration formats such as INI, [YAML][2], XML, or JSON, you can write out raw binary data, or you can store data in a structured database. SQLite is a self-contained, lightweight database that makes it easy to create, parse, query, modify, and transport data.
|
||||
|
||||
**[Download our [SQLite3 cheat sheet][3]]**
|
||||
|
||||
SQLite has been dedicated to the [public domain][4], which [technically means it is not copyrighted and therefore requires no license][5]. Should you require a license, you can [purchase a Warranty of Title][6]. SQLite is immensely common, with an estimated 1 _trillion_ SQLite databases in active use. That's counting multiple databases on every Android and iOS device, every macOS and Windows 10 computer, most Linux systems, within every Webkit-based web browser, modern TV sets, automotive multimedia systems, and countless other software applications.
|
||||
|
||||
In summary, it's a reliable and simple system to use for storing and organizing data.
|
||||
|
||||
### Installing
|
||||
|
||||
You probably already have SQLite libraries on your system, but you need its command-line tools installed to use it directly. On Linux, you probably already have these tools installed. The command provided by the tools is **sqlite3** (not just **sqlite**).
|
||||
|
||||
If you don't have SQLite installed on Linux or BSD, you can install it from your software repository or ports tree, or [download and install it][7] from source code or as a compiled binary.
|
||||
|
||||
On macOS or Windows, you can download and install SQLite tools from [sqlite.org][7].
|
||||
|
||||
### Using SQLite
|
||||
|
||||
It's common to interact with a database through a programming language. For this reason, there are SQLite interfaces (or "bindings") for Java, Python, Lua, PHP, Ruby, C++, and many many others. However, before using these libraries, it helps to understand what's actually happening with the database engine and why your choice of a database is significant. This article introduces you to SQLite and the **sqlite3** command so you can get familiar with the basics of how this database handles data.
|
||||
|
||||
### Interacting with SQLite
|
||||
|
||||
You can interact with SQLite using the **sqlite3** command. This command provides an interactive shell so you can view and update your databases.
|
||||
|
||||
|
||||
```
|
||||
$ sqlite3
|
||||
SQLite version 3.34.0 2020-12-01 16:14:00
|
||||
Enter ".help" for usage hints.
|
||||
Connected to a transient in-memory database.
|
||||
Use ".open FILENAME" to reopen on a persistent database.
|
||||
sqlite>
|
||||
```
|
||||
|
||||
The command places you in an SQLite subshell, and so your prompt is now an SQLite prompt. Your usual Bash commands don't work here. You must use SQLite commands. To see a list of SQLite commands, type **.help**:
|
||||
|
||||
|
||||
```
|
||||
sqlite> .help
|
||||
.archive ... Manage SQL archives
|
||||
.auth ON|OFF SHOW authorizer callbacks
|
||||
.backup ?DB? FILE Backup DB (DEFAULT "main") TO FILE
|
||||
.bail ON|off Stop after hitting an error. DEFAULT OFF
|
||||
.binary ON|off Turn BINARY output ON OR off. DEFAULT OFF
|
||||
.cd DIRECTORY CHANGE the working directory TO DIRECTORY
|
||||
[...]
|
||||
```
|
||||
|
||||
Some of these commands are binary, while others require unique arguments (like filenames, paths, etc.). These are administrative commands for your SQLite shell and are not database queries. Databases take queries in Structured Query Language (SQL), and many SQLite queries are the same as what you may already know from the [MySQL][8] and [MariaDB][9] databases. However, data types and functions differ, so pay close attention to minor differences if you're familiar with another database.
|
||||
|
||||
### Creating a database
|
||||
|
||||
When launching SQLite, you can either open a prompt in memory, or you can select a database to open:
|
||||
|
||||
|
||||
```
|
||||
`$ sqlite3 mydatabase.db`
|
||||
```
|
||||
|
||||
If you have no database yet, you can create one at the SQLite prompt:
|
||||
|
||||
|
||||
```
|
||||
`sqlite> .open mydatabase.db`
|
||||
```
|
||||
|
||||
You now have an empty file on your hard drive, ready to be used as an SQLite database. The file extension **.db** is arbitrary. You can also use **.sqlite**, or whatever you want.
|
||||
|
||||
### Creating a table
|
||||
|
||||
Databases contain _tables_, which can be visualized as a spreadsheet. There's a series of rows (called _records_ in a database) and columns. The intersection of a row and a column is called a _field_.
|
||||
|
||||
The Structured Query Language (SQL) is named after what it provides: A method to inquire about the contents of a database in a predictable and consistent syntax to receive useful results. SQL reads a lot like an ordinary English sentence, if a little robotic. Currently, your database is empty, devoid of any tables.
|
||||
|
||||
You can create a table with the **CREATE** query. It's useful to combine this with the **IF NOT EXISTS** statement, which prevents SQLite from clobbering an existing table.
|
||||
|
||||
You can't create an empty table in SQLite, so before trying a **CREATE** statement, you must think about what kind of data you anticipate the table will store. In this example, I'll create a table called _member_ with these columns:
|
||||
|
||||
* A unique identifier
|
||||
* A person's name
|
||||
* The date and time of data entry
|
||||
|
||||
|
||||
|
||||
#### Unique ID
|
||||
|
||||
It's always good to refer to a record by a unique number, and luckily SQLite recognizes this and does it automatically for you in a column called **rowid**.
|
||||
|
||||
No SQL statement is required to create this field.
|
||||
|
||||
#### Data types
|
||||
|
||||
For my example table, I'm creating a _name_ column to hold **TEXT** data. To prevent a record from being created without data in a specified field, you can add the **NOT NULL** directive.
|
||||
|
||||
The SQL to create this field is: **name TEXT NOT NULL**
|
||||
|
||||
There are five data types (actually _storage classes_) in SQLite:
|
||||
|
||||
* TEXT: a text string
|
||||
* INTEGER: a whole number
|
||||
* REAL: a floating point (unlimited decimal places) number
|
||||
* BLOB: binary data (for instance, a .jpeg or .webp image)
|
||||
* NULL: a null value
|
||||
|
||||
|
||||
|
||||
#### Date and time stamp
|
||||
|
||||
SQLite includes a convenient date and timestamp function. It is not a data type itself but a function in SQLite that generates either a string or integer, depending on your desired format. In this example, I left it as the default.
|
||||
|
||||
The SQL to create this field is: **datestamp DATETIME DEFAULT CURRENT_TIMESTAMP**
|
||||
|
||||
### Table creation SQL
|
||||
|
||||
The full SQL for creating this example table in SQLite:
|
||||
|
||||
|
||||
```
|
||||
sqlite> CREATE TABLE
|
||||
...> IF NOT EXISTS
|
||||
...> member (name TEXT NOT NULL,
|
||||
...> datestamp DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
```
|
||||
|
||||
In this code sample, I pressed **Return** after the logical clauses of the statement to make it easier to read. SQLite won't run your command unless it terminates with a semi-colon (**;**).
|
||||
|
||||
You can verify that the table has been created with the SQLite command **.tables**:
|
||||
|
||||
|
||||
```
|
||||
sqlite> .tables
|
||||
member
|
||||
```
|
||||
|
||||
### View all columns in a table
|
||||
|
||||
You can verify what columns and rows a table contains with the **PRAGMA** statement:
|
||||
|
||||
|
||||
```
|
||||
sqlite> PRAGMA table_info(member);
|
||||
0|name|TEXT|1||0
|
||||
1|datestamp|CURRENT_TIMESTAMP|0||0
|
||||
```
|
||||
|
||||
### Data entry
|
||||
|
||||
You can populate your new table with some sample data by using the **INSERT** SQL keyword:
|
||||
|
||||
|
||||
```
|
||||
> INSERT INTO member (name) VALUES ('Alice');
|
||||
> INSERT INTO member (name) VALUES ('Bob');
|
||||
> INSERT INTO member (name) VALUES ('Carol');
|
||||
> INSERT INTO member (name) VALUES ('David');
|
||||
```
|
||||
|
||||
Verify the data in the table:
|
||||
|
||||
|
||||
```
|
||||
> SELECT * FROM member;
|
||||
Alice|2020-12-15 22:39:00
|
||||
Bob|2020-12-15 22:39:02
|
||||
Carol|2020-12-15 22:39:05
|
||||
David|2020-12-15 22:39:07
|
||||
```
|
||||
|
||||
#### Adding multiple rows at once
|
||||
|
||||
Now create a second table:
|
||||
|
||||
|
||||
```
|
||||
> CREATE TABLE IF NOT EXISTS linux (
|
||||
...> distro TEXT NOT NULL)
|
||||
```
|
||||
|
||||
Populate it with some sample data, this time using a little **VALUES** shortcut so you can add multiple rows in just one command. The **VALUES** keyword expects a list in parentheses but can take multiple lists separated by commas:
|
||||
|
||||
|
||||
```
|
||||
> INSERT INTO linux (distro)
|
||||
...> VALUES ('Slackware'), ('RHEL'),
|
||||
...> ('Fedora'),('Debian');
|
||||
```
|
||||
|
||||
### Altering a table
|
||||
|
||||
You now have two tables, but as yet, there's no relationship between the two. They each contain independent data, but possibly you might need to associate a member of the first table to a specific item listed in the second.
|
||||
|
||||
To do that, you can create a new column for the first table that corresponds to something in the second. Because both tables were designed with unique identifiers (automatically, thanks to SQLite), the easiest way to connect them is to use the **rowid** field of one as a selector for the other.
|
||||
|
||||
Create a new column in the first table to represent a value in the second table:
|
||||
|
||||
|
||||
```
|
||||
`> ALTER TABLE member ADD os INT;`
|
||||
```
|
||||
|
||||
Using the unique IDs of the **linux** table, assign a distribution to each member. Because the records already exist, you use the **UPDATE** SQL keyword rather than **INSERT**. Specifically, you want to select one row and then update the value of one column. Syntactically, this is expressed a little in reverse, with the update happening first and the selection matching last:
|
||||
|
||||
|
||||
```
|
||||
`> UPDATE member SET os=1 WHERE name='Alice';`
|
||||
```
|
||||
|
||||
Repeat this process for the other names in the **member** table, just to populate it with data. For variety, assign three different distributions across the four rows (doubling up on one).
|
||||
|
||||
### Joining tables
|
||||
|
||||
Now that these two tables relate to one another, you can use SQL to display the associated data. There are many kinds of _joins_ in databases, but you can try them all once you know the basics. Here's a basic join to correlate the values found in the **os** field of the **member** table to the **id** field of the **linux** table:
|
||||
|
||||
|
||||
```
|
||||
> SELECT * FROM member INNER JOIN linux ON member.os=linux.rowid;
|
||||
Alice|2020-12-15 22:39:00|1|Slackware
|
||||
Bob|2020-12-15 22:39:02|3|Fedora
|
||||
Carol|2020-12-15 22:39:05|3|Fedora
|
||||
David|2020-12-15 22:39:07|4|Debian
|
||||
```
|
||||
|
||||
The **os** and **id** fields form the join.
|
||||
|
||||
In a graphical application, you can imagine that the **os** field might be set by a drop-down menu, the values for which are drawn from the contents of the **distro** field of the **linux** table. By using separate tables for unique but related sets of data, you ensure the consistency and validity of data, and thanks to SQL, you can associate them dynamically later.
|
||||
|
||||
### Learning more
|
||||
|
||||
SQLite is an infinitely useful self-contained, portable, open source database. Learning to use it interactively is a great first step toward managing it for web applications or using it through programming language libraries.
|
||||
|
||||
If you enjoy SQLite, you might also try [Fossil][10] by the same author, Dr. Richard Hipp.
|
||||
|
||||
As you learn and use SQLite, it may help to have a list of common commands nearby, so download our **[SQLite3 cheat sheet][3]** today!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/sqlite3-cheat-sheet
|
||||
|
||||
作者:[Klaatu][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/klaatu
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image)
|
||||
[2]: https://www.redhat.com/sysadmin/yaml-beginners
|
||||
[3]: https://opensource.com/downloads/sqlite-cheat-sheet
|
||||
[4]: https://sqlite.org/copyright.html
|
||||
[5]: https://directory.fsf.org/wiki/License:PublicDomain
|
||||
[6]: https://www.sqlite.org/purchase/license?
|
||||
[7]: https://www.sqlite.org/download.html
|
||||
[8]: https://www.mysql.com/
|
||||
[9]: https://mariadb.org/
|
||||
[10]: https://opensource.com/article/20/11/fossil
|
@ -0,0 +1,101 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 reasons to choose Linux for art and design)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-art-design)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
4 reasons to choose Linux for art and design
|
||||
======
|
||||
Open source enhances creativity by breaking you out of a proprietary
|
||||
mindset and opening your mind to possibilities. Explore several open
|
||||
source creative programs.
|
||||
![Painting art on a computer screen][1]
|
||||
|
||||
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. Today I'll explain why Linux is an excellent choice for creative work.
|
||||
|
||||
Linux gets a lot of press for its amazing server and cloud computing software. It comes as a surprise to some that Linux happens to have a great set of creative tools, too, and that they easily rival popular creative apps in user experience and quality. When I first started using open source creative software, it wasn't because I didn't have access to the other software. Quite the contrary, I started using open source tools when I had the greatest access to the proprietary tools offered by several leading companies. I chose to switch to open source because open source made more sense and produced better results. Those are some big claims, so allow me to explain.
|
||||
|
||||
### High availability means high productivity
|
||||
|
||||
The term _productivity_ means different things to different people. When I think of productivity, it's that when you sit down to do something, it's rewarding when you're able to meet whatever goal you've set for yourself. If you get interrupted or stopped by something outside your control, then your productivity goes down.
|
||||
|
||||
Computers can seem unpredictable, and there are admittedly a lot of things that can go wrong. There are lots of hardware parts to a computer, and any one of them can break at any time. Software has bugs and updates to fix bugs, and then new bugs introduced by those updates. If you're not comfortable with computers, it can feel a little like a timebomb just waiting to ensnare you. With so much potentially working _against_ you in the digital world, it doesn't make sense to me to embrace software that guarantees not to work when certain requirements (like a valid license, or more often, an up-to-date subscription) aren't met.
|
||||
|
||||
![Inkscape application][2]
|
||||
|
||||
Inkscape
|
||||
|
||||
Open source creative apps have no required subscription fee and no licensing requirements. They're available when you need them and usually on any platform. That means when you sit down at a working computer, you know you have access to your must-have software. And if you're having a rough day and you find yourself sitting in front of a computer that isn't working, the fix is to find one that does work, install your creative suite, and get to work.
|
||||
|
||||
It's far harder to find a computer that _can't_ run Inkscape, for instance, than it is to find a computer that _is_ running a similar proprietary application. That's called high availability, and it's a game-changer. I've never found myself wasting hours of my day for lack of the software I want to run to get things done.
|
||||
|
||||
### Open access is better for diversity
|
||||
|
||||
When I was working in the creative industry, it sometimes surprised me how many of my colleagues were self-taught both in their artistic and technical disciplines. Some taught themselves on expensive rigs with all the latest "professional" applications, but there was always a large group of people who perfected their digital trade on free and open source software because, as kids or as poor college students, that was what they could afford and obtain easily.
|
||||
|
||||
That's a different kind of high availability, but it's one that's important to me and many other users who wouldn't be in the creative industry but for open source. Even open source projects that do offer a paid subscription, like [Ardour][3], ensure that users have access to the software regardless of an ability to pay.
|
||||
|
||||
![Ardour interface][4]
|
||||
|
||||
Ardour
|
||||
|
||||
When you don't restrict who gets to use your software, you're implicitly inviting more users. And when you do that, you enable a greater diversity of creative voices. Art loves influence, and the greater the variety of experiences and ideas you have to draw from, the better. That's what's possible with open source creative software.
|
||||
|
||||
### Resolute format support is more inclusive
|
||||
|
||||
We all acknowledge the value of inclusivity in basically every industry. Inviting _more people_ to the party results in a greater spectacle, in nearly every sense. Knowing this, it's painful when I see a project or initiative that invites people to collaborate, only to limit what kind of file formats are acceptable. It feels archaic, like a vestige of elitism out of the far past, and yet it's a real problem even today.
|
||||
|
||||
In a surprise and unfortunate twist, it's not because of technical limitations. Proprietary software has access to open file formats because they're open source and free to integrate into any application. Integrating these formats requires no reciprocation. By stark contrast, proprietary file formats are often shrouded in secrecy, locked away for use by the select few who pay to play. It's so bad, in fact, that quite often, you can't open some files to get to your data without the proprietary software available. Amazingly, open source creative applications nevertheless include support for as many proprietary formats as they possibly can. Here's just a sample of Inkscape's staggering support list:
|
||||
|
||||
![Available Inkscape file formats][5]
|
||||
|
||||
Inkscape file formats
|
||||
|
||||
And that's largely without contribution from the companies owning the file formats.
|
||||
|
||||
Supporting open file formats is more inclusive, and it's better for everyone.
|
||||
|
||||
### No restrictions for fresh ideas
|
||||
|
||||
One of the things I've come to love about open source is the sheer diversity of how any given task is interpreted. When you're around proprietary software, you tend to start to see the world based on what's available to you. For instance, if you're thinking of manipulating some photos, then you generally frame your intent based on what you know to be possible. You choose from the three of four or ten applications on the shelf because they're the only options presented.
|
||||
|
||||
You generally have several obligatory "obvious" solutions in open source, but you also get an additional _dozen_ contenders hanging out on the fringe. These options are sometimes only half-complete, or they're hyper-focused on a specific task, or they're challenging to learn, but most importantly, they're unique and innovative. Sometimes they've been developed by someone who's never seen the way a task is "supposed to be done," and so the approach is wildly different than anything else on the market. Other times, they're developed by someone familiar with the "right way" of doing something but is trying a different tactic anyway. It's a big, dynamic brainstorm of possibility.
|
||||
|
||||
These kinds of everyday innovations can lead to flashes of inspiration, moments of brilliance, or widespread common improvements. For instance, the famous GIMP filter that removes items from photographs and automatically replaces the background was so popular that it later got "borrowed" by proprietary photo editing software. That's one metric of success, but it's the personal impact that matters most for an artist. I marvel at the creativity of new Linux users when I've shown them just one simple audio or video filter or paint application at a tech demo. Without any instruction or context, the ideas that spring out of a simple interaction with a new tool can be exciting and inspiring, and a whole new series of artwork can easily emerge from experimentation with just a few simple tools.
|
||||
|
||||
There are also ways of working more efficiently, provided the right set of tools are available. While proprietary software usually isn't opposed to the idea of smarter work habits, there's rarely a direct benefit from concentrating on making it easy for users to automate tasks. Linux and open source are largely built exactly for [automation and orchestration][6], and not just for servers. Tools like [ImageMagick][7] and [GIMP scripts][8] have changed the way I work with images, both for bulk processing and idle experimentation.
|
||||
|
||||
You never know what you might create, given tools that you've never imagined existed.
|
||||
|
||||
### Linux artists
|
||||
|
||||
There's a whole [community of artists using open source][9], from [photography][10] to [makers][11] to [musicians][12], and much much more. If you want to get creative, give Linux a go.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-art-design
|
||||
|
||||
作者:[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/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen)
|
||||
[2]: https://opensource.com/sites/default/files/inkscape_0.jpg
|
||||
[3]: https://community.ardour.org/subscribe
|
||||
[4]: https://opensource.com/sites/default/files/ardour.jpg
|
||||
[5]: https://opensource.com/sites/default/files/formats.jpg
|
||||
[6]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[7]: https://opensource.com/life/16/6/fun-and-semi-useless-toys-linux#imagemagick
|
||||
[8]: https://opensource.com/article/21/1/gimp-scripting
|
||||
[9]: https://librearts.org
|
||||
[10]: https://pixls.us
|
||||
[11]: https://www.redhat.com/en/blog/channel/red-hat-open-studio
|
||||
[12]: https://linuxmusicians.com
|
@ -0,0 +1,139 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Network address translation part 2 – the conntrack tool)
|
||||
[#]: via: (https://fedoramagazine.org/network-address-translation-part-2-the-conntrack-tool/)
|
||||
[#]: author: (Florian Westphal https://fedoramagazine.org/author/strlen/)
|
||||
|
||||
Network address translation part 2 – the conntrack tool
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
This is the second article in a series about network address translation (NAT). The first article introduced [how to use the iptables/nftables packet tracing feature][2] to find the source of NAT-related connectivity problems. Part 2 introduces the “conntrack” command. conntrack allows you to inspect and modify tracked connections.
|
||||
|
||||
### Introduction
|
||||
|
||||
NAT configured via iptables or nftables builds on top of netfilters connection tracking facility. The _conntrack_ command is used to inspect and alter the state table. It is part of the “conntrack-tools” package.
|
||||
|
||||
### Conntrack state table
|
||||
|
||||
The connection tracking subsystem keeps track of all packet flows that it has seen. Run “_sudo conntrack -L_” to see its content:
|
||||
|
||||
```
|
||||
tcp 6 43184 ESTABLISHED src=192.168.2.5 dst=10.25.39.80 sport=5646 dport=443 src=10.25.39.80 dst=192.168.2.5 sport=443 dport=5646 [ASSURED] mark=0 use=1
|
||||
tcp 6 26 SYN_SENT src=192.168.2.5 dst=192.168.2.10 sport=35684 dport=443 [UNREPLIED] src=192.168.2.10 dst=192.168.2.5 sport=443 dport=35684 mark=0 use=1
|
||||
udp 17 29 src=192.168.8.1 dst=239.255.255.250 sport=48169 dport=1900 [UNREPLIED] src=239.255.255.250 dst=192.168.8.1 sport=1900 dport=48169 mark=0 use=1
|
||||
```
|
||||
|
||||
Each line shows one connection tracking entry. You might notice that each line shows the addresses and port numbers twice and even with inverted address and port pairs! This is because each entry is inserted into the state table twice. The first address quadruple (source and destination address and ports) are those recorded in the original direction, i.e. what the initiator sent. The second quadruple is what conntrack expects to see when a reply from the peer is received. This solves two problems:
|
||||
|
||||
1. If a NAT rule matches, such as IP address masquerading, this is recorded in the reply part of the connection tracking entry and can then be automatically applied to all future packets that are part of the same flow.
|
||||
2. A lookup in the state table will be successful even if its a reply packet to a flow that has any form of network or port address translation applied.
|
||||
|
||||
|
||||
|
||||
The original (first shown) quadruple stored never changes: Its what the initiator sent. NAT manipulation only alters the reply (second) quadruple because that is what the receiver will see. Changes to the first quadruple would be pointless: netfilter has no control over the initiators state, it can only influence the packet as it is received/forwarded. When a packet does not map to an existing entry, conntrack may add a new state entry for it. In the case of UDP this happens automatically. In the case of TCP conntrack can be configured to only add the new entry if the TCP packet has the [SYN bit][3] set. By default conntrack allows mid-stream pickups to not cause problems for flows that existed prior to conntrack becoming active.
|
||||
|
||||
### Conntrack state table and NAT
|
||||
|
||||
As explained in the previous section, the reply tuple listed contains the NAT information. Its possible to filter the output to only show entries with source or destination nat applied. This allows to see which kind of NAT transformation is active on a given flow. _“sudo conntrack -L -p tcp –src-nat_” might show something like this:
|
||||
|
||||
```
|
||||
tcp 6 114 TIME_WAIT src=10.0.0.10 dst=10.8.2.12 sport=5536 dport=80 src=10.8.2.12 dst=192.168.1.2 sport=80 dport=5536 [ASSURED]
|
||||
```
|
||||
|
||||
This entry shows a connection from 10.0.0.10:5536 to 10.8.2.12:80. But unlike the previous example, the reply direction is not just the inverted original direction: the source address is changed. The destination host (10.8.2.12) sends reply packets to 192.168.1.2 instead of 10.0.0.10. Whenever 10.0.0.10 sends another packet, the router with this entry replaces the source address with 192.168.1.2. When 10.8.2.12 sends a reply, it changes the destination back to 10.0.0.10. This source NAT is due to a [nft masquerade][4] rule:
|
||||
|
||||
```
|
||||
inet nat postrouting meta oifname "veth0" masquerade
|
||||
```
|
||||
|
||||
Other types of NAT rules, such as “dnat to” or “redirect to” would be shown in a similar fashion, with the reply tuples destination different from the original one.
|
||||
|
||||
### Conntrack extensions
|
||||
|
||||
Two useful extensions are conntrack accounting and timestamping. _“sudo sysctl net.netfilter.nf_conntrack_acct=1”_ makes _“sudo conntrack -L_” track byte and packet counters for each flow.
|
||||
|
||||
_“sudo sysctl net.netfilter.nf_conntrack_timestamp=1”_ records a “start timestamp” for each connection. _“sudo conntrack -L”_ then displays the seconds elapsed since the flow was first seen. Add “_–output ktimestamp_” to see the absolute start date as well.
|
||||
|
||||
### Insert and change entries
|
||||
|
||||
You can add entries to the state table. For example:
|
||||
|
||||
```
|
||||
sudo conntrack -I -s 192.168.7.10 -d 10.1.1.1 --protonum 17 --timeout 120 --sport 12345 --dport 80
|
||||
```
|
||||
|
||||
This is used by conntrackd for state replication. Entries of an active firewall are replicated to a standby system. The standby system can then take over without breaking connectivity even on established flows. Conntrack can also store metadata not related to the packet data sent on the wire, for example the conntrack mark and connection tracking labels. Change them with the “update” (-U) option:
|
||||
|
||||
```
|
||||
sudo conntrack -U -m 42 -p tcp
|
||||
```
|
||||
|
||||
This changes the connmark of all tcp flows to 42.
|
||||
|
||||
### **Delete entries**
|
||||
|
||||
In some cases, you want to delete enries from the state table. For example, changes to NAT rules have no effect on packets belonging to flows that are already in the table. For long-lived UDP sessions, such as tunneling protocols like VXLAN, it might make sense to delete the entry so the new NAT transformation can take effect. Delete entries via _“sudo conntrack -D_” followed by an optional list of address and port information. The following example removes the given entry from the table:
|
||||
|
||||
```
|
||||
sudo conntrack -D -p udp --src 10.0.12.4 --dst 10.0.0.1 --sport 1234 --dport 53
|
||||
```
|
||||
|
||||
### Conntrack error counters
|
||||
|
||||
Conntrack also exports statistics:
|
||||
|
||||
```
|
||||
# sudo conntrack -S
|
||||
cpu=0 found=0 invalid=130 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=10
|
||||
cpu=1 found=0 invalid=0 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=0
|
||||
cpu=2 found=0 invalid=0 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=1
|
||||
cpu=3 found=0 invalid=0 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=0
|
||||
```
|
||||
|
||||
Most counters will be 0. “Found” and “insert” will always be 0, they only exist for backwards compatibility. Other errors accounted for are:
|
||||
|
||||
* invalid: packet does not match an existing connection and doesn’t create a new connection.
|
||||
* insert_failed: packet starts a new connection, but insertion into the state table failed. This can happen for example when NAT engine happened to pick identical source address and port when Masquerading.
|
||||
* drop: packet starts a new connection, but no memory is available to allocate a new state entry for it.
|
||||
* early_drop: conntrack table is full. In order to accept the new connection existing connections that did not see two-way communication were dropped.
|
||||
* error: icmp(v6) received icmp error packet that did not match a known connection
|
||||
* search_restart: lookup interrupted by an insertion or deletion on another CPU.
|
||||
* clash_resolve: Several CPUs tried to insert identical conntrack entry.
|
||||
|
||||
|
||||
|
||||
These error conditions are harmless unless they occur frequently. Some can be mitigated by tuning the conntrack sysctls for the expected workload. _net.netfilter.nf_conntrack_buckets_ and _net.netfilter.nf_conntrack_max_ are typical candidates. See the [nf_conntrack-sysctl documentation][5] for a full list.
|
||||
|
||||
Use “_sudo sysctl_ _net.netfilter.nf_conntrack_log_invalid=255″_ to get more information when a packet is invalid. For example, when conntrack logs the following when it encounters a packet with all tcp flags cleared:
|
||||
|
||||
```
|
||||
nf_ct_proto_6: invalid tcp flag combination SRC=10.0.2.1 DST=10.0.96.7 LEN=1040 TOS=0x00 PREC=0x00 TTL=255 ID=0 PROTO=TCP SPT=5723 DPT=443 SEQ=1 ACK=0
|
||||
```
|
||||
|
||||
### Summary
|
||||
|
||||
This article gave an introduction on how to inspect the connection tracking table and the NAT information stored in tracked flows. The next part in the series will expand on the conntrack tool and the connection tracking event framework.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/network-address-translation-part-2-the-conntrack-tool/
|
||||
|
||||
作者:[Florian Westphal][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/strlen/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/02/network-address-translation-part-2-816x345.jpg
|
||||
[2]: https://fedoramagazine.org/network-address-translation-part-1-packet-tracing/
|
||||
[3]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure
|
||||
[4]: https://wiki.nftables.org/wiki-nftables/index.php/Performing_Network_Address_Translation_(NAT)#Masquerading
|
||||
[5]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/nf_conntrack-sysctl.rst
|
@ -0,0 +1,71 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why programmers love Linux packaging)
|
||||
[#]: via: (https://opensource.com/article/21/2/linux-packaging)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Why programmers love Linux packaging
|
||||
======
|
||||
Programmers can distribute their software easily and consistently via
|
||||
Flatpaks, letting them focus on their passion: Programming.
|
||||
![Package wrapped with brown paper and red bow][1]
|
||||
|
||||
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. Today, I'll talk about what makes packaging for Linux ideal for programmers.
|
||||
|
||||
Programmers love to program. That probably seems like an obvious statement, but it's important to understand that developing software involves a lot more than just writing code. It includes compiling, documentation, source code management, install scripts, configuration defaults, support files, delivery format, and more. Getting from a blank screen to a deliverable software installer requires much more than just programming, but most programmers would rather program than package.
|
||||
|
||||
### What is packaging?
|
||||
|
||||
When food is sent to stores to be purchased, it is packaged. When buying directly from a farmer or from an eco-friendly bulk or bin store, the packaging is whatever container you've brought with you. When buying from a grocery store, packaging may be a cardboard box, plastic bag, a tin can, and so on.
|
||||
|
||||
When software is made available to computer users at large, it also must be packaged. Like food, there are several ways software can be packaged. Open source software can be left unpackaged because users, having access to the raw code, can compile and package it themselves. However, there are advantages to packages, so applications are commonly delivered in some format specific to the user's platform. And that's where the problems begin, because there's not just one format for software packages.
|
||||
|
||||
For the user, packages make it easy to install software because all the work is done by the system's installer. The software is extracted from its package and distributed to the appropriate places within the operating system. There's little opportunity for anything to go wrong.
|
||||
|
||||
For the software developer, however, packaging means that you have to learn how to create a package—and not just one package, but a unique package for every operating system you want your software to be installable on. To complicate matters, there are multiple packaging formats and options for each operating system, and sometimes even for the programming language being used.
|
||||
|
||||
### Packaging on Linux
|
||||
|
||||
Packaging options for Linux have traditionally seemed pretty overwhelming. Linux distributions derived from Fedora, such as Red Hat and CentOS, default to `.rpm` packages. Debian and Ubuntu (and similar) default to `.deb` packages. Other distributions may use one or the other, or neither, opting for a custom format. When asked, many Linux users say that ideally, a programmer won't package their software for Linux at all but instead rely on the package maintainers of each distribution to create the package. All software installed onto any Linux system ought to come from that distribution's official repository. However, it remains unclear how to get your software reliably packaged and included by one distribution, let alone all distributions.
|
||||
|
||||
### Flatpak for Linux
|
||||
|
||||
The Flatpak packaging system was introduced to unify and decentralize Linux as a delivery target for developers. With Flatpak, either a developer or anyone (a member of a Linux community, a different developer, a Flatpak team member, or anyone else) is free to package software. They can then submit the package to Flathub or choose to self-host the package and offer it to basically any Linux distribution. The Flatpak system is available to all Linux distributions, so targeting one is the same as targeting them all.
|
||||
|
||||
### How Flatpak technology works
|
||||
|
||||
The secret to Flatpak's universal appeal is a standard base. The Flatpak system allows developers to reference a common set of Software Developer Kit (SDK) modules. These are packaged and managed by the maintainers of the Flatpak system. The SDKs get pulled in as needed whenever you install a Flatpak, ensuring compatibility with your system. Any given SDK is only required once because the libraries it contains can be shared across any Flatpak calling for it.
|
||||
|
||||
If a developer requires a library not already included in an existing SDK, the developer can add that library in the Flatpak.
|
||||
|
||||
The results speak for themselves. Users may install hundreds of packages on any Linux distribution from one central repository, called [Flathub][2].
|
||||
|
||||
### How developers use Flatpaks
|
||||
|
||||
Flatpaks are designed to be reproducible, so the build process is easily integrated into a CI/CD workflow. A Flatpak is defined in a [YAML][3] or JSON manifest file. You can create your first Flatpak by following my [introductory article][4], and you can read the full documentation at [docs.flatpak.org][5].
|
||||
|
||||
### Linux makes it easy
|
||||
|
||||
Creating software on Linux is easy, and packaging it up for Linux is simple and automatable. If you're a programmer, Linux makes it easy for you to forget about packaging by targeting one system and integrating that into your build process.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/2/linux-packaging
|
||||
|
||||
作者:[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/brown-package-red-bow.jpg?itok=oxZYQzH- (Package wrapped with brown paper and red bow)
|
||||
[2]: https://flatpak.org/setup/
|
||||
[3]: https://www.redhat.com/sysadmin/yaml-beginners
|
||||
[4]: https://opensource.com/article/19/10/how-build-flatpak-packaging
|
||||
[5]: https://docs.flatpak.org/en/latest/index.html
|
@ -0,0 +1,58 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Namespaces are the shamash candle of the Zen of Python)
|
||||
[#]: via: (https://opensource.com/article/19/12/zen-python-namespaces)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
命名空间是 Python 之禅的精髓
|
||||
======
|
||||
|
||||
> 这是 Python 之禅特别系列的一部分,重点是一个额外的原则:命名空间。
|
||||
|
||||
![在建筑物上的笔记本电脑上编程的人][1]
|
||||
|
||||
著名的<ruby>光明节<rt>Hanukkah</rt></ruby>有八个晚上的庆祝活动。然而,光明节的灯台有九根蜡烛:八根普通蜡烛和总是偏移的第九根蜡烛。它被称为 “shamash” 或 “shamos”,大致可以翻译为“仆人”或“看门人”的意思。
|
||||
|
||||
shamos 是点燃所有其它蜡烛的蜡烛:它是唯一一支可以用火的蜡烛,而不仅仅是观看。当我们结束关于 Python 之禅系列时,我看到命名空间提供了类似的作用。
|
||||
|
||||
### Python 中的命名空间
|
||||
|
||||
Python 使用命名空间来处理一切。虽然简单,但它们是稀疏的数据结构 —— 这通常是实现目标的最佳方式。
|
||||
|
||||
> *命名空间* 是一个从名字到对象的映射。
|
||||
>
|
||||
> —— [Python.org][2]
|
||||
|
||||
模块是命名空间。这意味着正确地预测模块语义通常只需要熟悉 Python 命名空间的工作方式。类是命名空间,对象是命名空间。函数可以访问它们的本地命名空间、父命名空间和全局命名空间。
|
||||
|
||||
这个简单的模型,即用 `.` 操作符访问一个对象,而这个对象又通常(但并不总是)会进行某种字典查找,这使得 Python 很难优化,但很容易解释。
|
||||
|
||||
事实上,一些第三方模块也采取了这个准则,并以此来运行。例如,[variants][3] 包把函数变成了“相关功能”的命名空间。这是一个很好的例子,说明 [Python 之禅][4] 是如何激发新的抽象的。
|
||||
|
||||
### 结语
|
||||
|
||||
感谢你和我一起参加这次以光明节为灵感的 [我最喜欢的语言][5] 的探索。
|
||||
|
||||
静心参禅,直至悟道。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/12/zen-python-namespaces
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building)
|
||||
[2]: https://docs.python.org/3/tutorial/classes.html
|
||||
[3]: https://pypi.org/project/variants/
|
||||
[4]: https://www.python.org/dev/peps/pep-0020/
|
||||
[5]: https://opensource.com/article/19/10/why-love-python
|
@ -0,0 +1,202 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "How to Create and Manage Archive Files in Linux"
|
||||
[#]: via: "https://www.linux.com/news/how-to-create-and-manage-archive-files-in-linux-2/"
|
||||
[#]: author: "LF Training https://training.linuxfoundation.org/announcements/how-to-create-and-manage-archive-files-in-linux/"
|
||||
|
||||
如何在 Linux 中创建和管理归档文件
|
||||
======
|
||||
|
||||
_由 Matt Zand 和 Kevin Downs 联合写作_
|
||||
|
||||
简而言之,归档是一个包含一系列文件和(或)目录的单一文件。归档文件通常用于在本地或互联网上传输,或成为一个一系列文件和目录的备份副本,从而允许你使用一个文件来工作(如果压缩,则其大小会小于所有文件的总和)。同样的,归档也用于软件应用程序打包。为了方便传输,可以很容易地压缩这个单一文件,而存档中的文件会保留原始结构和权限。
|
||||
|
||||
我们可以使用 tar 工具来创建、列出和提取归档中的文件。用 tar 生成的归档通常称为“tar 文件”、“tar 归档”或者“压缩包”(因为所有已归档的文件被合成了一个文件)。
|
||||
|
||||
本教程会展示如何使用 tar 创建、列出和提取归档中的内容。这三个操作都会使用两个公共选项 "-f" 和 "-v":使用 "-f" 指定归档文件的名称,使用 "-v"("verbose") 选项使 tar 在处理文件时输出文件名。虽然 "-v" 选项不是必需的,但是它可以让你观察 tar 操作的过程。
|
||||
|
||||
在本教程的剩余部分中,会涵盖 3 个主题:1、创建一个归档文件;2、列出归档文件内容;3、提取归档文件内容。另外我们会回答通过调查与归档文件管理的 6 个实际问题来结束本教程。你从本教程学到的内容对于执行与[网络安全][1]和[云技术][2]相关的任务至关重要。
|
||||
|
||||
### 1- 创建一个归档文件
|
||||
|
||||
要使用 tar 创建一个归档文件,使用 "-c"("create") 选项,然后用 "-f" 选项指定要创建的归档文件名。通常的做法是使用带有 ".tar" 扩展名的名称,例如 "my-backup.tar"。注意,除非另有特别说明,否则本文其余部分中使用的所有命令和参数都以小写形式使用。记住,在你的终端上输入本文的命令时,无需输入每个命令行开头的 $ 提示符。
|
||||
|
||||
输入要归档的文件名作为参数;如果要创建一个包含所有文件及其子目录的归档文件,提供目录名称作为参数。
|
||||
|
||||
要归档 "project" 目录内容,输入
|
||||
|
||||
$ _tar -cvf project.tar project_
|
||||
|
||||
这个命令将创建一个名为 "project.tar" 的归档文件,包含 "project" 目录的所有内容,而原目录 "project" 将保持不变。
|
||||
|
||||
使用 "-z" 选项可以对归档文件进行压缩,这样产生的输出与创建未压缩的存档然后用 gzip 压缩是一样的,但它省去了额外的步骤。
|
||||
|
||||
要从 "project" 目录创建一个 "project.tar.gz" 的压缩包,输入:
|
||||
|
||||
$ _tar -zcvf project.tar.gz project_
|
||||
|
||||
这个命令将创建一个 "project.tar.gz" 的压缩包,包含 "project" 目录的所有内容,而原目录 "project" 将保持不变。
|
||||
|
||||
**注意:**在使用 "-z" 选项时,你应该使用 ".tar.gz" 扩展名而不是 ".tar" 扩展名,这样表示已压缩。虽然不是必须的,但这是一个很好的实践。
|
||||
|
||||
Gzip 不是唯一的压缩形式,还有 bzip2 和 xz。当我们看到扩展名为 xz 的文件时,我们知道该文件是使用 xz 压缩的,扩展名为 .bz2 的文件是用 bzip2 压缩的。随着 bzip2 不再维护,我们将远离它而关注 xz。使用 xz 压缩时,需要花费更长的时间。然而,等待通常是值得的,因为压缩效果要好的多,这意味着压缩包通常比使用其它压缩形式要小。更好的是,不同压缩形式之间的解压缩或提取文件并没有太大区别。下面我们将看到一个使用 tar 压缩文件时如何使用 xz 的示例:
|
||||
|
||||
$ _tar -Jcvf project.tar.xz project_
|
||||
|
||||
我们只需将 gzip 的 -z 选项转换为 xz 的大写 -J 即可。以下是一些输出,显示压缩形式之间的差异:
|
||||
|
||||
![][3]
|
||||
|
||||
![][4]
|
||||
|
||||
如你所见,zx 的压缩时间最长。但是,它在减小文件大小方面做的最好,所以值得等待。文件越大,压缩效果也越好。
|
||||
|
||||
### 2- 列出归档文件的内容
|
||||
|
||||
要列出 tar 归档文件的内容但不提取,使用 "-t" 选项。
|
||||
|
||||
要列出 "project.tar" 的内容,输入:
|
||||
|
||||
$ _tar -tvf project.tar_ * *
|
||||
|
||||
这个命令列出了 "project.tar" 归档的内容。"-v" 和 "-t" 选项一起使用会输出每个文件的权限和修改时间,以及文件名。这与 ls 命令使用 "-l" 选项时使用的格式相同。
|
||||
|
||||
要列出 "project.tar.gz" 压缩包的内容,输入:
|
||||
|
||||
$ _tar -tvf project.tar_
|
||||
|
||||
### 3- 从归档中提取内容
|
||||
|
||||
要提取(解压)tar 归档文件中的内容,使用 "-x"("extract") 选项。
|
||||
|
||||
要提取 "project.tar" 归档的内容,输入:
|
||||
|
||||
$ _tar -xvf project.tar_
|
||||
|
||||
这个命令会将 "project.tar" 归档的内容提取到当前目录。
|
||||
|
||||
如果一个归档文件被压缩,通常来说它的扩展名为 ".tar.gz" 或 ".tgz",包括 "-z" 选项。
|
||||
|
||||
要提取 "project.tar.gz" 压缩包的内容,输入:
|
||||
|
||||
$ _tar -zxvf project.tar.gz_
|
||||
|
||||
**注意**:如果当前目录中有文件或子目录与归档文件中的内容同名,那么在提取归档文件时,这些文件或子目录将被覆盖。如果你不知道归档中包含哪些文件,请考虑先查看归档文件的内容。
|
||||
|
||||
在提取归档内容之前列出其内容的另一个原因是,确定归档中的内容是否包含在目录中。如果没有,而当前目录中包含许多不相关的文件,那么你可能将它们与归档中提取的文件混淆。
|
||||
|
||||
要将文件提取到它们自己的目录中,新建一个目录,将归档文件移到该目录,然后你就可以在新目录中提取文件。
|
||||
|
||||
现在我们已经学习了如何创建归档文件并列出和提取其内容,接下来我们可以继续讨论 Linux 专业人员经常被问到的 9 个实用问题。
|
||||
|
||||
* 可以在不解压缩的情况下添加内容到压缩包中吗?
|
||||
|
||||
很不幸,一旦文件将被压缩,就无法向其添加内容。你需要解压缩或提取其内容,然后编辑或添加内容,最后再次压缩文件。如果文件很小,这个过程不会花费很长时间,否则请等待一会。
|
||||
|
||||
* 可以在不解压缩的情况下删除归档文件中的内容吗?
|
||||
|
||||
这取决压缩时使用的 tar 版本。较新版本的 tar 支持 -delete 选项。
|
||||
|
||||
例如,假设归档文件中有 file1 和 file2,可以使用以下命令将它们从 file.tar 中删除:
|
||||
|
||||
_$ tar -vf file.tar –delete file1 file2_
|
||||
|
||||
删除目录 dir1:
|
||||
|
||||
_$ tar -f file.tar –delete dir1/*_
|
||||
|
||||
* 压缩和归档之间有什么区别?
|
||||
|
||||
查看归档和压缩之间差异最简单的方法是查看其解压大小。归档文件时,会将多个文件合并为一个。所以,如果我们归档 10 个 100kb 文件,则最终会得到一个 100kb 大小的文件。而如果压缩这些文件,则最终可能得到一个只有几 kb 或接近 100kb 的文件。
|
||||
|
||||
* 如何压缩归档文件?
|
||||
|
||||
如上所说,你可以使用带有 cvf 选项的 tar 目录来创建和归档文件。要压缩归档文件,有两个选择:通过压缩程序(例如 gzip)运行归档文件,或在使用 tar 命令时使用压缩选项。最常见的压缩标志 -z 表示 gzip,-j 表示 bzip,-J 表示 xz。例如:
|
||||
|
||||
_$ gzip file.tar_
|
||||
|
||||
或者,我们可以在使用 tar 命令时使用压缩标志,以下命令使用 gzip 标志 "z":
|
||||
|
||||
_$ tar -cvzf file.tar /some/directory_
|
||||
|
||||
* 如何一次创建多个目录和/或文件的归档?
|
||||
|
||||
一次要归档多个文件,这种情况并不少见。一次归档多个文件和目录并不像你想的那么难,你只需要提供多个文件或目录作为 tar 的参数即可:
|
||||
|
||||
_$ tar -cvzf file.tar file1 file2 file3_
|
||||
|
||||
或者
|
||||
|
||||
_$ tar -cvzf file.tar /some/directory1 /some/directory2_
|
||||
|
||||
* 创建归档时如何跳过目录和/或文件?
|
||||
|
||||
你可能会遇到这样的情况:要归档一个目录或文件,但不是所有文件,这种情况下可以使用 --exclude 选项:
|
||||
|
||||
_$ tar –exclude ‘/some/directory’ -cvf file.tar /home/user_
|
||||
|
||||
在示例中,/home/user 目录中除了 /some/directory 之外都将被归档。将 -exclude 选项放在源和目标之前,并用单引号将要排除的文件或目录引起来,这一点很重要。
|
||||
|
||||
### 总结
|
||||
|
||||
tar 命令对展示不需要的文件创建备份或压缩文件很有用。在更改文件之前备份它们是一个很好的做法。如果某些东西在更改后没有按预期正常工作,你始终可以还原到旧文件。压缩不再使用的文件有助于保持系统干净,并降低磁盘空间使用率。还有其它实用程序可以归档或压缩,但是 tar 因其多功能、易用性和受欢迎程度而独占鳌头。
|
||||
|
||||
### 资源
|
||||
|
||||
如果你想了解有关 Linux 的更多信息,强烈建议阅读以下文章和教程:
|
||||
|
||||
* [Linux 文件系统架构和管理综述][5]
|
||||
* [Linux 文件和目录系统工作原理的全面回顾][6]
|
||||
* [所有 Linux 系统发行版的综合列表][7]
|
||||
* [特殊用途 Linux 发行版的综合列表][8]
|
||||
* [Linux 系统管理指南 - 制作和管理备份操作的最佳实践][9]
|
||||
* [Linux 系统管理指南 - Linux 虚拟内存和磁盘缓冲区缓存概述][10]
|
||||
* [Linux 系统管理指南 - 监控 Linux 的最佳实践][11]
|
||||
* [Linux 系统管理指南 - Linux 启动和关闭的最佳实践][12]
|
||||
|
||||
|
||||
|
||||
### 关于作者
|
||||
|
||||
**Matt Zand** 是一位创业者,也是 3 家科技创业公司的创始人: [DC Web Makers][13]、[Coding Bootcamps][14] 和 [High School Technology Services][15]。他也是 [使用 Hyperledger Fabric 进行智能合约开发][16] 一书的主要作者。他为 Hyperledger、以太坊和 Corda R3 平台编写了 100 多篇关于区块链开发的技术文章和教程。在 DC Web Makers,他领导了一个区块链专家团队,负责咨询和部署企业去中心化应用程序。作为首席架构师,他为编码训练营设计和开发了区块链课程和培训项目。他拥有马里兰大学(University of Maryland)工商管理硕士学位。在区块链开发和咨询之前,他曾担任一些初创公司的高级网页和移动应用程序开发和顾问、天使投资人和业务顾问。你可以通过以下这个网址和他取得联系: <https://www.linkedin.com/in/matt-zand-64047871>。
|
||||
|
||||
**Kevin Downs** 是 Red Hat 认证的系统管理员和 RHCSA。他目前在 IBM 担任系统管理员,负责管理数百台运行在不同 Linux 发行版上的服务器。他是[编码训练营][17]的首席 Linux 讲师,并且他会讲授 [5 个自己的课程][18].
|
||||
|
||||
本文首发在 [Linux 基础培训][20]上。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/news/how-to-create-and-manage-archive-files-in-linux-2/
|
||||
|
||||
作者:[LF Training][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://training.linuxfoundation.org/announcements/how-to-create-and-manage-archive-files-in-linux/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://learn.coding-bootcamps.com/p/essential-practical-guide-to-cybersecurity-for-system-admin-and-developers
|
||||
[2]: https://learn.coding-bootcamps.com/p/introduction-to-cloud-technology
|
||||
[3]: https://training.linuxfoundation.org/wp-content/uploads/2020/12/Linux1-300x94.png
|
||||
[4]: https://training.linuxfoundation.org/wp-content/uploads/2020/12/Linux2-300x110.png
|
||||
[5]: https://blockchain.dcwebmakers.com/blog/linux-os-file-system-architecture-and-management.html
|
||||
[6]: https://coding-bootcamps.com/linux/filesystem/index.html
|
||||
[7]: https://myhsts.org/tutorial-list-of-all-linux-operating-system-distributions.php
|
||||
[8]: https://coding-bootcamps.com/list-of-all-special-purpose-linux-distributions.html
|
||||
[9]: https://myhsts.org/tutorial-system-admin-best-practices-for-managing-backup-operations.php
|
||||
[10]: https://myhsts.org/tutorial-how-linux-virtual-memory-and-disk-buffer-cache-work.php
|
||||
[11]: https://myhsts.org/tutorial-system-admin-best-practices-for-monitoring-linux-systems.php
|
||||
[12]: https://myhsts.org/tutorial-best-practices-for-performing-linux-boots-and-shutdowns.php
|
||||
[13]: https://blockchain.dcwebmakers.com/
|
||||
[14]: http://coding-bootcamps.com/
|
||||
[15]: https://myhsts.org/
|
||||
[16]: https://www.oreilly.com/library/view/hands-on-smart-contract/9781492086116/
|
||||
[17]: https://coding-bootcamps.com/
|
||||
[18]: https://learn.coding-bootcamps.com/courses/author/758905
|
||||
[19]: https://training.linuxfoundation.org/announcements/how-to-create-and-manage-archive-files-in-linux/
|
||||
[20]: https://training.linuxfoundation.org/
|
@ -0,0 +1,123 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (mengxinayan)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (10 ways to get started with open source in 2021)
|
||||
[#]: via: (https://opensource.com/article/21/1/getting-started-open-source)
|
||||
[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo)
|
||||
|
||||
2021 年开始使用开源的10钟方法
|
||||
======
|
||||
如果您刚开始接触开源,那么下面的 2020 年十大文章有助于指导您的发展之路。
|
||||
![看着职业生涯的地图][1]
|
||||
|
||||
opensource.com 存在的意义是为了向世界宣传开源的一切,从新工具到框架拓展到社区。我们的目标是让想要使用开源或为开源做贡献的人更容易参与其中。
|
||||
|
||||
入门开源可能很难,所以我们定期分享如何参与其中的提示和建议。如果你想要学习 Python,帮助抗击 COVID-19,或者加入 K8s 设置,我们将为您服务。
|
||||
|
||||
为了帮助您开始,我们总结了2020年发布的 10 篇最流行的开源入门文章。希望它们能激发您在 2021 年学习一些新知识。
|
||||
|
||||
### 利用 Python 实现网络爬虫的新手指南
|
||||
|
||||
您是否想通过实践而不是阅读来学习 Python?在本教程中,Julia Piaskowski 将会指导您完成她的第一个[Python 网页爬取项目][2]。她具体展示了如何使用 Python 库请求访问网页内容。
|
||||
|
||||
Julia 详细介绍了每一步,从安装 Python3 到使用 pandas 来清洁 Web 抓取结果。她利用了大量截图解释了如何以最终目标为目的进行爬取。
|
||||
|
||||
有关爬取相关内容的部分特别有用;当遇到困难处时,她会详细解释。但是,与本文的其余部分一样,她会指导您完成每个步骤。
|
||||
|
||||
### 在 Linux 上使用 SSH 进行远程连接的初学者指南
|
||||
|
||||
如果你之前从未使用过安全 shell(SSH),那么你在第一次使用时可能会感到困惑。在本教程中,Seth Kenlon 展示了[如何为两台计算机之间配置 SSH 连接][3],以及如何不使用密码而安全地进行连接。
|
||||
|
||||
Seth 解释了建立 SSH 连接的每个步骤,从您应该了解的四个关键术语到在每个主机上激活 SSH 的步骤。他还提供了有关查找计算机 IP 地址、创建 SSH 密钥以及堆远程计算机的远程访问权限的建议。
|
||||
|
||||
### 学习任何编程语言的 5 个步骤
|
||||
|
||||
如果您已经掌握了一种编程语言,则可以[全部学习[4]。这是 Seth Kenlon 编写本文的前提,他认为了解一些基本编程逻辑便可以跨语言拓展。
|
||||
|
||||
Seth 分享了程序员在学习一种新的编程语言或编码方式时所需要的五种东西。语法、内置函数和解析器位于这五种之中,他将会陪着每个人采取行动。
|
||||
|
||||
那么团结它们的关键方式是?一旦了解了代码工作原理,您就可以跨语言拓展。没有什么太难的让您学习。
|
||||
|
||||
### 为 COVID-19 贡献开源医疗项目
|
||||
|
||||
您是否知道一家意大利医院通过 3D 打印机设备挽救了 COVID-19 患者的生命?这是开源贡献者为 2020 年 COVID-19 大流行[建立的众多解决方案之一][5]。
|
||||
|
||||
在本文中,Joshua Pearce 分享了针对 COVID-19 的开源志愿服务项目。虽然 Open Air 是最大的项目,但 Joshua 解释了如何在 wiki 上为开源呼吸机工作,编写开源 COVID-19 医疗供应要求,测试开源氧气浓缩机原型等。
|
||||
|
||||
### GNOME 入门建议
|
||||
|
||||
GNOME 是最受欢迎的 Linux 桌面之一,但是它适合您吗?本文分享了[来自 GNOME 用户的建议][6],以及 opensource.com 上有关此主题的文章。
|
||||
|
||||
想要在配置桌面上寻找一些灵感吗?本文包含了有关 GNOME 拓展入门,将 Dash 安装到 Dock,使用 GNOME Tweak 工具等的链接。
|
||||
|
||||
毕竟,您可能会认为 GNOME 仍然不适合您——不用担心,最后您将找到指向其他 Linux 桌面和窗口管理器的链接。
|
||||
|
||||
### 现在开始为开源做贡献的 3 个理由
|
||||
|
||||
截至到 2020 年 6 月,Github 托管了超过 180,000 个公共仓库。现如今加入开源社区比过去更容易,但这是意味着您应该这样做?在本文中,opensource.com 通讯员 Jason Blais [分享了三个尝试的原因][7]。
|
||||
|
||||
为开源做贡献可以增强您的信心,简历和专业网络。Jason 还解释了如何利用有用的信息,从如何在领英(LinkedIn)个人资料中添加开源信息,到如何将这些信息转变为付费角色。 最后还列出了供初学者使用的出色项目。
|
||||
|
||||
### 作为 Linux 系统管理员为开源做贡献的 4 种方法
|
||||
|
||||
系统管理员是开源的无名英雄。他们在代码背后做了大量工作,这些代码非常有价值,但通常是看不见的。
|
||||
|
||||
在本文中,Elizabeth K. Joseph 介绍了她如何以 Linux 系统管理员的身份[来改善开源项目][8]。她离开社区比发现社区更好的几种方式为用户支持、托管项目资源以及查找新的网站环境。
|
||||
|
||||
也许最重要的贡献是什么?文档!Elizabeth 开始使用开源程序,为她使用的项目重写了快速入门指南。同时向您经常使用的项目提交错误和补丁报告是参与其中的理想方法。
|
||||
|
||||
### 为 Slack 的开源替代品做出贡献的 6 种方法
|
||||
|
||||
Mattermost 是需要开源消息传递系统的团队的流行平台。其活跃、充满活力的社区是让用户保持忠诚度的关键因素,尤其是对那些具有 Go,React 和 DevOps 经验的用户。
|
||||
|
||||
如果您想[为 Mattermost 做出贡献][9],Jason Blais 具体介绍了如何参与其中。将本文视为您的入门文档:Blais 分享了您要采取的步骤,并介绍了您可以做出的六种贡献。
|
||||
|
||||
无论您是要构建集成还是本地化语言,本文都将介绍如何进行。
|
||||
|
||||
### 如何为 K8s 做贡献
|
||||
|
||||
当我走进 2018 年温哥华青年开源峰会却不了解 K8s。主题演讲结束后,我离开会场后依然是一个困惑的女人。毫不夸张地说,K8s 已经彻底改变了开源:找到一个更受欢迎、更具影响力的项目很困难。
|
||||
|
||||
如果您想做出贡献,那么 IBM 工程师 Tara Gu 介绍了[她是如何开始的][10]。本文介绍了她在 All Things Open 2019 会议上的闪电演讲的回顾以及包括她亲自演讲的视频。还记得那些吗?
|
||||
|
||||
### 任何人如何在工作中为开源软件做出贡献
|
||||
|
||||
必要性是发明之母,尤其是在开源中。许多人针对自己遇到的问题构建开源解决方案。但是如果开发人员在没有收集目标用户反馈的情况下通过构建产品而错过了商标,会发生什么呢?
|
||||
|
||||
产品和设计团队通常会填补企业中的这一空白。如果开源团队中不存在这样的角色,开发人员应该怎么做?
|
||||
|
||||
在本文中,Catherine Robson 介绍了开源团队如何从目标用户那里[收集反馈][11]。它为希望与开发人员分享他们的工作经验,从而将他们的反馈贡献到开源项目的人们而编写。
|
||||
|
||||
Catherine 概述的步骤将帮助您与开源团队分享您的见解,并在帮助团队开发更好的产品方面发挥关键作用。
|
||||
|
||||
### 您想要学习什么?
|
||||
|
||||
您想了解开源入门哪些方面的知识?请在评论中分享您堆文章主题的建议。同时如果您有一个故事可以分享,以帮助他人开始使用开源软件,请考虑为 opensource.com [编写文章][12]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/1/getting-started-open-source
|
||||
|
||||
作者:[Lauren Maffeo][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[萌新阿岩](https://github.com/mengxinayan)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/lmaffeo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/career_journey_road_gps_path_map_520.png?itok=PpL6jJgY (Looking at a map for career journey)
|
||||
[2]: https://opensource.com/article/20/5/web-scraping-python
|
||||
[3]: https://opensource.com/article/20/9/ssh
|
||||
[4]: https://opensource.com/article/20/10/learn-any-programming-language
|
||||
[5]: https://opensource.com/article/20/3/volunteer-covid19
|
||||
[6]: https://opensource.com/article/20/6/gnome-users
|
||||
[7]: https://opensource.com/article/20/6/why-contribute-open-source
|
||||
[8]: https://opensource.com/article/20/7/open-source-sysadmin
|
||||
[9]: https://opensource.com/article/20/7/mattermost
|
||||
[10]: https://opensource.com/article/20/1/contributing-kubernetes-all-things-open-2019
|
||||
[11]: https://opensource.com/article/20/10/open-your-job
|
||||
[12]: https://opensource.com/how-submit-article
|
Loading…
Reference in New Issue
Block a user