Merge pull request #3 from LCTT/master

从上游更新
This commit is contained in:
jx.zeng 2020-06-30 09:37:42 +08:00 committed by GitHub
commit 08f3d300aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 3384 additions and 1796 deletions

View File

@ -1,22 +1,22 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12354-1.html)
[#]: subject: (Ubuntu Budgie 20.04 Review: Smooth, Polished & Plenty of Changes)
[#]: via: (https://itsfoss.com/ubuntu-budgie-20-04-review/)
[#]: author: (John Paul https://itsfoss.com/author/john/)
Ubuntu Budgie 20.04 评测:平滑、精致和丰富的变化
Ubuntu Budgie 20.04 LTS平滑、精致和丰富的变化
======
正如我们向读者承诺的那样,我们将对 [Ubuntu 20.04 LTS 版本][1]的所有主要特色版进行评测。在这个续篇中,我们将对 Ubuntu Budgie 进行评测。
![Ubuntu Budgie Desktop][2]
[Ubuntu Budgie][3],顾名思义,是使用 [Budgie 桌面环境][5]的 [Ubuntu 官方特色版][4]。这个版本是 Ubuntu 家族中较新的成员。Ubuntu Budgie 的第一个版本是 16.04,它在 17.04 版本被接受为官方特色版。
顾名思义,[Ubuntu Budgie][3] 是使用 [Budgie 桌面环境][5]的 [Ubuntu 官方特色版][4]。这个版本是 Ubuntu 家族中较新的一位成员。Ubuntu Budgie 的第一个版本是 16.04,它在 17.04 版本被接受为官方特色版。
他们的[目标][6]是“将 Budgie 界面的简洁和优雅结合起来,产生一个具有现代范式的传统的桌面导向的发行版。”
他们的[目标][6]是“结合 Budgie 界面的简洁和优雅,以生产具有现代范式的面向桌面的传统发行版。”
### Ubuntu Budgie 20.04 评测:哪些改变了,哪些没有!
@ -31,38 +31,38 @@ Ubuntu Budgie 20.04 评测:平滑、精致和丰富的变化
* 现在已经为 20.04 重构了向后移植包
* 默认浏览器是火狐
* 默认使用 Catfish 搜索文件和文本
* 在 budgie 中集成了 Nemo 文件管理器
* 在 Budgie 中集成了 Nemo 文件管理器
* 由于错误,系统托盘小程序被移除了
* 默认情况下,事件警报声被禁用
* 修复键盘快捷键神秘失踪的问题
* 更好的锁屏风格
* 由于社区的求,文件应用 Nautilus 已被 Nemo 取代
* Plank 坞站现在已经切换到屏幕底部,是透明的,并且默认有弹动画
* 快速笔记和热角小程序已从 Python 移植到 Vala以提高速度
* 修复键盘快捷键神秘失踪的问题
* 更好的锁屏样式
* 由于社区的求,文件应用 Nautilus 已被 Nemo 取代
* Plank 坞站现在已经切换到屏幕底部,是透明的,并且默认有弹动画
* 快速笔记和热角小程序已从 Python 移植到 Vala以提高速度
* Celluloid 取代了 MPV
* 更新了 GNOME 的依赖性
![][8]
Ubuntu Budgie 现在提供最新版本的 Budgie 桌面环境10.5.1)。改进的地方包括:
Ubuntu Budgie 现在随附了 Budgie 桌面环境的最新版本10.5.1)。改进包括:
* 在 Budgie 桌面设置中新增 Raven 部分
* Raven 通知可以分组,通知可以关闭
* 图标任务列表被移除
* 重新打造了图标任务列表
* 能够设置虚拟桌面的数量
Ubuntu Budgie 自带了大量的 Budgie 小程序和微应用。它们可以通过 Ubuntu Budgie Welcome 来安装。
Ubuntu Budgie 自带了大量的 Budgie <ruby>小程序<rt>applet</rt></ruby><ruby>微应用<rt>min-app</rt></ruby>。它们可以通过 Ubuntu Budgie “欢迎”应用来安装。
![Ubuntu Budgie Welcome][9]
* WeatherShow - 显示未来五天的天气预报,每 3 小时更新一次
* Wallstreet - 一个允许你在图像文件夹中循环的壁纸工具
* Visual-space - 一个紧凑的工作区切换器
* Dropby - 这个小程序允许你从面板上快速管理 U 盘
* Kangaroo - 从面板上快速浏览文件夹
* 垃圾桶小程序 - 管理你的垃圾桶
* Fuzzyclock - 以模糊的方式显示时间
* 工作区秒表 - 允许你跟踪在每个工作区花费的时间
* WeatherShow显示未来五天的天气预报,每 3 小时更新一次
* Wallstreet:一个可以循环展示你的图像文件夹中的壁纸工具
* Visual-space一个紧凑的工作区切换器
* Dropby:这个小程序可让你在面板上快速管理 U 盘
* Kangaroo从面板上快速浏览文件夹
* 垃圾桶小程序管理你的垃圾桶
* Fuzzyclock以模糊的方式显示时间
* 工作区秒表允许你跟踪在每个工作区花费的时间
完整的变更和更新列表,请访问[变更日志][10]。
@ -97,7 +97,7 @@ Ubuntu Budgie 中默认包含了以下有用的应用程序:
* Maps
* Rhythmbox
* Tilix
* Ubuntu Budgie Welcome
* Ubuntu Budgie 欢迎应用
* Evince 文档查看器
* Plank
* Celluloid
@ -106,27 +106,27 @@ Ubuntu Budgie 中默认包含了以下有用的应用程序:
### 安装
起初,我无法让 Ubuntu Budgie 进入即用环境,以便我可以安装它。结果发现 Ubuntu Budgie 试图通过 EFI 来启动,我联系了 [Ubuntu Budgie 论坛][14]得到了解决方案。
起初,我无法让 Ubuntu Budgie 进入<ruby>即用<rt>live</rt></ruby>环境来安装它。结果发现 Ubuntu Budgie 试图通过 EFI 来启动,我从 [Ubuntu Budgie 论坛][14]得到了解决方案。
一旦出现紫色的闪屏,我必须按下 `ESC` 键并选择 `legacy`。之后,它就像正常的启动和安装一样了,没有问题。我只在 Ubuntu Budgie 上遇到过这个问题。我下载并尝试了 Ubuntu MATE 20.04 ISO但没有遇到类似的问题。
当出现紫色的闪屏时,我必须按下 `ESC` 键并选择 `legacy`。之后,它就如常启动了,安装也没有问题了。我只在 Ubuntu Budgie 上遇到过这个问题。我下载并尝试了 Ubuntu MATE 20.04 ISO但没有遇到类似的问题。
### Ubuntu Budgie 20.04 的体验
![][15]
除了安装上的小问题,我使用 Ubuntu Budgie 期间非常愉快。自 [Ikey][16] 第一次创建 Budgie 桌面以来Budgie 桌面已经进步了很多,它已经成为一个非常成熟的选择。Ubuntu Budgie 的目标是“制作一个传统的桌面导向的发行版”。它确实做到了这一点。他们所做的所有改变都在不断地为他们的产品增添更多的光彩。
除了这个安装上的小问题,我使用 Ubuntu Budgie 的体验非常愉快。自 [Ikey][16] 第一次创建 Budgie 桌面以来Budgie 桌面已经进步了很多,并且已经成为一个非常成熟的选择。Ubuntu Budgie 的目标是“生产一个面向桌面的传统发行版”。它确实做到了极致。他们所做的所有改变都在不断地为他们的产品增添更多的光彩。
总的来说Ubuntu Budgie 是一个非常漂亮的发行版。从默认的主题到壁纸选项,你可以看出他们在视觉体验上做了很多努力
总的来说Ubuntu Budgie 是一个非常漂亮的发行版。从默认的主题到壁纸选择,你可以看出他们付出了很多努力,视觉体验非常吸引人
需要注意的是Ubuntu Budgie 并不适合低配置的系统。我在戴尔 Latitude D630 上运行它。在没有打开任何应用程序的情况下,它使用了大约 700MB 的内存。
在 Ubuntu Budgie 中,我喜欢的一个部分是 [Tilix 终端模拟器][17]。Tilix 允许你在右侧或下方添加终端窗口。它有一大堆功能,我就是喜欢用它,我正打算安装在我的其他 Linux 系统上
在 Ubuntu Budgie 中,我喜欢的部分超乎我的预期,其中一个部分是 [Tilix 终端模拟器][17]。Tilix 允许你在右侧或下方添加终端窗口。它有很多很多功能,我简直爱死了它,我打算在我的其他 Linux 系统上也安装它
### 关于 Ubuntu Budgie 20.04 的最后感想
Ubuntu Budgie 是众多官方版本中一个值得欢迎的新版本。Budgie 给人的感觉是非常流畅和精致。它不会让你碍手碍脚,而是让你完成工作。
Ubuntu Budgie 是众多官方版本中一个很受欢迎的新版本。Budgie 给人的感觉非常流畅和精致。它不会让你觉得碍手碍脚,而是帮你完成工作。
如果你厌倦了当前的桌面环境,想看看新的东西,不妨来看看。如果你对当前的设置感到满意,请查看 Ubuntu Budgie 的即用 DVD。你可能会喜欢上它。
如果你厌倦了当前的桌面环境,想体验一下新的东西,不妨来看看。如果你对当前的环境感到满意,那么就试试 Ubuntu Budgie 的即用 DVD。你可能会喜欢上它。
![关于 Ubuntu Budgie][18]
@ -139,7 +139,7 @@ via: https://itsfoss.com/ubuntu-budgie-20-04-review/
作者:[John Paul][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -149,7 +149,7 @@ via: https://itsfoss.com/ubuntu-budgie-20-04-review/
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-busgie-desktop.png?resize=800%2C500&ssl=1
[3]: https://ubuntubudgie.org/
[4]: https://itsfoss.com/which-ubuntu-install/
[5]: https://en.wikipedia.org/wiki/Budgie_(desktop_environment
[5]: https://en.wikipedia.org/wiki/Budgie_
[6]: https://ubuntubudgie.org/about-us/
[7]: https://itsfoss.com/ubuntu-budgie-18-review/
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-desktop-settings.jpeg?ssl=1

View File

@ -1,108 +1,123 @@
[#]: collector: (lujun9972)
[#]: translator: (MjSeven)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12356-1.html)
[#]: subject: (Simplify data visualization in Python with Plotly)
[#]: via: (https://opensource.com/article/20/5/plotly-python)
[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan)
使用 Plotly 来简化 Python 中的数据可视化
======
Plotly 是一个数据绘图库,具有整洁的接口,它旨在允许你构建自己的 API。
![Colorful sound wave graph][1]
> Plotly 是一个数据绘图库,具有整洁的接口,它旨在允许你构建自己的 API。
![](https://img.linux.net.cn/data/attachment/album/202006/27/215314y0rkrz0e9zw7wd2o.jpg)
Plotly 是一个绘图生态系统,可以让你在 [Python][2] 以及 JavaScript 和 R 中进行绘图。在本文中,我将重点介绍[使用 Python 库进行绘图][3]。
Plotly 有三种不同的 Python API你可以选择不同的方法来使用它
* 类似于 Matplotlib 的[面向对象的 API][4]
* [数据驱动的 API][5],通过构造类似 JSON 的数据结构来指定绘图
* 类似于 Matplotlib 的面向对象的 API
* 数据驱动的 API通过构造类似 JSON 的数据结构来定义绘图
* 类似于 Seaborn 的高级绘图接口,称为 “Plotly Express” API
* 类似于 Seaborn 的高级绘图接口,称为 ["Plotly Express" API][6]
我将通过使用每个 API 来绘制相同的图来探索它们:英国大选结果的分组柱状图。
我将探索使用每个 API 来绘制相同的图:英国大选结果的分组柱状图。
在我们进一步探讨之前,请注意,你可能需要调整你的 Python 环境来让这段代码运行,包括以下内容:
- 运行最新版本的Python[Linux][4]、[Mac][5] 和 [Windows][6] 的说明)
- 确认你运行的 Python 版本能与这些库一起工作
数据可在线获得,可以用 Pandas 导入。
```
import pandas as pd
df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv')
```
现在我们可以继续进行了。
### 使用图对象来绘制图
Plotly 面向对象的 API 被称为图对象,它有点类似于 [Matplotlib 的面向对象 API][7]。
Plotly 面向对象的 API 被称为 `graph_objects`,它有点类似于 [Matplotlib 的面向对象 API][7]。
要创建一个柱状图,你可以构造一个包含四个柱状图的对象:
```
    # 导入 Plotly 和数据
    import plotly.graph_objects as go
    from votes import wide as df
# 导入 Plotly 和数据
import plotly.graph_objects as go
from votes import wide as df
    # 得到 x 列表
    years = df['year']
    x = list(range(len(years)))
# 得到 x 列表
years = df['year']
x = list(range(len(years)))
    # 指定绘图
    bar_plots = [
      go.Bar(x=x, y=df['conservative'], name='Conservative', marker=go.bar.Marker(color='#0343df')),
      go.Bar(x=x, y=df['labour'], name='Labour', marker=go.bar.Marker(color='#e50000')),
      go.Bar(x=x, y=df['liberal'], name='Liberal', marker=go.bar.Marker(color='#ffff14')),
      go.Bar(x=x, y=df['others'], name='Others', marker=go.bar.Marker(color='#929591')),
    ]
# 定义绘图
bar_plots = [
  go.Bar(x=x, y=df['conservative'], name='Conservative', marker=go.bar.Marker(color='#0343df')),
  go.Bar(x=x, y=df['labour'], name='Labour', marker=go.bar.Marker(color='#e50000')),
  go.Bar(x=x, y=df['liberal'], name='Liberal', marker=go.bar.Marker(color='#ffff14')),
  go.Bar(x=x, y=df['others'], name='Others', marker=go.bar.Marker(color='#929591')),
]
# 指定样式
layout = go.Layout(
  title=go.layout.Title(text="Election results", x=0.5),
  yaxis_title="Seats",
  xaxis_tickmode="array",
  xaxis_tickvals=list(range(27)),
  xaxis_ticktext=tuple(df['year'].values),
)
   
    # 指定样式
    layout = go.Layout(
      title=go.layout.Title(text="Election results", x=0.5),
      yaxis_title="Seats",
      xaxis_tickmode="array",
      xaxis_tickvals=list(range(27)),
      xaxis_ticktext=tuple(df['year'].values),
    )
       
    # 绘制柱状图
    fig = go.Figure(data=bar_plots, layout=layout)
# 绘制柱状图
fig = go.Figure(data=bar_plots, layout=layout)
    # 告诉 Plotly 去渲染
    fig.show()
# 告诉 Plotly 去渲染
fig.show()
```
与 Matplotlib 不同的是,你无需手动计算柱状图的 x 轴位置Plotly 会帮你适配。
与 Matplotlib 不同的是,你无需手动计算柱状图的 `x` 轴位置Plotly 会帮你适配。
最终结果图:
![A multi-bar plot made using Graph Objects][8]
A multi-bar plot made using Graph Objects (© 2019 [Anvil][9])
*A multi-bar plot made using Graph Objects (© 2019 [Anvil][9])*
### 使用 Python 数据结构来绘图
你还可以使用 Python 基本数据结构来定绘图,它与面对对象 API 具有相同的结构。这直接对应于 Plotly 的 JavaScript 实现的 JSON API。
你还可以使用 Python 基本数据结构来定绘图,它与面对对象 API 具有相同的结构。这直接对应于 Plotly 的 JavaScript 实现的 JSON API。
```
    # 指定绘图数据
    fig = {
        'data': [
            {'type': 'bar', 'x': x, 'y': df['conservative'], 'name': 'Conservative', 'marker': {'color': '#0343df'}},
            {'type': 'bar', 'x': x, 'y': df['labour'], 'name': 'Labour', 'marker': {'color': '#e50000'}},
            {'type': 'bar', 'x': x, 'y': df['liberal'], 'name': 'Liberal', 'marker': {'color': '#ffff14'}},
            {'type': 'bar', 'x': x, 'y': df['others'], 'name': 'Others', 'marker': {'color': '#929591'}},
        ],
        'layout': {
            'title': {'text': 'Election results', 'x': 0.5},
            'yaxis': {'title': 'Seats'},
            'xaxis': {
                'tickmode': 'array',
                'tickvals': list(range(27)),
                'ticktext': tuple(df['year'].values),
            }
# 定义绘图数据
fig = {
    'data': [
        {'type': 'bar', 'x': x, 'y': df['conservative'], 'name': 'Conservative', 'marker': {'color': '#0343df'}},
        {'type': 'bar', 'x': x, 'y': df['labour'], 'name': 'Labour', 'marker': {'color': '#e50000'}},
        {'type': 'bar', 'x': x, 'y': df['liberal'], 'name': 'Liberal', 'marker': {'color': '#ffff14'}},
        {'type': 'bar', 'x': x, 'y': df['others'], 'name': 'Others', 'marker': {'color': '#929591'}},
    ],
    'layout': {
        'title': {'text': 'Election results', 'x': 0.5},
        'yaxis': {'title': 'Seats'},
        'xaxis': {
            'tickmode': 'array',
            'tickvals': list(range(27)),
            'ticktext': tuple(df['year'].values),
        }
    }
}
    # 告诉 Plotly 去渲染它
    pio.show(fig)
# 告诉 Plotly 去渲染它
pio.show(fig)
```
最终结果与上次完全相同:
![A multi-bar plot made using JSON-like data structures][10]
A multi-bar plot made using JSON-like data structures (© 2019 [Anvil][9])
*A multi-bar plot made using JSON-like data structures (© 2019 [Anvil][9])*
#### 使用 Plotly Express 进行绘图
@ -111,23 +126,23 @@ A multi-bar plot made using JSON-like data structures (© 2019 [Anvil][9])
你可以使用一行代码来绘制柱状图:
```
    # 导入 Plotly 和数据
    import plotly.express as px
    from votes import long as df
# 导入 Plotly 和数据
import plotly.express as px
from votes import long as df
    # 定义颜色字典获得自定义栏颜色
    cmap = {
        'Conservative': '#0343df',
        'Labour': '#e50000',
        'Liberal': '#ffff14',
        'Others': '#929591',
    }
   
    # 生成图
    fig = px.bar(df, x="year", y="seats", color="party", barmode="group", color_discrete_map=cmap)
# 定义颜色字典获得自定义栏颜色
cmap = {
    'Conservative': '#0343df',
    'Labour': '#e50000',
    'Liberal': '#ffff14',
    'Others': '#929591',
}
# 生成图
fig = px.bar(df, x="year", y="seats", color="party", barmode="group", color_discrete_map=cmap)
```
这里使用了 [Long Form][12] 数据,也称为“整洁数据”。这些列代表年份、政党和席位,而不是按政党划分。这与在 [Seaborn][13] 中制作柱状图非常相似。
这里使用了<ruby>[长表][12]<rt>Long Form</rt></ruby> 数据,也称为“整洁数据”。这些列代表年份、政党和席位,而不是按政党划分。这与在 [Seaborn][13] 中制作柱状图非常相似。
```
>> print(long)
@ -147,38 +162,38 @@ A multi-bar plot made using JSON-like data structures (© 2019 [Anvil][9])
[108 rows x 3 columns]
```
你可以访问底层的图对象 API 进行详细调整。如添加标题和 y 轴标签:
你可以访问底层的图对象 API 进行详细调整。如添加标题和 `y` 轴标签:
```
    # 使用图对象 API 来调整绘图
    import plotly.graph_objects as go
    fig.layout = go.Layout(
        title=go.layout.Title(text="Election results", x=0.5),
        yaxis_title="Seats",
    )
# 使用图对象 API 来调整绘图
import plotly.graph_objects as go
fig.layout = go.Layout(
    title=go.layout.Title(text="Election results", x=0.5),
    yaxis_title="Seats",
)
```
最后,让 Plotly 渲染:
```
    fig.show()
fig.show()
```
这将在未使用的端口上运行一个临时 Web 服务器,并打开默认的 Web 浏览器来查看图像Web 服务器将会马上被关闭)。
不幸的是结果并不完美。x 轴被视为整数,因此两组之间的距离很远且很小,这使得我们很难看到趋势。
不幸的是,结果并不完美。`x` 轴被视为整数,因此两组之间的距离很远且很小,这使得我们很难看到趋势。
![使用 Plotly Express 制作的柱状图][14]
A multi-bar plot made using Plotly Express (© 2019 [Anvil][9])
*A multi-bar plot made using Plotly Express (© 2019 [Anvil][9])*
你可能会尝试通过将 x 值转换为字符串来使 Plotly Express 将其视为字符串,这样它就会以均匀的间隔和词法顺序来绘制。不幸的是,它们的间隔还是很大,设置 x 值不像在图对象中那样设置
你可能会尝试通过将 `x` 值转换为字符串来使 Plotly Express 将其视为字符串,这样它就会以均匀的间隔和词法顺序来绘制。不幸的是,它们的间隔还是很大,像在 `graph_objects`中那样设置 `xaxis_tickvals` 也不行
与 [Seaborn][13] 中的类似示例不同,在这种情况下,抽象似乎没有提供足够的[应急方案][15]来提供你想要的东西,但是也许你可以编写 _自己_ 的 API
与 [Seaborn][13] 中的类似示例不同,在这种情况下,抽象似乎没有提供足够的[应急方案][15]来提供你想要的东西,但是也许你可以编写*自己*的 API
### 构建自己的 Plotly API
对 Plotly 的操作方式不满意?构建自己的 Plotly API
对 Plotly 的操作方式不满意?那就构建自己的 Plotly API
Plotly 的核心是一个 JavaScript 库,它使用 [D3][16] 和 [stack.gl][17] 进行绘图。JavaScript 库的接口使用指定的 JSON 结构来绘图。因此,你只需要输出 JavaScript 库喜欢使用的 JSON 结构就好了。
@ -186,42 +201,42 @@ Anvil 这样做是为了创建一个完全在浏览器中工作的 Python Plotly
![Ployly 使用 JavaScript 库创建图形,由其它语言库通过 JSON 使用][18]
Plotly uses a JavaScript library to create plots, driven by libraries in other languages via JSON  2019 [Anvil][9])
*Plotly uses a JavaScript library to create plots, driven by libraries in other languages via JSON  2019 [Anvil][9])*
在 Anvil 版本中,你可以同时使用图对象 API 和上面介绍的 Python 数据结构方法。运行完全相同的命令,将数据和布局分配给 Anvil 应用程序中的 [Plot 组件][19]。
这是用 Anvil 的客户端 Python API 绘制的柱状图:
这是用 Anvil 的客户端 Python API 绘制的多列柱状图:
```
# Import Anvil libraries
# 导入 Anvil 库
from ._anvil_designer import EntrypointTemplate
from anvil import *
import anvil.server
# Import client-side Plotly
# 导入客户端 Plotly
import plotly.graph_objs as go
# This is an Anvil Form
# 这是一个 Anvil 表单
class Entrypoint(EntrypointTemplate):
  def __init__(self, **properties):
    # Set Form properties and Data Bindings.
    self.init_components(**properties)
    # Fetch the data from the server
    # 从服务器获取数据
    data = anvil.server.call('get_election_data')
   
    #  Get a convenient list of x-values
    # 获取一个方便的 x 值列表
    years = data['year']
    x = list(range(len(years)))
    # Specify the plots
    # 定义绘图
    bar_plots = [
      go.Bar(x=x, y=data['conservative'], name='Conservative', marker=go.Marker(color='#0343df')),
      go.Bar(x=x, y=data['labour'], name='Labour', marker=go.Marker(color='#e50000')),
      go.Bar(x=x, y=data['liberal'], name='Liberal', marker=go.Marker(color='#ffff14')),
      go.Bar(x=x, y=data['others'], name='Others', marker=go.Marker(color='#929591')),
    ]
    # Specify the layout
    # 规定布局
    layout = {
      'title': 'Election results',
      'yaxis': {'title': 'Seats'},
@ -232,7 +247,7 @@ class Entrypoint(EntrypointTemplate):
      },
    }
    # Make the multi-bar plot
    # 生成多列柱状图
    self.plot_1.data = bar_plots
    self.plot_1.layout = layout
```
@ -243,8 +258,7 @@ class Entrypoint(EntrypointTemplate):
![The election plot on the web using Anvil's client-side-Python Plotly library][20]
The election plot on the web using Anvil's [client-side-Python][21] Plotly library (© 2019 [Anvil][9])
使用 Anvil 的 [Python 客户端][21] Plotly 库在网络上进行选举的情节 (© 2019 [Anvil][9])
*The election plot on the web using Anvil's [client-side-Python][21] Plotly library (© 2019 [Anvil][9])*
你可以[复制此示例][22]作为一个 Anvil 应用程序注意Anvil 需要注册才能使用)。
@ -252,60 +266,53 @@ The election plot on the web using Anvil's [client-side-Python][21] Plotly libra
### 在 Plotly 中自定义交互
Plotly 绘图不仅是动态的,你可以自定义它们的互动行为。例如,你可以在每个条形图中使用 hovertemplate 自定义工具提示的格式:
Plotly 绘图不仅是动态的,你可以自定义它们的互动行为。例如,你可以在每个柱状图中使用 `hovertemplate` 自定义工具提示的格式:
```
    go.Bar(
      x=x,
      y=df['others'],
      name='others',
      marker=go.bar.Marker(color='#929591'),
      hovertemplate='Seats: &lt;b&gt;%{y}&lt;/b&gt;',
    ),
go.Bar(
x=x,
y=df['others'],
name='others',
marker=go.bar.Marker(color='#929591'),
hovertemplate='Seats: <b>%{y}</b>',
),
```
当你把这个应用到每个柱状图时,你会看到以下结果:
![A multi-bar plot with custom tool-tips][23]
A multi-bar plot with custom tool-tips (© 2019 [Anvil][9])
*A multi-bar plot with custom tool-tips (© 2019 [Anvil][9])*
这很有用,当你想要在某些事件发生时执行另一些事件时它会表现的更好(例如,当用户将鼠标悬停在栏上,你想要显示有关相关选择的信息框)。在 Anvil 的 Plotly 库中,你可以将事件处理程序绑定到诸如悬停之类的事件,这使得复杂的交互成为可能。
这很有用,当你想要在某些事件发生时执行任何你想要的代码就更好了(例如,当用户将鼠标悬停在栏上,你想要显示一个相关选举的信息框)。在 Anvil 的 Plotly 库中,你可以将事件处理程序绑定到诸如悬停之类的事件,这使得复杂的交互成为可能。
![A multi-bar plot with a hover event handler][24]
A multi-bar plot with a hover event handler (© 2019 [Anvil][9])
*A multi-bar plot with a hover event handler (© 2019 [Anvil][9])*
你可以通过将方法绑定到绘图的悬停事件来实现:
```
  def plot_1_hover(self, points, **event_args):
    """This method is called when a data point is hovered."""
    i = points[0]['point_number']
    self.label_year.text = self.data['year'][i]
    self.label_con.text = self.data['conservative'][i]
    self.label_lab.text = self.data['labour'][i]
    self.label_lib.text = self.data['liberal'][i]
    self.label_oth.text = self.data['others'][i]
    url = f"<https://en.wikipedia.org/wiki/{self.data\['year'\]\[i\]}\_United\_Kingdom\_general\_election>"
    self.link_more_info.text = url
    self.link_more_info.url = url
def plot_1_hover(self, points, **event_args):
"""This method is called when a data point is hovered."""
i = points[0]['point_number']
self.label_year.text = self.data['year'][i]
self.label_con.text = self.data['conservative'][i]
self.label_lab.text = self.data['labour'][i]
self.label_lib.text = self.data['liberal'][i]
self.label_oth.text = self.data['others'][i]
url = f"https://en.wikipedia.org/wiki/{self.data['year'][i]}_United_Kingdom_general_election"
self.link_more_info.text = url
self.link_more_info.url = url
```
这是一种相当极端的交互性,从开发人员的角度来看,也是一种极端的可定制性。这都要归功于 Plotly 的架构 - 它有一个整洁的接口,明确设计用于构建自己的 API。到处都可以看到这种出色的设计
这是一种相当极端的交互性,从开发人员的角度来看,也是一种极端的可定制性。这都要归功于 Plotly 的架构 —— 它有一个简洁的接口明确的设计是为了让你建立自己的API。如果到处都能看到这种伟大的设计那将会很有帮助
### 使用 Bokeh 进行自定义交互
现在你已经了解了 Plotly 如何使用 JavaScript 来创建动态图,并且可以使用 Anvil 的客户端编写 Python 代码在浏览器中实时编辑它们。
Bokeh 是另一个 Python 绘图库,它输出可嵌入 Web 应用程序的 HTML 文档,并获得与 Plotly 提供的功能类似的动态功能(如果你想知道如何发音,那就是 "BOE-kay")。
* * *
_本文基于 Anvil 博客中的 [如何使用 Plotly 来绘图][9]一文已允许使用。_
Bokeh 是另一个 Python 绘图库,它可以输出可嵌入 Web 应用程序的 HTML 文档,并获得与 Plotly 提供的功能类似的动态功能(如果你想知道如何发音,那就是 “BOE-kay”
--------------------------------------------------------------------------------
@ -314,7 +321,7 @@ via: https://opensource.com/article/20/5/plotly-python
作者:[Shaun Taylor-Morgan][a]
选题:[lujun9972][b]
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -322,10 +329,10 @@ via: https://opensource.com/article/20/5/plotly-python
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph)
[2]: https://opensource.com/resources/python
[3]: https://opensource.com/article/20/4/plot-data-python
[4]: tmp.c4bQMTUIxx#GraphObjects
[5]: tmp.c4bQMTUIxx#DataDrivenAPI
[6]: tmp.c4bQMTUIxx#PlotlyExpress
[3]: https://linux.cn/article-12327-1.html
[4]: https://opensource.com/article/20/4/install-python-linux
[5]: thttps://opensource.com/article/19/5/python-3-default-mac
[6]: https://opensource.com/article/19/8/how-install-python-windows
[7]: https://opensource.com/article/20/5/matplotlib-python
[8]: https://opensource.com/sites/default/files/uploads/plotly.png (A multi-bar plot made using Graph Objects)
[9]: https://anvil.works/blog/plotting-in-plotly

View File

@ -1,66 +1,66 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12353-1.html)
[#]: subject: (Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions)
[#]: via: (https://itsfoss.com/synaptic-package-manager/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
在 Ubuntu 或其它基于 Debian Linux 的发行版中使用轻量的 Apt 软件包管理器 Synaptic
在 Ubuntu 中使用轻量的 Apt 软件包管理器 Synaptic
======
这周的开源软件推荐是 Synaptic 。学习这个好的旧的软件包管理器可以做而现代的软件包管理器不能做什么。
![](https://img.linux.net.cn/data/attachment/album/202006/26/220622uh75qnmmzgh58lpv.jpg)
这周推荐的开源软件是 Synaptic。学习这个经过时光积淀的软件包管理器能做哪些现代软件管理器做不到的事情。
### Synaptic 软件包管理器是什么?
[Synaptic][1] 是使用在 Debian, Ubuntu, Linux Mint 以及其它很多基于 Debian/Ubuntu 发行版中的一个 [apt 软件包管理器系统][2] 的轻量级 GUI 前端
[Synaptic][1] 是一个轻量级的 [apt 软件包管理器系统][2]的 GUI 前端,使用在 Debian、Ubuntu、Linux Mint 以及其它很多基于 Debian/Ubuntu 发行版中。
总的来说,你可以 [在终端中使用 apt-get 命令][3] 来完成的任何事,都可以通过 Synaptic 来实现。
总的来说,所有你可以 [在终端中使用 apt-get 命令][3] 来做的事,都可以通过 Synaptic 来实现。
![][4]
在一段时间内Synaptic 曾经几乎是所有基于 Debian Linux 发行版的默认图形化软件包管理器。它被认为是一种用户友好易于使用的管理应用程序的方法。
曾几何时Synaptic 几乎是所有基于 Debian Linux 发行版的默认图形化软件包管理器。它被认为是一种用户友好的、易于使用的管理应用程序的方法。
随着像 [GNOME Software][5] 和 [KDE Discover][6] 等现代软件包管理器工具带来更现代和直观的图形用户界面,事情发生了变化。这些软件包管理器有更好的界面,以一种更友好的方式显示软件包信息,带有缩略图评分和评论。
随着像 [GNOME “软件”][5] 和 [KDE “发现”][6] 等现代软件包管理器工具带来更现代和直观的图形用户界面,事情发生了变化。这些软件包管理器有更好的界面,以一种更友好的方式显示软件包信息,带有缩略图评分和评论。
最后Synaptic [被限制使用于大多数的轻量级 Linux 发行版][7] 中。
最后Synaptic [的使用被局限于在大多数的轻量级 Linux 发行版][7] 中。
#### 为什么你要使用像 Synaptic 软件包管理器这样的 ‘古老的’ 软件?
#### 为什么你要使用像 Synaptic 软件包管理器这样的 “古老的” 软件?
当然,在多大数的时间中,你没有必要这样做。
当然,在多大数的情况下,你没有必要这样做。
但是Synaptic 仍然比 GNOME 软件的功能要很多。记住,它基本上是 apt 的 GUI 前端,这意味着它可以(几乎)做任何你能够 [在终端中使用 apt 命令][8] 所做的事.
但是Synaptic 仍然比 GNOME 软件的功能要很多。记住,它基本上是 `apt` 的 GUI 前端,这意味着它(几乎)可以做任何你能够 [在终端中使用 apt 命令][8] 所做的事
例如,如果你想 [在 Ubuntu 中阻止特定的软件包更新][9],你可以在 Synaptic 中做到这一点,但是你却不能 GNOME/Ubuntu 软件中心中实现。
例如,如果你想 [在 Ubuntu 中阻止特定的软件包更新][9],你可以在 Synaptic 中做到这一点,但是你却不能 GNOME/Ubuntu 软件中心中实现。
![][10]
另外,我注意到在 Ubuntu 20.04 中的软件中心的一些问题。它加载速度缓慢,它搜索软件包时缓慢,并且它充满了 snap 应用程序 (不是每个人都喜欢).
另外,我注意到 Ubuntu 20.04 的软件中心存在一些问题。它加载速度缓慢,它搜索软件包时缓慢,并且它充满了 snap 应用程序(不是每个人都喜欢)。
Synaptic 也是 [你可以在 Ubuntu 中使用的一个轻量级应用程序][7] ,用以加速你的系统
Synaptic 也是 [Ubuntu 中一个轻量级应用程序][7],使用可以可以让你感觉你的系统快一点
#### Synaptic 软件包管理器特色
#### Synaptic 软件包管理器的功能
这里是一个你可以使用 Synaptic 做什么的概括
下面是对 Synaptic 的概况
* 更新软件包缓存
* 升级整个系统
* 管理软件包包存储库
* 通过名称、描述、维护者、版本、依赖项等搜索软件包
* 通过组、状态(安装)、源或更多信息列出软件包
* 通过组、状态(安装与否)、源或更多信息列出软件包
* 通过名称、状态、大小或版本排序软件包
* 获取与软件包相关的信息
* 锁定软件包版本
* 安装具体指定版本的软件包
* 安装指定版本的软件包
这里有很多功能,你可以自己去探索。
还有很多功能,大家可以自己去探索。
### 如何在 Ubuntu 上安装 Synaptic 软件包管理器
Synaptic 软件包管理器可在 Ubuntu 的 Universe 存储库中获得。如果 Universe 存储库未启用你可以在软件中心中找到Synaptic:
Synaptic 软件包管理器可在 Ubuntu 的 Universe 存储库中获得。如果 Universe 存储库未启用你可以在软件中心中找到Synaptic
![Synaptic 在 Ubuntu 软件中心][11]
@ -70,7 +70,7 @@ Synaptic 软件包管理器可在 Ubuntu 的 Universe 存储库中获得。如
sudo add-apt-repository univers
```
然后更新缓存 (在 Ubuntu 18.04 及更高版本中不需要)
然后更新缓存(在 Ubuntu 18.04 及更高版本中不需要)
```
sudo apt update
@ -86,15 +86,15 @@ sudo apt install synaptic
### 如何使用 Synaptic 软件包管理器
在安装后,你可以在菜单中开始搜索 Synaptic
在安装后,你可以在菜单中开始搜索 Synaptic 并启动它
![][12]
你可以看到这个界面不是这里最漂亮的一个界面。注意复选框的颜色。白色意味着软件包未安装,绿色意味软件包已安装。
可以看到,这个界面不是最好看的界面之一。注意复选框的颜色。白色意味着软件包未安装,绿色意味软件包已安装。
![][4]
你可以搜索一个应用程序并单击复选框将标记其为安装。它也将高亮将被作为依赖关系项目的软件包(以绿色的形式)。单击应用来安装选择的软件包:
你可以搜索一个应用程序并单击复选框将标记其为安装。它也将(以绿色的形式)高亮将被作为依赖关系项目的软件包。单击应用来安装选择的软件包:
![][13]
@ -102,11 +102,11 @@ sudo apt install synaptic
![][15]
你可以看到在基于源显示的单个存储库中可用的软件包。一个很好的方法来查看 [哪个 PPA 提供什么软件包][16]。你可以通过如上所述的方法来安装或移除软件包。
你可以根据源显示各个存储库中可用的软件包。这是查看 [哪个 PPA 提供什么软件包][16]的好方法。你可以通过如上所述的方法来安装或移除软件包。
![][17]
通常,当你更新 Ubuntu 时,所有的软件包都会同时更新。使用 Synaptic ,你可以轻松地选择你需要更新/升级到一个较新版本的软件包。
通常,当你更新 Ubuntu 时,所有的软件包都会同时更新。使用 Synaptic你可以轻松地选择你需要更新/升级到较新版本的软件包。
![][18]
@ -118,25 +118,25 @@ sudo apt install synaptic
![][20]
如果你认为你做了错误的选择,你可以从编辑菜单中单击撤销。
如果你认为你做了错误的选择,你可以从编辑菜单中单击撤销。
你可以使用 Synaptic 做很多事,我不可能涵盖所有可能的用法。我在这里已经涵盖了最常见的一些方法,如果你将要去使用 Synaptic 的话,我留给你去探索。
你可以使用 Synaptic 做很多事,我无法涵盖所有可能的用法。我在这里已经涵盖了最常见的一些方法,如果你将要去使用 Synaptic 的话,我留给你去探索。
### Synaptic 并不适合所有的人
如果你不喜欢 Synaptic ,你可以在软件中心中移除它,或在终端中使用这个命令:
如果你不喜欢 Synaptic你可以在软件中心中移除它或在终端中使用这个命令
```
sudo apt remove synaptic
```
这里有另一个用于 Ubuntu 的被称为 [AppGrid][21] 的轻量级软件包管理器。据我所知,它已经很久没有更新了。
Ubuntu 还有另一个被称为 [AppGrid][21] 的轻量级软件包管理器。据我所知,它已经有一段时间没有更新了。
Synaptic 当然并不适合所有的人。它列出了在常规软件中心中看不到的库和包。如果你移除了一个你不知道的库,那么它可能会引起问题。
Synaptic 当然并不适合所有的人。它列出了在常规软件中心中看不到的库和包。如果你移除了一个你不知道的库,那么它可能会引起问题。
我认为 Synaptic 更适合于那些既想更好地控制软件包管理器又不想使用命令行方法的中级到高级用户
我认为 Synaptic 更适合于中高级用户,他们既想更好地控制软件包管理器又不想使用命令行方法。
你有什么要说的吗?你曾经使用过 Synaptic 软件包管理器吗?你在软件中心中做出回应,还是你只在终端中探索?一定要在评论区中分享你的喜好。
你有什么要说的吗?你使用过 Synaptic 软件包管理器吗?你是使用软件中心还是你只在终端中探索?请在评论区中分享你的喜好。
--------------------------------------------------------------------------------
@ -145,7 +145,7 @@ via: https://itsfoss.com/synaptic-package-manager/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[robsean](https://github.comrobsean)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,240 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12361-1.html)
[#]: subject: (How to Make Ubuntu Look Like macOS in 5 Easy Steps)
[#]: via: (https://itsfoss.com/make-ubuntu-look-like-macos/)
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
5 个简单步骤使你的 Ubuntu 看起来像 macOS
======
定制是 [我为什么使用 Linux][1] 的一个主要原因。定制桌面 Linux 的道路是永无止境的。你可以更改图标、主题、字体、终端、添加屏幕小工具、[指示器小程序][2]、扩展等诸如此类的东西。
我们已经介绍了很多桌面环境定制的建议和技巧。在这篇文章中,我将向你展示如何使 Ubuntu 看起来像 macOS。
很多人使用 macOS是因为它的简单和优雅的外观。你可能不同意这一点但这仍然是一个流行的观点。甚至有的 Linux 发行版也有类似 macOS 外观和感觉。
一位读者要求我们展示如何使 Ubuntu 看起来像 macOS因此我们写了这篇教程。事实上这是一个用来展示桌面 Linux 定制能力的很好的示例。
不过,你没有必要为定制外观而安装一个新的发行版。你可以在你自己的系统上做一些调整来给予你一个类似 macOS 的外观。
### 如何给你的 Ubuntu Linux 进行 macOS 改造
![][3]
尽管这篇文章是对 Ubuntu 的建议,但是你也可以在其它使用 GNOME 桌面环境的发行版中使用这些建议,几乎可以不做任何改动。请确保[检查一下你的桌面环境][4]。
说实话,即使你使用的是其它的桌面环境,你仍然可以得到一些关于要做哪些更改的提示。但是你必须确保使用你的桌面环境的工具按照步骤进行。
#### 必要条件: GNOME Tweaks 和 GNOME 扩展
请确保 [安装 GNOME Tweaks 工具][5]。你需要它来更改主题和图标。
你也需要 [启用 GNOME 扩展][6] 来更改 GNOME Shell 和添加重要的要点。
在你启用 GNOME 扩展后,你需要从 [GNOME 扩展][7] 网站安装“用户主题” 扩展,或者只需要转到 [这个超链接][8] ,并单击开关来将其打开。
我也希望你对 [在 Ubuntu 上安装主题][9] 有一定的了解。不过,我还是简单的谈了一下这个主题。
让我们依次看看每个步骤。
#### 步骤 1: 安装一个 macOS 风格的 GTK 主题
因为重点是使 GNOME 看起来像 macOS所以你应该选择一个像 macOS 一样的主题。有很多主题都是像 macOS 一样的。
##### 下载一个你选择的主题
你可以转到 [Gnome-look][10] 站点,并搜索关于 GTK3 的主题。如果你在 Gnome-look 网站上看到 “Pling” 字样,不用担心,它们都是来自同一个供应商。
你可以选择任何你想要的主题。下面是一些我认为你应该看看的macOS主题
- [mcOS 11][11]
- [McHigh Sierra][12]
- [Catalina][13]
- [McMojave][14]
在这篇文章中,我将使用 “[McMojave][14]”。你可以选择任何你想要的主题。你将在网站的右侧找到下拉式的下载按钮,单击它。
![McMojave 暗黑主题][15]
在这里你可以找到各种 “.tar.xz” 文件。这些不同的文件包含了相同的主题,但有一些小的差异。像在 “McMojave” 中,我们有像暗黑主题和明亮主题的变体。你可以尝试所有的主题,或者从之间随意选择一个你喜欢的。
##### 设置下载的主题
提取下载的主题,并复制这些提取的主题文件夹到 `.local/share/themes` 文件夹下。
打开 GNOME Tweak 工具,并更改应用程序和 Shell 的主题。在你更改主题的同时,你可以看到黄色、绿色和红色三个按钮,以及左上角的苹果标志。你也可以看到在面板项上的一些更改。
![McMojave GTK 和 Shell 主题][16]
#### 步骤 2: 安装像 macOS 一样的图标
macOS 外观改造的下一步骤是使用像 macOS 一样的图标。
##### 下载图标集合
这里有一些我建议使用的图标集合,你可以从 Gnome-look 网站下载:
- [McMojave-circle][17]
- [Mojave CT-icons][18]
- [Cupertino icons][19]
在这篇文章中,我将使用 “[McMojave-circle][17]” ,你可以随意使用任何你喜欢的图标。
就像主题一样,你可以从右侧的下拉式的 “下载” 按钮下载图标集合。在这里你也可以找到同一种图标的不同版本。
![Mcmojave Circle][20]
##### 设置图标
现在设置下载的图标。为此,提取下载文件中的文件夹并复制它到你的家目录下的 `.icons` 文件夹。 查看这篇关于 [在 Ubuntu 中安装图标主题][9] 的文章。
这是这种图标看起来的样子:
![McMojave Circle 图标外观][21]
#### 步骤 3: 添加类似 macOS 样子的坞站
没有类似 macOS 样子的<ruby>坞站<rt>dock</rt></ruby>,你的 Ubuntu 就看起来不像 macOS。在 Linux 上有很多可用的坞站。我喜欢 “[Dash to Dock][22]”,我会在这里使用它。
“Dash to Dock” 是一个 GNOME 扩展。到现在为止,你已经熟悉 GNOME 扩展。只需要转到 [这个超链接][23] ,并单击切换按钮来安装它。你的原本的坞站将自动被 “Dash to Dock” 所替换。
你可以通过右键单击 “show applications” 按钮(最右边的菜单按钮)并选择 “Dash to dock settings” 来更改设置。
![Dash To Dock][24]
#### 步骤 4: 使用 macOS 壁纸
大多数复杂的东西已经完成。现在是时候设置 macOS 壁纸了。你可以从下面的超链接下载 macOS 默认壁纸:
- [下载 macOS 壁纸][25]
##### 更改桌面背景
我将使用 “Mojave Day” 壁纸。右键单击已下载的的图像,并选择 “设置为壁纸” 选项来更改壁纸。
在设置这个壁纸后,这是我系统外观的样子:
![][26]
##### 更改锁屏壁纸
锁屏壁纸选项已经从 [Ubuntu 20.04][27] 的设置中移除。现在它使用一个模糊的桌面壁纸作为锁屏壁纸。
要设置一个自定义锁屏壁纸,你可以使用 “[Lock screen background][28]” 扩展。
打开 “Lock screen background” 扩展设置,并设置锁屏壁纸。
![锁屏背景设置][29]
这是锁屏现在的样子。如果你感到好奇话,这里是 [如何在 Ubuntu 中截图锁屏][30]。
![锁屏][31]
![登录屏幕][32]
#### 步骤 5: 更改系统字体
这几年macOS 的主要系统字体是 “San Francisco” 。但是,这个字体并不是公共领域的,而是像苹果生态系统中的许多其他东西一样,是专有字体。基于这个原因,你不能使用这种字体。
你能做的就是使用一种看起来像 San Francisc 字体一样的开源字体。我建议使用 Google 的 [Roboto][33] 字体,或 Adobe 的 [Source Sans Pro][34] 。
[在 Ubuntu 中安装字体是很简单的][35] 。下载 字体的 zip 文件,只需要在提取出来的文件夹中双击 ttf 文件。它会给你一个选项来逐一安装字体。
如果你想节省时间并一次安装所有的字体,提取其中所有的字体到你的家目录(`~/.fonts`)下的 `.fonts` 目录中。
![安装字体][36]
在你安装字体后,你可以使用 GNOME Tweaks 工具来更改系统字体。
![设置字体][37]
#### 额外提示Spotlight 式的应用程序启动器(如果你像更进一步的话)
如果你是 macOS Spotlight 启动器的粉丝,那么你在 Linux 上也能找到类似的东西。我最喜欢的这类启动器的软件包是 “[Albert][38]”。
你可以 [在 Albert 网站上找到它的安装说明][39] 。
安装完成后,打开 Albert 并设置快捷键(你想打开该启动器的组合键)就可以了。我想,在 macOS 中 `Command + Space` 键是来启动 Spotlight在 Ubuntu 中,你可以设置 `Super+Space` [快捷键][40]。
你会会得到很多内置的主题,在下面的图片中,我使用 “Spotlight dark” 主题。
Albert 不能直接启动应用程序,你必须授予它在哪里可以进行搜索的权限。
![Albert 设置][41]
在设置后,这是它看起来的样子:
![Albert 暗黑主题][42]
这是我的 Ubuntu 20.04 在完成所有定制后的样子。它看起来像 macOS 吗? 仁者见仁,智者见智。
![macOS 主题][43]
![Ubuntu 使用 macOS 外观改造][44]
如此,这就是你如何使你的 GNOME 桌面看起来像 macOS 一样的步骤。正如我在开始时所说的,这是一个很好的 Linux 桌面定制功能的示例。
如果你有新的注意或有任何疑问;评论区全是你的地盘。
本文由 Sumeet 编写,并由 Abhishek Prakash 提供补充输入信息。
--------------------------------------------------------------------------------
via: https://itsfoss.com/make-ubuntu-look-like-macos/
作者:[Sumeet][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/itsfoss/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/why-use-linux/
[2]: https://itsfoss.com/best-indicator-applets-ubuntu/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Make-Ubuntu-Look-like-MacOS.png?ssl=1
[4]: https://linux.cn/article-12124-1.html
[5]: https://itsfoss.com/gnome-tweak-tool/
[6]: https://linux.cn/article-9447-1.html
[7]: https://extensions.gnome.org/
[8]: https://extensions.gnome.org/extension/19/user-themes/
[9]: https://itsfoss.com/install-themes-ubuntu/
[10]: https://www.gnome-look.org/
[11]: https://www.pling.com/p/1220826
[12]: https://www.pling.com/p/1013714
[13]: https://www.pling.com/p/1226871
[14]: https://www.pling.com/p/1275087
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-dark-theme.png?ssl=1
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-Desktop.png?ssl=1
[17]: https://www.gnome-look.org/p/1305429/
[18]: https://www.gnome-look.org/p/1210856/
[19]: https://www.gnome-look.org/p/1102582/
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-.png?ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-icons-look.png?fit=800%2C494&ssl=1
[22]: https://github.com/micheleg/dash-to-dock
[23]: https://extensions.gnome.org/extension/307/dash-to-dock/
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Dash-to-dock-1.png?ssl=1
[25]: https://oswallpapers.com/category/mac-os/
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Wallpaper.png?fit=800%2C450&ssl=1
[27]: https://itsfoss.com/ubuntu-20-04-release-features/
[28]: https://extensions.gnome.org/extension/1476/unlock-dialog-background/
[29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-background-setting.png?ssl=1
[30]: https://itsfoss.com/screenshot-login-screen-ubuntu-linux/
[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-1.png?ssl=1
[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?ssl=1
[33]: https://fonts.google.com/specimen/Roboto?query=robot
[34]: https://adobe-fonts.github.io/source-sans-pro/
[35]: https://itsfoss.com/install-fonts-ubuntu/
[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Fonts.png?ssl=1
[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Set-fonts.png?ssl=1
[38]: https://albertlauncher.github.io/
[39]: https://albertlauncher.github.io/docs/installing/
[40]: https://itsfoss.com/ubuntu-shortcuts/
[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-settings.png?ssl=1
[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-look.png?ssl=1
[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme.png?fit=800%2C450&ssl=1
[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme-2.png?fit=800%2C450&ssl=1

View File

@ -0,0 +1,263 @@
[#]: collector: (lujun9972)
[#]: translator: (nophDog)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12358-1.html)
[#]: subject: (Make the switch from Mac to Linux easier with Homebrew)
[#]: via: (https://opensource.com/article/20/6/homebrew-linux)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
Homebrew 让你从 Mac 切换到 Linux 更轻松
======
> 不管你是想要更舒服地从 Mac 搬到 Linux还是不满意常规的 Linux 包管理器,都可以试试 Homebrew。
![](https://img.linux.net.cn/data/attachment/album/202006/28/091127an02f8oae0pln3as.jpg)
[Homebrew][2] 项目最初是为了给 Mac 用户提供一个非官方的 Linux 式的包管理器。用户很快就爱上了它友好的界面以及帮助性的提示,而且,它已经被移植到 Linux 系统 —— 这看起来像是一个奇怪的命运转折。
一开始,有两个分开的项目分别针对 macOS 和 Linux Homebrew 与 Linuxbrew但是现在是由 Homebrew 核心管理着这两个操作系统。由于我正 [从 Mac 切换到 Linux][3],所以一直在研究我在 macOS 最常用的开源软件在 Linux 表现如何,最终,我很高兴地发现 Homebrew 对 Linux 的支持太赞了!
### 为什么要在 Linux 使用 Homebrew 呢?
长期使用 Linux 的用户对 Homebrew 的第一反应是:“为什么不直接使用……呢”,省略号代表他们喜欢的某个 Linux 包管理器。基于 Debian 的系统早就有了 `apt`,基于 Fedora 的系统则有 `dnf``yum`,并且像 Flatpak 跟 AppImage 这样的项目,在两种系统上都能流畅运行。我花了不少时间尝试这些技术,不得不说,它们都有其强大之处。
那我为什么还要 [坚持使用 Homebrew][4] 呢?首先,我对它非常熟悉。在为我过去使用的专有软件寻找开源替代品的过程中,我已经学会了许多使用方法,而保持一些熟悉的东西,比如 Homebrew可以让我专注于一次学习一件事情而不是被不同系统间的差异搞垮。
此外,我没有看到哪一个包管理器像 Homebrew 一样,对用户如此友好。正如默认的帮助命令一样,命令井然有序:
```
$ brew -h
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]
Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA
Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
Further help:
  brew commands
  brew help [COMMAND]
  man brew
  <https://docs.brew.sh>
```
过于简短的输出可能会被误解为它功能局限,但是你简单看看每一个子命令,都有很丰富的功能。虽然上面的列表只有短短 23 行,但对高级用户来说,光是子命令 `install` 就包含整整 79 行的帮助信息:
```
$ brew --help | wc -l
23
$ brew install --help | wc -l
79
```
它可以选择忽略或者安装依赖关系,也可以选择用源代码编译以及用什么编译器来编译某个确切的上游 Git 提交,或者选择应用的官方 “灌装” 版。总而言之Homebrew 即适合新手,也同样能满足老鸟。
### 开始在 Linux 使用 Homebrew
如果你想要试着使用 Homebrew可以用这个单行脚本在 Mac 或者 Linux 上进行安装:
```
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```
这条命令会立即开始安装 Homebrew。如果你比较谨慎可以使用 `curl` 将该文件下载到本地,检查完毕之后再运行。
```
$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh --output homebrew_installer.sh
$ more homebrew_installer.sh # 审核该脚本,直到你觉得没问题了
$ bash homebrew_installer.sh
```
对 Linux 的安装步骤还包括如何配置点文件,对于 Debian 系统来说是 `~/.profile`,对于 Fedora 系统是 `~/.bash_profile`
```
$ test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
$ test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
$ echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
```
为了确认已经安装好Homebrew 团队提供一个空的 `hello` “秘方” 供测试:
```
$ brew install hello
==> Downloading https://linuxbrew.bintray.com/bottles/hello-2.10.x86_64_linux.bottle.tar.gz
######################################################################## 100.0%
==> Pouring hello-2.10.x86_64_linux.bottle.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/hello/2.10: 52 files, 595.6KB
```
看起来安装毫无问题,让我来试试更多操作。
### 命令行工具 Brew
Homebrew 宣称自己是一款默认只 “安装你需要而 [Linux] 没有的东西”的应用程序。
你可以用 `brew` 命令安装任何打包在 Homebrew 中的命令行软件。这些包的定义文件叫做 “<ruby>秘方<rt>formula</rt></ruby>”,而且它们通过“<ruby>瓶子<rt>bottle</rt></ruby>”来编译并分享。在 Homebrew 的世界里,还有许多 “啤酒方面” 的术语,但这个包管理器主要目的是让软件便于使用。
都有些什么样的软件呢?对我这样的技术玩家(既然你已经在读这篇文章,估计你也是)来说最方便的东西。例如,便利的 `tree` 命令,可以展示目录结构,或者 `pyenv`,我用它来 [在 Mac 管理不同版本 Python][5]。
你可以用 `search` 命令查看所有可以安装的“秘方”,在后面加上 `wc` 命令看看一共有多少:
```
# -l 选项统计行数
$ brew search | wc -l
    5087
```
迄今为止,一共有 5000 多个 “秘方”,这囊括了很多软件。需要注意的是:并非所有 “秘方” 都能在 Linux 运行。在 `brew search --help` 输出中有一节提到可以按软件运行的操作系统来筛选软件。它会在浏览器打开用于每个操作系统的软件仓库。我运行的是 Fedora所以我会用它来试一试
```
$ brew search --fedora tree
```
浏览器打开了网址 `https://apps.fedoraproject.org/packages/s/tree`,向我展示了所有 Fedora 的可用选项。你也可以通过其它方法进行浏览。“秘方” 被集中整理到由操作系统划分的核心仓库当中Mac 在 [Homebrew Core][6]Linux 在 [Linux Core][7])。同样也可以通过 Homebrew API [在网页显示][8]。
即使有这些选择,我还是通过其它用户的推荐找到很多新工具。我列出一些我最喜欢的工具,你可以在里面找点灵感:
* `pyenv`、`rbenv` 和 `nodenv` 用来管理(相应的) Python、Ruby 和 Node.js 版本
* `imagemagick` 用于脚本化编辑图片
* `pandoc` 用于脚本化转换文档格式(我通常将 .docx 文件转成 .md 或者 .html
* `hub` 为 GitHub 用户提供 [更好的 Git 体验][9]
* `tldr` 展示了命令工具的使用范例
想要深入了解 Homebrew可以去 [trldr 页面][10] 看看,比起应用的 man 页面,它要友好得多。使用 `search` 命令确认你可以安装:
```
$ brew search tldr
==> Formulae
tldr ✔
```
太好了!对勾说明你可以安装。那么继续吧:
```
$ brew install tldr
==> Downloading https://linuxbrew.bintray.com/bottles/tldr-1.3.0_2.x86_64_linux.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring tldr-1.3.0_2.x86_64_linux.bottle.1.tar.gz
🍺 /home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2: 6 files, 63.2KB
```
Homebrew 提供了编译好的二进制文件,所以你不必在本地机器上从源码编译。这能节省很多时间,也不用听 CPU 风扇的噪声。我很欣赏 Homebrew 的另外一点是,你不完全理解每一个选项的含义也不会影响正常使用。若你想自己编译,可以在 `brew install` 命令后面加上 `-s` 或者 `--build-from-source` 标识,这样就能从源码编译 “秘方”(即便已经有一个 “瓶子” 存在)。
同样,软件底层的复杂性也很有意思。使用 `info` 可以查看 `tldr` 软件的依赖管理,“秘方” 的源代码存放在磁盘上的何处,甚至还能查看公开分析。
```
$ brew info tldr
tldr: stable 1.3.0 (bottled), HEAD
Simplified and community-driven man pages
https://tldr.sh/
Conflicts with:
tealdeer (because both install `tldr` binaries)
/home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2 (6 files, 63.2KB) *
Poured from bottle on 2020-06-08 at 15:56:15
From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/tldr.rb
==> Dependencies
Build: pkg-config ✔
Required: libzip ✔, curl ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 197 (30 days), 647 (90 days), 1,546 (365 days)
install-on-request: 197 (30 days), 646 (90 days), 1,546 (365 days)
build-error: 0 (30 days)
```
### 从 Mac 到 Linux 的一点不足
在 macOSHomebrew 的 `cask`(“酒桶”)子命令可以让用户使用命令行安装、管理整个应用软件。不幸的是,`cask` 还不能在任何 Linux 发行版上使用。我在安装一个开源工具时发现了这点:
```
$ brew cask install tusk
Error: Installing casks is supported only on macOS
```
我在 [论坛上][11] 问了一下,很快得到其他用户的反馈。总结一下,方案如下:
* 复刻 Homebrew 项目,构建这个特性,然后像别人展示其价值
* 给该软件写一个 “秘方”,然后从源代码编译
* 为该软件创建一个第三方仓库
最后一个是我最感兴趣的。Homebrew 通过 [创建并维护 “<ruby>水龙头<rt>tap</rt></ruby>”][12] (另一个受啤酒影响的术语)管理第三方仓库。随着你对系统越来越熟悉,并想加入生态系统, “水龙头” 是值得研究的。
### 备份 Homebrew 的安装记录
我最中意的 Homebrew 特性之一就是你可以像其它任何 [用版本控制工具来备份点文件][13] 一样备份你的安装记录。为了实现这个目的Homebrew 提供 `bundle`(“捆扎”)子命令,它可以控制一个叫 `dump`(“倾倒”)的子命令生成一个 `Brewfile`。这个文件包含你目前所有安装的工具列表,可以重复使用。进入你想使用的目录然后运行命令,它会根据你所安装的软件生成 `Brewfile`
```
$ cd ~/Development/dotfiles # This is my dotfile folder
$ brew bundle dump
$ ls Brewfile
Brewfile
```
当我换了一台机器,想要安装一样的软件时,进入含有 `Brewfile` 的文件夹,然后重新安装:
```
$ ls Brewfile
Brewfile
$ brew bundle
```
它会在我的新机器上安装所有列出的 “秘方”。
#### 在 Mac 和 Linux 同时管理 Brewfile
`Brewfile` 非常适合备份你目前的安装记录,但是如果某些在 Mac 上运行的软件无法运行在 Linux 呢?或者刚好相反?我发现不管是 Mac 还是 Linux如果软件无法在当前操作系统运行Homebrew 会优雅地忽略那一行。如果它遇到不兼容的请求(比如使用 `brew` 在 Linux 安装 “<ruby>酒桶<rt>cask</rt></ruby>” 时),它会选择跳过,继续安装过程:
```
$ brew bundle --file=Brewfile.example
Skipping cask licecap (on Linux)
Skipping cask macdown (on Linux)
Installing fish
Homebrew Bundle complete! 1 Brewfile dependency now installed.
```
为了保持配置文件的简洁,我在两个操作系统上使用同一份 `Brewfile`,因为它只安装与操作系统相关的版本,所以我一直没有遇到任何问题。
### 使用 Homebrew 管理软件包
Homebrew 已经成了我必备的命令行工具,由于我很熟悉它,所以在 Linux 上的体验也充满乐趣。Homebrew 让我的工具井然有序,并且时刻保持更新,我愈发欣赏它在实用性与功能上找到的平衡点。我更喜欢将软件包管理的细节保持在用户需要了解的最小程度,大多数人都会从中受益。如果你已经很熟悉 Linux 包管理器了Homebrew 可能会让你觉得很基础,但稍微深入一点看,就会发现它的高级选项远远超过本文的内容。
对 Linux 用户来说,他们有很多包管理器可以选择。如果你来自 MacOSHomebrew 会让你宾至如归。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/homebrew-linux
作者:[Matthew Broberg][a]
选题:[lujun9972][b]
译者:[nophDog](https://github.com/nophDog)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop)
[2]: https://brew.sh/
[3]: https://opensource.com/article/19/10/why-switch-mac-linux
[4]: https://opensource.com/article/20/6/homebrew-mac
[5]: https://opensource.com/article/20/4/pyenv
[6]: https://github.com/Homebrew/homebrew-core
[7]: https://github.com/Homebrew/linuxbrew-core
[8]: https://formulae.brew.sh/formula/
[9]: https://opensource.com/article/20/3/github-hub
[10]: https://github.com/tldr-pages/tldr
[11]: https://discourse.brew.sh/t/add-linux-support-to-existing-cask/5766
[12]: https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap
[13]: https://opensource.com/article/19/3/move-your-dotfiles-version-control

View File

@ -0,0 +1,68 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (The ultimate guide to contributing to open source, an unparallelled reliance on Linux, and more industry trends)
[#]: via: (https://opensource.com/article/20/6/linux-industry-trends)
[#]: author: (Tim Hildred https://opensource.com/users/thildred)
The ultimate guide to contributing to open source, an unparallelled reliance on Linux, and more industry trends
======
A weekly look at open source community and industry trends.
![Person standing in front of a giant computer screen with numbers, data][1]
As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update.
## [How to Contribute to Open Source: The Ultimate Guide][2]
> “The biggest challenge for most people is that they dont identify their areas of interest and where they can help us. They come to the project and ask, How can I help?’” he said. “Instead, they could say, This is the skill set Id like to achieve. For example, Id like to develop some specific functionality for this piece of the project.’”
**The impact**: Saying "I want to contribute to open source" is a bit like saying "I want to work in the not-for-profit sector". Open source is a means to an end, and there is almost certainly a project working toward the end you care about that could use the skills you have.
## [Vulnerability Scoring Struggles to Remain Viable in the Era of Cloud Native Computing][3]
> To this claim, Danen said, “It was designed to indicate the severity of a flaw relative to other flaws. Nowhere will you see it described, by FIRST who created it, as a means of assessing risk. So yes, reliable to describe the mechanics of a vulnerability, but wholly inadequate to describe the risk of the vulnerability to a particular organization or environment.”
**The impact**: Using the [Common Vulnerability Scoring System][4] (CVSS) classification systems for vulnerabilities is becoming more difficult. Non-experts will usually use a number that describes something in the easiest possible way. The challenge is for experts is to make sure that the easiest possible way is also the right way.
## [The rise of parallel serverless compute][5]
> So why isnt everything fast, amazing, and running this way already? One of the challenging parts about this today is that most software is designed to run on single machines, and parallelization may be limited to the number of machine cores or threads available locally. Because this architecture &amp; “serverless compute” is so new (_cough cough 2014_), most software is not designed to leverage this approach. I see this changing in the future as more become aware of this approach.
**The impact**: It is actually hard to think scalably and takes a lot of practice to mentally understand what can be done alongside other things and what has to be done sequentially.
## [From Earth to orbit with Linux and SpaceX][6]
> Ordinary? Yes, ordinary. You see, spacecraft CPUs are far from the newest and greatest. They're developed for spacecraft, which takes years -- even decades -- to go from the drafting board to launch. For example, the International Space Station (ISS) runs on 1988-vintage 20 MHz Intel 80386SX CPUs. We don't know, however, what chips the Falcon 9 uses. Chances are, though, their design is at least a decade older than what you'd buy at a Best Buy now. 
**The impact**: If your time horizon is measured in decades, there is a good chance Linux is your best option for a stable operating system.
## [Why the Success of Edge Computing Relies on a Linux Legacy][7]
> For edge computing innovation, we need to be thinking more about how we create sustainable solutions and technologies given how many deployments will require a longer life cycle and are more tightly bound to hardware and equipment refreshes. The path of innovation leads from Linux to and through the network edge. Companies that follow this approach will be better positioned to leverage the promise and power of the edge while avoiding fragmentation and lock-in.
**The impact**: Edge devices can't (shouldn't?) be ephemeral; to get the value we're promised by cheap, always on, always monitoring, always streaming devices they really need to be reliable over time. Linux = sustainability.
_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/linux-industry-trends
作者:[Tim Hildred][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/thildred
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data)
[2]: https://builtin.com/software-engineering-perspectives/open-source-contribution
[3]: https://thenewstack.io/cvss-struggles-to-remain-viable-in-the-era-of-cloud-native-computing/
[4]: https://www.first.org/cvss/
[5]: https://davidwells.io/blog/rise-of-embarrassingly-parallel-serverless-compute
[6]: https://www.zdnet.com/article/from-earth-to-orbit-with-linux-and-spacex/
[7]: https://devops.com/why-the-success-of-edge-computing-relies-on-a-linux-legacy/

View File

@ -0,0 +1,112 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Linux Mint 20 is Officially Available Now! The Performance and Visual Improvements Make it an Exciting New Release)
[#]: via: (https://itsfoss.com/linux-mint-20-download/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Linux Mint 20 is Officially Available Now! The Performance and Visual Improvements Make it an Exciting New Release
======
Linux Mint 20 “Ulyana” is finally released and available to download.
Linux Mint 19 was based on Ubuntu 18.04 LTS and [Mint 20][1] is based on [Ubuntu 20.04 LTS][2] — so you will find a lot of things different, improved, and potentially better.
Now that its here, lets take a look at its new features, where to download it, and how to upgrade your system.
### Linux Mint 20: Whats New?
We have made a video about the initial visual impressions on Linux Mint 20 to give you a better idea:
[Subscribe to our YouTube channel for more Linux videos][3]
Theres a lot of things to talk about when it comes to Linux Mint 20 release. While we have already covered the new key [features in Linux Mint 20][1], Ill mention a few points here for a quick glance:
* Performance improvements in Nemo file manager for thumbnail generation
* Some re-worked color themes
* Linux Mint 20 will forbid APT from using Snapd
* A new GUI tool to share files using the local network
* Improved multi-monitor support
* Improved hybrid graphics support for laptops
* No 32-bit releases anymore
In addition to all these changes, you will also notice some visual changes with Cinnamon 4.6 desktop update.
Here are some screenshots of Linux Mint 20 Cinnamon edition. Click on the images to see in full screen.
![Mint 20 Welcome Screen][4]
![Mint 20 Color Themes][5]
![Mint 20 Nemo File Manager][6]
![Mint 20 Nemo File Manager Blue Color Theme][7]
![Mint 20 Wallpapers][8]
![Mint 20 Redesigned Gdebi Installer][9]
![Mint 20 Warpinator Tool for Sharing Files on Local Network][10]
![Mint 20 Terminal][11]
### Upgrading to Linux Mint 20: What you need to know
If you are already using Linux Mint, you may have the option to upgrade to Linux Mint 20.
* If you are using Linux Mint 20 beta version, you can upgrade to Mint 20 stable version.
* If youre using Linux Mint 19.3 (which is the latest iteration of Mint 19), you can upgrade your system to Linux Mint 20 without needing to perform a clean installation.
* There is no 32-bit version of Linux Mint 20. If you are **using 32-bit Mint 19 series, you wont be able to upgrade to Mint 20**.
* If you are using Linux Mint 18 series, youll have to upgrade through Mint 19 series first. A fresh install of Mint 20 would be less time-consuming and troublesome in my opinion.
* If you are using Linux Mint 17, 16, 15 or lower, you must not use them anymore. These versions are not supported anymore.
Its FOSS has a detailed guide showing the steps to [upgrade Linux Mint version][12] from 18.3 to 19. I am guessing the steps should be the same for Mint 20 as well. Its FOSS team will be doing some tests for Mint 19.3 to Mint 20 upgrade and update this guide as applicable.
Before you go on upgrading make sure to backup your data and [create system snapshots using Timeshift][13].
### Download Linux Mint 20
You can simply head on to its official download page and grab the latest stable ISO for yourself. Youll find the ISO for the officially supported desktop environments, i.e. Cinnamon, MATE and Xfce.
Torrent links are also available for those who have slow or inconsistent internet connection.
[Download Linux Mint 20][14]
If you just want to try it out without replacing your main system, I suggest [installing Linux Mint 20 in VirtualBox][15] first and see if this is something you would like.
Have you tried Linux Mint 20 yet? What do you think about the release? Let me know your thoughts in the comments section below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/linux-mint-20-download/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/linux-mint-20/
[2]: https://itsfoss.com/download-ubuntu-20-04/
[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-welcome-screen.png?fit=800%2C397&ssl=1
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-color-themes.png?fit=800%2C396&ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-nemo-file-manager.png?fit=800%2C397&ssl=1
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-nemo-file-manager-blue-color-theme.png?fit=800%2C450&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-wallpapers.png?fit=800%2C450&ssl=1
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-redesigned-gdebi-installer.png?fit=800%2C582&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-warpinator.png?fit=800%2C397&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-terminal.png?fit=800%2C540&ssl=1
[12]: https://itsfoss.com/upgrade-linux-mint-version/
[13]: https://itsfoss.com/backup-restore-linux-timeshift/
[14]: https://linuxmint.com/download.php
[15]: https://itsfoss.com/install-linux-mint-in-virtualbox/

View File

@ -0,0 +1,79 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Wi-Fi 6E: When its coming and what its good for)
[#]: via: (https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html)
[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/)
Wi-Fi 6E: When its coming and what its good for
======
New wireless spectrum recently dedicated to Wi-Fi allows for more channels and higher density deployments, but gear to support it wont be widely deployed until 2020, according to an Extreme Networks exec.
Thinkstock
This spring [the FCC opened up a new swath of unlicensed wireless spectrum][1] in the 6GHz band thats intended for use with Wi-Fi and can provide lower latency and faster data rates. The new spectrum also has a shorter range and supports more channels than bands that were already dedicated to Wi-Fi, making it suitable for deployment in high-density areas like stadiums.
To further understand what Wi-Fi 6E is and how it differs from Wi-Fi 6, I recently talked with Perry Correll, director of product management for networking solutions vendor Extreme Networks.
**Learn more about 5G and WiFi 6**
* [What is 5G? How is it better than 4G?][2]
* [How to determine if WiFi 6 is right for you][3]
* [What is MU-MIMO? Why do you need it in your wireless routers?][4]
* [When to use 5G, when to use WiFi 6][5]
* [How enterprises can prep for 5G networks][6]
**Kerravala:** **Wi-Fi 6 seems to be getting a lot of hype but not Wi-Fi 6E. Why?**
**Correll:** Theres so much confusion around all the 666 numbers, itll scare you to death. Youve got Wi-Fi 6, Wi-Fi 6E and Wi-Fi 6 still has additional enhancements coming after that, with multi-user multiple input, multiple output (multi-user MIMO) functionalities. Then theres the 6GHz spectrum, but thats not where Wi-Fi 6 gets its name from: Its the sixth generation of Wi-Fi. On top of all that, we are just getting a handle 5G and there already talking about 6G seriously, look it up  it's going to get even more confusing.
**Kerravala:** **Why do we need Wi-Fi 6E versus regular Wi-Fi 6?**
**Correll:** The last time we got a boost in UNII-2 and UNII-2 Extended was 15 years ago and smartphones hadnt even taken off yet. Now being able to get 1.2GHz is enormous. With Wi-Fi 6E, were not doubling the amount of Wi-Fi space, we're actually quadrupling the amount of usable space. Thats three, four, or five times more spectrum, depending on where you are in the world. Plus you don't have to worry about DFS [dynamic frequency selection], especially indoors.
Wi-Fi 6E is not going to be faster than Wi-Fi 6 and its not adding enhanced technology features. The neat thing is operating the 6GHz will require Wi-Fi 6 or above clients. So, were not going to have any slow clients and were not going to have a lot of noise. Were going to gain performance in a cleaner environment with faster devices.
**Kerravala:** **Can you also run wider channels?**
**Correll:** Exactly, that's the cool thing about it. If youre in a typical enterprise environment, 20 and 40MHz is pretty much all you need. In high-density environments like stadiums, trying to do 80 or 160MHz just became tough. Wider channels are really going help things like [virtual reality], which can take advantage of those channels that are eating up the rest of the spectrum. Thats probably the biggest use case.
Three or four years down the road, if you want to do digital signage or screen edge at stadiums then you can use 80 of the 160MHz without getting impacted by anything else. Theres already talk of Wi-Fi 7 and its going to have 320MHz-wide channels.
**Kerravala:** **Will this be primarily an augmentation to most Wi-Fi strategies?**
**Correll:** It's definitely going to be at the edges in the short term. The first products are probably going to launch at the end of this year, and theyre going to be consumer-grade. For the enterprise, 6GHz-capable products will start showing up next year. Not before 2022 will you actually start seeing any density so, not any time soon. For smartphone companies, Wi-Fi is not a big deal and theyd rather focus on other features.
Still, its a huge opportunity. The nicest thing about the 6GHz versus CBRS [Citizens Broadband Radio Service] or 5G is [that many] would rather stick with Wi-Fi than having to move to a different architecture. These are the users that are going to drive the manufacturers of the widgets to IoT devices or robots or whatever requires the 6GHz. It's a clean spectrum and might be cheaper than the regular Wi-Fi 6. There are also some power-saving benefits there, too.
**Kerravala:** **Theres talk of 5G replacing Wi-Fi 6. But whats the practicality of that?**
**Correll:** Realistically, you cant put a SIM in every device. But one of the big issues that come up is data ownership because the carrier is going to own your data, not you. If you want to use your data for any kind of business analytics, will the carrier release the data back to you at a certain price? Thats a frightening thought.
There are just too many reasons why Wi-Fi is not going away. When Wi-Fi 6 and 5G-capable devices come out, what will happen to all the other laptops, tablets, and IoT devices that only have Wi-Fi? There will either be Wi-Fi-only or Wi-Fi and 5G devices, but 5G is not going to replace Wi-Fi altogether. If you look at the 5G radio network backbone, Wi-Fi is a component. It's one big happy family. The technologies are designed to coexist.
Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html
作者:[Zeus Kerravala][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Zeus-Kerravala/
[b]: https://github.com/lujun9972
[1]: https://www.networkworld.com/article/3540288/how-wi-fi-6e-boosts-wireless-spectrum-five-fold.html
[2]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html
[3]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html
[4]: https://www.networkworld.com/article/3250268/what-is-mu-mimo-and-why-you-need-it-in-your-wireless-routers.html
[5]: https://www.networkworld.com/article/3402316/when-to-use-5g-when-to-use-wi-fi-6.html
[6]: https://www.networkworld.com/article/3306720/mobile-wireless/how-enterprises-can-prep-for-5g.html
[7]: https://www.facebook.com/NetworkWorld/
[8]: https://www.linkedin.com/company/network-world

View File

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

View File

@ -1,576 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Stop debugging Go with Println and use Delve instead)
[#]: via: (https://opensource.com/article/20/6/debug-go-delve)
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
Stop debugging Go with Println and use Delve instead
======
Delve is packed with functionality to make debugging a breeze.
![Bug tracking magnifying glass on computer screen][1]
When was the last time you tried to learn a new programming language? Do you stick with your tried and true, or are you one of the brave souls who tries out a new one as soon as it is announced? Either way, learning a new language can be extremely useful, and a lot of fun.
You try out with a simple "Hello, world!" then move onto writing some sample code and executing it, making minor changes along the way and then moving on from there. I am sure we have all gone through this experience no matter which technology we've worked on. Though if you do manage to stay with a language for some time, and you wish to become proficient in it, there are a few things that can help you along the way.
One of those things is a debugger. Some people prefer debugging using simple "print" statements in code, and they are fine for a few simple line programs; however, if you are working on a large project with multiple developers and thousands of lines of code, it makes sense to invest in a debugger.
I've recently started learning the Go programming language, and in this article, we will explore a debugger called Delve. Delve is a special utility made to debug Go programs, and we will cover some of its features using some sample Go code. Don't worry about the Go code examples presented here; they are understandable even if you have never programmed in Go before. One of the goals of Go is simplicity, so the code is consistent, which can be easier to understand and interpret.
### Introduction to Delve
Delve is an open source project hosted at [GitHub][2].
In its own words:
_Delve is a debugger for the Go programming language. The goal of the project is to provide a simple, full-featured debugging tool for Go. Delve should be easy to invoke and easy to use. Chances are if you're using a debugger, things aren't going your way. With that in mind, Delve should stay out of your way as much as possible._
Let's take a closer look.
My test system is a laptop running Fedora Linux along with the following Go compiler version:
```
$ cat /etc/fedora-release
Fedora release 30 (Thirty)
$
$ go version
go version go1.12.17 linux/amd64
$
```
### Golang installation
If you do not have Go installed, you can get it by simply running the following command to fetch it from your configured repositories.
```
`$ dnf install golang.x86_64`
```
Alternatively, you can visit the [install page][3] for other installation options suitable for your OS distribution.
Before we get started, please ensure that the following required PATHS are set, as required by Go tools. If these paths are not set, some of the examples might not work. These can be easily set as environment variables in your SHELL's RC file, like the `$HOME/bashrc` file in my case.
```
$ go env | grep GOPATH
GOPATH="/home/user/go"
$
$ go env | grep GOBIN
GOBIN="/home/user/go/gobin"
$
```
### Delve installation
You can install Delve by running a simple `go get` command, as shown below. `go get` is the Golang way of downloading and installing required packages from external sources. If you do face any issues with installation, please refer to the install instructions for Delve [here][4].
```
$ go get -u github.com/go-delve/delve/cmd/dlv
$
```
Running the above command downloads Delve to your $GOPATH location, which, in the default case, happens to be $HOME/go. It will be different if you have set $GOPATH to something else.
You can move to the go/ directory, within which you will see `dlv` under bin/ directory.
```
$ ls -l $HOME/go
total 8
drwxrwxr-x. 2 user user 4096 May 25 19:11 bin
drwxrwxr-x. 4 user user 4096 May 25 19:21 src
$
$ ls -l ~/go/bin/
total 19596
-rwxrwxr-x. 1 user user 20062654 May 25 19:17 dlv
$
```
Since you installed Delve under $GOPATH, it is also available as a regular shell command, so you do not have to move to the directory where it is installed every time. You can verify `dlv` is correctly installed by running it with the `version` option. The version it installed is 1.4.1.
```
$ which dlv
~/go/bin/dlv
$
$ dlv version
Delve Debugger
Version: 1.4.1
Build: $Id: bda606147ff48b58bde39e20b9e11378eaa4db46 $
$
```
Now, let's use Delve with some Go programs to understand its features and how to use them. As we do with all programs, let's start with a simple "Hello, world!" message, which, in Go, is called `hello.go`.
Remember, I am placing these sample programs within the $GOBIN directory.
```
$ pwd
/home/user/go/gobin
$
$ cat hello.go
package main
import "fmt"
func main() {
        fmt.Println("Hello, world!")
}
$
```
To build a Go program, you run the `build` command and provide it with the source file using the .go extention. If the program is free of any syntax issues, the Go compiler compiles it and puts out a binary or executables file. This file can then be executed directly, and we see the "Hello, world!" message displayed onscreen.
```
$ go build hello.go
$
$ ls -l hello
-rwxrwxr-x. 1 user user 1997284 May 26 12:13 hello
$
$ ./hello
Hello, world!
$
```
### Loading a program in Delve
There are two ways to load a program into the Delve debugger.
**Using the debug argument when source code is not yet compiled to binary.**
The first way is to use the **debug** command when you simply need to source files. Delve compiles a binary for you named **__debug_bin**, and loads it into the debugger.
In this example, move to the directory where **hello.go** is present and run the **dlv debug** command. If there are multiple Go source files within a directory and each has its own main function, then Delve might throw an error, expecting a single program or a single project to build a binary from. Should that occur, you're better off using the second option, presented below.
```
$ ls -l
total 4
-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go
$
$ dlv debug
Type 'help' for list of commands.
(dlv)
```
Now open another terminal and list the contents of the same directory. You see an additional **__debug_bin** binary that was compiled from the source code and loaded into the debugger. You can now move to the **dlv** prompt to continue using Delve further.
 
```
$ ls -l
total 2036
-rwxrwxr-x. 1 user user 2077085 Jun  4 11:48 __debug_bin
-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go
$
```
**Using the exec argument**
The second method to load a program into Delve is useful when you have a pre-compiled Go binary, or one that you have already compiled using the **go build** command, and don't want Delve to compile it to a `__debug_bin` binary. In such cases, use the **exec** argument to load the binary directory into the Delve debugger.
```
$ ls -l
total 4
-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go
$
$ go build hello.go
$
$ ls -l
total 1956
-rwxrwxr-x. 1 user user 1997284 Jun  4 11:54 hello
-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go
$
$ dlv exec ./hello
Type 'help' for list of commands.
(dlv)
```
### Getting help within Delve
At the **dlv** prompt, you can run `help` to have a look at the various help options available in Delve. The command list is quite extensive, and we will cover some of the important features here. Following is an overview of Delve's functionality.
```
(dlv) help
The following commands are available:
Running the program:
Manipulating breakpoints:
Viewing program variables and memory:
Listing and switching between threads and goroutines:
Viewing the call stack and selecting frames:
Other commands:
Type help followed by a command for full documentation.
(dlv)
```
#### Setting breakpoints
Now that we have loaded the hello.go program within the Delve debugger, let's set the breakpoint on our main function and then confirm it. Within Go, the main program starts with `main.main`, so you need to provide this name to the `break command`. Next, we will see if the breakpoint was set correctly using the `breakpoints` command.
Also, remember you can use shorthands for commands, so instead of using `break main.main`, you can also use `b main.main` to the same effect, or `bp` instead of `breakpoints`. To find the exact shorthand for a command, please refer to the help section by running the `help` command.
```
(dlv) break main.main
Breakpoint 1 set at 0x4a228f for main.main() ./hello.go:5
(dlv) breakpoints
Breakpoint runtime-fatal-throw at 0x42c410 for runtime.fatalthrow() /usr/lib/golang/src/runtime/panic.go:663 (0)
Breakpoint unrecovered-panic at 0x42c480 for runtime.fatalpanic() /usr/lib/golang/src/runtime/panic.go:690 (0)
        print runtime.curg._panic.arg
Breakpoint 1 at 0x4a228f for main.main() ./hello.go:5 (0)
(dlv)
```
#### Continue execution of the program
Now, let's continue running the program using "continue." It will run until it hits a breakpoint, which, in our case, is the `main.main` or the main function. From there, we can use the `next` command to execute the program line by line. Notice that, once we move ahead of `fmt.Println("Hello, world!")`, we can see that `Hello, world!` is printed to the screen while we are still within the debugger session.
```
(dlv) continue
&gt; main.main() ./hello.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a228f)
     1: package main
     2:
     3: import "fmt"
     4:
=&gt;   5:      func main() {
     6:         fmt.Println("Hello, world!")
     7: }
(dlv) next
&gt; main.main() ./hello.go:6 (PC: 0x4a229d)
     1: package main
     2:
     3: import "fmt"
     4:
     5: func main() {
=&gt;   6:              fmt.Println("Hello, world!")
     7: }
(dlv) next
Hello, world!
&gt; main.main() ./hello.go:7 (PC: 0x4a22ff)
     2:
     3: import "fmt"
     4:
     5: func main() {
     6:         fmt.Println("Hello, world!")
=&gt;   7:      }
(dlv)
```
#### Quitting Delve
If you wish to quit the debugger at any time, you can run the `quit` command, and you will be returned to the shell prompt. Pretty simple, right?
```
(dlv) quit
$
```
Let's use some other Go programs to explore some other Delve features. This time, we will pick a program from the [Golang tour][5]. If you are learning Go, the Golang tour should be your first stop.
The following program, `functions.go`, simply displays how functions are defined and called in a Go program. Here, we have a simple `add()` function that adds two numbers and returns their value. You can build the program and execute it, as shown below.
```
$ cat functions.go
package main
import "fmt"
func add(x int, y int) int {
        return x + y
}
func main() {
        fmt.Println(add(42, 13))
}
$
```
You can build the program and execute it as shown below.
```
$ go build functions.go  &amp;&amp; ./functions
55
$
```
#### Stepping into functions
As shown earlier, let's load the binary into the Delve debugger using one of the options mentioned earlier, again setting a breakpoint at `main.main` and continuing to run the program while we hit the breakpoint. Then hit `next` until you reach `fmt.Println(add(42, 13))`; here we make a call to the `add()` function. We can use the Delve `step` command to move from the `main` function to the `add()` function, as seen below.
```
$ dlv debug
Type 'help' for list of commands.
(dlv) break main.main
Breakpoint 1 set at 0x4a22b3 for main.main() ./functions.go:9
(dlv) c
&gt; main.main() ./functions.go:9 (hits goroutine(1):1 total:1) (PC: 0x4a22b3)
     4:
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
=&gt;   9:      func main() {
    10:         fmt.Println(add(42, 13))
    11: }
(dlv) next
&gt; main.main() ./functions.go:10 (PC: 0x4a22c1)
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
=&gt;  10:              fmt.Println(add(42, 13))
    11: }
(dlv) step
&gt; main.add() ./functions.go:5 (PC: 0x4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=&gt;   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv)
```
#### Set breakpoint using filename: linenumber
Above, we went through `main` and then moved to the `add()` function, but you can also use the `filename:linenumber` combination to set a breakpoint directly where we want it. Following is another way of setting a breakpoint at the start of the `add()` function.
```
(dlv) break functions.go:5
Breakpoint 1 set at 0x4a2280 for main.add() ./functions.go:5
(dlv) continue
&gt; main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=&gt;   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv)
```
#### View current stack details
Now that we are at the `add()` function, we can view the current contents of the stack using the `stack` command in Delve. This shows the topmost function `add()` at 0 where we are, followed by `main.main` at 1 from where the `add()` function was called. Functions below `main.main` belong to the Go runtime, which is responsible for loading and executing the program.
```
(dlv) stack
0  0x00000000004a2280 in main.add
   at ./functions.go:5
1  0x00000000004a22d7 in main.main
   at ./functions.go:10
2  0x000000000042dd1f in runtime.main
   at /usr/lib/golang/src/runtime/proc.go:200
3  0x0000000000458171 in runtime.goexit
   at /usr/lib/golang/src/runtime/asm_amd64.s:1337
(dlv)
```
#### Move between frames
Using the `frame` command in Delve, we can switch between the above frames at will. In the example below, using `frame 1` switches us from within the `add()` frame to the `main.main` frame, and so on.
```
(dlv) frame 0
&gt; main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
Frame 0: ./functions.go:5 (PC: 4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=&gt;   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv) frame 1
&gt; main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
Frame 1: ./functions.go:10 (PC: 4a22d7)
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
=&gt;  10:              fmt.Println(add(42, 13))
    11: }
(dlv)
```
**Print function arguments**
A function often accepts multiple arguments to work on. In the case of the `add()` function, it accepts two integers. Delve has a handy command called `args`, which displays the command-line arguments passed to the function.
```
(dlv) args
x = 42
y = 13
~r2 = 824633786832
(dlv)
```
#### View disassembly
Since we are dealing with compiled binaries, it is extremely helpful to be able to see the assembly language instructions produced by the compiler. Delve provides a `disassemble` command to view these. In the example below, we use it to view the disassembly instructions for the `add()` function.
```
(dlv) step
&gt; main.add() ./functions.go:5 (PC: 0x4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=&gt;   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv) disassemble
TEXT main.add(SB) /home/user/go/gobin/functions.go
=&gt;   functions.go:5  0x4a2280   48c744241800000000   mov qword ptr [rsp+0x18], 0x0
        functions.go:6  0x4a2289   488b442408           mov rax, qword ptr [rsp+0x8]
        functions.go:6  0x4a228e   4803442410           add rax, qword ptr [rsp+0x10]
        functions.go:6  0x4a2293   4889442418           mov qword ptr [rsp+0x18], rax
        functions.go:6  0x4a2298   c3                   ret
(dlv)
```
#### Stepout of functions
Another feature is `stepout`, which allows us to return back to where the function was called from. In our example, if we wish to return to the `main.main` function, we can simply run the `stepout` command and it will take us back. This can be quite a handy tool to help you move around in a large codebase.
```
(dlv) stepout
&gt; main.main() ./functions.go:10 (PC: 0x4a22d7)
Values returned:
        ~r2: 55
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
=&gt;  10:              fmt.Println(add(42, 13))
    11: }
(dlv)
```
Let's use another sample program from the [Go tour][6] to see how Delve deals with variables in Go. The following sample program defines and initializes some variables of different types. You can build the program and execute it.
```
$ cat variables.go
package main
import "fmt"
var i, j int = 1, 2
func main() {
        var c, python, java = true, false, "no!"
        fmt.Println(i, j, c, python, java)
}
$
$ go build variables.go &amp;&amp; ./variables
1 2 true false no!
$
```
#### Print variable information
As stated earlier, use `delve debug` to load the program in the debugger. You can use the `print` command from within Delve along with the variable name to show their current values.
```
(dlv) print c
true
(dlv) print java
"no!"
(dlv)
```
Alternatively, you can use the `locals` command to print all local variables within a function.
```
(dlv) locals
python = false
c = true
java = "no!"
(dlv)
```
If you are not aware of the type of the variable, you can use the `whatis` command along with the variable name to print the type.
```
(dlv) whatis python
bool
(dlv) whatis c
bool
(dlv) whatis java
string
(dlv)
```
### Conclusion
So far, we have only scratched the surface of the features Delve offers. You can refer to the `help` section and try out various other commands. Some of the other useful features include attaching Delve to running Go programs (daemons!) or even using Delve to explore some of the internals of Golang libraries, provided you have the Go source code package installed. Keep exploring!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/debug-go-delve
作者:[Gaurav Kamathe][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/gkamathe
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen)
[2]: https://github.com/go-delve/delve
[3]: https://golang.org/doc/install
[4]: https://github.com/go-delve/delve/blob/master/Documentation/installation/linux/install.md
[5]: https://tour.golang.org/basics/4
[6]: https://tour.golang.org/basics/9

View File

@ -1,105 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 essential tools to set up your Python environment for success)
[#]: via: (https://opensource.com/article/20/6/python-tools)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
4 essential tools to set up your Python environment for success
======
This selection of tools will streamline your Python environment for
smooth and consistent development practices.
![Python programming language logo with question marks][1]
Python is a wonderful general-purpose programming language, often taught as a first programming language. Twenty years in, multiple books written, and it remains [my language of choice][2]. While the language is often said to be straight-forward, configuring Python for development has not been described as such (as documented by [xkcd][3]).
![xkcd python illustration][4]
A complex Python environment: [xkcd][3]
There are many ways to use Python in your day-to-day life. I will explain how I use the Python ecosystem tools, and I will be honest where I am still looking for alternatives.
### Use pyenv to manage Python versions
The best way I have found to get a Python version working on your machine is `pyenv`. This software will work on Linux, Mac OS X, and WSL2: the three "UNIX-like" environments that I usually care about.
Installing `pyenv` itself can be a little tricky at times. One way is to use the dedicated [pyenv installer][5], which uses a `curl | bash` method to bootstrap (see the instructions for more details).
If you're on a Mac (or another system where you run Homebrew), you can follow instructions on how to install and use pyenv [here][6].
Once you install and set up `pyenv` per the directions, you can use `pyenv global` to set a "default Python" version. In general, you will want to select your "favorite" version. This will usually be the latest stable, but other considerations can change that.
### Make virtual environments simpler with virtualenvwrapper
One advantage of using `pyenv` to install Python is that all subsequent Python interpreter installations you care about are owned by you instead of the operating system you use.
Though installing things inside Python itself is usually not the best option, there is one exception: in your "favorite" Python chosen above, install and configure `virtualenvwrapper`. This gives you the ability to create and switch to virtual environments at a moment's notice.
I walk through exactly how to install and use `virtualenvwrapper` [in this article][7].
Here is where I recommend a unique workflow. There is one virtual environment that you will want to make so that you can reuse it a lot—`runner`. In this environment, install your favorite `runner`; that is, software that you will regularly use to run other software. As of today, my preference is `tox`.
### Use tox as a Python runner
[tox][8] is a great tool to automate your test runs of Python. In each Python environment, I create a `tox.ini` file. Whatever system I use for continuous integration will run it, and I can run the same locally with `virtualenvwrapper`'s workon syntax described in the article above:
```
$ workon runner
$ tox
```
The reason this workflow is important is that I test my code against multiple versions of Python and multiple versions of the library dependencies. That means there are going to be multiple environments in the tox runner. Some will try running against the latest dependencies. Some will try running against frozen dependencies (more on that next), and I might also generate those locally with `pip-compile`.
Side note: I am currently [looking at `nox`][9] as a replacement for `tox`. The reasons are beyond the scope of this article, but it's worth taking a look at.
### Use pip-compile for Python dependency management
Python is a dynamic programming language, which means it loads its dependencies on every execution of the code. Understanding exactly what version of each dependency is running could mean the difference between smoothly running code and an unexpected crash. That means we have to think about dependency management tooling.
For each new project, I include a `requirements.in` file that is (usually) only the following:
```
`.`
```
Yes, that's right. A single line with a single dot. I document "loose" dependencies, such as `Twisted>=17.5` in the `setup.py`file. That is in contrast to exact dependencies like `Twisted==18.1`, which make it harder to upgrade to new versions of the library when you need a feature or a bug fix.
The `.` means "current directory," which uses the current directory's `setup.py` as the source for dependencies.
This means that using `pip-compile requirements.in > requirements.txt` will create a frozen dependencies file. You can use this dependencies file either in a virtual environment created by `virtualenvwrapper` or in `tox.ini`.
Sometimes it is useful to have `requirements-dev.txt`, generated from `requirements-dev.in` (contents: `.[dev]`) or `requirements-test.txt`, generated from `requirements-test.in` (contents: `.[test]`).
I am looking to see if `pip-compile` should be replaced in this flow by [`dephell`][10]. The `dephell` tool has a bunch of interesting things about it, like the use of asynchronous HTTP requests to speak dependency downloads.
### Conclusion
Python is as powerful as it is pleasing on the eyes. In order to write that code, I lean on a particular toolchain that has worked well for me. The tools `pyenv`, `virtualenvwrapper`, `tox`, and `pip-compile` are all separate. However, they each have their own role, with no overlaps, and together, they deliver a powerful Python workflow.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/python-tools
作者:[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/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks)
[2]: https://opensource.com/article/19/10/why-love-python
[3]: https://xkcd.com/1987/
[4]: https://opensource.com/sites/default/files/uploads/python_environment_xkcd_1.png (xkcd python illustration)
[5]: https://github.com/pyenv/pyenv-installer
[6]: https://opensource.com/article/20/4/pyenv
[7]: https://opensource.com/article/19/6/python-virtual-environments-mac
[8]: https://opensource.com/article/19/5/python-tox
[9]: https://nox.thea.codes/en/stable/
[10]: https://github.com/dephell/dephell

View File

@ -1,245 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Make Ubuntu Look Like macOS in 5 Easy Steps)
[#]: via: (https://itsfoss.com/make-ubuntu-look-like-macos/)
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
How to Make Ubuntu Look Like macOS in 5 Easy Steps
======
Customization is one of the main reasons [why I use Linux][1]. There is no end to the kind of customization you can do to your desktop Linux. You can change icons, themes, change fonts, change terminals, add screenlets, [indicator applets][2], extensions and what not.
We have covered numerous desktop customization tips and tricks on Its FOSS. In this one, Ill show you how to make Ubuntu look like macOS.
Many people use macOS because of its simplistic and elegant look. You may disagree with it but it remains a popular opinion. Even there are Linux distributions that have macOS like look and feel.
**One of the readers requested us to show how to make Ubuntu look like macOS** and hence weve created this tutorial. In fact, this is a **good example to show the customization capability of desktop Linux**.
No, you dont have to install a new distribution just for customizing the looks. You can do some tweaking on your own and give your system mac-like looks.
### How to give your Ubuntu Linux a macOS makeover
![][3]
Although this article suggests its for Ubuntu, you can follow it for **other distributions with GNOME desktop** with little or no changes. Please make sure to [check your desktop environment][4].
To be honest, even if you are using some other desktop environment, you can still take some hints about what changes to do. But you have to make sure to follow the steps using your DEs tools.
#### Prerequisites: GNOME Tweaks and GNOME Extensions
Please make sure to [install GNOME Tweaks tool][5]. Youll need it for changing the themes and icons.
Youll also need to [enable GNOME Extensions][6] for changing GNOME Shell and adding planks.
After you enable GNOME Extension, you need to install “user themes” extension from [Gnome extensions][7] or just go to [this link][8] and click on the switch to turn it on.
I also expect you to have some knowledge [about installing themes in Ubuntu][9]. Ill briefly touch on this subject, though.
Lets see the steps one by one.
#### Step 1: Install a macOS inspired GTK theme
Since the focus is on making GNOME look like macOS, you should choose a macOS like theme. There are plenty of themes which are macOS like.
**Download a theme of your choice**
You can go to [Gnome-look][10] site, and look for themes for GTK3. Dont worry if you see “Pling” written on the Gnome-look website, they both are from same providers.
You can choose any theme you want. Here are some macOS themes I think you should take a look at:
[**mcOS 11**][11]
[McHigh Sierra][12]
[Catalina][13]
[McMojave][14]
I shall be using “[McMojave][14]” in this article. You can choose any theme you want. You will find dropdown download button on the right side of website, click on it.
![McMojave Dark Theme][15]
Here you may find various “.tar.xz” files. These different files contain same theme with small differences. Like in “McMojave” we have variations like dark and light theme. You can try them all, or just pick anyone you like from the carousel given in middle.
**Set downloaded theme**
Extract the downloaded theme and copy this extracted theme folder to .local/share/themes folder.
Open GNOME Tweak tool and change the Application and Shell theme. As soon as you change the themes, you can see those three yellow, green and red buttons, and that Apple logo on upper left corner. You can also notice come changes on panel items.
![McMojave GTK and Shell theme][16]
#### Step 2: Install macOS like icons
The next step in this macOS makeover is to use macOS like icons.
**Download icon set**
Here are some icon sets I suggest that you can download from Gnome-look website:
[McMojave-circle][17]
[Mojave CT-icons][18]
[Cupertino icons][19]
I shall be using “[McMojave-circle][17]” in this article, feel free to use any icons you like.
Just like the theme, you can download it from “download” dropdown button from right side. Here you may also find various different versions of same icons.
![Mcmojave Circle][20]
**Set icon**
Now set the downloaded icon. For that extarct the download folder and copy it to .icons folder in your home directory. See this article on [installing icon][9] [][9][themes in Ubuntu][9].
This is what this icon looks like:
![McMojave Circle Icons Look][21]
#### Step 3: Add macOS like dock
Without macOS like dock, your Ubuntu will not look like macOS. There are various docks available for Linux. I like [Dash to Dock][22] and I am going to use it here.
Dash to Dock is a GNOME extension. By now you are familar with GNOME Extensions. Just go to [this link][23] and click on toggle button to install it. Your native dock will be automatically replaced with dash-to-dock.
You can change settings by right clicking on “show applications” button (rightmost menu button), and selecting “Dash to dock settings”.
![Dash To Dock][24]
#### Step 4: Use macOS wallpaper
Most of the complicated stuff are done. Now its time to set macOS wallpaper. You can download macOS default wallpapers from the link below:
[Download macOS wallpapers][25]
**Change the desktop background**
I shall be using “Mojave Day” wallpaper. Right click on the downloaded image and select Set As Wallpaper option to change the wallpaper.
After setting this wallpaper, this is how my system looks like:
![][26]
**Change the lock screen Wallpaper**
The lock screen background option is removed from the settings of [Ubuntu 20.04][27]. Now it uses blurred desktop wallpaper as the background of lock screen.
To set a custom lock screen wallpaper, you can use “[Lock screen background][28]” extension.
Open “Lock screen background” extension setting, and set lock screen wallpaper.
![Lock Screen Background Setting][29]
This is how the lockscreen looks now. If you are wondering, heres [how to take screenshot of lockscreen in Ubuntu][30].
![Lock Screen][31]
![Login Screen][32]
#### Step 5: Change system fonts
For several years, the primary system font in macOS is San Francisco. But this San Francisco font is not public domain but proprietary like so many other things in the Apple ecosystem. For this reason, you cannot use this font.
What you can do is to use an open source font that looks similar to the San Francisco fonts. I recommend using [Roboto][33] font by Google or [Source Sans Pro][34] by Adobe.
[Installing fonts is straightforward in Ubuntu][35]. Download the zip files of the fonts and just double-click on the ttf files in the extracted folder. It will give you the option to install the fonts one by one.
If you want to save time and install all the fonts at once, extract all fonts in it to the “.fonts” directory in your home folder (~/.fonts).
![Installing fonts][36]
Once you have installed the fonts, you can change the system wide font using GNOME Tweaks tool.
![Set Fonts][37]
#### Bonus Tip: Spotlight like app launcher (if you want to go the extra mile)
If you are a fan of macOS Spotlight launcher, you may have something similar on Linux also. My favorite package for getting this kind of launcher is “[Albert][38]“.
You can find the [installation instruction for Albert on its website][39].
After installing; open “Albert” and set hotkey (key combination you want for opening launcher) and you are good to go. I think in macOS, the Command+Space is to launch Spotlight. You may set Super+Space [keyboard shortcut in Ubuntu][40].
You will get many themes in built, in picture below Ive used “Spotlight dark”.
Albert wont be able to launch apps directly, you have to give it permissions for where it can look for search results.
![Albert Settings][41]
After setting up, this is how it looks:
![Albert dark theme][42]
This is how my Ubuntu 20.04 looks like after making all the customizations. Does it look like macOS? You be the judge.
![macOS Theme][43]
![Ubuntu with macOS makeover][44]
So, this is how you can make your GNOME desktop look like macOS. As I said in the beginning, this is a good example of Linux desktops customization capability.
If you have any new ideas or have any queries; the comment section is all yours.
_Written by Sumeet with additional inputs from Abhishek Prakash._
--------------------------------------------------------------------------------
via: https://itsfoss.com/make-ubuntu-look-like-macos/
作者:[Community][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/itsfoss/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/why-use-linux/
[2]: https://itsfoss.com/best-indicator-applets-ubuntu/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Make-Ubuntu-Look-like-MacOS.png?ssl=1
[4]: https://itsfoss.com/find-desktop-environment/
[5]: https://itsfoss.com/gnome-tweak-tool/
[6]: https://itsfoss.com/gnome-shell-extensions/
[7]: https://extensions.gnome.org/
[8]: https://extensions.gnome.org/extension/19/user-themes/
[9]: https://itsfoss.com/install-themes-ubuntu/
[10]: https://www.gnome-look.org/
[11]: https://www.pling.com/p/1220826
[12]: https://www.pling.com/p/1013714
[13]: https://www.pling.com/p/1226871
[14]: https://www.pling.com/p/1275087
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-dark-theme.png?ssl=1
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-Desktop.png?ssl=1
[17]: https://www.gnome-look.org/p/1305429/
[18]: https://www.gnome-look.org/p/1210856/
[19]: https://www.gnome-look.org/p/1102582/
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-.png?ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-icons-look.png?fit=800%2C494&ssl=1
[22]: https://github.com/micheleg/dash-to-dock
[23]: https://extensions.gnome.org/extension/307/dash-to-dock/
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Dash-to-dock-1.png?ssl=1
[25]: https://oswallpapers.com/category/mac-os/
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Wallpaper.png?fit=800%2C450&ssl=1
[27]: https://itsfoss.com/ubuntu-20-04-release-features/
[28]: https://extensions.gnome.org/extension/1476/unlock-dialog-background/
[29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-background-setting.png?ssl=1
[30]: https://itsfoss.com/screenshot-login-screen-ubuntu-linux/
[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-1.png?ssl=1
[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?ssl=1
[33]: https://fonts.google.com/specimen/Roboto?query=robot
[34]: https://adobe-fonts.github.io/source-sans-pro/
[35]: https://itsfoss.com/install-fonts-ubuntu/
[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Fonts.png?ssl=1
[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Set-fonts.png?ssl=1
[38]: https://albertlauncher.github.io/
[39]: https://albertlauncher.github.io/docs/installing/
[40]: https://itsfoss.com/ubuntu-shortcuts/
[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-settings.png?ssl=1
[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-look.png?ssl=1
[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme.png?fit=800%2C450&ssl=1
[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme-2.png?fit=800%2C450&ssl=1

View File

@ -1,125 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Linux tools for improving your time management)
[#]: via: (https://opensource.com/article/20/6/linux-time-management)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
Linux tools for improving your time management
======
Whether you need help to stay focused, maintain timeliness, or find
shortcuts to avoid repetition, these Linux tools have you covered.
![Business woman on laptop sitting in front of window][1]
Productivity is a subjective term, but essentially, it's a measurement of how efficiently a particular task is completed. Everyone has different things that keep them productive—some people need help staying on task, some people need a particular kind of work environment, some people need alerts and reminders to avoid missed deadlines, and some need assistance with repetitive, manual chores. Luckily, there are myriad tools and technologies available to provide you the specific support you need. In particular, if you are a Linux user, there are some tweaks that can help you increase your productivity; here are two that I use on a regular basis.
### Clipboard Indicator
Are you someone who uses a lot of copy and paste functions between several documents in your day to day usage? If so, then [Clipboard Indicator][2] should become one of your go-to solutions. Install Clipboard Indicator as a GNOME extension to your Linux distribution. In my experience, it has a minimum performance impact on GNOME Shell—at least, less than other solutions I have tried.
This tool adds an indicator menu to the top panel and caches your clipboard history. You can set the history size, preview the number of characters you want to view. It shows notifications on copy and acts as a temporary space to store whatever you copy.
![Clipboard indicator menu on GNOME desktop][3]
The easiest way to install the extension and connector is to use your distro's package manager.
For Fedora, CentOs, or RHEL, use:
```
`$ sudo dnf install chrome-gnome-shell`
```
On Ubuntu or Debian, use `apt install` instead.
Once it's installed, go to <https://extensions.gnome.org/> and check your installed extensions.
If you use Firefox, use the Firefox browser add-on and install the `GNOME Shell integration`**.** You will see a small footprint icon in your Firefox toolbar, which will take you to the Extensions page. On that page, search for the Clipboard Indicator extension and toggle to enable it.
Now, follow the prompts to download the GNOME extension and activate it. You can check your `~/.local/share/gnome-shell/extensions` location to view the extension.
Voila! You'll see a new icon in the top-right corner of your GNOME desktop. Copy anything and experiment with its settings.
A quick installation via Git can also be performed by cloning the repo into your local `gnome-shell extensions` directory using the command:
```
`$ git clone https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator.git ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com`
```
Go to the GNOME Tweak tool and activate it from the Extensions screen.
### Pomodoro
![Using the pomodoro timer on GNOME][4]
The Pomodoro Technique is a time management philosophy that aims to provide the user with maximum focus. Each 25-minute work period is called a "pomodoro," (Italian for tomato); after each pomodoro, you take a five-minute break. Every four pomodoros, or 100 minutes, you then take a 15 to 20-minute break. If you have a large and varied to-do list, using the Pomodoro Technique can help you crank through projects faster by forcing you to adhere to strict timing.
The installation procedure can be managed through the GNOME Tweaks webpage (extensions.gnome.org) or through the command line. For the latter, choose your distribution of Linux along with the release version and install using the following command:
```
`$ sudo dnf install gnome-shell-extension-pomodoro`
```
or if you wish to build from source:
```
$ git clone -b gnome-3.34 <https://github.com/codito/gnome-pomodoro.git>
$ cd gnome-pomodoro
```
The source code has a number of dependencies, many of which are likely already installed. To make sure of it, install of the following.
```
`$ sudo dnf install autoconf-archive gettext vala vala-tools pkg-config desktop-file-utils glib2-devel gtk3-devel libappstream-glib-devel libappindicator-gtk3-devel libcanberra-devel libpeas-devel sqlite-devel gom-devel gobject-introspection-devel gsettings-desktop-schemas-devel gstreamer1-devel`
```
Inside unpacked directory of the source code, complete the build.
```
$ ./autogen.sh --prefix=/usr --datadir=/usr/share 
$ make 
$ sudo make install 
```
No matter how we install, go to GNOME Tweaks and turn on the pomodoro timer. If you don't already have GNOME Tweaks, installing it through your package manager or in your software installer of choice. For example, on Fedora:
```
`$ sudo dnf install gnome-tweaks`
```
On Ubuntu or Debian, use `apt install` instead.
Pomodoro desktop integration is currently available for GNOME Shell, and they plan to support more desktops in the future. Check out <https://gnomepomodoro.org/> for the latest on the project. For KDE users in the meantime, there is an alternative called [Fokus][5].
### Productivity on Linux
Productivity is personal, but it's something we all are after in one way or another. Each of these tools has either saved me time or made my working time more productive, and they're a quick integration with Linux.
Do you have a favorite productivity tool? Share it in the comments!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/linux-time-management
作者:[Sudeshna Sur][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/sudeshna-sur
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
[2]: https://extensions.gnome.org/extension/779/clipboard-indicator/
[3]: https://opensource.com/sites/default/files/uploads/gnome-tweaks-productivity_0.png (Clipboard indicator menu on GNOME desktop)
[4]: https://opensource.com/sites/default/files/uploads/pomodoro-timer-fedora-opensourcecom.png (Using the pomodoro timer on GNOME)
[5]: https://store.kde.org/p/1308861/

View File

@ -1,107 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Missing Photoshop on Linux? Use PhotoGIMP and Convert GIMP into Photoshop)
[#]: via: (https://itsfoss.com/photogimp/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
Missing Photoshop on Linux? Use PhotoGIMP and Convert GIMP into Photoshop
======
[Adobe Photoshop][1] is not available for desktop Linux. GIMP is the [best alternative to Adobe Photoshop on Linux][2].
If you have used Photoshop for sometime, youll notice that the [GIMP][3] has different settings, different keyboard shortcuts and layout than Photoshop.
And there is absolutely nothing wrong with it. After all, both are two different software, and they dont have to look the same.
However, people who are used to Photoshop find it difficult to forget their hard learned muscle memory while switching to GIMP. This could frustrate some because using a new interface means learning numerous keyboard shortcuts and spending time on finding which tool is located where.
To help such Photoshop to GIMP switchers, [Diolinux][4] has introduced a tool that mimics Adobe Photoshop in GIMP.
### PhotoGIMP: Give Adobe Photoshop like look and feel to GIMP in Linux
![][5]
[PhotoGIMP][6] is not a standalone graphics software. It is a patch for GIMP 2.10. You need to have GIMP installed on your system to use PhotoGIMP.
When you apply the PhotoGIMP patch, it changes GIMP layout to mimic Adobe Photoshop.
* Installs hundreds of new fonts by default
* Installs new Python filters such as “heal selection”
* Adds new splash screen
* Adds new default settings to maximize space on the canvas
* Adds keyboard shortcuts similar to Adobe Photoshop
PhotoGIMP also adds new icon and name from custom .desktop file. Lets see how to use it.
### Installing PhotoGIMP on Linux [for intermediate to expert users]
PhotoGIMP is essentially a patch. You download and [extract the zip file in Linux][7]. Youll find the following hidden folders in the extracted folder:
* icons: which have a new PhotoGIMP icon
* .local: which contain the personalized .desktop file so that you see PhotoGIMP instead of GIMP in system menu
* .var : the main folder containing the patch for GIMP
You should [use Ctrl+H keyboard shortcut to show hidden files in Ubuntu][8].
Warning: I suggest making backup of GIMP config files so that you can revert if you dont like PhotoGIMP. Simply copy the content of GIMP config files into some other location.
At present, PhotoGIMP is mainly compatible with GIMP installed via [Flatpak][9]. If you installed GIMP using Flatpak, you can simply copy-paste these hidden folders in your home directory and it will convert your GIMP into Adobe Photoshop like settings.
However, if you installed GIMP via apt or snap or your distributions package manager, youll have to find the GIMP config folder and paste the content of the .var directory of PhotoGIMP. When asked, opt for merge option and replace existing files of the same name.
I [installed GIMP in Ubuntu 20.04 using apt][10]. The location for GIMP config file for me was ~/.config/GIMP/2.10. I copied the content of the .var/app/org.gimp.GIMP/config/GIMP/2.10 directory here and started GIMP to see the PhotoGIMP splash.
Heres the interface of GIMP after being patched by PhotoGIMP:
![][11]
I tried a couple of Photoshop keyboard shortcuts to check the changes it made and it seemed to be working.
[Download PhotoGIMP][12]
I also found [PhotoGIMP available as Snap package][13] but its from 2019, and I am not sure if it works everywhere or just with snap install.
**Conclusion**
This is not the first project of this kind. Some years ago, we had a similar project called Gimpshop. The Gimpshop project hasnt seen any development in past several years and it is safe to assume that the project is dead. There is a website in the name of Gimpshop but thats from imposters trying to cash in on Gimpshop name.
I am not an Adobe Photoshop user. I am not even a GIMP expert this is why the [GIMP tutorials][14] on Its FOSS are covered by Dimitrios.
For this reason, I cannot comment on how useful the PhotoGIMP project is. If you are familiar with both software, you should be able to judge it better than me.
If you try PhotoGIMP, do share your experience with it and let us know if it is worth the installation or not.
--------------------------------------------------------------------------------
via: https://itsfoss.com/photogimp/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.adobe.com/in/products/photoshop.html
[2]: https://itsfoss.com/open-source-photoshop-alternatives/
[3]: https://www.gimp.org/
[4]: https://diolinux.com.br/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-feature.jpg?ssl=1
[6]: https://github.com/Diolinux/PhotoGIMP
[7]: https://itsfoss.com/unzip-linux/
[8]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/
[9]: https://flatpak.org/
[10]: https://itsfoss.com/gimp-2-10-release/
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-editor-interface.jpg?resize=800%2C538&ssl=1
[12]: https://github.com/Diolinux/PhotoGIMP/releases
[13]: https://snapcraft.io/photogimp
[14]: https://itsfoss.com/tag/gimp-tips/

View File

@ -0,0 +1,450 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why you should use Node.js for data science)
[#]: via: (https://opensource.com/article/20/6/data-science-nodejs)
[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana)
Why you should use Node.js for data science
======
Node.js and other JavaScript libraries are excellent choices for data
science. Here's why.
![Computer screen with files or windows open][1]
[JavaScript][2] (also known as JS) is the [lingua franca][3] of the web, as it is supported by all the major web browsers—the other languages that run in browsers are [transpiled][4] (or translated) to JavaScript. Sometimes JS [can be confusing][5], but I find it pleasant to use because I try to stick to the [good parts][6]. JavaScript was created to run in a browser, but it can also be used in other contexts, such as an [embedded language][7] or for [server-side applications][8].
In this tutorial, I will explain how to write a program that will run in Node.js, which is a runtime environment that can execute JavaScript applications. What I like the most about Node.js is its [event-driven architecture][9] for [asynchronous programming][10]. With this approach, functions (aka callbacks) can be attached to certain events; when the attached event occurs, the callback executes. This way, the developer does not have to write a main loop because the runtime takes care of that.
JavaScript also has new [async functions][11] that use a different syntax, but I think they hide the event-driven architecture too well to use them in a how-to article. So, in this tutorial, I will use the traditional callbacks approach, even though it is not necessary for this case.
### Understanding the program task
The program task in this tutorial is to:
* Read some data from a [CSV file][12] that contains the [Anscombe's quartet][13] dataset
* Interpolate the data with a straight line (i.e., _f(x) = m·x + q_)
* Plot the result to an image file
For more details about this task, you can read the previous articles in this series, which do the same task in [Python and GNU Octave][14] and [C and C++][15]. The full source code for all the examples is available in my [polyglot_fit repository][16] on GitLab.
### Installing
Before you can run this example, you must install Node.js and its package manager [npm][17]. To install them on [Fedora][18], run:
```
`$ sudo dnf install nodejs npm`
```
On Ubuntu:
```
`$ sudo apt install nodejs npm`
```
Next, use `npm` to install the required packages. Packages are installed in a local [`node_modules` subdirectory][19], so Node.js can search for packages in that folder. The required packages are:
* [CSV Parse][20] for parsing the CSV file
* [Simple Statistics][21] for calculating the data correlation factor
* [Regression-js][22] for determining the fitting line
* [D3-Node][23] for server-side plotting
Run npm to install the packages:
```
`$ npm install csv-parse simple-statistics regression d3-node`
```
### Commenting code
Just like in C, in JavaScript, you can insert [comments][24] by putting `//` before your comment, and the interpreter will discard the rest of the line. Another option: JavaScript will discard anything between `/*` and `*/`:
```
// This is a comment ignored by the interpreter.
/* Also this is ignored */
```
### Loading modules
You can load modules with the [`require()` function][25]. The function returns an object that contains a module's functions:
```
const EventEmitter = require('events');
const fs = require('fs');
const csv = require('csv-parser');
const regression = require('regression');
const ss = require('simple-statistics');
const D3Node = require('d3-node');
```
Some of these modules are part of the Node.js standard library, so you do not need to install them with npm.
### Defining variables
Variables do not have to be declared before they are used, but if they are used without a declaration, they will be defined as global variables. Generally, global variables are considered bad practice, as they could lead to [bugs][26] if they're used carelessly. To declare a variable, you can use the [var][27], [let][28], and [const][29] statements. Variables can contain any kind of data (even functions!). You can create some objects by applying the [`new` operator][30] to a constructor function:
```
const inputFileName = "anscombe.csv";
const delimiter = "\t";
const skipHeader = 3;
const columnX = String(0);
const columnY = String(1);
const d3n = new D3Node();
const d3 = d3n.d3;
var data = [];
```
Data read from the CSV file is stored in the `data` array. Arrays are dynamic, so you do not have to decide their size beforehand.
### Defining functions
There are several ways to define functions in JavaScript. For example, the [function declaration][31] allows you to directly define a function:
```
function triplify(x) {
    return 3 * x;
}
// The function call is:
triplify(3);
```
You can also declare a function with an [expression][32] and store it in a variable:
```
var triplify = function (x) {
    return 3 * x;
}
// The function call is still:
triplify(3);
```
Finally, you can use the [arrow function expression][33], a syntactically short version of a function expression, but it has [some limitations][33]. It is generally used for concise functions that do simple calculations on its arguments:
```
var triplify = (x) =&gt; 3 * x;
// The function call is still:
triplify(3);
```
### Printing output
In order to print on the terminal, you can use the built-in [`console` object][34] in the Node.js standard library. The [`log()` method][35] prints on the terminal (adding a newline at the end of the string):
```
`console.log("#### Anscombe's first set with JavaScript in Node.js ####");`
```
The `console` object is a more powerful facility than just printing output; for instance, it can also print [warnings][36] and [errors][37]. If you want to print the value of a variable, you can convert it to a string and use `console.log()`:
```
`console.log("Slope: " + slope.toString());`
```
### Reading data
Input/output in Node.js uses a [very interesting approach][38]; you can choose either a synchronous or an asynchronous approach. The former uses blocking function calls, and the latter uses non-blocking function calls. In a blocking function, the program stops there and waits until the function finishes its task, whereas non-blocking functions do not stop the execution but continue their task somehow and somewhere else.
You have a couple of options here: you could periodically check whether the function ended, or the function could notify you when it ends. This tutorial uses the second approach: it employs [an `EventEmitter`][39] that generates an [event][40] associated with a callback function. The callback executes when the event is triggered.
First, generate the `EventEmitter`:
```
`const myEmitter = new EventEmitter();`
```
Then associate the file-reading's end with an event called `myEmitter`. Although you do not need to follow this path for this simple example—you could use a simple blocking call—it is a very powerful approach that can be very useful in other situations. Before doing that, add another piece to this section for using the CSV Parse library to do the data reading. This library provides [several approaches][41] you can choose from, but this example uses the [stream API][42] with a [pipe][43]. The library needs some configuration, which is defined in an object:
```
const csvOptions = {'separator': delimiter,
                    'skipLines': skipHeader,
                    'headers': false};
```
Since you've defined the options, you can read the file:
```
fs.createReadStream(inputFileName)
  .pipe(csv(csvOptions))
  .on('data', (datum) =&gt; data.push({'x': Number(datum[columnX]), 'y': Number(datum[columnY])}))
  .on('end', () =&gt; myEmitter.emit('reading-end'));
```
I'll walk through each line of this short, dense code snippet:
* `fs.createReadStream(inputFileName)` opens a [stream of data][44] that is read from the file. A stream gradually reads a file in chunks.
* `.pipe(csv(csvOptions))` forwards the stream to the CSV Parse library that handles the difficult task of reading the file and parsing it.
* `.on('data', (datum) => data.push({'x': Number(datum[columnX]), 'y': Number(datum[columnY])}))` is rather dense, so I will break it out:
* `(datum) => ...` defines a function to which each row of the CSV file will be passed.
* `data.push(...` adds the newly read data to the `data` array.
* `{'x': ..., 'y': ...}` constructs a new data point with `x` and `y` members.
* `Number(datum[columnX])` converts the element in `columnX` to a number.
* `.on('end', () => myEmitter.emit('reading-end'));` uses the emitter you created to notify you when the file-reading finishes.
When the emitter emits the `reading-end` event, you know that the file was completely parsed and its contents are in the `data` array.
### Fitting data
Now that you filled the `data` array, you can analyze the data in it. The function that carries out the analysis is associated with the `reading-end` event of the emitter you defined, so you can be sure that the data is ready. The emitter associates a callback function to that event and executes the function when the event is triggered.
```
myEmitter.on('reading-end', function () {
    const fit_data = data.map((datum) =&gt; [datum.x, datum.y]);
    const result = regression.linear(fit_data);
    const slope = result.equation[0];
    const intercept = result.equation[1];
    console.log("Slope: " + slope.toString());
    console.log("Intercept: " + intercept.toString());
    const x = data.map((datum) =&gt; datum.x);
    const y = data.map((datum) =&gt; datum.y);
    const r_value = ss.sampleCorrelation(x, y);
    console.log("Correlation coefficient: " + r_value.toString());
    myEmitter.emit('analysis-end', data, slope, intercept);
});
```
The statistics libraries expect data in different formats, so employ the [`map()` method][45] of the `data` array. `map()` creates a new array from an existing one and applies a function to each array element. The arrow functions are very practical in this context due to their conciseness. When the analysis finishes, you can trigger a new event to continue in a new callback. You could also directly plot the data in this function, but I opted to continue in a new one because the analysis could be a very lengthy process. By emitting the `analysis-end` event, you also pass the relevant data from this function to the next callback.
### Plotting
[D3.js][46] is a [very powerful][47] library for plotting data. The learning curve is rather steep, probably because it is a [misunderstood library][48], but it is the best open source option I've found for server-side plotting. My favorite D3.js feature is probably that it works on SVG images. D3.js was designed to run in a web browser, so it assumes it has a web page to handle. Working server-side is a very different environment, and you need a [virtual web page][49] to work on. Luckily, [D3-Node][50] makes this process very simple.
Begin by defining some useful measurements that will be required later:
```
const figDPI = 100;
const figWidth = 7 * figDPI;
const figHeight = figWidth / 16 * 9;
const margins = {top: 20, right: 20, bottom: 50, left: 50};
let plotWidth = figWidth - margins.left - margins.right;
let plotHeight = figHeight - margins.top - margins.bottom;
let minX = d3.min(data, (datum) =&gt; datum.x);
let maxX = d3.max(data, (datum) =&gt; datum.x);
let minY = d3.min(data, (datum) =&gt; datum.y);
let maxY = d3.max(data, (datum) =&gt; datum.y);
```
You have to convert between the data coordinates and the plot (image) coordinates. You can use scales for this conversion: the scale's domain is the data space where you pick the data points, and the scale's range is the image space where you put the points:
```
let scaleX = d3.scaleLinear()
               .range([0, plotWidth])
               .domain([minX - 1, maxX + 1]);
let scaleY = d3.scaleLinear()
               .range([plotHeight, 0])
               .domain([minY - 1, maxY + 1]);
const axisX = d3.axisBottom(scaleX).ticks(10);
const axisY = d3.axisLeft(scaleY).ticks(10);
```
Note that the `y` scale has an inverted range because in the SVG standard, the `y` scale's origin is at the top. After defining the scales, start drawing the plot on a newly created SVG image:
```
let svg = d3n.createSVG(figWidth, figHeight)
svg.attr('background-color', 'white');
svg.append("rect")
   .attr("width", figWidth)
   .attr("height", figHeight)
   .attr("fill", 'white');
```
First, draw the interpolating line appending a `line` element to the SVG image:
```
svg.append("g")
   .attr('transform', `translate(${margins.left}, ${margins.top})`)
   .append("line")
   .attr("x1", scaleX(minX - 1))
   .attr("y1", scaleY((minX - 1) * slope + intercept))
   .attr("x2", scaleX(maxX + 1))
   .attr("y2", scaleY((maxX + 1) * slope + intercept))
   .attr("stroke", "#1f77b4");
```
Then add a `circle` for each data point to the right location. D3.js's key point is that it associates data with SVG elements. Thus, you use the `data()` method to associate the data points to the circles you create. The [`enter()` method][51] tells the library what to do with the newly associated data:
```
svg.append("g")
   .attr('transform', `translate(${margins.left}, ${margins.top})`)
   .selectAll("circle")
   .data(data)
   .enter()
   .append("circle")
   .classed("circle", true)
   .attr("cx", (d) =&gt; scaleX(d.x))
   .attr("cy", (d) =&gt; scaleY(d.y))
   .attr("r", 3)
   .attr("fill", "#ff7f0e");
```
The last elements you draw are the axes and their labels; this is so you can be sure they overlap the plot lines and circles:
```
svg.append("g")
   .attr('transform', `translate(${margins.left}, ${margins.top + plotHeight})`)
   .call(axisX);
svg.append("g")
   .append("text")
   .attr("transform", `translate(${margins.left + 0.5 * plotWidth}, ${margins.top + plotHeight + 0.7 * margins.bottom})`)
  .style("text-anchor", "middle")
  .text("X");
svg.append("g")
   .attr('transform', `translate(${margins.left}, ${margins.top})`)
   .call(axisY);
svg.append("g")
   .attr("transform", `translate(${0.5 * margins.left}, ${margins.top + 0.5 * plotHeight})`)
   .append("text")
   .attr("transform", "rotate(-90)")
  .style("text-anchor", "middle")
  .text("Y");
```
Finally, save the plot to an SVG file. I opted for a synchronous write of the file, so I could show this [second approach][52]:
```
`fs.writeFileSync("fit_node.svg", d3n.svgString());`
```
### Results
Running the script is as simple as:
```
`$ node fitting_node.js`
```
And the command-line output is:
```
#### Anscombe's first set with JavaScript in Node.js ####
Slope: 0.5
Intercept: 3
Correlation coefficient: 0.8164205163448399
```
Here is the image I generated with D3.js and Node.js:
![Plot and fit of the dataset obtained with Node.js][53]
(Cristiano Fontana, [CC BY-SA 4.0][54])
### Conclusion
JavaScript is a core technology of today, and it is well suited for data exploration with the right libraries. With this introduction to event-driven architecture and an example of how server-side plotting looks in practice, we can start to consider Node.js and D3.js as alternatives to the common programming languages associated with data science.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/data-science-nodejs
作者:[Cristiano L. Fontana][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/cristianofontana
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open)
[2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/About_JavaScript
[3]: https://en.wikipedia.org/wiki/Lingua_franca
[4]: https://en.wikipedia.org/wiki/Source-to-source_compiler
[5]: https://www.destroyallsoftware.com/talks/wat
[6]: https://www.youtube.com/watch?v=_DKkVvOt6dk
[7]: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
[8]: https://nodejs.org/en/
[9]: https://en.wikipedia.org/wiki/Event-driven_architecture
[10]: https://en.wikipedia.org/wiki/Asynchrony_%28computer_programming%29
[11]: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Async_await
[12]: https://en.wikipedia.org/wiki/Comma-separated_values
[13]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet
[14]: https://opensource.com/article/20/2/python-gnu-octave-data-science
[15]: https://opensource.com/article/20/2/c-data-science
[16]: https://gitlab.com/cristiano.fontana/polyglot_fit
[17]: https://www.npmjs.com/
[18]: https://getfedora.org/
[19]: https://docs.npmjs.com/configuring-npm/folders.html
[20]: https://csv.js.org/parse/
[21]: https://simplestatistics.org/
[22]: http://tom-alexander.github.io/regression-js/
[23]: https://bradoyler.com/projects/d3-node/
[24]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Comments
[25]: https://nodejs.org/en/knowledge/getting-started/what-is-require/
[26]: https://gist.github.com/hallettj/64478
[27]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var
[28]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
[29]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
[30]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new
[31]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function
[32]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function
[33]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
[34]: https://nodejs.org/api/console.html
[35]: https://nodejs.org/api/console.html#console_console_log_data_args
[36]: https://nodejs.org/api/console.html#console_console_warn_data_args
[37]: https://nodejs.org/api/console.html#console_console_error_data_args
[38]: https://nodejs.org/en/docs/guides/blocking-vs-non-blocking/
[39]: https://nodejs.org/api/events.html#events_class_eventemitter
[40]: https://nodejs.org/api/events.html#events_events
[41]: https://csv.js.org/parse/api/
[42]: https://csv.js.org/parse/api/stream/
[43]: https://csv.js.org/parse/recipies/stream_pipe/
[44]: https://nodejs.org/api/stream.html#stream_stream
[45]: https://developer.mozilla.org/it/docs/Web/JavaScript/Reference/Global_Objects/Array/map
[46]: https://d3js.org/
[47]: https://observablehq.com/@d3/gallery
[48]: https://medium.com/dailyjs/the-trouble-with-d3-4a84f7de011f
[49]: https://github.com/jsdom/jsdom
[50]: https://github.com/d3-node/d3-node
[51]: https://www.d3indepth.com/enterexit/
[52]: https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options
[53]: https://opensource.com/sites/default/files/uploads/fit_node.jpg (Plot and fit of the dataset obtained with Node.js)
[54]: https://creativecommons.org/licenses/by-sa/4.0/

View File

@ -0,0 +1,211 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to stress test your Linux system)
[#]: via: (https://www.networkworld.com/article/3563334/how-to-stress-test-your-linux-system.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
How to stress test your Linux system
======
Stressing your Linux servers can be a good idea if you'd like to see how well they function when they're loaded down. In this post, we'll look at some tools that can help you add stress and gauge the results.
DigitalSoul / Getty Images / Linux
Why would you ever want to stress your Linux system? Because sometimes you might want to know how a system will behave when its under a lot of pressure due to a large number of running processes, heavy network traffic, excessive memory use and so on.  This kind of testing can help to ensure that a system is ready to "go public".
If you need to predict how long applications might take to respond and what, if any, processes might fail or run slowly under a heavy load, doing the stress testing up front can be a very good idea.
[[Get regularly scheduled insights by signing up for Network World newsletters.]][1]
Fortunately for those who need to be able to predict how a Linux system will react under stress, there are some helpful techniques you can employ and tools that you can use to make the process easier. In this post, we examine a few options.
### Do it yourself loops
This first technique involves running some loops on the command line and watching how they affect the system. This technique burdens the CPUs by greatly increasing the load. The results can easily be seen using the **uptime** or similar commands.
In the command below, we kick off four endless loops. You can increase the number of loops by adding digits or using a **bash** expression like **{1..6}** in place of "1 2 3 4".
```
for i in 1 2 3 4; do while : ; do : ; done & done
```
Typed on the command line, this command will start four endless loops in the background.
```
$ for i in 1 2 3 4; do while : ; do : ; done & done
[1] 205012
[2] 205013
[3] 205014
[4] 205015
```
In this case, jobs 1-4 were kicked off. Both the job numbers and process IDs are displayed.
To observe the effect on load averages, use a command like the one shown below. In this case, the **uptime** command is run every 30 seconds:
```
$ while true; do uptime; sleep 30; done
```
If you intend to run tests like this periodically, you can put the loop command into a script:
```
#!/bin/bash
while true
do
uptime
sleep 30
done
```
In the output, you can see how the load averages increase and then start going down again once the loops have been ended.
```
11:25:34 up 5 days, 17:27, 2 users, load average: 0.15, 0.14, 0.08
11:26:04 up 5 days, 17:27, 2 users, load average: 0.09, 0.12, 0.08
11:26:34 up 5 days, 17:28, 2 users, load average: 1.42, 0.43, 0.18
11:27:04 up 5 days, 17:28, 2 users, load average: 2.50, 0.79, 0.31
11:27:34 up 5 days, 17:29, 2 users, load average: 3.09, 1.10, 0.43
11:28:04 up 5 days, 17:29, 2 users, load average: 3.45, 1.38, 0.54
11:28:34 up 5 days, 17:30, 2 users, load average: 3.67, 1.63, 0.66
11:29:04 up 5 days, 17:30, 2 users, load average: 3.80, 1.86, 0.76
11:29:34 up 5 days, 17:31, 2 users, load average: 3.88, 2.06, 0.87
11:30:04 up 5 days, 17:31, 2 users, load average: 3.93, 2.25, 0.97
11:30:34 up 5 days, 17:32, 2 users, load average: 3.64, 2.35, 1.04 <== loops
11:31:04 up 5 days, 17:32, 2 users, load average: 2.20, 2.13, 1.01 stopped
11:31:34 up 5 days, 17:33, 2 users, load average: 1.40, 1.94, 0.98
```
Because the loads shown represent averages over 1, 5 and 15 minutes, the values will take a while to go back to what is likely normal for the system.
To stop the loops, issue a **kill** command like this one below assuming the job numbers are 1-4 as was shown earlier in this post. If youre unsure, use the jobs command to verify the job IDs.
```
$ kill %1 %2 %3 %4
```
### Specialized tools for adding stress
Another way to create system stress involves using a tool that was specifically built to stress the system for you. One of these is called “stress” and can stress the system in a number of ways. The **stress** tool is a workload generator that provides CPU, memory and disk I/O stress tests.
With the **\--cpu** option, the **stress** command uses a square-root function to force the CPUs to work hard. The higher the number of CPUs specified, the faster the loads will ramp up.
A second **watch-it** script (**watch-it-2**) can be used to gauge the effect on system memory usage. Note that it uses the **free** command to see the effect of the stressing.
```
$ cat watch-it-2
#!/bin/bash
while true
do
free
sleep 30
done
```
Kicking off and observing the stress:
```
$ stress --cpu 2
$ ./watch-it
13:09:14 up 5 days, 19:10, 2 users, load average: 0.00, 0.00, 0.00
13:09:44 up 5 days, 19:11, 2 users, load average: 0.68, 0.16, 0.05
13:10:14 up 5 days, 19:11, 2 users, load average: 1.20, 0.34, 0.12
13:10:44 up 5 days, 19:12, 2 users, load average: 1.52, 0.50, 0.18
13:11:14 up 5 days, 19:12, 2 users, load average: 1.71, 0.64, 0.24
13:11:44 up 5 days, 19:13, 2 users, load average: 1.83, 0.77, 0.30
```
The more CPUs specified on the command line, the faster the load will ramp up.
```
$ stress --cpu 4
$ ./watch-it
13:47:49 up 5 days, 19:49, 2 users, load average: 0.00, 0.00, 0.00
13:48:19 up 5 days, 19:49, 2 users, load average: 1.58, 0.38, 0.13
13:48:49 up 5 days, 19:50, 2 users, load average: 2.61, 0.75, 0.26
13:49:19 up 5 days, 19:50, 2 users, load average: 3.16, 1.06, 0.38
13:49:49 up 5 days, 19:51, 2 users, load average: 3.49, 1.34, 0.50
13:50:19 up 5 days, 19:51, 2 users, load average: 3.69, 1.60, 0.61
```
The **stress** command can also stress the system by adding I/O and memory load with its **\--io** (input/output) and **\--vm** (memory) options.
In this next example, this command for adding memory stress is run, and then the **watch-it-2** script is started:
```
$ stress --vm 2
$ watch-it-2
total used free shared buff/cache available
Mem: 6087064 662160 2519164 8868 2905740 5117548
Swap: 2097148 0 2097148
total used free shared buff/cache available
Mem: 6087064 803464 2377832 8864 2905768 4976248
Swap: 2097148 0 2097148
total used free shared buff/cache available
Mem: 6087064 968512 2212772 8864 2905780 4811200
Swap: 2097148 0 2097148
```
Another option for **stress** is to use the **\--io** option to add input/output activity to the system. In this case, you would use a command like this:
```
$ stress --io 4
```
You could then observe the stressed IO using **iotop**. Note that **iotop** requires root privilege.
###### before
```
$ sudo iotop -o
Total DISK READ: 0.00 B/s | Total DISK WRITE: 19.36 K/s
Current DISK READ: 0.00 B/s | Current DISK WRITE: 27.10 K/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
269308 be/4 root 0.00 B/s 0.00 B/s 0.00 % 1.24 % [kworker~fficient]
283 be/3 root 0.00 B/s 19.36 K/s 0.00 % 0.26 % [jbd2/sda1-8]
```
###### after
```
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
Current DISK READ: 0.00 B/s | Current DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
270983 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 51.45 % stress --io 4
270984 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 51.36 % stress --io 4
270985 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 50.95 % stress --io 4
270982 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 50.80 % stress --io 4
269308 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.09 % [kworker~fficient]
```
**Stress** is just one of a number of tools for adding stress to a system. Another and newer tool, **stress-ng**, will be covered in a future post.
### Wrap-Up
Various tools for stress-testing a system will help you anticipate how systems will respond in real world situations in which they are subjected to increased traffic and computing demands.
While what we've shown in the post are ways to create and measure various types of stress, the ultimate benefit is how the stress helps in determining how well your system or application responds to it.
Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3563334/how-to-stress-test-your-linux-system.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.networkworld.com/newsletters/signup.html
[2]: https://www.facebook.com/NetworkWorld/
[3]: https://www.linkedin.com/company/network-world

View File

@ -1,156 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Make Bash history more useful with these tips)
[#]: via: (https://opensource.com/article/20/6/bash-history-control)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Make Bash history more useful with these tips
======
Tell Bash what you want it to remember—or even rewrite history by
deleting entries you don't want or need.
![A person programming][1]
A Linux terminal running [Bash][2] has a built-in history that you can use to track what you've been doing lately. To view a history of your Bash session, use the built-in command `history`:
```
$ echo "foo"
foo
$ echo "bar"
bar
$ history
  1  echo "foo"
  2  echo "bar"
  3  history
```
The `history` command isn't an executable file on your filesystem, like most commands, but a function of Bash. You can verify this by using the `type` command:
```
$ type history
history is a shell builtin
```
### History control
The upper limit of lines in your shell history is defined by the `HISTSIZE` variable. You can set this variable in your `.bashrc` file. The following sets your history to 3,000 lines, after which the oldest line is removed to make room for the newest command, placed at the bottom of the list:
```
`export HISTSIZE=3000`
```
There are other history-related variables, too. The `HISTCONTROL` variable controls what history is stored. You can force Bash to exclude commands starting with empty space by placing this in your `.bashrc` file:
```
`export HISTCONTROL=$HISTCONTROL:ignorespace`
```
Now, if you type a command starting with a space, that command won't get recorded in history:
```
$ echo "hello"
$     mysql -u bogus -h badpassword123 mydatabase
$ echo "world"
$ history
  1  echo "hello"
  2  echo "world"
  3  history
```
You can avoid duplicate entries, too:
```
`export HISTCONTROL=$HISTCONTROL:ignoredups`
```
Now, if you type two commands, one after another, only one appears in history:
```
$ ls
$ ls
$ ls
$ history
  1  ls
  2  history
```
If you like both of these ignores, you can just use `ignoreboth`:
```
`export HISTCONTROL=$HISTCONTROL:ignoreboth`
```
### Remove a command from history
Sometimes you make a mistake and type something sensitive into your shell, or maybe you just want to clean up your history so that it more accurately represents the steps you took to get something working correctly. If you want to delete a command from your history in Bash, use the `-d` option with the line number of the item you want to remove:
```
$ echo "foo"
foo
$ echo "bar"
bar
$ history | tail
  535  echo "foo"
  536  echo "bar"
  537  history | tail
$ history -d 536
$ history | tail
  535  echo "foo"
  536  history | tail
  537  history -d 536
  538  history | tail
```
To stop adding `history` entries, you can place a `space` before the command, as long as you have `ignorespace` in your `HISTCONTROL` environment variable:
```
$  history | tail
  535  echo "foo"
  536  echo "bar"
$  history -d 536
$  history | tail
  535  echo "foo"
```
You can clear your entire session history with the `-c` option:
```
$ history -c
$  history
$
```
### History lessons
Manipulating history is usually less dangerous than it sounds, especially when you're curating it with a purpose in mind. For instance, if you're documenting a complex problem, it's often best to use your session history to record your commands because, by slotting them into your history, you're running them and thereby testing the process. Very often, documenting without doing leads to overlooking small steps or writing minor details wrong.
Use your history sessions as needed, and exercise your power over history wisely. Happy history hacking!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/bash-history-control
作者:[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/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming)
[2]: https://opensource.com/resources/what-bash

View File

@ -0,0 +1,155 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Advice for getting started with GNOME)
[#]: via: (https://opensource.com/article/20/6/gnome-users)
[#]: author: (Opensource.com https://opensource.com/users/admin)
Advice for getting started with GNOME
======
The GNOME desktop is a unified interface for Linux that offers lots of
extensions to customize your experience. Here's some advice from GNOME
users on how to get the most from it.
![Digital images of a computer desktop][1]
GNOME is one of the most popular Linux desktops today. It started as a humble desktop called the GNU Network Object Model Environment (GNOME) and was built on top of the GIMP GTK libraries. Its 1.0 release [was announced in 1999][2], just two years after the project got started.
Today, the most widely used Linux distributions provide GNOME 3 as their graphical desktop, and it's a great place to start learning Linux. As with any open source desktop, GNOME is extremely amenable to customization. You can alter and add to GNOME until it best suits your unique style of work.
But the eternal question is: should you?
We asked GNOME users their thoughts on this question, and some argue it's easier to learn GNOME (and Linux in the process) by using the desktop as delivered from the GNOME developers.
> Going against the grain, Id recommend using stock GNOME first and getting completely comfortable with it before delving into any extensions. —John Allison
> GNOME may need some getting used to. It might turn out to be indigestible, or it might turn out to be the single best way to interact with a Linux machine. Your mileage may vary. —Alexey Rusakov
> I dont necessarily like the idea of recommending extensions. While they can be useful, every time someone complains about GNOME being unstable, it ends up being due to some sort of extension. Sometimes I feel as though recommending extensions to GNOME users creates the culture of installing a ginormous number of extensions to make GNOME something that it isnt, and then the entire desktop comes crashing down. For me, my policy is to use as few extensions as possible. I really like the default GNOME layout with few or no changes. —Jay LaCroix
It was a common theme among the responses—users new to GNOME should learn GNOME before changing it.
### New users
GNOME is deceptively simple—when you turn on your Linux computer, you end up on a desktop with only a few obvious prompts. There's the Activities menu in the upper left corner of the screen and a typical system tray in the upper right.
Clicking on the Activities menu reveals an overlay containing an application dock. Clicking on the grid icon on the dock shows your installed applications.
Default apps include the same kinds of services you'd expect from any other desktop—a file manager, PDF reader, network manager, system settings or control panel, and so on. There are also some unexpected but nice defaults. For instance, GNOME includes a robust [virtualization application][3].
GNOME has worked its way into becoming the unifying interface for most Linux users. While each distribution has its own convention for package management, software development practices, and nearly everything else, GNOME is a unified front. If you learn GNOME, you learn a common "language" for interacting with the graphical side of Linux.
GNOME works hard at consistency, too. For instance, one key that is often ignored on keyboards is the Super key, which is the key with (usually) a Windows logo on it, or the Command key on Mac. GNOME uses this as a global hotkey, meaning that, no matter what application you're in, the Super key always talks to GNOME (any application can use the Super key, but few do). That means you have access to desktop functions regardless of what window is currently in focus.
That's not true for most key combos based around Control or Alt. Being able to "jump" out of an application to access desktop functions is an underrated feature, and once you get used to it, you start to miss it when using other desktops.
Here's some insight from our responders about acclimating to the GNOME way of doing things:
> Learn one environment well, and then you may try other ones. —Marcin Juszkiewicz
> Learn some of the handy shortcuts before attempting to define your own.
>
> * Super+Arrowup to maximize a window
> * Super+Arrowup to minimize a window
> * Super+Arrowleft or Super+ArrowRight to tile the window to take up half the screen
> * Super+PageUP or Super+PageDown to change workspace
> * Launch apps: Super, and then type 3-4 letters of the app you want to Launch (for example, f-i-r-e for Firefox, and so on)
> * Calculations: Super, and then type a simple equation (9*9) for a quick calculation
>
>
> Its a beautiful desktop, and it makes learning a new environment fun. Then again, learning something new can also be hard, so if youre a new user, most of the people responding to us agreed that a slow and steady approach is best. Get familiar with your surroundings before jumping to change everything. —Andreas Nilsson
> This might be a tough habit to unlearn for many users, but change from _mouse first_ to _Super key first_ for window switching, desktop navigation, launching, and searching. —Tim Quinlan
### Built-in help
Need help? There is a tutorial built-in.
> We have a Help application in GNOME that gets launched at first boot. It has quick videos showing how to launch applications, manage windows and workspaces, and more. You can always find the Help application by searching for it in the Activities screen, or launch help from a terminal. —Felipe Borges
### Get more apps
Getting to know a desktop is one thing, but a desktop can only do so much. Obviously, at some point, you're going to want more applications so you can get work done.
GNOME has an "app store" called Software that offers hundreds of open source applications you can install with a single click. It's topical, convenient, and easy.
![GNOME software installer][4]
### Experienced users
If you're used to trying out different Linux desktops, then customizing your environment is nothing new to you. For GNOME, the easiest and most obvious way to customize the desktop beyond what GNOME provides you in Settings is [Tweaks][5], available from your Software app.
![GNOME tweaks menu][6]
Tweaks lets you customize practically anything—themes, the buttons that show up in your window bars, GNOME extensions, fonts, power settings, startup applications, and much more.
Here is how some users set up their GNOME desktops:
> [Matt Broberg][7]
>
> * Learn how to [get started with GNOME extensions][8].
> * Customize the look of GNOME with [GNOME-look.org][9].
> * All GNOME customizations (extensions included) are saved to a users `$HOME/.config` directory, so if I migrate my home directory to another computer, or I put my configs into Git management, I can keep my environment consistent.
>
> Daniel Alley
>
> * Install [Dash to Dock][10], [Caffeine][11], [Disconnect Wifi][12], and [Sound Input and Output Device Chooser][13] extensions.
> * Enable minimize and maximize buttons in window bars with GNOME Tweak tool.
>
> Grzegorz Grzybek
>
> * One of my favorite extensions is [GTK Title Bar][14], which removes title bars of non-GNOME apps when theyre put into fullscreen mode.
>
### Try something the same, or try something different
GNOME was a direct response to the KDE desktop, which, at the time, was not licensed as [free software][15], and its original design played to the expectations of a KDE user.
![GNOME desktop example with Fedora][16]
It has come a long way since the early days and stands beside (and in many ways surpasses) the best-known desktops on other platforms. GNOME 3 is a progressive desktop, moving toward a unified interface for interfaces driven by keyboard, mouse, and touch. It's designed to balance beauty with resource requirements, innovation with familiarity, and efficiency with intuition.
![GNOME 3 desktop][17]
But if you're finding that you're familiar enough with GNOME but still not enjoying it, then there's nothing stopping you from trying something entirely different. In fact, it's common to try many different [desktops and window managers][18] on Linux and BSD because having choice in how you interact with your own computer is arguably the best embodiment of the open source spirit. You get to use your technology on your own terms. You never have to settle for what somebody else thinks is best.
How do you configure GNOME? Do you use GNOME or a different desktop? Tell us in the comments!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/gnome-users
作者:[Opensource.com][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/admin
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop)
[2]: https://www.gnome.org/press/1999/03/gnome-1-0-released/
[3]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization
[4]: https://opensource.com/sites/default/files/uploads/gnome-software-installer.png (GNOME software installer)
[5]: https://wiki.gnome.org/action/show/Apps/Tweaks?action=show&redirect=Apps%2FGnomeTweakTool
[6]: https://opensource.com/sites/default/files/uploads/gnome-tweaks.png (GNOME tweaks menu)
[7]: https://opensource.com/users/mbbroberg
[8]: https://extensions.gnome.org
[9]: https://www.gnome-look.org
[10]: https://extensions.gnome.org/extension/307/dash-to-dock/
[11]: https://extensions.gnome.org/extension/517/caffeine/
[12]: https://extensions.gnome.org/extension/904/disconnect-wifi/
[13]: https://extensions.gnome.org/extension/906/sound-output-device-chooser/
[14]: https://extensions.gnome.org/extension/1732/gtk-title-bar/
[15]: https://www.fsf.org/about/what-is-free-software
[16]: https://opensource.com/sites/default/files/uploads/gnome_desktop.png (GNOME desktop example with Fedora)
[17]: https://opensource.com/sites/default/files/uploads/advent-gnome_0.jpg (GNOME 3 desktop)
[18]: https://opensource.com/article/20/5/linux-desktops

View File

@ -0,0 +1,120 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Docker and Fedora 32)
[#]: via: (https://fedoramagazine.org/docker-and-fedora-32/)
[#]: author: (Kevin "Eonfge" Degeling https://fedoramagazine.org/author/eonfge/)
Docker and Fedora 32
======
![][1]
With the release of Fedora 32, regular users of [Docker][2] have been confronted by a small challenge. At the time of writing, Docker is not supported on Fedora 32. There are alternatives, like [Podman][3] and [Buildah][4], but for many existing users, switching now might not be the best time. As such, this article can help you set up your Docker environment on Fedora 32.
### Step 0: Removing conflicts
This step is for any user upgrading from Fedora 30 or 31. If this is a fresh installation of Fedora 32, you can move on to step 1.
To remove docker and all its related components:
```
sudo dnf remove docker-*
sudo dnf config-manager --disable docker-*
```
### Step 1: System preparation
With the last two versions of Fedora, the operating system has moved to two new technologies: CGroups and NFTables for the Firewall. While the details of these new technologies is behind the scope of this tutorial, its a sad fact that docker doesnt support them yet. As such, youll have to make some changes to facilitate Docker on Fedora.
#### Enable old CGroups
The previous implementation of CGroups is still supported and it can be enabled using the following command.
```
sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
```
#### Whitelist docker in firewall
To allow Docker to have network access, two commands are needed.
```
sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0
sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-masquerade
```
The first command will add the Docker-interface to the trusted environment which allows Docker to make remote connections. The second command will allow docker to make local connections. This is particularly useful when multiple Docker containers are in as a development environment.
### Step 2: installing Moby
[Moby][5] is the open-source, white label version of Docker. Its based on the same code but it does not carry the trademark. Its included in the main Fedora repository, which makes it easy to install.
```
sudo dnf install moby-engine docker-compose
```
This installs _moby-engine_, _docker-compose_, _containerd_ and some other related libraries. Once installed, youll have to enable the system-wide daemon to run docker.
```
sudo systemctl enable docker
```
### Step 3: Restart and test
To ensure that all systems and settings are properly processed, youll now have to reboot your machine.
```
sudo systemctl reboot
```
After that, you can validate your installation using the Docker hello-world package.
```
sudo docker run hello-world
```
You are then greeted by the Hello from Docker! unless something went wrong.
#### Running as admin
Optionally, you can now also add your user to the group account of Docker, so that you can start docker images without typing _sudo_.
```
sudo groupadd docker
sudo usermod -aG docker $USER
```
Logout and login for the change to take effect. If the thought of running containers with administrator privileges concerns you, then you should look into Podman.
### In summary
From this point on, Docker will work how youre used to, including docker-compose and all docker-related tools. Dont forget to check out the official documentation which can help you in many cases where something isnt quite right.
The current state of Docker on Fedora 32 is not ideal. The lack of an official package might bother some, and there is an [issue upstream][6] where this is discussed. The missing support for both [CGroups][7] and [NFTables][8] is more technical, but you can check their progress in their public issues.
These instruction should allow you to continue working like nothing has happened. If this has not satisfied your needs, dont forget to address your technical issues at the Moby or Docker Github pages, or take a look at Podman which might prove more robust in the long-term future.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/docker-and-fedora-32/
作者:[Kevin "Eonfge" Degeling][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/eonfge/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/f32-04-twilight-816x459.png
[2]: https://docs.docker.com/
[3]: https://podman.io/getting-started/
[4]: https://buildah.io/
[5]: https://mobyproject.org/
[6]: https://github.com/docker/for-linux/issues/955
[7]: https://github.com/moby/moby/issues/40360
[8]: https://github.com/moby/moby/issues/26824

View File

@ -0,0 +1,80 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Open source tools for translating British to American English)
[#]: via: (https://opensource.com/article/20/6/british-american-cli-translator)
[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas)
Open source tools for translating British to American English
======
Convert British English to American English (and vice versa) with these
command-line translators.
![Red telephone booth on a street in England][1]
Last Christmas, my wife and I traveled to my hometown of Ft. Pierce, Florida, and frequented a local establishment on the beach. There, we met a couple from The Midlands in the UK. The music was loud and so was the beer, so it was a bit hard to hear. Plus, even though it "seemed" they were speaking English, it was sometimes a challenge to understand what they were saying. I thought my time in Australia would have given me enough linguistic power, but, alas, a lot went over my head. There was more than the usual "soccer is football" or "trunk is a boot" sort of confusion.
Fortunately, there are open source solutions to translate "British" into "American." We may speak the same language, but our shared speech takes more twists and turns than Zig Zag Hill in Shaftesbury, Dorset!
If you happen to be at the bar with your Linux laptop, you can use a handy open source command-line program, cleverly called the [American British English Translator][2] (MIT license).
I installed the Translator on my repurposed MacBook running Linux with:
```
`$ npm install -g american-british-english-translator`
```
Which required me to [install Node.js][3] first.
### I do declare!
In addition to translating words and phrases, the American British English Translator will analyze, ummm, analyse, documents. I gave this a go with a popular document called _The Declaration of Independence_. (tl;dr). It analyzed the document and returned many results. One of the more interesting was:
```
fall:
issue: Different meanings
details:
American English: autumn
British English:
"""
to become pregnant. (Either as in 'I fell pregnant' or as in 'She fell for a baby.');
```
Not exactly "taken captive on the high seas" as the *Declaration's *authors accused:
> "He has constrained our fellow Citizens taken Captive on the high Seas to bear Arms against their Country, to become the executioners of their friends and Brethren, or to fall themselves by their Hands."
### Along comes MARY
For simple word replacements, you can try [Common_Language][4], an open source (MIT license) Python script.
Of course, if you're sharing a pint with your mates, you may need to actually speak to them in a voice and language they will understand. This would be a good time to bring MARY along with you.
[MaryTTS][5] is an open source, multilingual text-to-speech synthesis platform written in Java (GNU license). The handy [browser-based interface][6] makes it easy to translate your American bar talk into right good English (or other languages) in either a male or female voice.
So, now I am ready to meet my British friends (when it is safe to do so again), grab a few pints, and—Bob's your uncle—speak English like a native! Cheerio, y'all!
Translating documentation takes time and effort, but not nearly as much as starting over from...
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/british-american-cli-translator
作者:[Jeff Macharyas][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/jeffmacharyas
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/england-telephone-booth-street.jpg?itok=JQsc_piX (Red telephone booth on a street in England)
[2]: https://github.com/hyperreality/American-British-English-Translator
[3]: https://nodejs.org/en/download/
[4]: https://github.com/willettk/common_language
[5]: https://github.com/marytts/marytts
[6]: http://mary.dfki.de:59125/

View File

@ -0,0 +1,50 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (An open source browser extension to zoom in on images)
[#]: via: (https://opensource.com/article/20/6/hoverzoom)
[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas)
An open source browser extension to zoom in on images
======
Taking a closer look at web images isn't always straightforward, but
Hover Zoom+ makes it as easy as a slide of your mouse.
![Digital images of a computer desktop][1]
Have you ever visited a website and wanted to see the images displayed larger? That happens to me all the time, and it isn't always easy to make that happen.
On occasion, I sift through the source code, use **Ctrl + F** to search for the image, copy the image source address and paste it into a new window in order to see the image at its full-size glory. Or, the other option is to right-click, copy the image address, and paste into a new tab.
![Example image source code ][2]
Hover Zoom+ makes this a much simpler process. Issued under the MIT license, Hover Zoom+ is a simple Chrome extension available at the Chrome Store, and the source code is available on [GitHub.][3] It is also available for Firefox. 
This app makes that process much easier. By simply hovering over an image, you will see a pop-up show the image in its entirety, fit to your browser window, whether it is cropped or not (or if the image was placed, sized to fit, it will look the same). This can be interesting, as sometimes, the original image may have been cropped, either to fit the space or to focus on a specific part of the image. You cannot right-click and save the image directly from the pop-up, however.
According to San Jose, California-based developer Oleg Anashkin, "This is an open source version of the original HoverZoom extension, which is now overrun by malware and deleted from the store. In this version, all spyware has been removed, many bugs were fixed, and new features were added. It doesn't collect any statistics by default."
I installed the extension in Chrome on my Windows 10 laptop and took it for a spin. With the extension installed, I simply hovered over an image, and it displayed larger-than-life in a pop-up window.
However, Hover Zoom+ does not work on all websites or for all images. It works great for Facebook and Twitter, but not for sponsored content on those sites. The user can easily toggle the app to enable or disable it for specific sites. It was easy to see the entire Instagram screenshot of this cute kitten by using Hover Zoom+ without having to actually read the post (convenient!):
![Zoomed-in image of a kitten from Facebook][4]
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/hoverzoom
作者:[Jeff Macharyas][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/jeffmacharyas
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop)
[2]: https://opensource.com/sites/default/files/uploads/source.jpg (Example image source code)
[3]: https://github.com/extesy/hoverzoom/
[4]: https://opensource.com/sites/default/files/uploads/fb-cat.jpg (HoverZoom+ enlarged image)

View File

@ -0,0 +1,84 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to crop images in GIMP [Quick Tip])
[#]: via: (https://itsfoss.com/crop-images-gimp/)
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
How to crop images in GIMP [Quick Tip]
======
There are many reasons you may want to crop an image in [GIMP][1]. You may want to remove useless borders or information to improve your image, or you may want the focus of the final image to be a specific detail for example.
In this tutorial, I will demonstrate how to cut out an image in GIMP quickly and without compromising the precision. Lets see.
### How to crop images in GIMP
![][2]
#### Method 1
Cropping is just an operation to trim the image down to a smaller region than the original one. The procedure to crop an image is straightforward.
You can get to the Crop Tool through the Tools palette like this:
![Use Crop Tool for cropping images in GIMP][3]
You can also access the crop tool through the menus:
**Tools → Transform Tools → Crop**
Once the tool is activated, youll notice that your mouse cursor on the canvas will change to indicate the Crop Tool is being used.
Now you can Left-Click anywhere on your image canvas, and drag the mouse to a location to create the cropping boundaries. You dont have to worry about the precision at this point, as you will be able to modify the final selection before actually cropping.
![Crop Selection][4]
At this point hovering your mouse cursor over any of the four corners of the selection will change the mouse cursor, and highlight that region. This allows you to now fine-tune the selection for cropping. You can click and drag any side or corner to move that portion of the selection.
Once the region is good enough to be cropped, you can just press the “**Enter**” key on your keyboard to crop.
If at any time youd like to start over or decide not to crop at all, you can press the “**Esc**” key on your keyboard.
#### Method 2
Another way to crop an image is to make a selection first, using the **Rectangle Select Tool**.
**Tools → Selection Tools → Rectangle Select**
![][5]
You can then highlight a selection the same way as the **Crop Tool**, and adjust the selection as well. Once you have a selection you like, you can crop the image to fit that selection through
**Image → Crop to Selection**
![][6]
#### Conclusion
Cropping precisely an image can be considered a fundamental asset for a GIMP user. You may choose which method fits better to your needs and explore its potential.
If you have any questions about the procedure, please let me know in the comments below. If you are “craving” more [GIMP tutorials][7], make sure to subscribe on your favorite social media platforms!
--------------------------------------------------------------------------------
via: https://itsfoss.com/crop-images-gimp/
作者:[Dimitrios Savvopoulos][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/dimitrios/
[b]: https://github.com/lujun9972
[1]: https://www.gimp.org/
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-images-in-GIMP.png?ssl=1
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-tool.png?ssl=1
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-selection.jpg?ssl=1
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/select-1.gif?ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/crop.gif?ssl=1
[7]: https://itsfoss.com/tag/gimp-tips/

View File

@ -0,0 +1,576 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Stop debugging Go with Println and use Delve instead)
[#]: via: (https://opensource.com/article/20/6/debug-go-delve)
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
使用 Delve 代替 Println 来调试 Go 程序
======
Delve 是能让调试变成轻而易举的事的万能工具包。
![Bug tracking magnifying glass on computer screen][1]
你上次尝试去学习一种新的编程语言时什么时候?你有没有持之以恒,或者你是那些在新事物发布的第一时间就勇敢地去尝试的一员吗?不管怎样,学习一种新的语言也许非常有用,也会有很多乐趣。
你尝试着写简单的 “Hello, world!”,然后写一些实例代码,运行它,继续做一些小的修改,之后继续做一些改动。我敢保证我们都有过这个经历,不论我们使用哪种技术。假如你尝试一直用一种语言,并且你希望能称为技术专家,有一些事物能在你的进取之路上帮助你。
其中之一就是调试器。有些人喜欢在代码中用简单的 “print” 语句进行调试,这种方式很适合代码量少的简单程序;然而,如果你处理的是有多个开发者和几千行代码的大型项目,你应该使用调试器。
最近我开始学习 Go 编程语言了,在本文中,我们将探讨 Delve 调试器。Delve 是专门用来调试 Go 程序的工具,我们会借助一些 Go 示例代码来了解下它的一些功能。不要担心这里展示的 Go 示例代码;即使你之前没有写过 Go 代码也能看懂。Go 的目标之一是简单,因此代码是始终如一的,理解和解释起来都很容易。
### Delve 介绍
Delve 是托管在 [GitHub][2] 上的一个开源项目。
它自己的文档中写道:
*Delve 是 Go 编程语言的调试器。该项目的目标是为 Go 提供一个简单、全功能的调试工具。Delve 的引入和使用都很简单。当你使用调试器时,事情可能不会按你的思路运行。如果你这样想,那么你不适合用 Delve。*
让我们来近距离看一下。
我的测试系统是运行着 Fedora Linux 的笔记本电脑Go 编译器版本如下:
```
$ cat /etc/fedora-release
Fedora release 30 (Thirty)
$
$ go version
go version go1.12.17 linux/amd64
$
```
### Golang 安装
如果你没有安装 Go你可以运行下面的命令很轻松地就可以从配置的仓库中获取。
```
`$ dnf install golang.x86_64`
```
或者,你可以在[安装页面][3]找到适合你的操作系统的其他安装版本。
在开始之前,请先确认已经设置好了 Go tool 依赖的下列各个 PATH。如果这些路径没有设置有些示例可能不能正常运行。你可以在 SHELL 的 RC 文件中轻松设置这些环境变量,我的机器上是在 `$HOME/bashrc` 文件中设置的。
```
$ go env | grep GOPATH
GOPATH="/home/user/go"
$
$ go env | grep GOBIN
GOBIN="/home/user/go/gobin"
$
```
### Delve 安装
你可以像下面那样,通过运行一个简单的 `go get` 命令来安装 Delve。`go get` 是 Golang 从外部源下载和安装需要的包的方式。如果你安装过程中遇到了问题,可以查看[Delve 安装教程][4]
```
$ go get -u github.com/go-delve/delve/cmd/dlv
$
```
运行上面的命令,就会把 Delve 下载到你的 \$GOPATH 的位置,如果你没有把 \$GOPATH 设置成其他值,那么默认情况下 \$GOPATH 和 \$HOME/go 是同一个路径。
你可以进入 go/ 目录,你可以在 bin/ 目录下看到 `dlv`
```
$ ls -l $HOME/go
total 8
drwxrwxr-x. 2 user user 4096 May 25 19:11 bin
drwxrwxr-x. 4 user user 4096 May 25 19:21 src
$
$ ls -l ~/go/bin/
total 19596
-rwxrwxr-x. 1 user user 20062654 May 25 19:17 dlv
$
```
因为你把 Delve 安装到了 \$GOPATH所以你可以像运行普通的 shell 命令一样运行它,即每次运行时你不必先进入它所在的目录。你可以通过 `version` 选项来验证 `dlv` 是否正确安装。示例中安装的版本是 1.4.1。
```
$ which dlv
~/go/bin/dlv
$
$ dlv version
Delve Debugger
Version: 1.4.1
Build: $Id: bda606147ff48b58bde39e20b9e11378eaa4db46 $
$
```
现在,我们一起在 Go 程序中使用 Delve 来理解下它的功能以及如何使用它们。我们先来写一个 `hello.go`,简单地打印一条 "Hello, world!" 信息。
记着,我把这些示例程序放到了 \$GOBIN 目录下。
```
$ pwd
/home/user/go/gobin
$
$ cat hello.go
package main
import "fmt"
func main() {
        fmt.Println("Hello, world!")
}
$
```
运行 `build` 命令来编译一个 Go 程序,它的输入是 `.go` 后缀的文件。如果程序没有语法错误Go 编译器把它编译成一个二进制或可执行文件。这个文件可以被直接运行,运行后我们会在屏幕上看到 "Hello, world!" 信息。
```
$ go build hello.go
$
$ ls -l hello
-rwxrwxr-x. 1 user user 1997284 May 26 12:13 hello
$
$ ./hello
Hello, world!
$
```
### 在 Delve 中加载程序
把一个程序加载进 Delve 调试器有两种方式。
**在源码编译成二进制文件之前使用 debug 参数。**
第一种方式是在需要时对源码使用 **debug** 命令。Delve 会为你编译出一个名为 **_debug_bin** 的二进制文件,并把它加载进调试器。
在这个例子中,你可以进入 **hello.go** 所在的目录,然后运行 **dlv debug** 命令。如果目录中有多个源文件且每个文件都有自己的主函数Delve 则可能抛出错误,它期望的是单个程序或从单个项目构建成单个二进制文件。如果出现了这种错误,那么你就应该用下面展示的第二种方式。
```
$ ls -l
total 4
-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go
$
$ dlv debug
Type 'help' for list of commands.
(dlv)
```
现在打开另一个终端,列出目录下的文件。你可以看到一个多出的 **__debug_bin** 二进制文件,这个文件是由源码编译生成的,并会加载进调试器。你现在可以回到 **dlv** 提示框继续使用 Delve。
```
$ ls -l
total 2036
-rwxrwxr-x. 1 user user 2077085 Jun  4 11:48 __debug_bin
-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go
$
```
**使用 exec 参数**
如果你已经有提前编译好的 Go 程序或者已经用 **go build** 命令编译完成了,不想再用 Delve 编译出 `__debug_bin` 二进制文件,那么第二种把程序加载进 Delve 的方法在这些情况下会很有用。在上述情况下,你可以使用 **exec** 参数来把整个目录加载进 Delve 调试器。
```
$ ls -l
total 4
-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go
$
$ go build hello.go
$
$ ls -l
total 1956
-rwxrwxr-x. 1 user user 1997284 Jun  4 11:54 hello
-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go
$
$ dlv exec ./hello
Type 'help' for list of commands.
(dlv)
```
### 查看 delve 帮助信息
**dlv** 提示框中,你可以运行 help 来查看 Delve 提供的多种帮助选项。命令列表相当长,这里我们只列举一些重要的功能。下面是 Delve 的功能概览。
```
(dlv) help
The following commands are available:
Running the program:
Manipulating breakpoints:
Viewing program variables and memory:
Listing and switching between threads and goroutines:
Viewing the call stack and selecting frames:
Other commands:
Type help followed by a command for full documentation.
(dlv)
```
#### 设置断点
现在我们已经把 hello.go 程序加载进了 Delve 调试器,我们在主函数处设置断点,稍后来确认它。在 Go 中,主程序从 `main.main` 处开始执行,因此你需要把这个名字提供个 `break` 命令。之后,我们可以用 `breakpoints` 命令来检查断点是否正确设置了。
不要忘了你还可以用命令简写,因此你可以用 `b main.main` 来代替 `break main.main`,两者效果相同,`bp` 和 `breakpoints` 同理。你可以通过运行 `help` 命令查看帮助信息来找到你想要的命令简写。
```
(dlv) break main.main
Breakpoint 1 set at 0x4a228f for main.main() ./hello.go:5
(dlv) breakpoints
Breakpoint runtime-fatal-throw at 0x42c410 for runtime.fatalthrow() /usr/lib/golang/src/runtime/panic.go:663 (0)
Breakpoint unrecovered-panic at 0x42c480 for runtime.fatalpanic() /usr/lib/golang/src/runtime/panic.go:690 (0)
        print runtime.curg._panic.arg
Breakpoint 1 at 0x4a228f for main.main() ./hello.go:5 (0)
(dlv)
```
#### 程序继续执行
现在,我们用 `continue` 来继续运行程序。它会运行到断点处中止,在我们的例子中,会运行到主函数的 `main.main` 处中止。从这里开始,我们可以用 `next` 命令来逐行执行程序。请注意,当我们运行到 `fmt.Println("Hello, world!")` 处时,即使我们还在调试器里,我们也能看到打印到屏幕的 `Hello, world!`
```
(dlv) continue
> main.main() ./hello.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a228f)
     1: package main
     2:
     3: import "fmt"
     4:
=>   5:      func main() {
     6:         fmt.Println("Hello, world!")
     7: }
(dlv) next
> main.main() ./hello.go:6 (PC: 0x4a229d)
     1: package main
     2:
     3: import "fmt"
     4:
     5: func main() {
=>   6:              fmt.Println("Hello, world!")
     7: }
(dlv) next
Hello, world!
> main.main() ./hello.go:7 (PC: 0x4a22ff)
     2:
     3: import "fmt"
     4:
     5: func main() {
     6:         fmt.Println("Hello, world!")
=>   7:      }
(dlv)
```
#### 退出 Delve
你随时可以运行 `quit` 命令来退出调试器,退出之后你会回到 shell 提示框。相当简单,对吗?
```
(dlv) quit
$
```
我们用其他的 Go 程序来探索下 Delve 的其他功能。这次,我们从 [golang 教程][5] 中找了一个程序。如果你要学习 Go 语言,那么 Golang tour 应该是你的第一站。
下面的程序,`functions.go` 中简单展示了 Go 程序中是怎样定义和调用函数的。这里,我们有一个简单的把两数相加并返回和值的 `add()` 函数。你可以像下面那样构建程序并运行它。
```
$ cat functions.go
package main
import "fmt"
func add(x int, y int) int {
        return x + y
}
func main() {
        fmt.Println(add(42, 13))
}
$
```
你可以像下面那样构建和运行程序。
```
$ go build functions.go  && ./functions
55
$
```
#### 进入函数
跟前面展示的一样,我们用前面提到的一个选项来把二进制文件加载进 Delve 调试器,再一次在 `main.main` 处设置断点,继续运行程序直到断点处。然后执行 `next` 直到 `fmt.Println(add(42, 13))` 处;这里我们调用了 `add()` 函数。我们可以像下面展示的那样,用 Delve 的 `step` 命令从 `main` 函数进入 `add()` 函数。
```
$ dlv debug
Type 'help' for list of commands.
(dlv) break main.main
Breakpoint 1 set at 0x4a22b3 for main.main() ./functions.go:9
(dlv) c
> main.main() ./functions.go:9 (hits goroutine(1):1 total:1) (PC: 0x4a22b3)
     4:
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
=>   9:      func main() {
    10:         fmt.Println(add(42, 13))
    11: }
(dlv) next
> main.main() ./functions.go:10 (PC: 0x4a22c1)
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
=>  10:              fmt.Println(add(42, 13))
    11: }
(dlv) step
> main.add() ./functions.go:5 (PC: 0x4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=>   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv)
```
#### 使用`文件名:行号`来设置断点
上面的例子中,我们经过 `main` 函数进入了 `add()` 函数,但是你也可以在你想加断点的地方直接使用`文件名:行号`的组合。下面是在 `add()` 函数开始处加断点的另一种方式。
```
(dlv) break functions.go:5
Breakpoint 1 set at 0x4a2280 for main.add() ./functions.go:5
(dlv) continue
> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=>   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv)
```
#### 查看当前的栈信息
现在我们运行到了 `add()` 函数,我们可以在 Delve 中用 `stack` 命令查看当前栈的内容。这里在 0 位置展示了栈顶的函数 `add()` ,紧接着在 1 位置展示了调用 `add()` 函数的 `main.main`。在`main.main` 下面的函数属于 Go 运行时,是用来处理加载和执行该程序的。
```
(dlv) stack
0  0x00000000004a2280 in main.add
   at ./functions.go:5
1  0x00000000004a22d7 in main.main
   at ./functions.go:10
2  0x000000000042dd1f in runtime.main
   at /usr/lib/golang/src/runtime/proc.go:200
3  0x0000000000458171 in runtime.goexit
   at /usr/lib/golang/src/runtime/asm_amd64.s:1337
(dlv)
```
#### 在 frame 间跳转
在 Delve 中我们可以用 `frame` 命令实现 frame 间的跳转。在下面的例子中,我们用 `frame` 实现了从 `add()` frame 跳到 `main.main` frame以此类推。
```
(dlv) frame 0
> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
Frame 0: ./functions.go:5 (PC: 4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=>   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv) frame 1
> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
Frame 1: ./functions.go:10 (PC: 4a22d7)
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
=>  10:              fmt.Println(add(42, 13))
    11: }
(dlv)
```
**打印函数参数**
一个函数通常会接收多个参数。在 `add()` 函数中它的入参是两个整型。Delve 有个便捷的 `args` 命令,它能打印出命令行传给函数的参数。
```
(dlv) args
x = 42
y = 13
~r2 = 824633786832
(dlv)
```
#### 查看反汇编码
由于我们是调试编译出的二进制文件因此如果我们能查看编译器生成的汇编语言指令将会非常有用。Delve 提供了一个 `disassemble` 命令来查看这些指令。在下面的例子中,我们用它来查看 `add()` 函数的汇编指令。
```
(dlv) step
> main.add() ./functions.go:5 (PC: 0x4a2280)
     1: package main
     2:
     3: import "fmt"
     4:
=>   5:      func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
    10:         fmt.Println(add(42, 13))
(dlv) disassemble
TEXT main.add(SB) /home/user/go/gobin/functions.go
=>   functions.go:5  0x4a2280   48c744241800000000   mov qword ptr [rsp+0x18], 0x0
        functions.go:6  0x4a2289   488b442408           mov rax, qword ptr [rsp+0x8]
        functions.go:6  0x4a228e   4803442410           add rax, qword ptr [rsp+0x10]
        functions.go:6  0x4a2293   4889442418           mov qword ptr [rsp+0x18], rax
        functions.go:6  0x4a2298   c3                   ret
(dlv)
```
#### 单步退出函数
另一个功能是 `stepout`,这个功能可以让我们跳回到函数被调用的地方。在我们的例子中,如果我们想回到 `main.main` 函数,我们只需要简单地运行 `stepout` 命令,它就会把我们带回去。在我们调试大型代码库时,这个功能会是一个非常便捷的工具。
```
(dlv) stepout
> main.main() ./functions.go:10 (PC: 0x4a22d7)
Values returned:
        ~r2: 55
     5: func add(x int, y int) int {
     6:         return x + y
     7: }
     8:
     9: func main() {
=>  10:              fmt.Println(add(42, 13))
    11: }
(dlv)
```
我们一起通过 [Go 教程][6] 的另一个示例程序来看下 Delve 是怎么处理 Go 中的变量的。下面的示例程序定义和初始化了一些不同类型的变量。你可以构建和运行程序。
```
$ cat variables.go
package main
import "fmt"
var i, j int = 1, 2
func main() {
        var c, python, java = true, false, "no!"
        fmt.Println(i, j, c, python, java)
}
$
$ go build variables.go &&; ./variables
1 2 true false no!
$
```
#### 打印变量信息
像前面说过的那样,用 `delve debug` 在调试器中加载程序。你可以在 Delve 中用 `print` 命令通过变量名来展示他们当前的值。
```
(dlv) print c
true
(dlv) print java
"no!"
(dlv)
```
或者,你还可以用 `locals` 命令来打印函数内所有的局部变量。
```
(dlv) locals
python = false
c = true
java = "no!"
(dlv)
```
如果你不知道变量的类型,你可以用 `whatis` 命令来通过变量名来打印它的类型。
```
(dlv) whatis python
bool
(dlv) whatis c
bool
(dlv) whatis java
string
(dlv)
```
### 总结
现在我们只是了解了 Delve 所有功能的皮毛。你可以自己去查看 `help` 内容,尝试下其他的命令。你还可以把 Delve 绑定到运行中的 Go 程序上(守护进程!),如果你安装了 Go 源码库,你甚至可以用 Delve 导出 Golang 库内部的信息。勇敢去探索吧!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/debug-go-delve
作者:[Gaurav Kamathe][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/gkamathe
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen)
[2]: https://github.com/go-delve/delve
[3]: https://golang.org/doc/install
[4]: https://github.com/go-delve/delve/blob/master/Documentation/installation/linux/install.md
[5]: https://tour.golang.org/basics/4
[6]: https://tour.golang.org/basics/9

View File

@ -0,0 +1,104 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 essential tools to set up your Python environment for success)
[#]: via: (https://opensource.com/article/20/6/python-tools)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
建立成功的 Python 环境的 4 个基本工具
======
> 选择的这些工具将简化你的 Python 环境,以实现顺畅和一致的开发实践。
![Python programming language logo with question marks][1]
Python 是一门出色的通用编程语言,经常作为第一门编程语言来教授。二十年来,我为它撰写了很多本书,而它仍然是[我的首选语言][2]。虽然通常来说这门语言是简洁明了的,但是(正如 [xkcd][3] 所说的),从来没有人说过配置 Python 环境也是一样的简单。
![xkcd python illustration][4]
*一个复杂的Python环境。 [xkcd][3]*
在日常生活中有很多使用 Python 的方法。我将解释我是如何使用这些 Python 生态系统工具的,坦诚的说,我仍在寻找更多替代品。
### 使用 pyenv 来管理 Python 版本
我发现在你的机器上运行一个特定版本的 Python 的最好方法是使用 `pyenv`。这个软件可以在 Linux、Mac OS X 和 WSL2 上工作:这是我通常关心的三个 “类 UNIX” 环境。
安装 `pyenv` 本身有时会有点棘手。一种方法是使用专用的 [pyenv 安装程序][5],它使用 `curl | bash` 的方法来进行(详见说明)。
如果你是在 Mac 上(或者你运行 Homebrew 的其他系统),你可以按照[这里][6]的说明来安装和使用 `pyenv`
按照说明安装和设置了 `pyenv` 之后,你可以使用 `pyenv global` 来设置一个 “默认的” Python 版本。一般来说,你会选择你 “最喜欢的” 版本。这通常是最新的稳定版本,但如果有其他考虑因素也可能做不同的选择。
### 使用 virtualenvwrapper 让虚拟环境更简单
使用 `pyenv` 安装 Python 的一个好处是,你后继安装的所有后续 Python 解释器环境都是你自己的,而不属于你的操作系统。
虽然在 Python 本身内部安装东西通常不是最好的选择,但有一个例外:在上面选择的 “最喜欢的” Python 中,安装并配置 `virtualenvwrapper`。这样你就可以在瞬间创建和切换到虚拟环境。
我在[这篇文章中][7]具体介绍了如何安装和使用 `virtualenvwrapper`
这里我推荐一个独特的工作流程。你可以制作一个虚拟环境,这样你就可以大量重复使用它来运行许多<ruby>运行器<rt>runner</rt></ruby>。在这个环境中,安装你最喜欢的运行器 —— 也就是你会经常用来运行其他软件的软件。就目前而言,我的首选是 `tox`
### 使用 tox 作为 Python 运行器
[tox][8] 是一个很好的工具,可以让你的 Python 测试自动化。在每个 Python 环境中,我都会创建一个 `tox.ini` 文件。无论我使用什么系统做持续集成,都可以运行它,我可以用上面文章中描述的 `virtualenvwrapper``workon` 语法在本地运行同样的东西:
```
$ workon runner
$ tox
```
这个工作流程之所以重要,是因为我要在多个版本的 Python 和多个版本的库依赖中测试我的代码。这意味着在 `tox` 运行器中会有多个环境。有些人会尝试在最新的依赖关系中运行,有些人会尝试在冻结的依赖关系中运行(接下来会有更多的介绍),我也可能会用 `pip-compile` 在本地生成这些环境。
附注:我目前正在[研究使用 nox][9] 作为 `tox` 的替代品。原因超出了本文的范围,但值得一试。
### 使用 pip-compile 进行 Python 依赖性管理
Python 是一种动态编程语言,这意味着它在每次执行代码时都会加载其依赖关系。确切了解每个依赖项的具体运行版本可能意味着是平稳运行代码还是意外崩溃。这意味着我们必须考虑依赖管理工具。
对于每个新项目,我都会包含一个 `requirements.in` 文件,(通常)只有以下内容:
```
.
```
是的,没错。只有一个点的单行。我在 `setup.py` 文件中记录了 “松散” 的依赖关系,比如 `Twisted>=17.5`。这与 `Twisted==18.1` 这样的确切依赖关系形成了鲜明对比,后者在需要一个特性或错误修复时升级到新版本的库变得更加困难。
`.` 的意思是 “当前目录”,它使用当前目录下的 `setup.py` 作为依赖关系的来源。
这意味着使用 `pip-compile requirements.in > requirements.txt` 将创建一个冻结的依赖文件。你可以在 `virtualenvwrapper` 创建的虚拟环境中或者 `tox.ini` 中使用这个依赖文件。
有时,从 `requirements-dev.in`(内容:`.[dev]`)生成的 `requirements-dev.txt` 或从 `requirements-test.in`(内容:`.[test]`)生成的 `requirements-test.txt` 很有用。
我正在研究在这个流程中是否应该用 [dephell][10] 代替 `pip-compile`。`dephell` 工具具有许多有趣的功能,比如使用异步 HTTP 请求来下载依赖项。
### 结论
Python 的功能既强大又赏心悦目。为了编写这些代码,我依靠了一个对我来说很有效的特定工具链。工具 `pyenv`、`virtualenvwrapper`、`tox` 和 `pip-compile` 都是独立的。但是,它们各有各的作用,没有重叠,它们一起打造了一个强大的 Python 工作流。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/python-tools
作者:[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/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks)
[2]: https://opensource.com/article/19/10/why-love-python
[3]: https://xkcd.com/1987/
[4]: https://opensource.com/sites/default/files/uploads/python_environment_xkcd_1.png (xkcd python illustration)
[5]: https://github.com/pyenv/pyenv-installer
[6]: https://opensource.com/article/20/4/pyenv
[7]: https://opensource.com/article/19/6/python-virtual-environments-mac
[8]: https://opensource.com/article/19/5/python-tox
[9]: https://nox.thea.codes/en/stable/
[10]: https://github.com/dephell/dephell

View File

@ -0,0 +1,125 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Linux tools for improving your time management)
[#]: via: (https://opensource.com/article/20/6/linux-time-management)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
用于改善时间管理的 Linux 工具
======
无论你是需要帮助来保持专注、保持及时性,还是发现为了避免重复的快捷方式,这些 Linux 工具能够帮助你。
![Business woman on laptop sitting in front of window][1]
生产率是一个主观术语,但从本质上讲,它是衡量特定任务完成效率的标准。每个人都有不同的方式来提高他们的生产力:有些人需要帮助完成任务、有些人需要特殊的工作环境、有些人需要警报和提醒以避免错过截止日期,还有些人需要帮助重复的,手工杂务。幸运的是,有多种工具和技术可为你提供所需的特定支持。特别地,如果你是 Linux 用户,有一些调整可以帮助你提高生产力。这是我经常使用的两个。
### Clipboard Indicator
你是日常在多个文档之间的大量使用复制和粘贴的人吗?如果是这样,那么 [Clipboard Indicator][2] 应该成为你的首选方案之一。将 Clipboard Indicator 作为 GNOME 扩展安装到 Linux 发行版中。以我的经验,它对 GNOME Shell 的性能影响最小,至少比我尝试过的其他方案要小。
该工具添加了一个指示器菜单到顶部面板,并缓存剪贴板历史。你可以设置历史记录大小,预览要查看的字符数。它显示有关复制的通知,并充当保存任意复制内容的临时空间。
![Clipboard indicator menu on GNOME desktop][3]
安装扩展程序和连接器的最简单方法是使用发行版的包管理器。
对于 Fedora、CentOS 或 RHEL请使用
```
`$ sudo dnf install chrome-gnome-shell`
```
在 Ubuntu 或 Debian 上,请改用 `apt install`
安装完成后,进入<https://extensions.gnome.org/> 并查看已安装的扩展。
如果你使用的是 Firefox请使用 Firefox 浏览器附加组件并安装 `GNOME Shell integration`。你将在 Firefox 工具栏中看到一个很小的图标,它将带你进入“扩展”页面。在该页面上,搜索 Clipboard Indicator 扩展并启用它
现在,按照提示下载 GNOME 扩展并激活它。你可以查看你的 `~/.local/share/gnome-shell/extensions` 来浏览扩展。
好了!你将在 GNOME 桌面的右上角看到一个新图标。复制任意内容并尝试其设置。
也可以使用以下命令通过 Git 进行快速安装:将仓库克隆到本地 `gnome-shell extensions` 目录中:
```
`$ git clone https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator.git ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com`
```
进入 GNOME Tweaks 工具,然后从“扩展”页面激活它。
### Pomodoro
![Using the pomodoro timer on GNOME][4]
Pomodoro 技术是一种时间管理理念,旨在为用户提供最大注意力。每个 25 分钟的工作时间称为“番茄时间 pomodoro意大利语的番茄每个番茄之后你需要休息五分钟。每四个番茄时间即每 100 分钟,你就要休息 15 至 20 分钟。如果你有大量的待办事项,那么使用 Pomodoro 技术可以通过强迫你遵守严格的时间安排来帮助你更快地完成项目。
可以通过 GNOME Tweaks 网页 extensions.gnome.org 或通过命令行来管理安装过程。对于后者,请选择 Linux 发行版和版本,并使用以下命令进行安装:
```
`$ sudo dnf install gnome-shell-extension-pomodoro`
```
或者,如果你希望从源代码构建:
```
$ git clone -b gnome-3.34 <https://github.com/codito/gnome-pomodoro.git>
$ cd gnome-pomodoro
```
源码有许多依赖关系,其中许多可能已经安装。为了确保这点,请安装以下内容。
```
`$ sudo dnf install autoconf-archive gettext vala vala-tools pkg-config desktop-file-utils glib2-devel gtk3-devel libappstream-glib-devel libappindicator-gtk3-devel libcanberra-devel libpeas-devel sqlite-devel gom-devel gobject-introspection-devel gsettings-desktop-schemas-devel gstreamer1-devel`
```
在源代码的解压目录中,完成构建。
```
$ ./autogen.sh --prefix=/usr --datadir=/usr/share 
$ make 
$ sudo make install 
```
无论我们如何安装,请进入 GNOME Tweaks 并打开番茄计时器。如果你还没有 GNOME Tweaks请通过包管理器或所选的软件安装程序进行安装。例如在 Fedora 上:
```
`$ sudo dnf install gnome-tweaks`
```
在 Ubuntu 或 Debian上请改用 `apt install`
Pomodoro 桌面集成当前可在 GNOME Shell 中使用,并且它们计划在将来支持更多桌面。 查看 <https://gnomepomodoro.org/> 获取有关该项目的最新信息。同时,对于 KDE 用户,还有一个名为 [Fokus][5] 的替代品。
### Linux 上的生产力
生产力是个人的,但这是我们所有人都在以某种方式追求的东西。 任何一个工具要么节省了我的时间,要么使我的工作效率提高了,它们可以与 Linux 快速集成。
你是否有喜欢的生产力工具?请在评论中分享!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/linux-time-management
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/sudeshna-sur
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
[2]: https://extensions.gnome.org/extension/779/clipboard-indicator/
[3]: https://opensource.com/sites/default/files/uploads/gnome-tweaks-productivity_0.png (Clipboard indicator menu on GNOME desktop)
[4]: https://opensource.com/sites/default/files/uploads/pomodoro-timer-fedora-opensourcecom.png (Using the pomodoro timer on GNOME)
[5]: https://store.kde.org/p/1308861/

View File

@ -0,0 +1,107 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Missing Photoshop on Linux? Use PhotoGIMP and Convert GIMP into Photoshop)
[#]: via: (https://itsfoss.com/photogimp/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
在 Linux 上缺少 Photoshop使用 PhotoGIMP 将 GIMP 变为 Photoshop
======
[Adobe Photoshop][1] 不适用于桌面 Linux。GIMP 是 [Linux 上 Adobe Photoshop 的最佳替代品][2]。
如果你使用过 Photoshop那么你会注意到 [GIMP][3] 和 Photoshop 相比有不同的设置、键盘快捷键和布局。
这没有错。毕竟,它们都是两种不同的软件,而且它们不必看起来相同。
但是,习惯了 Photoshop 的人们发现在切换到 GIMP 的时很难忘记他们反复学习的肌肉记忆。这可能会使某些人感到沮丧,因为使用新的界面意味着要学习大量的键盘快捷键,并花时间在查找工具位于何处。
为了帮助从 Photoshop 切换到 GIMP 的人,[Diolinux][4] 介绍了一个在 GIMP 中模仿 Adobe Photoshop 的工具。
### PhotoGIMP在 Linux 中为 GIMP 提供 Adobe Photoshop 的外观
![][5]
[PhotoGIMP][6] 不是独立的图形软件。它是 GIMP 2.10 的补丁。你需要在系统上安装 GIMP 才能使用 PhotoGIMP。
当你应用 PhotoGIMP 补丁时,它将更改 GIMP 布局以模仿 Adobe Photoshop。
* 默认安装数百种新字体
* 安装新的 Python 过滤器,例如 “heal selection”
* 添加新的启动画面
* 添加新的默认设置以最大化画布空间
* 添加类似于 Adobe Photoshop 的键盘快捷键
PhotoGIMP 还在自定义 .desktop 文件中添加新的图标和名称。让我们看看如何使用它。
### 在 Linux 上安装 PhotoGIMP (适合中级到专业用户)
PhotoGIMP 本质是一个补丁。在 Linux 中下载并[解压 zip 文件][7]。你将在解压的文件夹中找到以下隐藏的文件夹:
* icons其中包含新的 PhotoGIMP 图标
* .local包含个性化的 .desktop 文件,以便你在系统菜单中看到的是 PhotoGIMP 而不是 GIMP
* .var包含 GIMP 补丁的主文件夹
你应该[使用 Ctrl+H 快捷键在 Ubuntu 中显示隐藏文件][8]。
警告:建议你备份 GIMP 配置文件,以便在不喜欢 PhotoGIMP 时可以还原。只需将 GIMP 配置文件复制到其他位置。
目前PhotoGIMP 主要与通过 [Flatpak][9] 安装的 GIMP 兼容。如果你使用 Flatpak 安装了 GIMP那么只需将这些隐藏的文件夹复制粘贴到家目录中它将 GIMP 转换为 Adobe Photoshop 类似的设置。
但是,如果你通过 apt、snap 或发行版的包管理器安装了 GIMP那么必须找到 GIMP 的配置文件夹,然后粘贴 PhotoGIMP 的 .var 目录的内容。当出现询问时,请选择合并选项并替换同名的现有文件。
我[使用 apt 在 Ubuntu 20.04 中安装了 GIMP][10]。对我来说GIMP 配置文件在 \~/.config/GIMP/2.10。我复制了 .var/app/org.gimp.GIMP/config/GIMP/2.10 目录,并启动 GIMP 查看 PhotoGIMP 的启动页。
这是打了 PhotoGIMP 补丁后的 GIMP 界面:
![][11]
我尝试了几个 Photoshop 快捷键来检查它所做的更改,一切似乎可以正常工作。
[下载 PhotoGIMP][12]
我还找到了 [Snap 包形式的 PhotoGIMP][13],但它是 2019 年的,我不确定它是否可以在所有地方使用,或者仅适用于 snap 安装。
**总结**
这不是类似的第一个项目。几年前,我们有一个类似的项目叫 Gimpshop。Gimpshop 项目在过去的几年中没有任何进展,可以肯定地认为该项目已经死亡。有一个名为 Gimpshop 的网站,但该网站来自冒名者试图以 Gimpshop 的名义获利。
我不是 Adobe Photoshop 用户。我甚至不是 GIMP 专家,这就是为什么 Its FOSS 上的 [GIMP 教程][14] 用 Dimitrios 的原因。
因此,我无法评论 PhotoGIMP 项目的实用性。如果你熟悉这两种软件,那么应该能够比我更好地进行判断。
如果你尝试使用 PhotoGIMP请与他人分享你的经验并告诉我们是否值得安装。
--------------------------------------------------------------------------------
via: https://itsfoss.com/photogimp/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.adobe.com/in/products/photoshop.html
[2]: https://itsfoss.com/open-source-photoshop-alternatives/
[3]: https://www.gimp.org/
[4]: https://diolinux.com.br/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-feature.jpg?ssl=1
[6]: https://github.com/Diolinux/PhotoGIMP
[7]: https://itsfoss.com/unzip-linux/
[8]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/
[9]: https://flatpak.org/
[10]: https://itsfoss.com/gimp-2-10-release/
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-editor-interface.jpg?resize=800%2C538&ssl=1
[12]: https://github.com/Diolinux/PhotoGIMP/releases
[13]: https://snapcraft.io/photogimp
[14]: https://itsfoss.com/tag/gimp-tips/

View File

@ -1,276 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( nophDog)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Make the switch from Mac to Linux easier with Homebrew)
[#]: via: (https://opensource.com/article/20/6/homebrew-linux)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
Homebrew 让你从 Mac 切换到 Linux 更轻松
======
不管你是想要更舒服地从 Mac 搬到 Linux还是不满意常规的 Linux 包管理器,都可以试试 Homebrew。
![Digital images of a computer desktop][1]
[Homebrew][2] 项目最初是为了给 Mac 用户提供一个非官方的类 Linux 包管理器。用户很快就爱上了它友好的界面以及帮助性的提示,而且 —— 真是爱恨纠缠 —— 它已经被移植到 Linux 系统。
一开始macOS 和 Linux 有两个分开的项目Homebrew 与 Linuxbrew但是目前在两个操作系统上都是由 Homebrew 核心管理。由于我正 [从 Mac 切换到 Linux][3],所以一直在研究我在 macOS 最常用的开源软件在 Linux 表现如何,最终,我很高兴地发现 Homebrew 也支持 Linux太赞了
### 为什么要在 Linux 使用 Homebrew 呢?
长期的 Linux 用户对 Homebrew 的第一反应是:“为什么不用......呢”,省略号代表他们喜欢的 Linux 包管理器。基于 Debian 的系统早就有了 `apt`,基于 Fedora 的系统则有 `dnf``yum`,并且像 Flatpak 跟 AppImage 这样的项目,在两种系统上都能流畅运行。我花了不少时间尝试这些技术,不得不说它们都很强大。
那我为什么还要 [坚持使用 Homebrew][4] 呢?首先,我对它非常熟悉。在为我过去使用的专利软件寻找替代品的过程中,我已经学会了许多使用方法,而且越来越熟练 —— 就像我使用 Homebrew 一样 —— 让我专注于一次学习一件事情,而不会被不同系统间的差异搞垮。
此外,我没有看到哪一个包管理器像 Homebrew 一样,对用户如此友好。命令井井有条,默认的帮助命令显示如下:
```
$ brew -h
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]
Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA
Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
Further help:
  brew commands
  brew help [COMMAND]
  man brew
  <https://docs.brew.sh>
```
过于简短的输入可能会被误解成它的缺陷,但是你仔细看看每一个子命令,都有很丰富的功能。虽然这一列只有短短 23 行,但对进阶用户来说,光是子命令 `install` 就包含整整 79 行信息量:
```
$ brew --help | wc -l
23
$ brew install --help | wc -l
79
```
忽视或者安装依赖,用什么编译器从源码编译,使用上游 Git 提交或者官方 “bottled” 版应用这些你都可以选择。总而言之Homebrew 即适合新手,也同样能满足老鸟。
### 开始在 Linux 使用 Homebrew
如果你想要试着使用 Homebrew可以用这个一行脚本在 Mac 或者 Linux 上进行安装:
```
`$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`
```
这条命令会立即开始安装 Homebrew。如果你比较谨慎可以使用 `curl` 将文件下载到本地,检查完毕之后再运行。
```
$ curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/master/install.sh> \--output homebrew_installer.sh
$ more homebrew_installer.sh # review the script until you feel comfortable
$ bash homebrew_installer.sh
```
对 Linux 的安装指导包括如何配置点文件,尤其是 Debian 系统的 `~/.profile` 和 Fedora 系统的 `~/.bash_profile`
```
$ test -d /home/linuxbrew/.linuxbrew &amp;&amp; eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
$ test -r ~/.bash_profile &amp;&amp; echo "eval \$($(brew --prefix)/bin/brew shellenv)" &gt;&gt;~/.bash_profile
$ echo "eval \$($(brew --prefix)/bin/brew shellenv)" &gt;&gt;~/.profile
```
为了确认已经安装好Homebrew 团队提供一个空的 `hello` formulae 供测试:
```
$ brew install hello
==&gt; Downloading <https://linuxbrew.bintray.com/bottles/hello-2.10.x86\_64\_linux.bottle.tar.gz>
######################################################################## 100.0%
==&gt; Pouring hello-2.10.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/hello/2.10: 52 files, 595.6KB
```
It looks like my installation is working without any issues, so I'll explore a little more.
看起来安装毫无问题,那我来试试。
### Brew for command-line utilities
### 命令行工具 Brew
Homebrew 宣称自己默认只 “安装你需要但 [Linux] 不需要的东西”。
在 Homebrew 中,你可以用 `brew` 命令安装任何命令行软件。这些包的定义文件叫做 “formulae”而且它们是编译好的文件通过 “bottles” 共享。在 Homebrew 的世界里,还有许多 “beer-oriented” 术语,但这个包管理器主要目的是让软件便于使用。
什么样的软件呢?对我这样的技术玩家(既然你已经在读这篇文章,估计你也是)来说最方便的东西。例如,便利的 `tree` 命令,可以展示目录结构,或者 `pyenv`,我用来 [在 Mac 管理不同版本 Python][5]。
你可以用 `search` 命令查看所有可以安装的 formulae在后面通过 `wc` 命令看看一共有多少:
```
# -l counts the number of lines
$ brew search | wc -l
    5087
```
迄今为止,一共有 5000 多个 formulae这囊括了很多软件。需要注意的是并非所有 formula 都能在 Linux 运行。在 `brew search --help` 输出中有一部分提到可以通过操作系统标识来筛选软件。它会在浏览器打开用于每一个操作系统的软件仓库。我运行的是 Fedora所以我打算试一试
```
`$ brew search --fedora tree`
```
浏览器打开了网址 `https://apps.fedoraproject.org/packages/s/tree`,向我展示了所有 Fedora 的可用选项。你也可以通过其它方法进行浏览。Formulae 集中整理到由操作系统划分的核心仓库当中Mac 在 [Homebrew Core][6]Linux 在 [Linux Core][7])。同样也可以通过 Homebrew API [在网页显示][8]。
尽管已经安装好这些软件,我又通过其它用户的推荐找到很多新工具。我列出一些我最喜欢的工具,你可以在里面找点灵感:
* `pyenv`、`rbenv` 和 `nodenv` 用来管理(相应的) Python、Ruby 和 Node.js 版本
* `imagemagick` 用于脚本化编辑图片
* `pandoc` 用于脚本化转换文档格式(我通常将 .docx 文件转成 .md 或者 .html
* `hub` 为 GitHub 用户提供 [更好的 Git 体验][9]
* `tldr` 展示命令工具的用法
想要深入了解 Homebrew可以去 [trldr 页面][10] 看看,比起应用的 man 页面,它要友好得多。使用 `search` 命令确认你可以安装:
```
$ brew search tldr
==&gt; Formulae
tldr ✔
```
太好了!勾号说明你可以安装。那么继续吧:
```
$ brew install tldr
==&gt; Downloading <https://linuxbrew.bintray.com/bottles/tldr-1.3.0\_2.x86\_64\_linux.bottle.1.tar.gz>
######################################################################## 100.0%
==&gt; Pouring tldr-1.3.0_2.x86_64_linux.bottle.1.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2: 6 files, 63.2KB
```
Homebrew 提供编译好的二进制文件,所以你也不必在本地机器上编译源码。这能节省很多时间,也不用听 CPU 风扇的噪声。我同样欣赏 Homebrew 的另外一点,你不完全理解每一个选项的含义也不会影响正常使用。若你想自己编译,可以在 `brew install` 命令后面加上 `-s` 或者 `--build-from-source` 标识,这样就能从源码编译 formula即便已经有一个 bottle 存在)。
同样,软件之后的复杂度也很有意思。使用 `info` 查看 `tldr` 软件的依赖管理formula 源代码在磁盘上的分布,甚至还能查看公开数据。
```
$ brew info tldr
tldr: stable 1.3.0 (bottled), HEAD
Simplified and community-driven man pages
<https://tldr.sh/>
Conflicts with:
  tealdeer (because both install `tldr` binaries)
/home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2 (6 files, 63.2KB) *
  Poured from bottle on 2020-06-08 at 15:56:15
From: <https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/tldr.rb>
==&gt; Dependencies
Build: pkg-config ✔
Required: libzip ✔, curl ✔
==&gt; Options
\--HEAD
        Install HEAD version
==&gt; Analytics
install: 197 (30 days), 647 (90 days), 1,546 (365 days)
install-on-request: 197 (30 days), 646 (90 days), 1,546 (365 days)
build-error: 0 (30 days)
```
### 从 Mac 到 Linux 的一点不足
在 macOSHomebrew 的 `cask` 子命令可以让用户完全使用命令行安装、管理图形界面软件。不幸的是,`cask` 只在部分 Linux 发行版有效。我在安装一个开源工具时遇到了问题:
```
$ brew cask install tusk
Error: Installing casks is supported only on macOS
```
我在 [论坛][11] 提问,迅速得到其他用户的一些反馈。总结一下,方案如下:
* 复刻该项目,构建这个特性,然后告诉别人值得这样做
* 给该软件写一个 formula从源代码编译
* 为该软件创建一个第三方仓库
对我来说还有最后一件很有意思的事情。Homebrew 通过 [创建并维护 “taps”][12] (另一个 beer-influenced 名词)管理第三方仓库。当你对系统越来越熟悉时,你会将 Taps 加入这个生态,花点时间研究它能让你受益匪浅。
### 备份 Homebrew 的安装记录
我最中意的 Homebrew 特性之一就是你可以像其它任何 [版本控制工具备份点文件][13] 一样备份你的安装记录。为了实现这个目的Homebrew 提供 `bundle` 子命令,它有一个子命令叫 `dump` 可以生成一份 Brewfile。这个文件包含你目前所有安装的工具列表可以反复使用。进入你想使用的目录然后运行命令它会根据你所安装的软件生成 Brewfile
```
$ cd ~/Development/dotfiles # This is my dotfile folder
$ brew bundle dump
$ ls Brewfile
Brewfile
```
当我换了一台机器,想要安装一样的软件时,进入含有 Brewfile 的文件夹,然后重新安装:
```
$ ls Brewfile
Brewfile
$ brew bundle
```
它会在我的新机器上安装所有列出的 formulae。
#### 在 Mac 和 Linux 同时管理 Brewfile
Brewfile 非常适合备份你目前的安装记录,但是如果某些在 Mac 上运行的软件无法运行在 Linux 呢?或者刚好相反?我发现不管是 Mac 还是 Linux如果软件无法在当前操作系统运行Homebrew 会优雅地忽略那一行。如果它遇到不兼容的请求(正如使用 brew 在 Linux 安装 cask它会选择跳过继续安装过程
```
$ brew bundle --file=Brewfile.example
Skipping cask licecap (on Linux)
Skipping cask macdown (on Linux)
Installing fish
Homebrew Bundle complete! 1 Brewfile dependency now installed.
```
为了尽量保持配置文件的简洁,我在跨操作系统时使用同一份 Brewfile因为它只安装与操作系统相关的版本所以我一直没有遇到任何问题。
### 使用 Homebrew 管理软件包
Homebrew 已经成了我必备的命令行工具,由于我很熟悉它,所以在 Linux 上的体验也充满乐趣。Homebrew 让我的工具井井有条,并且时刻保持更新,我愈发欣赏它在实用性与功能上找到的平衡点。我喜欢只保留用户必要的包管理信息,大多数人能够从中受益。如果你对目前的 Linux 包管理起很满意Homebrew 可能会让你觉得很基础,但是你要去深入研究,发掘本文没有提到的高级用法。
对 Linux 用户来说,他们有很多包管理器可以选择。如果你来自 MacOSHomebrew 会让你宾至如归。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/homebrew-linux
作者:[Matthew Broberg][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/nophDog)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop)
[2]: https://brew.sh/
[3]: https://opensource.com/article/19/10/why-switch-mac-linux
[4]: https://opensource.com/article/20/6/homebrew-mac
[5]: https://opensource.com/article/20/4/pyenv
[6]: https://github.com/Homebrew/homebrew-core
[7]: https://github.com/Homebrew/linuxbrew-core
[8]: https://formulae.brew.sh/formula/
[9]: https://opensource.com/article/20/3/github-hub
[10]: https://github.com/tldr-pages/tldr
[11]: https://discourse.brew.sh/t/add-linux-support-to-existing-cask/5766
[12]: https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap
[13]: https://opensource.com/article/19/3/move-your-dotfiles-version-control

View File

@ -0,0 +1,155 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Make Bash history more useful with these tips)
[#]: via: (https://opensource.com/article/20/6/bash-history-control)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
这些技巧让 Bash history 更加有用
======
告诉 Bash 你想要它记住什么,甚至删除不需要的记录重写历史。
![A person programming][1]
运行 [Bash][2] 的 Linux 终端有内置的历史记录,你可以用来跟踪最近的操作。要查看你的 Bash 会话的历史记录,请使用内置命令 `history`
```
$ echo "foo"
foo
$ echo "bar"
bar
$ history
  1  echo "foo"
  2  echo "bar"
  3  history
```
与大多数命令不一样,`history` 命令不是文件系统上的可执行文件,而是 Bash 的功能。你可以使用 `type` 命令来验证:
```
$ type history
history is a shell builtin
```
### 历史控制
shell 历史记录的行数上限由 `HISTSIZE` 变量定义。你可以在 .bashrc 文件中设置此变量。以下将你的历史记录设置为 3,000 行,之后将最早的行删除以为最新命令腾出空间,该命令位于列表的底部:
```
`export HISTSIZE=3000`
```
还有其他与历史相关的变量。 `HISTCONTROL` 变量控制哪些历史被记录。你可以在 `.bashrc` 中写入下面的行来强制 Bash 排除以空格开头的命令:
```
`export HISTCONTROL=$HISTCONTROL:ignorespace`
```
现在,如果你输入以空格开头的命令,那么它将不会记录在历史记录中:
```
$ echo "hello"
$     mysql -u bogus -h badpassword123 mydatabase
$ echo "world"
$ history
  1  echo "hello"
  2  echo "world"
  3  history
```
你也可以避免重复的条目:
```
`export HISTCONTROL=$HISTCONTROL:ignoredups`
```
现在,如果你一个接着一个输入两个命令,历史记录中只会显示一个:
```
$ ls
$ ls
$ ls
$ history
  1  ls
  2  history
```
如果你喜欢这两个忽略,那么可以使用 `ignoreboth`
```
`export HISTCONTROL=$HISTCONTROL:ignoreboth`
```
### 从历史记录中删除命令
有时你会犯一个错误,在 shell 中输入了一些敏感内容,或者你​​只是想清理历史记录,以便它更准确地表示让某件事正常工作所采取的步骤。如果要从 Bash 的历史记录中删除命令,请在要删除的项目的行号上使用 `-d` 选项:
```
$ echo "foo"
foo
$ echo "bar"
bar
$ history | tail
  535  echo "foo"
  536  echo "bar"
  537  history | tail
$ history -d 536
$ history | tail
  535  echo "foo"
  536  history | tail
  537  history -d 536
  538  history | tail
```
要停止添加 `history` 条目,只要在 `HISTCONTROL` 环境变量中有 `ignorespace`,就可以在命令前添加`空格`
```
$  history | tail
  535  echo "foo"
  536  echo "bar"
$  history -d 536
$  history | tail
  535  echo "foo"
```
你可以使用 -c 选项清除所有会话历史记录:
```
$ history -c
$  history
$
```
### history 命令教训
操纵历史通常没有听起来那么危险,尤其是当你有目标地管理它时。例如,如果你要记录一个复杂的问题,通常最好使用会话历史来记录命令,因为通过将命令插入历史记录,你能运行它们并从而测试过程。很多时候,不执行历史命令会导致忽略小的步骤或写错小细节。。
按需使用历史会话,并明智地控制历史记录。享受历史修改吧!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/bash-history-control
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming)
[2]: https://opensource.com/resources/what-bash

View File

@ -0,0 +1,192 @@
[#]: collector: (lujun9972)
[#]: translator: (Yufei-Yan)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Learn Shell Scripting for Free With These Resources [PDF, Video Courses and Interactive Websites])
[#]: via: (https://itsfoss.com/shell-scripting-resources/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
通过这些资源免费学习 Shell 脚本编程——PDF视频课程和互动网站
======
_**那么, 你想学习 shell 脚本编程吗?或者你想提升现有的 bash 知识?我收集了以下免费的资源来帮助你学习 shell 脚本编程。**_
shell 是一个命令行解释器,它允许你输入命令并获得输出。当你在使用终端的时候,你就已经在看 shell 了。
是的shell 是一个你可以和它进行交互的命令行界面,你可以通过它给操作系统某种指令。虽然有不同类型的 shell**[bash][1]**GNU Bourne-Again Shell是在各 Linux 发行版中最流行的。
当谈到 shell 脚本编程的时候,也就意味着——用户希望使用脚本来执行多条命令来获得一个输出。
也许你需要学习 shell 脚本编程作为你的课程或者工作的一部分。了解 shell 脚本编程也可以帮助你在 Linux 中自动化某些重复的任务。
不管出于什么原因学习 shell 脚本编程,都可以看看这些我给你展示的资源。
### 最好的免费学习 shell 脚本编程的资源
![][2]
还没在你的系统上安装 Linux不用担心。有很多种方法[在 Windows 上使用 Linux 终端][3]。你也可以在某些情况下[使用在线 Linux 终端][4]来练习 shell 脚本编程。
#### 1\. 学习 Shell——互动网站
![][5]
如果你正在找一个互动网站来学习 shell 脚本编程并且还可以在线试试Learn Shell 是一个不错的起点。
它涵盖了基础知识,并且也提供了一些高级的练习。通常,内容还是简明扼要的——因此,我建议你看看这个网站。
[Learn Shell][6]
#### 2\. Shell 脚本编程教程——门户网站
![][7]
Shell scripting tutorial 是一个完全专注于 shell 脚本编程的网站。你可以选择免费阅读其中的资源,也可以购买 PDF、实体书籍和电子书来支持他们。
当然,花钱买纸质的版本或者电子书不是强制的。但是,这些免费资源查看起来还是很方便的。
[Shell Scripting Tutorial][8]
#### 3\. Shell 脚本——Udemy免费视频课程
![][9]
毫无疑问,[Udemy][10] 是最受欢迎的在线课程平台之一。而且,除了付费认证课程之外,它还提供了不包含证书的免费内容。
Shell Scripting 是 Udemy 上推荐度最高的免费课程之一。你不需要花费任何费用就可以注册这门课。
[Shell Scripting Udemy][11]
#### 4\. Bash Shell Scripting——Udemy免费视频课程
![][12]
Udemy 上另一个专注于 bash shell 脚本编程的有趣且免费的课程。与前面提到的课程相比,这个资源似乎更受欢迎。所以,你可以注册这门课,看看它都教些什么。
别忘了 Udemy 的免费课程不能提供证书。但是,它确实是一个让人印象深刻的免费 shell 脚本编程学习资源。
#### 5\. Bash Academy——互动游戏在线门户
![][13]
顾名思义Bash Academy 专注于向用户提供 bash shell 的教学。
尽管它没有很多的内容,它还是非常适合初学者和有一定经验的用户。不仅仅局限于指导——它也可以提供交互式的游戏来练习,不过目前已经不能用了。
因此,如果这个足够有趣,你可以去看看这个 [Github 页面][14],并且如果你愿意的话,还可以 fork 它并对现有资源进行改进。
[Bash Academy][15]
#### 6\. Bash Scripting LinkedIn Learning免费视频课程
![][16]
LinkedIn 提供了大量免费课程来帮助你提成技能,并且为更多工作做好准备。你还可以找到一些专注于 shell 脚本编程的课程,这些课程有助于重温基本技能或者这个过程中获得一些高级技能。
在这里,我提供一个 bash 脚本编程的课程链接,你还可以发现其他类似的免费课程。
[Bash Scripting (LinkedIn Learning)][17]
#### 7\. Advanced Bash Scripting Guide (免费 PDF 书籍)
![][18]
这是一个令人印象深刻的高级 bash 脚本编程指南,并且可以获得到它的 PDF 版本。这个 PDF 资源没有版权限制,是完全免费的。
尽管这个资源主要是提供高级的知识,通过参考这个 PDF 并且开始学习 shell 脚本编程,它还是很适合初学者的。
[Advanced Bash Scripting Guide [PDF]][19]
#### 8\. Bash Notes for Professionals免费 PDF 书籍)
![][20]
如果你已经对 Bash Shell 脚本编程比较熟悉或者只是想快速总结一下,那这是一个很好的参考。
这个可以免费下载的书有 100 多页,通过简单的描述和例子,这本书涵盖了各种各样的主题。
[下载 Bash Notes for Professional][21]
#### 9\. Tutorialspoint——门户网站
![][22]
Tutorialspoint 是一个非常流行的学习各种编程语言的门户网站。我想说这对于初学者学习基础知识非常好。
也许这不太适合作为一个详细的资源——但是他应该是不错的免费资源。
[Tutorialspoint][24]
#### 10\. 旧金山城市学院在线笔记——门户网站
![][25]
也许这不是最好的免费资源——但是如果你已经为学习 shell 脚本编程做好了探索每种资源的准备,为什么不看看旧金山城市学院的在线笔记呢?
当我在网上随便搜索关于 shell 脚本编程的资源的时候,我偶然遇到到了这个资源。
同样需要注意的是,在线笔记可能会有点过时。但是,这应该还是一个值得探索的有趣资源。
[旧金山城市学院笔记][26]
#### 荣誉奖: Linux 手册
![][27]
不要忘记bash 手册也应该是一个相当不错的免费资源,可以用它来查看命令和使用方法。
尽管他不是专门为你掌握 shell 脚本编程而量身打造的,它依然是一个你可以免费使用的重要网络资源。你可以选择访问在线手册,或者直接打开终端然后输入以下命令:
```
man bash
```
#### 总结
有很多很受欢迎的付费资源,比如这些[最好的 Linux 书籍][28]。从网络上的一些免费资源开始学习 shell 脚本编程还是很方便的。
除了我提到的这些,我敢肯定网上还有不计其数的资源可以帮助你学习 shell 脚本编程。
你喜欢换上面提到的资源吗?如果你知道我可能错过的非常棒的免费资源,记得在下面评论区告诉我。
--------------------------------------------------------------------------------
via: https://itsfoss.com/shell-scripting-resources/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[Yufei-Yan](https://github.com/Yufei-Yan)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/Bash_(Unix_shell)
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Learn-Shell-Scripting.png?ssl=1
[3]: https://itsfoss.com/run-linux-commands-in-windows/
[4]: https://itsfoss.com/online-linux-terminals/
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/learnshell.png?ssl=1
[6]: https://www.learnshell.org/
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/shell-scripting-tutorial.png?ssl=1
[8]: https://www.shellscript.sh/
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/shell-scripting-udemy.png?ssl=1
[10]: https://www.udemy.com
[11]: https://www.udemy.com/course/shell-scripting-i/
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/bash-shell-scripting.png?ssl=1
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/the-bash-academy.png?ssl=1
[14]: https://github.com/lhunath/guide.bash.academy
[15]: https://guide.bash.academy/
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/learn-bash-scripting-linkedin.png?ssl=1
[17]: https://www.linkedin.com/learning/learning-bash-scripting
[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/advanced-bash-scripting-pdf.png?ssl=1
[19]: http://tldp.org/LDP/abs/abs-guide.pdf
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Bash-Notes-for-Professional.jpg?ssl=1
[21]: https://goalkicker.com/BashBook/
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/tutorialspoint-shell.png?ssl=1
[23]: https://en.wikipedia.org/wiki/Programming_language
[24]: https://www.tutorialspoint.com/unix/shell_scripting.htm
[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/scripting-notes-ccsf.png?ssl=1
[26]: https://fog.ccsf.edu/~gboyd/cs160b/online/index.html
[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/bash-linux-man-page.png?ssl=1
[28]: https://itsfoss.com/best-linux-books/