Merge pull request #2 from LCTT/master

update
This commit is contained in:
阿九 2021-09-07 22:10:19 +08:00 committed by GitHub
commit 2130bbcbe5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
106 changed files with 4041 additions and 1969 deletions

View File

@ -0,0 +1,116 @@
[#]: subject: (Apps for daily needs part 2: office suites)
[#]: via: (https://fedoramagazine.org/apps-for-daily-needs-part-2-office-suites/)
[#]: author: (Arman Arisman https://fedoramagazine.org/author/armanwu/)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13755-1.html)
满足日常需求的应用(二):办公套件
======
![][1]
今天,几乎每个家庭都有一台台式电脑或笔记本电脑。这是因为计算机已经成为一个非常重要的要求。此外,不管是为了工作还是学习,许多人需要创建电子版的文档和演示文稿。因此,办公套件是几乎所有计算机上的必备应用程序。本文将介绍一些你可以在 Fedora Linux 上使用的开源办公套件。这些软件你可能需要安装。如果你不熟悉如何在 Fedora Linux 中添加软件包,请参阅我之前的文章 [安装 Fedora 34 工作站后要做的事情][4]。下面是满足日常需求的办公套件类的应用程序列表。
### LibreOffice
LibreOffice 是 GNU/Linux 用户中最流行的办公套件。它的用户界面和用户体验类似于微软 Office。这使得 LibreOffice 对于那些刚刚从微软 Office 迁移过来的人来说很容易学习。LibreOffice 有完整的功能可以满足你在文档和演示方面的工作需要。它由六个应用程序组成Writer、Calc、Impress、Draw、Math 和 Base。
第一个应用程序是 Writer用于创建各种类型的文档如信件、传真、议程、会议记录等。它是一个全功能的文字处理和桌面出版工具。第二个应用程序是 Calc它是一个电子表格程序非常适合以表格形式呈现数据和记录数据。Calc 可以创建简单的表格或进行专业的数据分析。第三个应用程序是 Impress它是一个易于使用的演示应用程序。你可以很容易地选择你在演示幻灯片中想要的功能如文本、图像、表格、图表等。
![LibreOffice Writer][5]
![LibreOffice Calc][6]
![LibreOffice Impress][7]
前面提到的三个 LibreOffice 应用程序是创建文档和演示文稿中最常用的应用程序。然而LibreOffice 提供的其他三个应用程序也非常有用。第一个是 Draw它可以用来创建从简单到复杂的图纸和图表。下一个应用程序是 Math它可以帮助我们做出完美格式的数学和科学公式。最后一个是 Base这是一个用于处理数据库的应用程序。
![LibreOffice Draw][8]
![LibreOffice Math][9]
![LibreOffice Base][10]
更多信息请见此链接:<https://www.libreoffice.org/>
### ONLYOFFICE
ONLYOFFICE 是一款与微软 Office 高度兼容的办公套件应用程序。因此,我们与使用微软 Office 的同事协作时就不必担心了,因为它可以读取各种文件格式,如 docx、xlsx 和 pptx。
ONLYOFFICE 提供了三种具有简洁和现代外观的应用程序。我们可以很容易地找到我们需要的功能和工具。虽然功能没有 LibreOffice 那么齐全,但也足以帮助我们创建良好的文档和演示文稿。
第一个应用程序是文档编辑器,它的功能与 LibreOffice 的 Writer 相同。它具有文字处理器所需的所有基本功能,如管理字体和样式、格式化文本、调整行距和段距、插入页眉和页脚、自定义页面布局和设置页边距。第二个应用程序是电子表格编辑器,它是一个用于处理数据并将其创建为表格格式的文件的应用程序。它是一个具有与 Calc 相同功能的应用程序。最后一个是演示文稿编辑器,它是一个演示文稿应用程序,其功能类似于 Impress。
不幸的是ONLYOFFICE 在官方的 Fedora Linux 软件库中并没有提供。但是你仍然可以使用 Flatpak 或 Appimages 在 Fedora Linux 上安装它。
![ONLYOFFICE Documents Editor][11]
![ONLYOFFICE Spreadsheets Editor][12]
![ONLYOFFICE Presentations Editor][13]
更多信息请见此链接:<https://www.onlyoffice.com/desktop.aspx>
### Calligra
Calligra 是一个由 KDE 创建的办公套件。因此,这个应用程序实际上更适合于 KDE Plasma 桌面环境的用户。但它仍然可以在其他桌面环境中良好运行,例如使用 GNOME 的 Fedora 工作站。
Calligra 提供的几个应用程序的外观与 LibreOffice 或 ONLYOFFICE 略有不同。对于那些习惯于主流办公套件应用程序的人来说可能需要一些适应。然而Calligra 仍然是一个可靠的办公套件,足以支持我们的日常需求。
第一个应用程序是 Words它是一个具有桌面出版功能的直观的文字处理器。它具有帮助我们进行文档创作的全面功能。第二个应用程序是 Sheets它具有与 Calc 和电子表格编辑器相同的功能,是一个功能齐全的电子表格应用程序。第三个应用程序是 Stage它可以帮助我们制作演示幻灯片。
![Calligra Words][14]
![Calligra Sheets][15]
![Calligra Stage][16]
这三个 Calligra 应用程序是创建文档和演示文稿最常用的应用程序。另外还有三个应用程序也非常有用。第一个是 Karbon它可以用来创建从简单到复杂的图纸和图表。下一个应用程序是 Plan这是一个项目管理应用程序可以帮助管理具有多种资源的中等规模的项目。最后一个是 KEXI它是一个可视化数据库应用程序的创建器。
![Calligra Karbon][17]
![Calligra Plan][18]
![Calligra Kexi][19]
更多信息请见此链接:<https://calligra.org/>
### 总结
这篇文章介绍了 3 个可以在 Fedora Linux 上使用的办公套件,以满足你的日常需要。如果你想拥有具有一套完整功能的办公套件,那么 LibreOffice 可能是正确的选择。如果想与微软 Office 有良好的兼容性,那么你可以选择 ONLYOFFICE。然而如果你想要一个不同的用户界面和创建文档和演示文稿的体验你可以试试 Calligra。希望这篇文章能帮助你选择合适的办公套件。如果你有使用这些应用程序的经验请在评论中分享你的经验。
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/apps-for-daily-needs-part-2-office-suites/
作者:[Arman Arisman][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://fedoramagazine.org/author/armanwu/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-2-Office-816x345.jpg
[2]: https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/meeting-on-cafe-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://fedoramagazine.org/things-to-do-after-installing-fedora-34-workstation/
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-writer-1-1024x575.png
[6]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-calc-1-1024x575.png
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-impress-1-1024x575.png
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-draw-1-1024x575.png
[9]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-math-1-1024x575.png
[10]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-base-1-1024x575.png
[11]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-only-doc-1024x575.png
[12]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-only-sheet-1024x575.png
[13]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-only-presentation-1024x575.png
[14]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-words-1024x575.png
[15]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-sheets-1024x575.png
[16]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-stage-1024x575.png
[17]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-karbon-1-1024x575.png
[18]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-plan-1024x575.png
[19]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-kexi-1024x575.png

View File

@ -0,0 +1,389 @@
[#]: subject: (Analyze the Linux kernel with ftrace)
[#]: via: (https://opensource.com/article/21/7/linux-kernel-ftrace)
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
[#]: collector: (lujun9972)
[#]: translator: (mengxinayan)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13752-1.html)
通过 ftrace 来分析 Linux 内核
======
> 通过 `ftrace` 来了解 Linux 内核内部工作方式是一个好方法。
![](https://img.linux.net.cn/data/attachment/album/202109/05/151954cb5z5rg7zqa9lbzu.jpg)
操作系统的内核是最难以理解的软件之一。自从你的系统启动后,它会一直在后台运行。尽管每个用户都不与内核直接交互,但他们在内核的帮助下完成自己的计算任务。与内核的交互发生在调用系统调用或者用户日常使用的各种库或应用间接调用了系统调用。
在之前的文章里我介绍了如何使用 [strace][6] 来追踪系统调用。然而,使用 `strace` 时你的视野是有限的。它允许你查看特定参数的系统调用。并在工作完成后,看到其返回值或状态,以表明是成功还是失败。但是你无法知道内核在这段时间内发生了什么。除了系统调用外,还有很多其他活动内核中发生,而你却视而不见。
### ftrace 介绍
本文的旨在通过使用一个名为 `ftrace` 的机制来阐明追踪内核函数的一些情况。它使得任何 Linux 用户可以轻松地追踪内核,并且了解更多关于 Linux 内核内部如何工作。
`ftrace` 默认产生的输出往往是巨大的,因为内核总是忙碌的。为了节省空间,很多情况下我会通过截断来给出尽量小的输出。
我使用 Fedora 来演示下面的例子,但是它们应该在其他最新的 Linux 发行版上同样可以运行。
### 启用 ftrace
`ftrace` 现在已经是内核中的一部分了,你不再需要事先安装它了。也就是说,如果你在使用最近的 Linux 系统,那么 `ftrace` 是已经启用了的。为了验证 `ftrace` 是否可用,运行 `mount` 命令并查找 `tracefs`。如果你看到类似下面的输出,表示 `ftrace` 已经启用,你可以轻松地尝试本文中下面的例子。下面有些命令需要在 root 用户下使用(用 `sudo` 执行是不够的)。
```
# mount | grep tracefs
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
```
要想使用 `ftrace`,你首先需要进入上面 `mount` 命令中找到的特定目录中,在那个目录下运行文章中的其他命令。
```
# cd /sys/kernel/tracing
```
### 一般的工作流程
首先,你需要理解捕捉踪迹和获取输出的一般流程。如果你直接运行 `ftrace`,不会运行任何特定的 `ftrace` 命令。相反的,基本操作是通过标准 Linux 命令来写入或读取一些文件。
一般的步骤如下:
1. 通过写入一些特定文件来启用/结束追踪
2. 通过写入一些特定文件来设置/取消追踪时的过滤规则
3. 从文件中读取基于第 1 和 2 步的追踪输出
4. 从文件中清除早期输出或缓冲区
5. 缩小到你的特定用例(你要追踪的内核函数),重复 1、2、3、4 步
### 可用的追踪器类型
有多种不同的追踪器可供使用。之前提到,在运行任何命令前,你需要进入一个特定的目录下,因为需要的文件在这些目录下。我在我的例子中使用了相对路径(而不是绝对路径)。
你可以查看 `available_tracers` 文件内容来查看所有可用的追踪器类型。你可以看下面列出了几个。不需要担心这些:
```
$ pwd
/sys/kernel/tracing
$ sudo cat available_tracers
hwlat blk mmiotrace function_graph wakeup_dl wakeup_rt wakeup function nop
```
在所有输出的追踪器中,我会聚焦于下面三个特殊的:启用追踪的 `function``function_graph`,以及停止追踪的 `nop`
### 确认当前的追踪器
通常情况默认的追踪器设定为 `nop`。即在特殊文件中 `current_tracer` 中的 “无操作”,这意味着追踪目前是关闭的:
```
$ pwd
/sys/kernel/tracing
$ sudo cat current_tracer
nop
```
### 查看追踪输出
在启用任何追踪功能之前,请你看一下保存追踪输出的文件。你可以用 [cat][2] 命令查看名为 `trace` 的文件的内容:
```
# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
```
### 启用 function 追踪器
你可以通过向 `current_tracer` 文件写入 `function` 来启用第一个追踪器 `function`(文件原本内容为 `nop`,意味着追踪是关闭的)。把这个操作看成是启用追踪的一种方式:
```
$ pwd
/sys/kernel/tracing
$ sudo cat current_tracer
nop
$ echo function > current_tracer
$
$ cat current_tracer
function
```
### 查看 function 追踪器的更新追踪输出
现在你已启用追踪,是时候查看输出了。如果你查看 `trace` 文件内容,你将会看到许多被连续写入的内容。我通过管道只展示了文件内容的前 20 行。根据左边输出的标题,你可以看到在某个 CPU 上运行的任务和进程 ID。根据右边输出的内容你可以看到具体的内核函数和其父函数。中间显示了时间戳信息
```
# sudo cat trace | head -20
# tracer: function
#
# entries-in-buffer/entries-written: 409936/4276216 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
<idle>-0 [000] d... 2088.841739: tsc_verify_tsc_adjust <-arch_cpu_idle_enter
<idle>-0 [000] d... 2088.841739: local_touch_nmi <-do_idle
<idle>-0 [000] d... 2088.841740: rcu_nocb_flush_deferred_wakeup <-do_idle
<idle>-0 [000] d... 2088.841740: tick_check_broadcast_expired <-do_idle
<idle>-0 [000] d... 2088.841740: cpuidle_get_cpu_driver <-do_idle
<idle>-0 [000] d... 2088.841740: cpuidle_not_available <-do_idle
<idle>-0 [000] d... 2088.841741: cpuidle_select <-do_idle
<idle>-0 [000] d... 2088.841741: menu_select <-do_idle
<idle>-0 [000] d... 2088.841741: cpuidle_governor_latency_req <-menu_select
```
请记住当追踪打开后,这意味着追踪结果会被一直连续写入直至你关闭追踪。
### 关闭追踪
关闭追踪是简单的。你只需要在 `current_tracer` 文件中用 `nop` 替换 `function` 追踪器即可:
```
$ sudo cat current_tracer
function
$ sudo echo nop > current_tracer
$ sudo cat current_tracer
nop
```
### 启用 function_graph 追踪器
现在尝试第二个名为 `function_graph` 的追踪器。你可以使用和上面相同的步骤:在 `current_tracer` 文件中写入 `function_graph`
```
$ sudo echo function_graph > current_tracer
$ sudo cat current_tracer
function_graph
```
### function_tracer 追踪器的追踪输出
注意到目前 `trace` 文件的输出格式已经发生变化。现在,你可以看到 CPU ID 和内核函数的执行时长。接下来,一个花括号表示一个函数的开始,以及它内部调用了哪些其他函数:
```
# cat trace | head -20
# tracer: function_graph
#
# CPU DURATION FUNCTION CALLS
# | | | | | | |
6) | n_tty_write() {
6) | down_read() {
6) | __cond_resched() {
6) 0.341 us | rcu_all_qs();
6) 1.057 us | }
6) 1.807 us | }
6) 0.402 us | process_echoes();
6) | add_wait_queue() {
6) 0.391 us | _raw_spin_lock_irqsave();
6) 0.359 us | _raw_spin_unlock_irqrestore();
6) 1.757 us | }
6) 0.350 us | tty_hung_up_p();
6) | mutex_lock() {
6) | __cond_resched() {
6) 0.404 us | rcu_all_qs();
6) 1.067 us | }
```
### 启用追踪的设置来增加追踪的深度
你可以使用下面的步骤来调整追踪器以看到更深层次的函数调用。完成之后,你可以查看 `trace` 文件的内容并发现输出变得更加详细了。为了文章的可读性,这个例子的输出被省略了:
```
# cat max_graph_depth
0
# echo 1 > max_graph_depth ## or:
# echo 2 > max_graph_depth
# sudo cat trace
```
### 查找要追踪的函数
上面的步骤足以让你开始追踪。但是它产生的输出内容是巨大的,当你想试图找到自己感兴趣的内容时,往往会很困难。通常你更希望能够只追踪特定的函数,而忽略其他函数。但如果你不知道它们确切的名称,你怎么知道要追踪哪些进程?有一个文件可以帮助你解决这个问题 —— `available_filter_functions` 文件提供了一个可供追踪的函数列表:
```
$ sudo wc -l available_filter_functions  
63165 available_filter_functions
```
### 查找一般的内核函数
现在试着搜索一个你所知道的简单内核函数。用户空间由 `malloc` 函数用来分配内存,而内核由 `kmalloc` 函数,它提供类似的功能。下面是所有与 `kmalloc` 相关的函数:
```
$ sudo grep kmalloc available_filter_functions
debug_kmalloc
mempool_kmalloc
kmalloc_slab
kmalloc_order
kmalloc_order_trace
kmalloc_fix_flags
kmalloc_large_node
__kmalloc
__kmalloc_track_caller
__kmalloc_node
__kmalloc_node_track_caller
[...]
```
### 查找内核模块或者驱动相关函数
`available_filter_functions` 文件的输出中,你可以看到一些以括号内文字结尾的行,例如下面的例子中的 `[kvm_intel]`。这些函数与当前加载的内核模块 `kvm_intel` 有关。你可以运行 `lsmod` 命令来验证:
```
$ sudo grep kvm available_filter_functions | tail
__pi_post_block [kvm_intel]
vmx_vcpu_pi_load [kvm_intel]
vmx_vcpu_pi_put [kvm_intel]
pi_pre_block [kvm_intel]
pi_post_block [kvm_intel]
pi_wakeup_handler [kvm_intel]
pi_has_pending_interrupt [kvm_intel]
pi_update_irte [kvm_intel]
vmx_dump_dtsel [kvm_intel]
vmx_dump_sel [kvm_intel]
$ lsmod  | grep -i kvm
kvm_intel             335872  0
kvm                   987136  1 kvm_intel
irqbypass              16384  1 kvm
```
### 仅追踪特定的函数
为了实现对特定函数或模式的追踪,你可以利用 `set_ftrace_filter` 文件来指定你要追踪上述输出中的哪些函数。这个文件也接受 `*` 模式,它可以扩展到包括具有给定模式的其他函数。作为一个例子,我在我的机器上使用 ext4 文件系统。我可以用下面的命令指定 ext4 的特定内核函数来追踪:
```
# mount | grep home
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel)
# pwd
/sys/kernel/tracing
# cat set_ftrace_filter
#### all functions enabled ####
$
$ echo ext4_* > set_ftrace_filter
$
$ cat set_ftrace_filter
ext4_has_free_clusters
ext4_validate_block_bitmap
ext4_get_group_number
ext4_get_group_no_and_offset
ext4_get_group_desc
[...]
```
现在当你可以看到追踪输出时,你只能看到与内核函数有关的 `ext4` 函数,而你之前已经为其设置了一个过滤器。所有其他的输出都被忽略了:
```
# cat trace |head -20
## tracer: function
#
# entries-in-buffer/entries-written: 3871/3871 #P:8
#
# _-----=> irqs-off
# / _----=> need-resched
# | / _---=> hardirq/softirq
# || / _--=> preempt-depth
# ||| / delay
# TASK-PID CPU# |||| TIMESTAMP FUNCTION
# | | | |||| | |
cupsd-1066 [004] .... 3308.989545: ext4_file_getattr <-vfs_fstat
cupsd-1066 [004] .... 3308.989547: ext4_getattr <-ext4_file_getattr
cupsd-1066 [004] .... 3308.989552: ext4_file_getattr <-vfs_fstat
cupsd-1066 [004] .... 3308.989553: ext4_getattr <-ext4_file_getattr
cupsd-1066 [004] .... 3308.990097: ext4_file_open <-do_dentry_open
cupsd-1066 [004] .... 3308.990111: ext4_file_getattr <-vfs_fstat
cupsd-1066 [004] .... 3308.990111: ext4_getattr <-ext4_file_getattr
cupsd-1066 [004] .... 3308.990122: ext4_llseek <-ksys_lseek
cupsd-1066 [004] .... 3308.990130: ext4_file_read_iter <-new_sync_read
```
### 排除要被追踪的函数
你并不总是知道你想追踪什么,但是,你肯定知道你不想追踪什么。因此,有一个 `set_ftrace_notrace` —— 请注意其中的 “no”。你可以在这个文件中写下你想要的模式并启用追踪。这样除了所提到的模式外任何其他东西都会被追踪到。这通常有助于删除那些使我们的输出变得混乱的普通功能
```
$ sudo cat set_ftrace_notrace
#### no functions disabled ####
```
### 具有目标性的追踪
到目前为止,你一直在追踪内核中发生的一切。但是,它无法帮助你追踪与某个特定命令有关的事件。为了达到这个目的,你可以按需打开和关闭跟踪,并且在它们之间,运行我们选择的命令,这样你就不会在跟踪输出中得到额外的输出。你可以通过向 `tracing_on` 写入 `1` 来启用跟踪,写 `0` 来关闭跟踪。
```
# cat tracing_on
0
# echo 1 > tracing_on
# cat tracing_on
1
### Run some specific command that we wish to trace here ###
# echo 0 > tracing_on
# cat tracing_on
0
```
### 追踪特定的 PID
如果你想追踪与正在运行的特定进程有关的活动,你可以将该 PID 写入一个名为 `set_ftrace_pid` 的文件,然后启用追踪。这样一来,追踪就只限于这个 PID这在某些情况下是非常有帮助的。
```
$ sudo echo $PID > set_ftrace_pid
```
### 总结
`ftrace` 是一个了解 Linux 内核内部工作的很好方式。通过一些练习,你可以学会对 `ftrace` 进行调整以缩小搜索范围。要想更详细地了解 `ftrace` 和它的高级用法,请看 `ftrace` 的核心作者 Steven Rostedt 写的这些优秀文章。
* [调试 Linux 内核,第一部分][3]
* [调试 Linux 内核,第二部分][4]
* [调试 Linux 内核,第三部分][5]
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/7/linux-kernel-ftrace
作者:[Gaurav Kamathe][a]
选题:[lujun9972][b]
译者:[萌新阿岩](https://github.com/mengxinayan)
校对:[wxy](https://github.com/wxy)
本文由 [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/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
[2]: https://opensource.com/article/19/2/getting-started-cat-command
[3]: https://lwn.net/Articles/365835/
[4]: https://lwn.net/Articles/366796/
[5]: https://lwn.net/Articles/370423/
[6]: https://linux.cn/article-11545-1.html

View File

@ -0,0 +1,79 @@
[#]: subject: "Apps for daily needs part 3: image editors"
[#]: via: "https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/"
[#]: author: "Arman Arisman https://fedoramagazine.org/author/armanwu/"
[#]: collector: "lujun9972"
[#]: translator: "wxy"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13761-1.html"
满足日常需求的应用(三):图像编辑器
======
![][1]
图像编辑器是许多人喜欢和需要的应用程序,从专业的设计师、学生,或那些有某些爱好的人。特别是在这个数字时代,越来越多的人因为各种原因需要图像编辑器。本文将介绍一些你可以在 Fedora Linux 上使用的开源图像编辑器。你可能需要安装提到的软件。如果你不熟悉如何在 Fedora Linux 中添加软件包,请参阅我之前的文章 [安装 Fedora 34 工作站后要做的事情][4]。这里列出了图像编辑器类的一些日常需求的应用程序。
### GIMP
GIMP<ruby>GNU 图像处理程序<rt>GNU Image Manipulation Program</rt></ruby>)是一个光栅图像(位图)编辑器,用于照片修饰、图像合成和图像创作。它的功能几乎与 Adobe Photoshop 相同。你可以用 GIMP 做很多你可以用 Photoshop 做的事情。正因为如此GIMP 作为 Adobe Photoshop 的开源替代品,已经成为最受欢迎的应用程序。
GIMP 有很多图像处理的功能,特别是针对光栅图像。你可以用 GIMP 修复或改变照片的颜色。你可以选择图像的一部分裁剪它然后与图像的其他部分合并。GIMP 还有许多你可以应用于你的图像的效果,包括模糊、阴影、噪音等等。许多人用 GIMP 来修复损坏的照片,提高图像质量,裁剪图像中不需要的部分,制作海报和各种图形设计作品,等等。此外,你还可以在 GIMP 中添加插件和脚本,使其功能更加全面。
![][5]
更多信息请见此链接: <https://www.gimp.org/>
### Inkscape
Inkscape 是一个流行的开源应用程序,用于创建和编辑矢量图。它是一个功能丰富的矢量图形编辑器,这使它可以与其他类似的专有应用程序(如 Adobe Illustrator 和 Corel Draw相竞争。正因为如此许多专业插画师使用它来创建基于矢量的艺术作品。
你可以用 Inkscape 制作艺术和技术插图如标志、图表、图标、桌面壁纸、流程图、漫画等等。此外Inkscape 可以处理各种图形文件格式。此外,你还可以添加附加组件,使你的工作更容易。
![][6]
更多信息请见此链接: <https://inkscape.org/>
### Krita
Krita 乍一看像 GIMP 或 Inkscape。但实际上它是一个完全不同的应用程序尽管它有一些类似的功能。Krita 是一款用于创作像艺术家那样的数字绘画的应用程序。你可以用 Krita 来制作概念艺术、插图、漫画、纹理和哑光画。
Krita 有 100 多个预装的专业画笔。它还有一个画笔稳定器功能,有 3 种不同的方式来平滑和稳定你的画笔笔触。此外,你可以用 9 种以上的独特画笔引擎来定制你的画笔。Krita 是那些喜欢进行数字绘画的人的合适应用。
![][7]
更多信息可在此链接获得:<https://krita.org/en/>
### darktable
darktable 是摄影师或那些想提高照片质量的人的完美选择。darktable 更侧重于图像编辑,特别是对 RAW 图像的非破坏性后期制作。因此,它提供专业的色彩管理,支持自动检测显示配置文件。此外,你还可以用 darktable 过滤和排序多张图片。所以你可以通过标签、评级、颜色标签等来搜索你的收藏。它可以导入各种图像格式,如 JPEG、CR2、NEF、HDR、PFM、RAF 等。
![][8]
更多信息可在此链接中获得:<https://www.darktable.org/>
### 总结
这篇文章介绍了四个图像编辑器,你可以在 Fedora Linux 上使用它们满足你日常需求。每个应用程序都代表了图像编辑器应用程序的一个子类别。实际上,还有许多其他的图像编辑器可以在 Fedora Linux 上使用。你也可以使用 RawTherapee 或 Photivo 作为 dartkable 替代品。此外,还有 Pinta 作为 GIMP 的替代品,以及 MyPaint 作为 Krita 的替代品。希望这篇文章能帮助你选择正确的图像编辑器。如果你有使用这些应用程序的经验,请在评论中分享你的经验。
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/
作者:[Arman Arisman][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://fedoramagazine.org/author/armanwu/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-3-Graphics-816x345.jpg
[2]: https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/meeting-on-cafe-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://fedoramagazine.org/things-to-do-after-installing-fedora-34-workstation/
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-gimp-1024x576.png
[6]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-inkscape-1024x575.png
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-krita-1024x592.png
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-darktable-1024x583.png

View File

@ -3,32 +3,34 @@
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: "perfiffer"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13746-1.html"
Debian 和 Ubuntu有什么不同应该选择哪一个
======
在 Debian 和 Ubuntu 系统中,你都可以 [使用 apt-get 命令][1] 来管理应用。你也可以在这两个发型版中安装 DEB 安装包。很多时候,你会在这两个发行版中发现同样的包安装介绍。
![](https://img.linux.net.cn/data/attachment/album/202109/02/230706mpahrwpwjjm2jkpu.jpg)
在 Debian 和 Ubuntu 系统中,你都可以 [使用 apt-get 命令][1] 来管理应用。你也可以在这两个发行版中安装 DEB 安装包。很多时候,你会在这两个发行版中发现同样的包安装命令。
它们两者是如此的相似,那么,它们两者之间有什么区别呢?
Debian 和 Ubuntu 属于同一系列的发行版。Debain 是由Ian Murdock 在 1993 年创建的最初的发行版。Ubuntu 是 Mark Shuttleworth 在 2004 年基于 Debian 创建的发行版。
Debian 和 Ubuntu 属于同一系列的发行版。Debian 是由 Ian Murdock 在 1993 年创建的最初的发行版。Ubuntu 是 Mark Shuttleworth 在 2004 年基于 Debian 创建的发行版。
### Ubuntu 基于 Debian这意味着什么
Linux 发行版虽然有数百个,但其中只有少数是从零开始的独立发行版。 [Debian][2]ArchRed Hat 是其中几个不派生于其它发行版的使用最广的发行版。
Linux 发行版虽然有数百个,但其中只有少数是从零开始的独立发行版。 [Debian][2]、Arch、Red Hat 是其中几个不派生于其它发行版的使用最广的发行版。
Ubuntu 源自 Debian。这意味着 Ubuntu 使用与 Debian 相同的 `APT` 包管理系统,并共享 Debian 库中的大量包和库。它建立在 Debian 基础架构上。
Ubuntu 源自 Debian。这意味着 Ubuntu 使用与 Debian 相同的 APT 包管理系统,并共享来自 Debian 库中的大量包和库。它建立在 Debian 基础架构上。
![Ubuntu uses Debian as base][3]
这就是大多数“衍生”发行版所做的。它们使用相同的包管理器,并将包共享为基本发行版。但他们也做了一些改变,添加了一些自己的包。这就是 Ubuntu 和 Debian 的不同之处,尽管它是从 Debian 衍生而来的。
这就是大多数“衍生”发行版所做的。它们使用相同的包管理器,并与基础发行版共享包。但它们也做了一些改变,添加了一些自己的包。这就是 Ubuntu 和 Debian 的不同之处,尽管它是从 Debian 衍生而来的。
### Ubuntu 和 Debian 的不同之处
因此Ubuntu 构建在 Debian 架构和基础设施上,也与 Debian 一样是用 `.DEB` 格式的软件包。
因此Ubuntu 构建在 Debian 架构和基础设施上,也与 Debian 一样是用 .DEB 格式的软件包。
这意味着使用 Ubuntu 和使用 Debian 是一样的吗?并不完全如此。有很多因素可以用来区分两个不同的发行版。
@ -36,23 +38,23 @@ Ubuntu 源自 Debian。这意味着 Ubuntu 使用与 Debian 相同的 `APT` 包
![][4]
#### 1\. 发布周期
#### 1发布周期
Ubuntu 有两种发布版本LTS 和 regular。[Ubuntu LTS (长期支持) 版本][5] 每两年发布一次,并且会提供五年的支持。你可以选择升级到下一个可用的 LTS 版本。LTS 版本更稳定。
Ubuntu 有两种发布版本LTS(长期支持)和常规版本。[Ubuntu LTS 版本][5] 每两年发布一次,并且会提供五年的支持。你可以选择升级到下一个可用的 LTS 版本。LTS 版本被认为更稳定。
还有一个非 LTS 版本,每六个月发布一次。这些版本仅仅提供九个月的支持,但是它们会有一些新的软件版本和功能。当当前的版本已经不在维护了,你必须升级到下一个 Ubuntu 版本。
还有一个非 LTS 版本,每六个月发布一次。这些版本仅仅提供九个月的支持,但是它们会有一些新的软件版本和功能。在当前的版本到达维护年限时,你应当升级到下一个 Ubuntu 版本。
所以基本上,你可以根据这些版本在稳定性和新特性之间进行选择。
另一方面Debian 有三个不同的版本:稳定版、测试版和非稳定版 。非稳定版是为了实际测试,应该避免使用。
另一方面Debian 有三个不同的版本:稳定版、测试版和非稳定版。非稳定版是为了实际测试,应该避免使用。
测试版并不是非稳定版。它是用来为下一个稳定版做准备。有一些 Debian 用户更倾向于使用测试版来获取新的特性。
测试版不是那么不稳定。它是用来为下一个稳定版做准备。有一些 Debian 用户更倾向于使用测试版来获取新的特性。
然后是稳定版。这是 Debian 的主要版本。Debian 稳定版可能没有最新的软件和功能,但在稳定性方面毋庸置疑。
每两年 Debian 会发布一个稳定版,并且会提供三年的支持。此后,你必须升级到下一个可用的稳定版。
每两年 Debian 会发布一个稳定版,并且会提供三年的支持。此后,你应当升级到下一个可用的稳定版。
#### 2\. 软件更新
#### 2软件更新
![][6]
@ -62,33 +64,33 @@ Debian 更关注稳定性,这意味着它并不总是使用最新版本的软
Ubuntu LTS 版本也关注稳定性。但是它们通常拥有较新版本的常见软件。
你应该注意,对于某些软件,从开发人员仓库安装也是一种选择。例如,如果你想要安装最新版的 Docker你可以在 Debian 和 Ubuntu 中添加 Docker 仓库。
你应该注意,对于某些软件,从开发者的仓库安装也是一种选择。例如,如果你想要安装最新版的 Docker你可以在 Debian 和 Ubuntu 中添加 Docker 仓库。
总体来说,相比较于 Ubuntu Debian 稳定版的软件版本会更旧。
#### 3\. 软件可用性
#### 3软件可用性
Debian 和 Ubuntu 都拥有一个巨大的软件仓库。然而,[Ubuntu 同时有PPA][7]<ruby>Personal Package Archive<ruby>。通过 `PPA`,安装更新版本的软件或者获取最新版本的软件都将会变的更容易。
Debian 和 Ubuntu 都拥有一个巨大的软件仓库。然而,[Ubuntu 还有 PPA][7]<ruby>个人软件包存档<rt>Personal Package Archive</rt></ruby>)。通过 PPA,安装更新版本的软件或者获取最新版本的软件都将会变的更容易。
![][8]
你可以在 Debian 中尝试使用 PPA但是体验并不好。大多数时候你都会遇到问题。
#### 4\. 支持的平台
#### 4支持的平台
Ubuntu 可以在 64 位的 x86 和 ARM 平台上使用。它不再提供 32 位的镜像。
另一方面Debian 支持 32 位和 64 位架构。除此之外Debian 还支持 64 位 ARMarm64、ARM EABIarmel、ARMv7EABI hard-float ABIarmhflittle-endian MIPSmipsel、64 位 little-endian MIPSmips64el、64 位 little-endian PowerPCppc64el 和 IBM System zs390x
另一方面Debian 支持 32 位和 64 位架构。除此之外Debian 还支持 64 位 ARMarm64、ARM EABIarmel、ARMv7EABI hard-float ABIarmhf小端 MIPSmipsel、64 位小端 MIPSmips64el、64 位小端 PowerPCppc64el 和 IBM System zs390x
所以它也被称为 “通用操作系统”。
所以它也被称为 “<ruby>通用操作系统<rt>universal operating system</rt></ruby>”。
#### 5\. 安装
#### 5安装
[安装 Ubuntu][9] 比安装 Debian 容易得多。我并不是在骗你。即使对于中级 Linux 用户Debian 也可能令人困惑。
[安装 Ubuntu][9] 比安装 Debian 容易得多。我并不是在开玩笑。即使对于有经验的 Linux 用户Debian 也可能令人困惑。
当你下载 Debian 的时候,它默认提供的是最小化镜像。 此镜像没有非免费(非开源)固件。如果你继续安装它,你就可能会发现你的网络适配器和其它硬件将无法识别。
当你下载 Debian 的时候,它默认提供的是最小化镜像。此镜像没有非自由(非开源)的固件。如果你继续安装它,你就可能会发现你的网络适配器和其它硬件将无法识别。
有一个单独的非免费镜像包含固件,但它是隐藏的,如果你不知道,你可能会大吃一惊。
有一个单独的包含固件的非自由镜像,但它是隐藏的,如果你不知道,你可能会大吃一惊。
![Getting non-free firmware is a pain in Debian][10]
@ -98,57 +100,57 @@ Ubuntu 在默认提供的镜像中包含专有驱动程序和固件时要宽容
![Installing Ubuntu is smoother][11]
#### 6\. 开箱即用的硬件支持
#### 6开箱即用的硬件支持
就像之前提到的Debian 主要关注 [FOSS][12](自由和开源软件)。这意味着 Debian 提供的内核不包括专有驱动程序和固件。
这并不是说你无法使其工作,而是你必须添加/启动其它存储库并手动安装。这可能令人沮丧,特别是对于初学者来说。
这并不是说你无法使其工作,而是你必须添加/启动额外的存储库并手动安装。这可能令人沮丧,特别是对于初学者来说。
Ubuntu 并不完美,但在提供开箱即用的驱动程序和固件方面,它比 Debian 好得多。这意味着更少的麻烦和更完整的开箱即用体验。
#### 7\. 桌面环境选择
#### 7桌面环境选择
Ubuntu 默认使用定制的 GNOME 桌面环境。你可以在其上安装其它桌面环境,或者选择各种基于桌面的 Ubuntu 风格,如 Kubuntu使用 KDE 桌面),Xubuntu使用 Xfce 桌面)等。
Ubuntu 默认使用定制的 GNOME 桌面环境。你可以在其上安装 [其它桌面环境][13],或者选择 [各种不同桌面风格的 Ubuntu][14],如 Kubuntu使用 KDE 桌面)、Xubuntu使用 Xfce 桌面)等。
Debian 也默认使用的 GNOME 桌面。但是它会让你在安装的过程中选择你要安装的桌面环境。
Debian 也默认安装了 GNOME 桌面。但是它会让你在安装的过程中选择你要安装的桌面环境。
![][15]
你还可以从其网站获取[DE 特定的 ISO 镜像][16]。
你还可以从其网站获取 [特定桌面环境的 ISO 镜像][16]。
#### 8\. 游戏性
#### 8游戏性
由于 Stream 及其 Proton 项目Linux 上的游戏总体上有所改善。尽管如此,游戏在很大程度上取决于硬件。
在硬件兼容性上Ubuntu 比 Debian 更好的支持专有驱动程序
在硬件兼容性上Ubuntu 比 Debian 在支持专有驱动程序方面要好
并不是说它在 Debian 中不能完成,而是需要一些时间和精力来实现。
并不是说在 Debian 中不能做到这一点,而是需要一些时间和精力来实现。
#### 9\. 性能
#### 9性能
性能部分没有明显的“赢家”,无论是在服务器版本还是在桌面版本。 Debian 和 Ubuntu 作为桌面和服务器操作系统都很受欢迎。
性能取决于你系统的硬件和你所使用的软件组件。你可以在你的操作系统中调整和控制你的系统。
#### 10\. 社区和支持
#### 10社区和支持
Debian 是社区项目。此项目的一切都由其社区成员管理。
Debian 是一个真正的社区项目。此项目的一切都由其社区成员管理。
Ubuntu 由 [Canonical][17] 提供支持。然而,它并不是一个真正意义上的企业项目。它确实有一个社区,但任何事情的最终决定权都掌握在 Canonical 手中。
就支持而言Ubuntu 和 Debian 都有专门的论坛,用户可以在其中寻求帮助和提出建议。
Canonical 还为其企业客户提供收费的专业支持。 Debian 没有这样的功能。
Canonical 还为其企业客户提供收费的专业支持。Debian 没有这样的功能。
### 结论
Debian 和 Ubuntu 都是桌面或服务器操作系统的可靠选择。 apt 包管理器和 DEB 包对两者都是通用的,因此提供了一些相似的体验。
Debian 和 Ubuntu 都是桌面或服务器操作系统的可靠选择。 APT 包管理器和 DEB 包对两者都是通用的,因此提供了一些相似的体验。
然而Debian 仍然需要一定程度的专业知识,特别是在桌面方面。如果你是 Linux 新手,坚持使用 Ubuntu 将是你更好的选择。在我看来,你应该获得一些经验,熟悉 Linux然后尝试使用 Debian。
然而Debian 仍然需要一定程度的专业知识,特别是在桌面方面。如果你是 Linux 新手,坚持使用 Ubuntu 将是你更好的选择。在我看来,你应该积累一些经验,熟悉了一般的 Linux然后再尝试使用 Debian。
并不是说你不能从一开始就使用 Debian但对于 Linux 初学者来说,这并不是一种很好的体验。
**欢迎你对这场 Debian 与 Ubuntu 辩论发表意见。**
欢迎你对这场 Debian 与 Ubuntu 辩论发表意见。
--------------------------------------------------------------------------------
@ -157,7 +159,7 @@ via: https://itsfoss.com/debian-vs-ubuntu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[perfiffer](https://github.com/perfiffer)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -3,38 +3,40 @@
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13753-1.html"
如何使用 youtube-dl 只下载音频
======
![](https://img.linux.net.cn/data/attachment/album/202109/05/153110dkamc1kv0173ggc3.jpg)
[youtube-dl][1] 是一个多功能的命令行工具,用于从 YouTube 和许多其他网站下载视频。我用它来做我自己的 YouTube 视频的备份。
默认情况下,你[使用 youtube-dl 下载视频][2]。用 youtube-dl 只提取音频怎么样? 其实很简单。让我告诉你步骤。
默认情况下,你[使用 youtube-dl 下载视频][2]。用 youtube-dl 只提取音频怎么样? 其实很简单。让我告诉你步骤。
注意
从网站下载视频可能违反他们的政策。这取决于你是否选择下载视频或音频。
> **注意**
>
> 从网站下载视频可能违反他们的政策。这取决于你是否选择下载视频或音频。
### 使用 youtube-dl 只下载音频
请确保你已经在你的 Linux 发行版上安装了 youtube-dl。
请确保你已经在你的 Linux 发行版上安装了 `youtube-dl`
```
sudo snap install youtube-dl
```
如果你只想从 YouTube 视频中下载音频,你可以使用 youtube-dl 的 -x 选项。这个提取音频的选项将视频文件转换为纯音频文件。
如果你只想从 YouTube 视频中下载音频,你可以使用 `youtube-dl``-x` 选项。这个提取音频的选项将视频文件转换为纯音频文件。
```
youtube-dl -x video_URL
```
该文件被保存在你运行 youtube-dl 命令的同一目录下。
该文件被保存在你运行 `youtube-dl` 命令的同一目录下。
这是我下载 Zorin OS 16 评论视频的画外音的示例
这是我下载 Zorin OS 16 评论视频的画外音的示例
```
youtube-dl -x https://www.youtube.com/watch?v=m_PmLG7HqbQ
@ -53,7 +55,7 @@ youtube-dl -x https://www.youtube.com/watch?v=m_PmLG7HqbQ
youtube-dl -x --audio-format mp3 video_URL
```
下面是我之前展示的同一个例子。你可以看到它[使用 ffmpeg 转换][3] m4a 文件为 mp3
下面是我之前展示的同一个例子。你可以看到它 [使用 ffmpeg 转换][3] m4a 文件为 mp3
```
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=m_PmLG7HqbQ
@ -87,11 +89,11 @@ https://www.youtube.com/playlist?list=XXXXXXXXXXXXXXXXXXX
youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" playlist_URL
```
那个看起来很可怕的 `-o "%(title)s.%(ext)s"` 指定了输出文件(选项 -o并指示它使用视频的标题和扩展名本例为 mp3来命名音频文件。
那个看起来很可怕的 `-o "%(title)s.%(ext)s"` 指定了输出文件(选项 `-o`),并指示它使用视频的标题和扩展名(本例为 mp3来命名音频文件。
![][6]
我希望你觉得这个技巧对你有帮助。享受音频文件吧 :)
我希望你觉得这个技巧对你有帮助。享受音频文件吧
--------------------------------------------------------------------------------
@ -100,7 +102,7 @@ via: https://itsfoss.com/youtube-dl-audio-only/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -2,96 +2,93 @@
[#]: via: "https://www.debugpoint.com/2021/08/10-things-to-do-after-install-elementary-os-6/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lujun9972"
[#]: translator: " anine09"
[#]: reviewer: " "
[#]: publisher: " "
[#]: translator: "anine09"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13749-1.html"
[#]: url: " "
安装elementary OS 6 “Odin”后要做的 10 件事
安装 elementary OS 6 “Odin” 后要做的 10 件事
======
一个关于安装 elementary OS 6 “Odin” 后要做的事情的列表。
> 一个精心准备的在安装 elementary OS 6 “Odin” 后要做的事情的列表。
在经过两年多的开发后 [elementary OS 6 “Odin”][1] 于不久前发布,此次版本更新在核心模块、 Pantheon 桌面、本地应用中引入了一系列变化巨大的新特性elementary OS 6 “Odin” 基于 Ubuntu 20.04 LTS。
![](https://img.linux.net.cn/data/attachment/album/202109/04/081345bf9co7ot40szdytg.jpg)
也就是说,如果你完成了安装,你可能想要尝试通过一些特定的设置来使你的系统更加的个性化。这里描述的选项是通用的,在某些情况下可能对你无效,但是我们觉得有必要列出一些基础知识,让你有合适的方式来探索这个漂亮的 elementary OS。
在经过两年多的开发后 [elementary OS 6 “Odin”][1] 于不久前发布,此次版本更新在核心模块、 Pantheon 桌面、原生应用方面带来了一大批新特性。elementary OS 6 “Odin” 是基于 Ubuntu 20.04 LTS 的。
如果你完成了安装,你可能想要尝试通过一些特定的设置来使你的系统更加的个性化。这里描述的选项是通用的,在某些情况下可能对你没有用,但是我们觉得有必要列出一些基本的东西,让你有合适的方式来探索这个漂亮的 elementary OS。
### 安装完 elementary OS 6 “Odin” 后要做的事情
***准备步骤***
准备步骤:
首先确保你已经连上了互联网,你可以在顶部的通知区域查看可用的网络列表
#### 1\. 更改 hostname
#### 1、更改主机名
这可能不是你想做的第一件事。但是我不知道为什么在安装过程中没有给出更改 hostname 的选项。例如,见下图的终端提示, 这个 hostname 是 elementary OS 的默认硬件配置。在我看来这一点都不好。
这可能不是你想做的第一件事。但是我不知道为什么在安装过程中没有给出更改主机名的选项。例如,见下图的终端提示, 这个主机名是 elementary OS 的默认硬件配置。在我看来这一点都不好。
![hostname 修改之前][2]
![主机名修改之前][2]
打开终端并运行下列命令以更改 hostname
打开终端并运行下列命令以更改主机名:
```bash
```
hostnamectl set-hostname your-new-hostname
```
示例:
![修改 hostname][3]
![修改主机名][3]
![hostname 修改之后][4]
![主机名修改之后][4]
#### 2\. 升级你的系统
#### 2升级你的系统
在安装任何 Linux 发行版后,你应该做的第一件事就是确保系统处于最新的软件包和安全更新状态。
你可以通过打开应用中心来检查或者安装更新。
或者打开终端运行下列命令
或者打开终端运行下列命令
```bash
```
sudo apt update
sudo apt upgrade
```
#### 3\. 安装 Pantheon Tweaks
#### 3安装 Pantheon Tweaks
Pantheon Tweaks 是 elementary OS 的必备应用。它提供了一些无法通过系统原生设置程序修改的额外的设置和配置选项,请打开终端并运行以下命令以安装 Pantheon Tweaks。注意先前版本的 Tweak 工具叫做 elementary Tweaks从 Odin 版本开始更名为 Pantheon Tweaks。
```bash
```
sudo apt install software-properties-common
sudo add-apt-repository -y ppa:philip.scott/pantheon-tweaks
sudo apt install -y pantheon-tweaks
```
安装后打开系统设置,你可以在那里找到 Tweaks 选项。
安装后打开系统设置,你可以在那里找到 <ruby>调整<rt>Tweaks</rt></ruby> 选项。
[这里][5] 提供了更详细的安装指南(如果你需要了解更多信息)
[这里][5] 提供了更详细的安装指南(如果你需要了解更多信息)
### 4. 配置 Dock
Dock 是整个桌面的中心。老实说Dock 中默认包含的应用并不常用,因此你是可以通过以下步骤配置 Dock 中的项目的。
* 移除:右键单击并取消 **在 Dock 中驻留** 选项。
* 添加新的项目:单击顶部的应用程序。然后右键单击你想要放在 Dock 的应用图标。选择 **添加到 Dock**。
### 4、配置 Dock
Dock 是整个桌面的中心。老实说Dock 中默认包含的应用并不常用,因此你可以通过以下步骤配置 Dock 中的项目。
* 移除:右键单击并取消 “<ruby>在 Dock 中驻留<rt>Keep in Dock</rt></ruby>” 选项。
* 添加新的项目:单击顶部的应用程序。然后右键单击你想要放在 Dock 的应用图标。选择 “<ruby>添加到 Dock<rt>Add to Dock</rt></ruby>”。
在我看来你应该至少把文件管理、截图工具、Firefox 、计算器,以及其他的一些应用添加到 Dock。然后移除 Dock 上那些你不需要的应用。
#### 5\. 更改外观
#### 5更改外观
elementary OS 6 Odin 改进了桌面的整体外观,为整个桌面和应用程序提供了自带的强调色和原生的夜间模式,同时,系统自带了许多漂亮的壁纸。你可以通过 **应用 > 系统设置 > 桌面** 来定制壁纸、外观、面板和多任务视图。
elementary OS 6 Odin 改进了桌面的整体外观,为整个桌面和应用程序提供了自带的强调色和原生的夜间模式,同时,系统自带了许多漂亮的壁纸。你可以通过 “应用 > 系统设置 > 桌面” 来定制壁纸、外观、面板和多任务视图。
![elementary OS 6 Odin 桌面设置界面][6]
按照你希望的样子来配置你系统的外观
参见:[elementary OS 6 Odin Promises Complete Dark Style](https://www.debugpoint.com/2020/11/elementary-os-6-odin-dark-style/)
按照你希望的样子来配置你系统的外观。
你也可以基于日出和日落的时间来设置夜间模式。
#### 6\. 安装其他的应用
#### 6安装其他的应用
自带的应用中心非常适合这个系统,我发现它是 Linux 桌面最好的应用商店之一。然而,有时候需要安装没有预装的必要应用(大多数是知名的应用)。下面是个新系统推荐安装的软件列表。(说真的,为什么 LibreOffice 没有预装?)
@ -102,66 +99,54 @@ elementary OS 6 Odin 改进了桌面的整体外观,为整个桌面和应用
* obs-studio
* libreoffice
#### 7、一些针对笔记本电脑的省电贴士
有许多方法可以配置你的 elementary OS或者一般的 Linux 桌面),以达到延长电池寿命的目的。记住,电池寿命取决于你的笔记本硬件,以及电池和笔记本的使用年限。所以,遵循下面的一些建议,最大限度的利用你的笔记本电池。
#### 7\. 一些针对笔记本电脑的省电贴士
* 安装 [tlp][8]。`tlp` 是一个简单易用的命令行程序,用来帮你在 Linux 上延长电池寿命。你只需要安装它,默认情况下,它会处理好其他的设置。安装命令:
有许多方法可以配置你的 elementary OS (或者一般的 Linux 桌面),以达到延长电池寿命的目的。记住,电池寿命取决于你的笔记本硬件,以及电池和笔记本的使用年限。所以,遵循下面的一些建议,最大限度的利用你的笔记本电池。
* 安装 [tlp][8]. tlp 是一个简单易用的命令行程序,用来帮你在 Linux 上延长电池寿命。你只需要安装它,默认情况下,它会处理好其他的设置。安装命令:
```
sudo add-apt-repository ppa:linrunner/tlp
sudo apt update
sudo apt-get install tlp
sudo tlp start
```
```
sudo add-apt-repository ppa:linrunner/tlp
sudo apt update
sudo apt-get install tlp
sudo tlp start
```
* 关闭蓝牙,默认情况下,蓝牙是开启状态。在需要的时候再启动它。
* 通过下面的命令安装 thermald。这个实用程序实际是个守护进程控制着你的 CPU 的 P-States 和 T-States 的温度以及 CPU 发热。
* 通过下面的命令安装 `thermald`。这个实用程序(实际是个守护进程)控制着你的 CPU 的 P-States 和 T-States 的温度以及 CPU 发热。
```
sudo apt install thermald
```
```
sudo apt install thermald
```
* 根据你的需要将亮度调到最小。
#### 8\. 安装磁盘实用程序
#### 8、安装磁盘实用程序
在很多情况下,你发现你需要格式化 USB 或者向 USB 中写入一些东西。默认情况下,系统没有安装任何相关的应用。你可以安装以下这些易用的应用。
```
gnome-disk-utility
gparted
```
* gnome-disk-utility
* gparted
#### 9\. 启用最大化和最小化选项
#### 9、启用最大化和最小化选项
许多用户喜欢在窗口标题栏左边或者右边使用最大化、最小化的按钮elementary OS 默认只提供关闭和恢复两个选项。这没什么问题,因为这就是它的设计理念。然而你可以通过使用 Pantheon Tweaks 来开启最大化和最小化按钮,具体的方式是:调整 > 外观 > 窗口控制。
许多用户喜欢在窗口标题栏左边或者右边使用最大化、最小化的按钮elementary OS 默认只提供关闭和恢复两个选项。这没什么问题,因为这就是它的设计理念。然而你可以通过使用 Pantheon Tweaks 来开启最大化和最小化按钮,具体的方式是:调整 > 外观 > 窗口控制
![在 elementary OS 中启动最大化和最小化设置][9]
#### 10\. 在 Odin 中学习新的多点触控手势
#### 10在 Odin 中学习新的多点触控手势
如果你是笔记本用户,并且使用 elementary OS Odin那么你一定要看看这些超酷的新触控手势。三根手指向上滑动就会平滑的打开多任务视图打开应用程序和工作空间。用三根手指向左或向右滑动就能在动态工作空间之间流畅的切换使任务之间的切换更快。
如果你是笔记本用户,并且使用 elementary OS Odin,那么你一定要看看这些超酷的新触控手势。三根手指向上滑动,就会平滑的打开多任务视图,展示打开应用程序和工作空间。用三根手指向左或向右滑动,就能在动态工作空间之间流畅的切换,使任务之间的切换更快。
用两根手指也可以再本地应用中实现类似的功能。
用两根手指也可以在原生应用中实现类似的功能。
### 结束语
我希望安装elementary OS 6 Odin 后要做的 10 件事能帮助到你,让你开始使用 elementary OS 6 Odin,尽管这些事情完全是用户的偏好,因此这些事情有可能适合你也有可能不适用于你,但总的来说,这些都是一般用户喜欢的预期调整。
我希望这篇安装 elementary OS 6 “Odin” 后要做的 10 件事能帮助到你,让你可以上手使用 elementary OS 6 “Odin”,尽管这些事情完全是用户的偏好,因此这些事情有可能适合你也有可能不适用于你,但总的来说,这些都是一般用户喜欢的预期调整。
如果你觉得有更多的东西应该添加到列表中,请在下面的评论中告诉我。
* * *
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/2021/08/10-things-to-do-after-install-elementary-os-6/
@ -169,7 +154,7 @@ via: https://www.debugpoint.com/2021/08/10-things-to-do-after-install-elementary
作者:[Arindam][a]
选题:[lujun9972][b]
译者:[anine09](https://github.com/anine09)
校对:[校对者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,135 @@
[#]: subject: "Linux kernel modules we can't live without"
[#]: via: "https://opensource.com/article/21/8/linux-kernel-module"
[#]: author: "Jen Wike Huger https://opensource.com/users/jen-wike"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13747-1.html"
我们离不开的 Linux 内核模块
======
> 开源爱好者们对他们所喜爱的 Linux 内核模块进行了评价。
![](https://img.linux.net.cn/data/attachment/album/202109/03/065649hik5hjiiy3htj589.jpg)
Linux 内核今年就要满 30 岁了! 如果你像我们一样对此特别重视,那么让我们本周用几个特别的文章来庆祝 Linux。
今天,我们先来看看来自社区对“**你不能没有哪个 Linux 内核模块?为什么?**”的回答,让我们听听这 10 位爱好者是怎么说的。
### #1
我猜一些内核开发者听到我的回答后会尖叫着跑开。不过,我还是在这里列出了两个最具争议性的模块:
* 第一个是 NVIDIA因为我的工作笔记本和个人台式机上都有 NVIDIA 显卡。
* 另一个可能产生的仇恨较少。VMware 的 VMNET 和 VMMON 模块,以便能够运行 VMware Workstation。
— [Peter Czanik][2]
### #2
我最喜欢的是 [zram][3] 模块。它在内存中创建了一个压缩块设备,然后它可以作为交换分区使用。在内存有限的情况下(例如,在虚拟机上),还有如果你担心频繁的 I/O 操作会磨损你的 SSD 或者甚至更糟糕的基于闪存的存储,那么使用基于 zram 的交换分区是非常理想的。
— [Stephan Avenwedde][4]
### #3
最有用的内核模块无疑是 snd-hda-intel因为它支持大多数集成声卡。我可以一边听音乐一边在 Linux 桌面上编码一个音频编曲器。
— [Joël Krähemann][5]
### #4
如果没有我用 Broadcom 文件生成的 kmod-wl我的笔记本就没有价值了。我有时会收到关于内核污染的信息但没有无线网络的笔记本电脑有什么用呢
— [Gregory Pittman][6]
### #5
我不能没有蓝牙。没有它,我的鼠标、键盘、扬声器和耳机除了用来挡住门板还有啥用?
— [Gary Smith][7]
### #6
我要冒昧地说 _全_ 都是。 说真的,我们已经到了随机拿一块硬件,插入它,它就可以工作的地步。
* USB 串行适配器能正常工作
* 显卡可以使用(尽管可能不是最好的)
* 网卡正常工作
* 声卡正常工作
所有这些模块整体带来大量可以工作的驱动程序,令人印象深刻。我记得在过去那些糟糕的日子里,我们曾经大喊 xrandr 魔法字符串才能来使投影仪工作。而现在,是的,当设备基本不能正常工作时,才真的罕见。
如果我不得不把它归结为一个,那就是 raid6。
— [John 'Warthog9' Hawley][8]
### #7
对于这个问题,我想回到 20 世纪 90 年代末。我是一家小公司的 Unix 系统管理员(兼任 IS 经理)。我们的磁带备份系统死了,由于“小公司”预算有限,我们没有急于更换或现场维修。所以我们必须得把它送去维修。
在那两个星期里,我们没有办法进行磁带备份。没有一个系统管理员愿意处于这种境地。
但后来我想起了读过的 [如何使用软盘磁带机][9],我们刚好有一台刚换下来的塔式电脑,它有一个软盘磁带机。
于是我用 Linux 重新安装了它,设置了 ftape 内核驱动模块,进行了一些备份/恢复测试,然后将我们最重要的备份运行到 QIC 磁带上。在这两个星期里,我们依靠 ftape 备份重要数据。
所以,对于那些让软盘磁带机在 1990 年代的 Linux 上工作的无名英雄,你真是太厉害了!
— [Jim Hall][10]
### #8
嗯,这很简单。是 kvm 内核模块。就个人而言我无法想象在没有虚拟机的情况下完成日常工作。我愿意相信我们大多数人都是这样。kvm 模块在使 Linux 成为云战略的核心方面也发挥了很大作用。
— [Gaurav Kamathe][11]
### #9
对我来说,是 dm-crypt它是用于 LUKS 的。参见:
* <https://www.redhat.com/sysadmin/disk-encryption-luks>
* <https://manpages.debian.org/unstable/cryptsetup-bin/cryptsetup.8.en.html>
知道别人无法看到你的磁盘上的内容是非常棒的,例如,如果你的笔记本丢失或被盗时。
— [Maximilian Kolb][12]
### #10
对于密码学基础,很难超越 crypto 模块和它的 C API它是如此简洁明了。
在日常生活中,还有什么比蓝牙提供的即插即用更有价值的吗?
— [Marty Kalin][13]
在评论中与我们分享。你的生活中不能没有什么 Linux 内核模块?
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/linux-kernel-module
作者:[Jen Wike Huger][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jen-wike
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
[2]: https://opensource.com/users/czanik
[3]: https://en.wikipedia.org/wiki/Zram
[4]: https://opensource.com/users/hansic99
[5]: https://opensource.com/users/joel2001k
[6]: https://opensource.com/users/greg-p
[7]: https://opensource.com/users/greptile
[8]: https://opensource.com/users/warthog9
[9]: https://tldp.org/HOWTO/Ftape-HOWTO.html
[10]: https://opensource.com/users/jim-hall
[11]: https://opensource.com/users/gkamathe
[12]: https://opensource.com/users/kolb
[13]: https://opensource.com/users/mkalindepauledu

View File

@ -0,0 +1,130 @@
[#]: sub·ject: "Position text on your screen in Linux with ncurses"
[#]: via: "https://opensource.com/article/21/8/ncurses-linux"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: "perfiffer"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13756-1.html"
使用 ncurses 在你的 Linux 屏幕上定位文本
======
> 使用 ncurses 在 Linux 屏幕上的特定位置放置文本,可以带来更友好的用户界面体验。
![](https://img.linux.net.cn/data/attachment/album/202109/06/085908qrdrrv5dru6pcucr.jpg)
大多数的 Linux 实用程序仅仅只在屏幕的底部滚动文本。如果你想在屏幕中放置你的文本,例如一个游戏或者一个数据展示,你可以试试 ncurses。
curses 是一个旧的 Unix 库它可以在文本终端界面控制光标。curses 的名称就来自于术语 “<ruby>光标控制<rt>cursor control</rt></ruby>”。多年以后,其他人编写了新的 curses 版本用来添加新的功能,新版本被叫做 “new curses” 或者 “ncurses”。你可以在每个流行的 Linux 发行版中找到 ncurses。尽管默认情况下可能未安装开发库、头文件和文档。例如在 Fedora 上,你需要使用以下命令安装 `ncurses-devel` 包:
```
$ sudo dnf install ncurses-devel
```
### 在程序中使用 ncurses
要在屏幕上直接寻址,你首先需要初始化 `ncurses` 库。大部分程序会通过以下三行来做到这一点:
* `initscr()`:初始化窗口对象和 ncurses 代码,返回代表整个屏幕的窗口对象
* `cbreak()`:禁用缓冲并使键入的输入立即可用
* `noecho()`:关闭回显,因此用户输入不会显示在屏幕上
这些函数定义在 `curses.h` 头文件中,你需要在你的程序中通过以下方式将其包含进来:
```
#include <curses.h>
```
初始化终端后,你可以自由使用任何 ncurses 函数,我们将在示例程序中探讨其中的一些函数。
当你使用完 ncurses 并想返回到常规终端模式下时,使用 `endwin()` 重置一切。此命令可以重置任何屏幕颜色,将光标移动到屏幕的左下角,并使光标可见。通常在退出程序之前执行此操作。
### 在屏幕上寻址
关于 ncurses 首先需要知道的是屏幕的坐标分为行和列,左上角的是 `0,0` 点。ncurses 定义了两个全局变量来帮助你识别屏幕:`LINES` 是屏幕的行数,`COLS` 是屏幕的列数。屏幕右下角的位置是 `LINES-1,COLS-1`
例如,如果你想要移动光标到第 10 行和第 30 列,你可以使用 `move()` 函数,移动到此坐标:
```
move(10, 30);
```
之后显示的任何文本都将从屏幕的该位置开始。要显示单个字符,请对单个字符使用 `addch(c)` 函数。要显示字符串,将对字符串使用 `addstr(s)` 函数。对于类似于 `printf` 的格式化输出,请使用带有常用选项的 `printw(fmt, ...)`
移动到屏幕指定位置和显示文本是一件很常见的事情ncurses 提供了同时执行这两项操作的快捷方式。`mvaddch(row, col, c)` 函数将在屏幕第 `row` 行,第 `col` 列的位置显示一个字符。而 `mvaddstr(row, col, s)` 函数将在屏幕第 `row` 行,第 `col` 列的位置显示一个字符串。举个更直接的例子,在程序中使用 `mvaddstr(10, 30, "Welcome to ncurses");` 函数将从屏幕的第 `10` 行和第 `30` 列开始显示文本 `Welcome to ncurses`。使用 `mvaddch(0, 0, '+')` 函数将在屏幕的左上角第 `0` 行和第 `0` 列处显示一个加号(`+`)。
在终端屏幕上绘制文本会对某些系统产生性能影响,尤其是在较旧的硬件终端上。因此 ncurses 允许你“堆叠”一堆文本以显示在屏幕上,然后使用 `refresh()` 函数使所有这些更改对用户可见。
让我们来看一个将以上所有内容整合在一起的简单示例:
```
#include <curses.h>
int
main()
{
  initscr();
  cbreak();
  noecho();
  mvaddch(0, 0, '+');
  mvaddch(LINES - 1, 0, '-');
  mvaddstr(10, 30, "press any key to quit");
  refresh();
  getch();
  endwin();
}
```
程序的开始初始化了一个终端窗口,然后在屏幕的左上角打印了一个加号,在左下角打印了一个减号,在第 `10` 行和第 `30` 列打印了 `press any key to quit` 文本。程序通过使用 `getch()` 函数接收了键盘输入的单个字符,接着,使用 `endwin()` 函数在程序完全退出前重置了终端。
`getch()` 是一个很有用的函数,你可以使用它来做很多事情。我经常使用它在我退出程序前用来暂停。与大多数 ncurses 函数一样,还有一个名为 `mvgetch(row, col)``getch()` 版本,用于在等待字符输入之前移动到屏幕位置的第 `row` 行,第 `col` 列。
### 使用 ncurses 编译
如果你尝试以通常的方式编译该示例程序,例如 `gcc pause.c`,你可能会从链接器中获得大量错误列表。那是因为 GNU C 编译器不会自动链接 `ncurses` 库。相反,你需要使用 `-l ncurses` 命令行选项加载它以进行链接。
```
$ gcc -o pause pause.c -lncurses
```
运行新程序将打印一条简单的 `press any key to quit`消息,该消息差不多位于屏幕中央:
![centered message in a program window][2]
*图 1程序中居中的 “press any key to quit” 消息。*
### 使用 ncurses 构建更好的程序
探索 `ncurses` 库函数以了解在屏幕上显示文本的其它方法。你可以在 `ncurses` 的手册页中找到所有 `ncurses` 函数的列表。这给出了 ncurses 的一般概述,并提供了不同 `ncurses` 函数的类似表格的列表,并参考了包含完整详细信息的手册页。例如,在 `curs_printw(3X)` 手册页中描述了 `printw`,可以通过以下方式查看:
```
$ man 3x curs_printw
```
更简单点:
```
$ man curs_printw
```
使用 ncurses你可以创建更多有趣的程序。通过在屏幕上的特定位置打印文本你可以创建在终端中运行的游戏和高级实用程序。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/ncurses-linux
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[perfiffer](https://github.com/perfiffer)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
[2]: https://opensource.com/sites/default/files/press-key_0.png

View File

@ -0,0 +1,99 @@
[#]: subject: "Zulip: An Interesting Open-Source Alternative to Slack"
[#]: via: "https://itsfoss.com/zulip/"
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13750-1.html"
Zulip一个不错的开源的 Slack 替代品
======
> Zulip 是一个开源的协作平台,它把自己定位为一个更好的 Slack 替代品。让我们来了解一下。
![](https://img.linux.net.cn/data/attachment/album/202109/04/083746lbheeynx13jmn3xn.jpg)
当涉及到你的工作时,消息和协作平台有很大的不同。
虽然有几个选择,但 Slack 是许多组织使用的一个流行选择。但是,可以自托管的 Slack 的开源替代方案如何呢?
Zulip 就是这样一个软件。
### Zulip开源的协作消息应用
![][1]
如果你想多了解,我必须提到还有更多的 [Slack 开源替代品][2]。
但在这里,我重点介绍 Zulip。
Zulip 是一个自由而开源的消息应用,有付费托管选项和自托管的能力。
它旨在提供与 Slack 类似的体验,同时努力帮助你利用话题提高对话的有效性。
与 Slack 中的频道相比Zulip 聊天添加了话题(类似标签),以快速过滤与你有关的对话。
### Zulip 的特点
![][3]
你可以通过 Zulip 获得大部分的基本功能。这里列出主要的亮点,你可以发现:
* 支持 Markdown
* 频道的主题
* 支持拖放文件
* 代码块
* 集成 GitHub 来跟踪问题
* 支持电子邮件通知
* 自托管选项
* 信息编辑
* 集成 GIPHY
* 用 Zoom、Jitsi 或 BigBlueButton 进行视频通话
除了上述功能外,你可以预期得到你通常在 Slack 和其他方面得到的基本选项。
此外,如果你愿意,你还可以将它与 Matrix 和 IRC 整合。
![][4]
在我简短的测试使用中,其用户界面对于有效的沟通来说是足够好的。然而,我没能找到任何黑暗模式或改变主题的能力。
它看起来比 Slack 更简单直白,这样可以改善用户体验方面的问题。
### 在 Linux 中安装 Zulip
Zulip 在其官方网站上以 AppImage 文件的形式提供。如果你需要帮助,可以参考我们关于 [在 Linux 中使用 AppImage][5] 的指南。
它也有一个 Snap 包。所以,你可以在任何一个 Linux 发行版上使用它们中的任何一个。
你也可以使用 APT 通过终端为基于 Ubuntu/Debian 的发行版安装它。如果你想这样做,请看它的 [官方说明][6]。
Zulip 可用于 Windows、Mac 和 Linux。你也应该发现它可用于 Android 和 iOS 手机。
- [Zulip][7]
你可以在网络、桌面和智能手机上使用 Zulip所以可以把它当做 Slack 的合适替代品。
你试过了吗?你用什么消息平台来进行工作协作?欢迎在评论中分享你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/zulip/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-chat-new.png?resize=800%2C551&ssl=1
[2]: https://itsfoss.com/open-source-slack-alternative/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-chat-screenshot.png?resize=800%2C550&ssl=1
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-settings.png?resize=800%2C546&ssl=1
[5]: https://itsfoss.com/use-appimage-linux/
[6]: https://zulip.com/help/desktop-app-install-guide
[7]: https://zulip.com/

View File

@ -0,0 +1,244 @@
[#]: subject: "20 essential Linux commands for every user"
[#]: via: "https://opensource.com/article/21/9/essential-linux-commands"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: "unigeorge"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13759-1.html"
用户必会的 20 个 Linux 基础命令
======
> 无论新手老手,这 20 个 Linux 命令都能让你的操作更轻松。
![](https://img.linux.net.cn/data/attachment/album/202109/07/082525n7amf7gejo16zaxx.jpg)
在黝黑的终端窗口中输入命令,这样的方式对某些人群来说可能好像过时了,但对许多专业计算机人员来说,这几乎是计算机完成能够执行的所有任务的最有效、最简便和最清晰的方式。如今,一些项目将开源命令引入了 macOS 和 Windows 等非开放平台,因此终端命令不仅仅是针对 Linux 和 BSD 用户,更是与每个人都息息相关。你可能会惊讶地发现,在一台普通的 [POSIX][2] 计算机上安装了数千个命令,当然,其中很多命令并不是真的有用,至少不是直接或经常性被使用。而其中的一部分命令虽然不是有效终端必须使用的命令,但相比其他命令而言使用频率较高,值得大家学习一下。
以下是终端用户最可能会使用的前 20 个命令:
### cd
在终端外,你可以单击图标从一个文件夹移动到另一个文件夹,但在终端中,你需要使用 `cd`。`cd` 命令代表<ruby>变更目录<rt>change directory</rt></ruby>,是用户在 Linux 系统中移动的方式。这是 Linux 中从一个地方到另一个地方最快、最直接的路线。
例如,在桌面上,当你想从你的主目录(你保存所有文件夹的地方)移动到一个名为 `presentations` 的文件夹时,你首先要打开你的 `Documents` 文件夹,然后打开一个名叫 `work` 的文件夹,然后是 `projects` 文件夹,然后是 `conference` 文件夹,最后是 `presentations` 文件夹,里面存放的是 LibreOffice Impress 幻灯片。这个过程包含了很多次的双击操作。同时屏幕上还需要许多鼠标移动动作,这取决于新窗口出现的位置,以及大脑需要跟踪的许多路径点。许多人通过将 _所有文件_ 都放在桌面上来避免这个看似微不足道的任务。
而终端用户只需键入以下内容即可避免此问题:
```
$ cd ~/Documents/work/projects/conference/presentations
```
一些有经验的终端用户甚至都懒得输入所有这些,而是使用 `Tab` 键自动完成单词填充。更甚者,有时你都不必依赖自动完成,而是改用通配符:
```
$ cd ~/Doc*/work/*/conf*/p*
```
### pwd
用 Buckaroo Banzai 的话来说:“无论你走到哪里,你就在那里。”
当你想弄清楚确切位置时,就可以使用 `pwd` 命令。`pwd` 代表<ruby>打印工作目录<rt>print working directory</rt></ruby>,这正是它的作用。`--physical`(在某些情况时缩写为 `-P`)显示解析所有符号链接后的确切位置。
```
$ pwd
/home/tux/presentation
$ pwd --physical
/home/tux/Documents/work/projects/conference/presentations
```
### sed
流编辑器 `sed` 更广为人知的是一个强大的批量 _查找和替换_ 命令,但它同时也是一个正当合理的文本编辑器。你可以通过阅读我的 [介绍性文章][3] 来学习使用它,然后通过我的 [高级教程和备忘录][4] 成为老手。
### grep
`grep` 命令使用很普遍,以至于经常被用作动词(例如 “我会对一些文件进行 grep”和动名词例如 “grep 一些输出”)。无论是查看日志文件还是解析其他命令的输出,它都是在 shell 中解析文本时的关键组件。这是忙碌的用户专注于特定信息的一种方式。考虑一下计算世界中的数据量,`grep` 命令的流行就见怪不怪了。你可以通过阅读我的 [介绍性文章][5] 了解 `grep`,然后下载 [备忘录][6] 学习。
### file
当你需要知道文件包含什么类型的数据时,请使用 `file` 命令:
```
$ file example.foo
example.foo: RIFF (little-endian) data, Web/P image [...]
$ file example.bar
example.bar: ELF 64-bit LSB executable, x86-64 [...]
```
当然,`file` 命令并不神奇。它只不过是根据文件如何标识自身而进行输出的,并且文件可能是错误的、损坏的或伪装的。使用 [hexdump][7] 进行严格检查的方式确定性更强,但对于日常使用而言,`file` 命令非常方便。
### awk
`awk` 不仅仅是一个命令,它还是一种字面意义上的 [编程语言][8]。[点此下载我们的免费 Awk 电子书][9] 进行学习,你可能会写出远超你想象的脚本。
### curl
`curl` 命令是用于终端的 [非交互式 Web 浏览器][10]。它是面向 Web 和 API 开发人员的 [开发工具][11]。它是一个复杂灵活的命令,但如果你想从你的终端顺利地与 Web 服务交互,该命令是很值得学习的。
下载我们免费的 [curl 备忘录][12],你可以从中学会 `curl` 的许多选项。
### ps
管理系统资源主要由内核负责,当你更喜欢或更需要手动管理时,可以使用 `ps` 命令。读者可以在我的 [使用 procps-ng 监控 Linux 系统][13] 文章中了解 `ps`
### cat
[cat 命令][14] 是<ruby>连接<rt>concatenate</rt></ruby>的缩写,它曾因为能将若干小文件合并而显得非常有用,这些小文件可能是由于大小限制而(使用 `split` 命令)拆分的。如今,`cat` 主要是用来将文本文件的内容转储到终端中以供快速阅读,除非你为此专门去使用 `head`、`tail`、`more` 或 `less` 等命令。
尽管它的原始用途几乎已被弃用,并且其他几个命令也主要提供了其次要功能,但 `cat` 仍然是一个有用的工具。例如,它可以是复制(`cp`)命令的替代品:
```
$ cat myfile.ogg > /backups/myfile.ogg
```
它可以显示文件中不便观察的隐形字符。例如,使用 `--show-tabs` 选项,分割 [YAML][15] 的 `Tab` 字符就会显示为 `^I`
```
$ cat --show-tabs my.yaml
---
- hosts: all
  tasks:
  - name: Make sure the current version of 'sysstat' is installed.
    dnf:
     name:
^I- sysstat
^I- httpd
^I- mariadb-server
     state: latest
```
它还可以用 `--show-nonprinting` 显示非打印字符,用 `--show-ends` 标记行尾,用 `--number` 提供行号,等等。
### find
`find` 命令可以用来查找文件,但它还有许多选项,这些选项可以帮助你通过各种过滤器和参数查找文件。读者可以从我的 [介绍性文章][16] 中学习该命令的基础知识。
如果你一直想知道为什么最基本的、不起眼的 [ls 命令][17],不在本文列表中,那是因为 `find` 的灵活性。它不仅可以列表文件:
```
$ find .
./bar.txt
./baz.xml
./foo.txt
[...]
```
它还可以提供包含详细信息的长列表功能:
```
$ find . -ls
3014803  464 -rw-rw-r--   1 tux users  473385 Jul 26 07:25 ./foo.txt
3014837  900 -rwxrwxr-x   1 tux users  918217 Nov  6  2019 ./baz.xml
3026891  452 -rw-rw-r--   1 tux users  461354 Aug 10 13:41 ./foo.txt
[...]
```
这是一个技术问题,但也是很一个巧妙的技巧。
### tar
人们有时会引用 BSD 的 `tar` 语法来拿 Linux 命令开玩笑。尽管有这样的名声,但 `tar` 命令实际上非常直观。读者可以阅读我的 [如何解压缩 tar.gz 文件][18] 文章,了解在需要时使用 `tar` 命令的简单知识。
### more、less 和 most
这些统称为分页命令。分页命令与 `cat` 类似,但前者会在屏幕底部暂停输出,直到你向下滚动查看更多内容。这些命令比较简单,但每个之间都有细微差别。用户是用箭头键还是空格键滚动?是必须手动退出,还是在显示的文件末尾自动退出?用户的首选搜索行为是什么样的?选择你最喜欢的分页命令并将其设置在 `.bashrc` 中吧!
### ssh 和 scp
OpenSSH 不仅有助于保护与远程系统的连接安全,还可以用于启用其他命令。例如,对于许多用户来说,有了 `.ssh` 目录,他们才能与 Git 存储库顺利交互、将更新发布到网站、登录云控制平台。
### mv
`mv` 命令有双重作用:它既可以 [移动文件][19] 又可以 [重命名文件][20]。它有几个可用的保护措施,例如 `--interactive``--no-clobber` 选项避免破坏现有文件,`--backup` 命令确保数据在新位置验证之前被保留,以及 `--update` 选项确保旧版本不会替换新版本文件。
### sudo
当某个用户账户的用户名已知,且具有 _全部_ 系统权限时,该用户很快就会成为黑客攻击的目标。`sudo` 命令消除了对字面上 `root` 用户的需求,从而优雅地移除了有关系统的重要信息。不过这还不是全部,使用 `sudo` 你还可以轻松地管理单个命令、用户和组的权限。你可以在选定的命令上启用无密码执行、记录用户会话、使用摘要验证来验证命令,[等等][21]。
### alias
使用 `alias` 命令将长命令变成易于记忆的快捷方式:
```
$ alias ls='ls --classify --almost-all --ignore-backups --color'
```
### clear
有时终端会显得很混乱,输入 `clear`(或在某些 shell 中按 `Ctrl+L`)后,你就能得到漂亮、刷新的屏幕了。
### setfacl
传统上POSIX 文件权限由 `chown``chmod` 决定。然而,如今系统变得更加复杂,因此有一个灵活性更高的命令。`setfacl` 命令允许创建一个 [访问控制列表ACL][22],可以配置任意用户所需权限,并可以为文件夹及其中创建的内容设置默认权限。
### netcat
可能需要使用 `netcat``nc`)的人不多,但这些使用它的人确离不开它。`nc` 命令是一个通用的网络连接工具。
它可以连接到一个端口,类似于 `telnet` 命令:
```
$ nc -u 192.168.0.12 80
```
它可以 ping 一个端口,类似于 `ping` 命令:
```
$ nc -zvn 192.168.0.12 25
```
它可以探测开放端口,类似于 `nmap` 命令:
```
$ nc -zv 192.168.0.12 25-80
```
以上仅是该命令的一小部分用途。
### 你自己构建的命令
在某种程度上Linux 终端是一个创造性解决问题的平台。当你学习命令时,你也在学习可用于创建自己的命令的组块。我的 [shell 历史][23] 中的许多命令都是自己编写的 shell 脚本,从而实现了根据自己想要的工作方式定制工作流程。你为自己的效率和舒适度而设计的命令也可以作为 shell 中的基本命令。花些时间了解一些很棒的命令,然后试着构建自己的命令吧。当你构建出的命令非常好用时,把它开源,这样就可以与他人分享你的想法啦!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/essential-linux-commands
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[unigeorge](https://github.com/unigeorge)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: https://opensource.com/article/20/12/sed
[4]: https://opensource.com/article/21/3/sed-cheat-sheet
[5]: https://opensource.com/article/21/3/grep-cheat-sheet
[6]: https://opensource.com/downloads/grep-cheat-sheet
[7]: https://opensource.com/article/19/8/dig-binary-files-hexdump
[8]: https://opensource.com/article/21/1/learn-awk
[9]: https://opensource.com/article/20/9/awk-ebook
[10]: https://opensource.com/article/20/5/curl-cheat-sheet
[11]: https://www.redhat.com/sysadmin/use-curl-api
[12]: https://opensource.com/downloads/curl-command-cheat-sheet
[13]: https://opensource.com/article/21/8/linux-procps-ng
[14]: https://opensource.com/article/19/2/getting-started-cat-command
[15]: https://www.redhat.com/sysadmin/yaml-beginners
[16]: https://opensource.com/article/21/8/find-files-and-directories-find
[17]: https://opensource.com/article/19/7/master-ls-command
[18]: https://opensource.com/article/17/7/how-unzip-targz-file
[19]: https://opensource.com/article/21/8/move-files-linux
[20]: https://opensource.com/article/21/8/rename-file-linux-terminal
[21]: https://opensource.com/article/19/10/know-about-sudo
[22]: https://opensource.com/article/20/3/external-drives-linux
[23]: https://opensource.com/article/18/6/history-command

View File

@ -0,0 +1,77 @@
[#]: subject: "Linux Lite Moves to Pay What You Want Model With Version 5.6 Release"
[#]: via: "https://news.itsfoss.com/linux-lite-5-6-release/"
[#]: author: "Jacob Crume https://news.itsfoss.com/author/jacob/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Linux Lite Moves to Pay What You Want Model With Version 5.6 Release
======
[Linux Lite][1] has just announced Linux lite 5.6, the fourth installment in their 5.x series of releases. This release brings some major changes, especially in the download process. Other, more subtle tweaks are also shown throughout the OS.
Here, we will be looking at what is new, what has changed, and how these changes may affect the future of Linux Lite.
### What Has Changed in Linux Lite 5.6?
![][2]
Alongside the new download model, there a few key changes. These include:
* New features in the Lite Tweaks app
* Updated icon theme
* New wallpapers
While this list is relatively short, there are a couple of meaningful changes.
### Pay Want You Want Download Model
Definitely the most impactful change, Linux Lite has moved to a “Pay what you want” download model. For those not familiar with the term, it is a system where the user is encouraged to pay to obtain a download link. Users can still enter $0 to get the download link for free, but it is not immediately clear and does not support the distro.
This move follows the footsteps of other popular distros, including ElementryOS. While I can see many users being annoyed at this change, it has also been made clear that Linux Lite would die without this change.
> “This is a road Id never thought Id go down, but we have no choice. Either we stagnate and accept the big Gs ever-changing algorithms, or we boldly go where others have dared.”
Jerry Bezencon
In hindsight, this change was inevitable, as there is almost no other way for distributions to reasonably sustain themselves (aside from donations). Now we need to see how this change pays off for the developers of Linux Lite.
### Updated Lite Tweaks App
With this update, the Lite Tweaks app gets a few improvements. One of these is the ability to completely clear the cache of the Brave web browser. It also has a new option to set Brave as the default web browser.
The second update within the Lite Tweaks app is a fix for GRUB. This tweak changes the grub entry from “Ubuntu” to “Linux Lite”. However, it should be noted that this option is only available when GRUB is controlled by Linux Lite.
### Wrapping Up
If you want to try Linux Lite for yourself, you can [download it from its website][3]. If you are already running Linux Lite, you can update to version 5.6 using the instructions found on the [release announcement][4].
While minor, this release does have a few improvements scattered around the OS. Most importantly, however, is the fact that Linux Lite can now be self-sustaining, meaning that we will continue to see more features added with every release. I think this is much better that the distro dying, dont you?
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/linux-lite-5-6-release/
作者:[Jacob Crume][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/jacob/
[b]: https://github.com/lujun9972
[1]: https://www.linuxliteos.com/
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ0MCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[3]: https://www.linuxliteos.com/download.php
[4]: https://www.linuxliteos.com/forums/release-announcements/linux-lite-5-6-final-released/

View File

@ -1,71 +0,0 @@
[#]: subject: "A guide to understanding your team's implicit values and needs"
[#]: via: "https://opensource.com/open-organization/21/8/leadership-cultural-social-norms"
[#]: author: "Ron McFarland https://opensource.com/users/ron-mcfarland"
[#]: collector: "lujun9972"
[#]: translator: "zz-air"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
A guide to understanding your team's implicit values and needs
======
To enhance team dynamics, open leaders can study the implicit social
norms that guide members' behaviors and decisions.
![Working meetings can be effective meetings][1]
Culture matters in [open organizations][2]. But "culture" seems like such a large, complicated concept to address. How can we help open organization teams better understand it?
One solution might come from [Michele J. Gelfand][3], author of [_Rule Makers, Rule Breakers_][4]_: Tight and Loose Cultures and the Secret Signals That Direct Our Lives_. Gelfand organizes all countries and cultures into two very simple groups: those with "tight" cultures and those with "loose" ones. Then she explains the characteristics and social norms of both, offering their relative strengths and weaknesses. By studying both, one might overcome the divisions and conflicts that separate people in and across teams, organizations, and countries.
In this two-part review of _Rule Makers, Rule Breakers_, I'll explain Gelfand's argument and discuss the ways it's useful to people working in open organizations.
### Know your social norms
Gelfand believes that our behavior is very strongly dependent on whether we live in a "tight" or "loose" community culture, because each of these cultures has social norms that differ from the other. These norms—and the strictness with which they are enforced—will determine our behavior in the community. They give us our identity. They help us coordinate with each other. In short, they're the glue that holds communities together.
They also impact our worldviews, the ways we build our environments, and even the processing in our brains. "Countless studies have shown that social norms are critical for uniting communities into cooperative, well-coordinated groups that can accomplish great feats," Gelfand writes. Throughout history, communities have put their citizens through the seemingly craziest of rituals for no other reason than to maintain group cohesion and cooperation. The rituals result in greater bonding, which has kept people alive (particularly in times of hunting, foraging, and warfare).
Social norms include rules we all tend to follow automatically, what Gelfand calls a kind of "normative autopilot." These are things we do without thinking about them—for example, being quiet in libraries, cinemas, elevators, or airplanes. We do these things automatically. "From the outside," Gelfand says, "our social norms often seem bizarre, but from the inside, we take them for granted." She explains that social norms can be codified into regulations and laws ("obey stop signs" and "don't steal"). Others are largely unspoken ("don't stare at people on the train" or "cover your mouth when you sneeze"). And, of course, they vary by context.
The challenge is that most social norms are invisible, and we don't know how much these social norms control us.
The challenge is that most social norms are invisible, and we don't know how much these social norms control us. Without knowing it, we often just follow the groups in our surroundings. This is called "groupthink," in which people will follow along with their identifying group, even if the group is wrong. They don't want to stand out.
### Organizations, tight and loose
Gelfand organizes social norms into various groupings. She argues that some norms are characteristic of "tight" cultures, while others are characteristic of "loose" cultures. To do this, Gelfand researched and sampled approximately seven thousand people from more than 30 countries across five continents and with a wide range of occupations, genders, ages, religions, sects, and social classes in order to learn where those communities positioned themselves (and how strongly their social norms were enforced officially and by the communities/neighborhoods in general). Differences between tight and loose cultures vary between nations, within countries (like within the United States and its various regions), within organizations, within social classes and even within households.
Because organizations have cultures, they too have their own social norms (after all, if an organization is unable to coordinate its members and influence their behavior, it won't be able to survive). So organizations can also reflect and instill the "light" or "loose" cultural characteristics Gelfand describes. And if we have a strong ability to identify these differences, we can predict and address conflict more successfully. Then, armed with greater awareness of those social norms, we can put open organization principles to work.
Gelfand describes the difference between tight and loose cultures this way:
> Broadly speaking, loose cultures tend to be open, but they're also much more disorderly. On the flip side, tight cultures have a comforting order and predictability, but they're less tolerant. This is the tight-loose trade-off: advantages in one realm coexist with drawbacks in another.
Tight societies, she concludes, maintain strict social order, synchrony and self-regulation; loose societies take pride in being highly tolerant, creative and open to change.
Although not true in every case, tight and loose cultures generally exhibit some trade-offs; each has its own strengths and weaknesses. See Figure 1 below.
![][5]
The work of successfully applying the five open organization principles in these two environments can vary greatly. To be successful, community commitment is vital, and if the social norms are different, the reasons for commitment would be different as well. Organizational leaders must know what the community's values are. Only then can that person adequately inspire others.
In the next part of this review, I'll explain more thoroughly the characteristics of tight and loose cultures, so leaders can get a better sense of how they can put open organization principles to work on their teams.
--------------------------------------------------------------------------------
via: https://opensource.com/open-organization/21/8/leadership-cultural-social-norms
作者:[Ron McFarland][a]
选题:[lujun9972][b]
译者:[zz-air](https://github.com/zz-air)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ron-mcfarland
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/leader-team-laptops-conference-meeting.png?itok=ztoA0E6f (Working meetings can be effective meetings)
[2]: https://theopenorganization.org/definition/
[3]: https://www.michelegelfand.com/
[4]: https://www.michelegelfand.com/rule-makers-rule-breakers
[5]: https://opensource.com/sites/default/files/images/open-org/rule-makers-breakers-1.png

View File

@ -1,124 +0,0 @@
[#]: subject: (Apps for daily needs part 2: office suites)
[#]: via: (https://fedoramagazine.org/apps-for-daily-needs-part-2-office-suites/)
[#]: author: (Arman Arisman https://fedoramagazine.org/author/armanwu/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Apps for daily needs part 2: office suites
======
![][1]
Photo by [Brooke Cagle][2] on [Unsplash][3]
Today, almost every family has a desktop computer or laptop. Thats because the computer has become a very important requirement. Moreover, many people have to create documents and presentations in digital format for work or study. Therefore, the office suites are must-have application on almost all computers. This article will introduce some of the open source office suites that you can use on Fedora Linux. You may need to install the software mentioned. If you are unfamiliar with how to add software packages in Fedora Linux, see my earlier article [Things to do after installing Fedora 34 Workstation][4]. Here is the list of apps for daily needs in the office suites category.
### LibreOffice
LibreOffice is the most popular office suite among GNU/Linux users. It has a user interface and user experience similar to Microsoft Office. This makes LibreOffice easy to learn for those who have just migrated from Microsoft Office. LibreOffice has complete features to meet your needs working on documents and presentations. It consists of six applications: Writer, Calc, Impress, Draw, Math, and Base.
The first application is Writer that is used to create various kinds of documents, such as letters, faxes, agendas, minutes, etc. It is a full-featured word processing and desktop publishing tool. The second application is Calc which is a spreadsheet program that is perfect for presenting data and documenting it in tabular format. Calc can create simple tables or do professional data analysis. The third application is Impress which is an easy-to-use presentation application. You can easily choose what you features want in your presentation slides, such as text, images, tables, diagrams, etc.
![LibreOffice Writer][5]
![LibreOffice Calc][6]
![LibreOffice Impress][7]
The three LibreOffice applications mentioned earlier are the most commonly used applications in creating documents and presentations. However, LibreOffice provides three other applications that are also very useful. The first is Draw which can be used to create drawings and diagrams, ranging from simple to complex. The next application is Math which can help us make perfectly formatted mathematical and scientific formulas. The last is Base which is an application for processing databases.
![LibreOffice Draw][8]
![LibreOffice Math][9]
![LibreOffice Base][10]
More information is available at this link: <https://www.libreoffice.org/>
* * *
### ONLYOFFICE
ONLYOFFICE is an office suite application that is highly compatible with Microsoft Office. Therefore we do not have to worry about collaborating with colleagues who use Microsoft Office because it can read various file formats such as docx, xlsx, and pptx.
ONLYOFFICE provides three applications with a clean and modern look. We can easily find the features and tools that we need. Although the features are not as complete as LibreOffice, they are very sufficient to help us create good documents and presentations.
The first application is Documents Editor which has the same function as Writer from LibreOffice. It has all the basic features needed in a word processor, such as managing fonts and styles, formatting text, adjusting line and paragraph spacing, inserting headers and footers, customizing page layout, and setting margins. The second application is Spreadsheet Editor which is an application for processing data and creating it as a document in tabular format. It is an application with the same functionality as Calc. The last one is Presentations Editor which is a presentation application with functions similar to Impress.
Unfortunately ONLYOFFICE is not available in the official Fedora Linux repositories. But you can still install it on Fedora Linux using Flatpak or Appimages.
![ONLYOFFICE Documents Editor][11]
![ONLYOFFICE Spreadsheets Editor][12]
![ONLYOFFICE Presentations Editor][13]
More information is available at this link: <https://www.onlyoffice.com/desktop.aspx>
* * *
### Calligra
Calligra is an office suite created by KDE. Therefore, this application is actually more suitable for users of the KDE Plasma desktop environment. But it can still run well on other desktop environments, such as Fedora Workstation using GNOME.
Calligra provides several applications with a slightly different look from LibreOffice or ONLYOFFICE. It may take some adjustment for those who are used to mainstream office suite applications. However, Calligra is still a reliable office suite to support our daily needs.
The first application is Words which is an intuitive word processor with desktop publishing features. It has a full range of features to help us in document creation. The second application is Sheets which has the same functionality as Calc and Spreadsheet Editors as a fully-featured spreadsheet application. The third application is Stage which can help us in making presentation slides.
![Calligra Words][14]
![Calligra Sheets][15]
![Calligra Stage][16]
The three Calligra applications are the most commonly used applications for creating documents and presentations. There are three other applications that are also very useful. The first is Karbon which can be used to create drawings and diagrams, ranging from simple to complex. The next application is Plan which is project management application that can help in managing moderately large projects with multiple resources. The last is KEXI which is a visual database application creator.
![Calligra Karbon][17]
![Calligra Plan][18]
![Calligra Kexi][19]
More information is available at this link: <https://calligra.org/>
* * *
### Conclusion
This article presented 3 office suites for your daily needs that you can use on Fedora Linux. If you want a complete set of features in your office suite, then LibreOffice may be the right choice. For good compatibility with Microsoft Office, then you may choose ONLYOFFICE. However, if you want a different user interface and experience in creating documents and presentations, you can try Calligra. Hopefully this article can help you to choose the right office suite. If you have experience in using these applications, please share your experience in the comments.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/apps-for-daily-needs-part-2-office-suites/
作者:[Arman Arisman][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/armanwu/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-2-Office-816x345.jpg
[2]: https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/meeting-on-cafe-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://fedoramagazine.org/things-to-do-after-installing-fedora-34-workstation/
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-writer-1-1024x575.png
[6]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-calc-1-1024x575.png
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-impress-1-1024x575.png
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-draw-1-1024x575.png
[9]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-math-1-1024x575.png
[10]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-libre-base-1-1024x575.png
[11]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-only-doc-1024x575.png
[12]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-only-sheet-1024x575.png
[13]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-only-presentation-1024x575.png
[14]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-words-1024x575.png
[15]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-sheets-1024x575.png
[16]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-stage-1024x575.png
[17]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-karbon-1-1024x575.png
[18]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-plan-1024x575.png
[19]: https://fedoramagazine.org/wp-content/uploads/2021/07/office-calligra-kexi-1024x575.png

View File

@ -1,89 +0,0 @@
[#]: subject: "Apps for daily needs part 3: image editors"
[#]: via: "https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/"
[#]: author: "Arman Arisman https://fedoramagazine.org/author/armanwu/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Apps for daily needs part 3: image editors
======
![][1]
Photo by [Brooke Cagle][2] on [Unsplash][3]
Image editors are applications that are liked and needed by many people, from professional designers, students, or for those who have certain hobbies. Especially in this digital era, more and more people need image editors for various reasons. This article will introduce some of the open source image editors that you can use on Fedora Linux. You may need to install the software mentioned. If you are unfamiliar with how to add software packages in Fedora Linux, see my earlier article [Things to do after installing Fedora 34 Workstation][4]. Here is a list of a few apps for daily needs in the image editors category.
### GIMP
GIMP (GNU Image Manipulation Program) is a raster graphics editor used for photo retouching, image composition, and image authoring. It has almost the same functionality as Adobe Photoshop. You can use GIMP to do a lot of the things you can do with Photoshop. Because of that, GIMP has become the most popular application as an open source alternative to Adobe Photoshop.
GIMP has a lot of features for manipulating images, especially for raster images. You can fix or change the color of your photos using GIMP. You can select a part of the image, crop it, and then merge it with other pieces of the image. GIMP also has many effects that you can apply to your images, including blur, shadow, noise, etc. Many people use GIMP to repair damaged photos, improve image quality, crop unwanted parts of images, create posters and various graphic design works, and much more. Moreover you can also add plugins and scripts in GIMP, making it even more fully featured.
![][5]
More information is available at this link: <https://www.gimp.org/>
* * *
### Inkscape
Inkscape is a popular open source application used to create and edit vector graphics. It is a feature-rich vector graphics editor which makes it competitive with other similar proprietary applications, such as Adobe Illustrator and Corel Draw. Because of that, many professional illustrators use it to create vector-based artwork.
You can use Inkscape for making artistic and technical illustrations, such as logos, diagrams, icons, desktop wallpapers, flowcharts, cartoons, and much more. Moreover, Inkscape can handle various graphic file formats. In addition, you can also add add-ons to make your work easier.
![][6]
More information is available at this link: <https://inkscape.org/>
* * *
### Krita
Krita looks like GIMP or Inkscape at first glance. But actually it is an application that is quite different, although it has some similar functions. Krita is an application for creating digital paintings like those made by artists. You can use Krita for making concept art, illustration, comics, texture, and matte paintings.
Krita has over 100 professionally made brushes that come preloaded. It also has a brush stabilizer feature with 3 different ways to smooth and stabilize your brush strokes. Moreover, you can customize your brushes with over 9 unique brush engines. Krita is the right application for those of you who like digital painting activities.
![][7]
More information is available at this link: <https://krita.org/en/>
* * *
### darktable
darktable is perfect for photographers or for those who want to improve the quality of their photos. darktable focuses more on image editing specifically on non-destructive post-production of raw images. Therefore, it provides professional color management that supports automatic display profile detection. In addition, you can also use darktable to handle multiple images with filtering and sorting features. So you can search your collections by tags, rating, color labels, and many more. It can import various image formats, such as JPEG, CR2, NEF, HDR, PFM, RAF, etc.
![][8]
More information is available at this link: <https://www.darktable.org/>
* * *
### Conclusion
This article presented four image editors as apps for your daily needs that you can use on Fedora Linux. Each application represents a sub-category of image editor applications. Actually there are many other image editors that you can use in Fedora Linux. You can also use RawTherapee or Photivo as a dartkable alternative. In addition there is Pinta as an alternative to GIMP, and MyPaint as an alternative to Krita. Hopefully this article can help you to choose the right image editors. If you have experience in using these applications, please share your experience in the comments.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/apps-for-daily-needs-part-3-image-editors/
作者:[Arman Arisman][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/armanwu/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/07/FedoraMagz-Apps-3-Graphics-816x345.jpg
[2]: https://unsplash.com/@brookecagle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/meeting-on-cafe-computer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://fedoramagazine.org/things-to-do-after-installing-fedora-34-workstation/
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-gimp-1024x576.png
[6]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-inkscape-1024x575.png
[7]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-krita-1024x592.png
[8]: https://fedoramagazine.org/wp-content/uploads/2021/07/image-darktable-1024x583.png

View File

@ -1,119 +0,0 @@
[#]: subject: "Check file status on Linux with the stat command"
[#]: via: "https://opensource.com/article/21/8/linux-stat-file-status"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: "New-World-2019"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Check file status on Linux with the stat command
======
All the information you need about any file or file system is just one
Linux command away.
![Hand putting a Linux file folder into a drawer][1]
The `stat` command, included in the GNU `coreutils` package, provides a variety of metadata, including file size, inode location, access permissions and SELinux context, and creation and modification times, about files and filesystems. It's a convenient way to gather information that you usually need several different commands to acquire.
### Installing stat on Linux
On Linux, you probably already have the `stat` command installed because it's part of a core utility package that's generally bundled with Linux distributions by default.
In the event that you don't have `stat` installed, you can install `coreutils` with your package manager.
Alternately, you can [compile coreutils from source code][2].
### Getting the status of a file
Running `stat` provides easy to read output about a specific file or directory.
```
$ stat planets.xml
  File: planets.xml
  Size: 325      Blocks: 8     IO Block: 4096   regular file
Device: fd03h/64771d    Inode: 140217      Links: 1
Access: (0664/-rw-rw-r--)  Uid: (1000/tux)   Gid: (100/users)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2021-08-17 18:26:57.281330711 +1200
Modify: 2021-08-17 18:26:58.738332799 +1200
Change: 2021-08-17 18:26:58.738332799 +1200
 Birth: 2021-08-17 18:26:57.281330711 +1200
```
It may be easy to read, but it's still a lot of information. Here's what `stat` is covering:
* **File**: the file name
* **Size**: the file size in bytes
* **Blocks**: the number of blocks on the hard drive reserved for this file
* **IO Block**: the size of a block of the filesystem
* **regular file**: the type of file (regular file, directory, filesystem)
* **Device**: the device where the file is located
* **Inode**: the inode number where the file is located
* **Links**: the number of links to the file
* **Access, UID, GID**: file permissions, user, and group owner
* **Context**: SELinux context
* **Access, Modify, Change, Birth**: the timestamp of when the file was accessed, modified, changed status, and created
### Terse output
For people who know the output well, or want to parse the output with other utilities like [awk][3], there's the `--terse` (`-t` for short) option, which formats the output without headings or line breaks.
```
$ stat --terse planets.xml
planets.xml 325 8 81b4 100977 100 fd03 140217 1 0 0 1629181617 1629181618 1629181618 1629181617 4096 unconfined_u:object_r:user_home_t:s0
```
### Choosing your own format
You can define your own format for output using the `--printf` option and a syntax similar to [printf][4]. Each attribute reported by `stat` has a format sequence (`%C` for SELinux context, `%n` for file name, and so on), so you can choose what you want to see in a report.
```
$ stat --printf="%n\n%C\n" planets.xml
planets.xml
unconfined_u:object_r:user_home_t:s0
$ $ stat --printf="Name: %n\nModified: %y\n" planets.xml
Name: planets.xml
Modified: 2021-08-17 18:26:58.738332799 +1200
```
Here are some common format sequences:
* **%a** access rights
* **%F** file type
* **%n** file name
* **%U** user name
* **%u** user ID
* **%g** group ID
* **%w** time of birth
* **%y** modification time
A full listing of format sequences is available in the `stat` man page and the `coreutils` info pages.
### File information
If you've ever tried to parse the output of `ls -l`, then you'll appreciate the flexibility of the `stat` command. You don't always need every bit of the default information that `stat` provides, but the command is invaluable when you do need some or all of it. Whether you read its output in its default format, or you create your own queries, the `stat` command gives you easy access to the data about your data.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/linux-stat-file-status
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://www.gnu.org/software/coreutils/
[3]: https://opensource.com/article/20/9/awk-ebook
[4]: https://opensource.com/article/20/8/printf

View File

@ -1,138 +0,0 @@
[#]: subject: "Position text on your screen in Linux with ncurses"
[#]: via: "https://opensource.com/article/21/8/ncurses-linux"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: "perfiffer"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Position text on your screen in Linux with ncurses
======
Use ncurses in Linux to place text at specific locations on the screen
and enable more user-friendly interfaces.
![Person using a laptop][1]
Most Linux utilities just scroll text from the bottom of the screen. But what if you wanted to position text on the screen, such as for a game or a data display? That's where **ncurses** comes in.
**curses** is an old Unix library that supports cursor control on a text terminal screen. The name _curses_ comes from the term _cursor control_. Years later, others wrote an improved version of **curses** to add new features, called _new curses_ or **ncurses**. You can find **ncurses** in every modern Linux distribution, although the development libraries, header files, and documentation may not be installed by default. For example, on Fedora, you will need to install the **ncurses-devel** package with this command:
```
`$ sudo dnf install ncurses-devel`
```
### Using ncurses in a program
To directly address the screen, you'll first need to initialize the **ncurses** library. Most programs will do that with these three lines:
* initscr(); Initialize the screen and the **ncurses** code
* cbreak(); Disable buffering and make typed input immediately available
* noecho(); Turn off echo, so user input is not displayed to the screen
These functions are defined in the **curses.h** header file, which you'll need to include in your program with:
```
`#include <curses.h>`
```
After initializing the terminal, you're free to use any of the **ncurses** functions, some of which we'll explore in a sample program.
When you're done with **ncurses** and want to go back to regular terminal mode, use **endwin();** to reset everything. This command resets any screen colors, moves the cursor to the lower-left of the screen, and makes the cursor visible. You usually do this right before exiting the program.
### Addressing the screen
The first thing to know about **ncurses** is that screen coordinates are _row,col_, and start in the upper-left at 0,0. **ncurses** defines two global variables to help you identify the screen size: LINES is the number of lines on the screen, and COLS is the number of columns. The bottom-right position is LINES-1,COLS-1.
For example, if you wanted to move the cursor to line 10 and column 30, you could use the move function with those coordinates:
```
`move(10, 30);`
```
Any text you display after that will start at that screen location. To display a single character, use the **addch(c)** function with a single character. To display a string, use **addstr(s)** with your string. For formatted output that's similar to **printf**, use **printw(fmt, …)** with the usual options.
Moving to a screen location and displaying text is such a common thing that **ncurses** provides a shortcut to do both at once. The **mvaddch(row, col, c)** function will display a character at screen location _row,col_. And the **mvaddstr(row, col, s)** function will display a string at that location. For a more direct example, using **mvaddstr(10, 30, "Welcome to ncurses");** in a program will display the text "Welcome to ncurses" starting at row 10 and column 30. And the line **mvaddch(0, 0, '+');** will display a single plus sign in the upper-left corner at row 0 and column 0.
Drawing text to the terminal screen can have a performance impact on certain systems, especially on older hardware terminals. So **ncurses** lets you "stack up" a bunch of text to display to the screen, then use the **refresh()** function to make all of those changes visible to the user.
Let's look at a simple example that pulls everything together:
```
#include &lt;curses.h&gt;
int
main()
{
  initscr();
  cbreak();
  noecho();
  mvaddch(0, 0, '+');
  mvaddch(LINES - 1, 0, '-');
  mvaddstr(10, 30, "press any key to quit");
  refresh();
  getch();
  endwin();
}
```
The program starts by initializing the terminal, then prints a plus sign in the upper-left corner, a minus in the lower-left corner, and the text "press any key to quit" at row 10 and column 30. The program gets a single character from the keyboard using the getch() function, then uses **endwin()** to reset the terminal before the program exits completely.
**getch()** is a useful function that you could use for many things. I often use it as a way to pause before I quit the program. And as with most **ncurses** functions, there's also a version of **getch()** called **mvgetch(row, col)** to move to screen position _row,col_ before waiting for a character.
### Compiling with ncurses
If you tried to compile that sample program in the usual way, such as `gcc pause.c`, you'll probably get a huge list of errors from the linker. That's because the **ncurses** library is not linked automatically by the GNU C Compiler. Instead, you'll need to load it for linking using the `-l ncurses` command-line option.
```
`$ gcc -o pause pause.c -lncurses`
```
Running the new program will print a simple "press any key to quit" message that's more or less centered on the screen:
![centered message in a program window][2]
Figure 1: A centered "press any key to quit" message in a program.
### Building better programs with ncurses
Explore the **ncurses** library functions to learn about other ways to display text to the screen. You can find a list of all **ncurses** functions in the man ncurses manual page. This gives a general overview of **ncurses** and provides a table-like list of the different **ncurses** functions, with a reference to the manual page that has full details. For example, **printw** is described in the _curs_printw(3X)_ manual page, which you can view with:
```
`$ man 3x curs_printw`
```
or just:
```
`$ man curs_printw`
```
With **ncurses**, you can create more interesting programs. By printing text at specific locations on the screen, you can create games and advanced utilities to run in the terminal.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/ncurses-linux
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
[2]: https://opensource.com/sites/default/files/press-key_0.png

View File

@ -1,164 +0,0 @@
[#]: subject: "Write a guessing game in ncurses on Linux"
[#]: via: "https://opensource.com/article/21/8/guess-number-game-ncurses-linux"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: "perfiffer"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Write a guessing game in ncurses on Linux
======
Use the flexibility and power of ncurses to create a guess-the-number
game on Linux.
![question mark in chalk][1]
In my [last article][2], I gave a brief introduction to using the **ncurses** library to write text-mode interactive applications in C. With **ncurses**, we can control where and how text gets displayed on the terminal. If you explore the **ncurses** library functions by reading the manual pages, youll find there are a ton of different ways to display text, including bold text, colors, blinking text, windows, borders, graphic characters, and other features to make your application stand out.
If youd like to explore a more advanced program that demonstrates a few of these interesting features, heres a simple “guess the number” game, updated to use **ncurses**. The program picks a random number in a range, then asks the user to make repeated guesses until they find the secret number. As the user makes their guess, the program lets them know if the guess was too low or too high.
Note that this program limits the possible numbers from 0 to 7. Keeping the values to a limited range of single-digit numbers makes it easier to use **getch()** to read a single number from the user. I also used the **getrandom** kernel system call to generate random bits, masked with the number 7 to pick a random number from 0 (binary 0000) to 7 (binary 0111).
```
#include &lt;curses.h&gt;
#include &lt;string.h&gt;          /* for strlen */
#include &lt;sys/random.h&gt;      /* for getrandom */
int
random0_7()
{
   int num;
   getrandom(&amp;num, sizeof(int), GRND_NONBLOCK);
   return (num &amp; 7); /* from 0000 to 0111 */
}
int
read_guess()
{
  int ch;
  do {
    ch = getch();
  } while ((ch &lt; '0') || (ch &gt; '7'));
  return (ch - '0'); /* turn into a number */
}
```
By using **ncurses**, we can add some visual interest. Lets add functions to display important text at the top of the screen and a message line to display status information at the bottom of the screen.
```
void
print_header(const char *text)
{
  move(0, 0);
  clrtoeol();
  attron(A_BOLD);
  mvaddstr(0, (COLS / 2) - (strlen(text) / 2), text);
  attroff(A_BOLD);
  refresh();
}
void
print_status(const char *text)
{
  move(LINES - 1, 0);
  clrtoeol();
 
  attron(A_REVERSE);
  mvaddstr(LINES - 1, 0, text);
  attroff(A_REVERSE);
  refresh();
}
```
With these functions, we can construct the main part of our number-guessing game. First, the program sets up the terminal for **ncurses**, then picks a random number from 0 to 7. After displaying a number scale, the program then enters a loop to ask the user for their guess.
As the user makes their guess, the program provides visual feedback. If the guess is too low, the program prints a left square bracket under the number on the screen. If the guess is too high, the game prints a right square bracket. This helps the user to narrow their choice until they guess the correct number.
```
int
main()
{
  int number, guess;
  initscr();
  cbreak();
  noecho();
  number = random0_7();
  mvprintw(1, COLS - 1, "%d", number); /* debugging */
  print_header("Guess the number 0-7");
  mvaddstr(9, (COLS / 2) - 7, "0 1 2 3 4 5 6 7");
  print_status("Make a guess...");
  do {
    guess = read_guess();
    move(10, (COLS / 2) - 7 + (guess * 2));
    if (guess &lt; number) {
      addch('[');
      print_status("Too low");
    }
    else if (guess &gt; number) {
      addch(']');
      print_status("Too high");
    }
    else {
      addch('^');
    }
  } while (guess != number);
  print_header("That's right!");
  print_status("Press any key to quit");
  getch();
  endwin();
  return 0;
}
```
Copy this program and compile it for yourself to try it out. Dont forget that you need to tell GCC to link with the **ncurses** library:
```
`$ gcc -o guess guess.c -lncurses`
```
Ive left the debugging line in there, so you can see the secret number near the upper-right corner of the screen:
![guess number game interface][3]
Figure 1: Guess the number game. Notice the secret number in the upper right.
### Get yourself going with ncurses
This program uses a bunch of other features of **ncurses** that you can use as a starting point. For example, the print_header function prints a message in bold text centered at the top of the screen, and the print_status function prints a message in reverse text at the bottom-left of the screen. Use this to help you get started with **ncurses** programming.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/guess-number-game-ncurses-linux
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/question-mark_chalkboard.jpg?itok=DaG4tje9 (question mark in chalk)
[2]: https://opensource.com/article/21/8/ncurses-linux
[3]: https://opensource.com/sites/default/files/guessnumber07.png

View File

@ -1,126 +0,0 @@
[#]: subject: "What is a container image?"
[#]: via: "https://opensource.com/article/21/8/container-image"
[#]: author: "Nived V https://opensource.com/users/nivedv"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
What is a container image?
======
A container image contains a packaged application, along with its
dependencies, and information on what processes it runs when launched.
![Shipping containers stacked][1]
Containers are a critical part of today's IT operations. A _container image_ contains a packaged application, along with its dependencies, and information on what processes it runs when launched.
You create container images by providing a set of specially formatted instructions, either as commits to a registry or as a Dockerfile. For example, this Dockerfile creates a container for a PHP web application:
```
FROM registry.access.redhat.com/ubi8/ubi:8.1
RUN yum --disableplugin=subscription-manager -y module enable php:7.3 \
  &amp;&amp; yum --disableplugin=subscription-manager -y install httpd php \
  &amp;&amp; yum --disableplugin=subscription-manager clean all
ADD index.php /var/www/html
RUN sed -i 's/Listen 80/Listen 8080/' /etc/httpd/conf/httpd.conf \
  &amp;&amp; sed -i 's/listen.acl_users = apache,nginx/listen.acl_users =/' /etc/php-fpm.d/www.conf \
  &amp;&amp; mkdir /run/php-fpm \
  &amp;&amp; chgrp -R 0 /var/log/httpd /var/run/httpd /run/php-fpm \
  &amp;&amp; chmod -R g=u /var/log/httpd /var/run/httpd /run/php-fpm
EXPOSE 8080
USER 1001
CMD php-fpm &amp; httpd -D FOREGROUND
```
Each instruction in this file adds a _layer_ to the container image. Each layer only adds the difference from the layer below it, and then, all these layers are stacked together to form a read-only container image.
### How does that work?
You need to know a few things about container images, and it's important to understand the concepts in this order:
1. Union file systems
2. Copy-on-Write
3. Overlay File Systems
4. Snapshotters
### Union File Systems (Aufs)
The Union File System (UnionFS) is built into the Linux kernel, and it allows contents from one file system to be merged with the contents of another, while keeping the "physical" content separate. The result is a unified file system, even though the data is actually structured in branches.
The idea here is that if you have multiple images with some identical data, instead of having this data copied over again, it's shared by using something called a _layer_.
![UnionFS][2]
Image CC BY-SA opensource.com
Each layer is a file system that can be shared across multiple containers, e.g., The httpd base layer is the official Apache image and can be used across any number of containers. Imagine the disk space we just saved since we are using the same base layer for all our containers.
These image layers are always read-only, but when we create a new container from this image, we add a thin writable layer on top of it. This writable layer is where you create/modify/delete or make other changes required for each container.
### Copy-on-write
When you start a container, it appears as if the container has an entire file system of its own. That means every container you run in the system needs its own copy of the file system. Wouldn't this take up a lot of disk space and also take a lot of time for the containers to boot? No—because every container does not need its own copy of the filesystem!
Containers and images use a copy-on-write mechanism to achieve this. Instead of copying files, the copy-on-write strategy shares the same instance of data to multiple processes and copies only when a process needs to modify or write data. All other processes would continue to use the original data. Before any write operation is performed in a running container, a copy of the file to be modified is placed on the writeable layer of the container. This is where the _write_ takes place. Now you know why it's called _copy-on-write_.
This strategy optimizes both image disk space usage and the performance of container start times and works in conjunction with UnionFS.
### Overlay File System
An overlay sits on top of an existing filesystem, combines an upper and lower directory tree, and presents them as a single directory. These directories are called _layers_. The lower layer remains unmodified. Each layer adds only the difference (the _diff_, in computing terminology) from the layer below it, and this unification process is referred to as a _union mount_.
The lowest directory or an Image layer is called _lowerdir_, and the upper directory is called _upperdir_. The final overlayed or unified layer is called _merged._
![Layered file system][3]
Image CC BY-SA opensource.com
Common terminology consists of these layer definitions:
* Base layer is where the files of your filesystem are located. In terms of container images, this layer would be your base image.
* Overlay layer is often called the _container layer_, as all the changes that are made to a running container, as adding, deleting, or modifying files, are written to this writable layer. All changes made to this layer are stored in the next layer, and is a _union_ view of the Base and Diff layers.
* Diff layer contains all changes made in the Overlay layer. If you write something that's already in the Base layer, then the overlay file system copies the file to the Diff layer and makes the modifications you intended to write. This is called a _copy-on-write_.
# Snapshotters
Containers can build, manage, and distribute changes as a part of their container filesystem using layers and graph drivers. But working with graph drivers is really complicated and is error-prone. SnapShotters are different from graph drivers, as they have no knowledge of images or containers.
Snapshotters work very similar to Git, such as the concept of having trees, and tracking changes to trees for each commit. A _snapshot_ represents a filesystem state. Snapshots have parent-child relationships using a set of directories. A _diff can_ be taken between a parent and its snapshot to create a layer.
The Snapshotter provides an API for allocating, snapshotting, and mounting abstract, layered file systems.
### Wrap up
You now have a good sense of what container images are and how their layered approach makes containers portable. Next up, I'll cover container runtimes and internals.
* * *
_This article is based on a [techbeatly][4] article and has been adapted with permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/container-image
作者:[Nived V][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/nivedv
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-containers.png?itok=d_4QhZxT (Shipping containers stacked)
[2]: https://opensource.com/sites/default/files/unionfs.png (UnionFS)
[3]: https://opensource.com/sites/default/files/rect1036.png (Layered file system)
[4]: https://medium.com/techbeatly/container-part-ii-images-4f2139194775

View File

@ -1,99 +0,0 @@
[#]: subject: "Zulip: An Interesting Open-Source Alternative to Slack"
[#]: via: "https://itsfoss.com/zulip/"
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Zulip: An Interesting Open-Source Alternative to Slack
======
_**Brief:** Zulip is an open-source collaboration platform that pitches itself as a better replacement to Slack. Let us take a closer look._
Messaging and collaboration platforms make a big difference when it comes to your work.
While there are several options available, Slack is a popular one used by many organizations. But, what about an open-source alternative to Slack that you can self-host?
Zulip is one such software.
### Zulip: Open Source Collaboration Messaging App
![][1]
If you want to explore, I must mention that there are more [open-source alternatives to Slack][2] out there.
Here, I focus on Zulip.
Zulip is a free and open-source messaging application with paid hosted options and the ability to self-host.
It aims to provide a similar experience to Slack while striving to help you improve the effectiveness of conversations using topics.
In contrast to channels in Slack, Zulip chat adds topics (which are like tags) to quickly filter through the conversations that matter to you.
### Features of Zulip
![][3]
You get most of the essential features with Zulip. To list the key highlights, you can find:
* Markdown support
* Topics for channels
* Drag and drop file support
* Code blocks
* GitHub integration to track issues
* Email notification support
* Self-host option
* Message editing
* GIPHY integration
* Video calls with Zoom, Jitsi, or BigBlueButton
In addition to the features mentioned, you should expect the basic options that you usually get with Slack and others.
Also, you can integrate it with Matrix and IRC if you want.
![][4]
In my brief test usage, the user interface is good enough for effective communication. However, I failed to find any dark mode or the ability to change a theme.
It looks more straightforward than Slack so that it can improve the user experience side of things.
### Install Zulip in Linux
Zulip is available as an AppImage file from its official website. You may refer to our guide on [using AppImage in Linux][5] in case you need help.
It is also available as a snap package. So, you can utilize either of them for any Linux distro.
You can also install it through the terminal for Ubuntu/Debian-based distros using APT. Take a look at its [official instructions][6] if you want that.
Zulip is available for Windows, Mac, and Linux. You should also find it available for Android and iOS mobile phones.
[Zulip][7]
Considering that you can use Zulip on the web, desktop, and smartphones, it is a suitable replacement for Slack.
_Have you tried it yet? What messaging platform do you use to collaborate for work? Feel free to share your thoughts in the comments._
--------------------------------------------------------------------------------
via: https://itsfoss.com/zulip/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-chat-new.png?resize=800%2C551&ssl=1
[2]: https://itsfoss.com/open-source-slack-alternative/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-chat-screenshot.png?resize=800%2C550&ssl=1
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/08/zulip-settings.png?resize=800%2C546&ssl=1
[5]: https://itsfoss.com/use-appimage-linux/
[6]: https://zulip.com/help/desktop-app-install-guide
[7]: https://zulip.com/

View File

@ -1,255 +0,0 @@
[#]: subject: "20 essential Linux commands for every user"
[#]: via: "https://opensource.com/article/21/9/essential-linux-commands"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
20 essential Linux commands for every user
======
From new user to power user, here are 20 Linux commands that will make
your life easier.
![Command line prompt][1]
Typing commands into a darkened terminal window may seem antiquated to some, but for many computer users, it's the most efficient, most accessible, and clearest way to accomplish nearly any task a computer is capable of performing. These days, thanks to all the projects that bring open source commands to non-open platforms like macOS and Windows, terminal commands are relevant to everybody, not just Linux and BSD users. It may surprise you to learn that there are thousands of commands installed on an average [POSIX][2] computer, but of course, a good many of those aren't really intended to be used, at least not directly or regularly. Some commands are more universally useful than others, and still fewer are absolutely essential for effective terminal use.
Here are the top 20 commands a terminal user might find themselves using:
### cd
Outside of a terminal, you click on icons to move from one folder to another, but in the terminal, you use `cd`. The `cd` command, which stands for _change directory_, is how you move through a Linux system. It's the fastest and most direct route from one place to another.
For instance, on the desktop, when you want to move from your home directory (the place you keep all of your folders) to a folder called `presentations`, then you might first have to open your `Documents` folder, then open a folder called `work`, then a `projects` folder, and then the `conference` folder, and finally the `presentations` folder, which contains your exciting LibreOffice Impress slideshow. That's a lot of double-clicking. It may also be a lot of moving around on the screen, depending on where new windows appear, and a lot of waypoints for your brain to track. Many people circumvent this seemingly minor task by keeping _everything_ on their desktop.
Terminal users avoid this issue by just typing:
```
`$ cd ~/Documents/work/projects/conference/presentations`
```
Experienced terminal users don't even bother typing all of that. They use the **Tab** key to autocomplete the words for them. And sometimes, you don't even have to resort to autocompletion. You can use wildcards instead:
```
`$ cd ~/Doc*/work/*/conf*/p*`
```
### pwd
In the words of Buckaroo Banzai: "No matter where you go, there you are."
When you need to figure out where exactly that is, you use the `pwd` command. The `pwd` stands for _print working directory,_ and that's exactly what it does. The `--physical` (or just `-P` in some implementations) shows your location with all symlinks resolved.
```
$ pwd
/home/tux/presentation
$ pwd --physical
/home/tux/Documents/work/projects/conference/presentations
```
### sed
Better known as `sed`, the stream editor is a powerful bulk _find and replace_ command, but it's also a legitimate text editor. You can learn to use it by reading my [introductory article][3], and then become an expert with my [advanced tutorial and cheat sheet][4].
### grep
The `grep` command is so ubiquitous that it's often used as a verb ("I'll grep through some files") and a gerund ("grepping some output"). It's a key component when parsing text in your shell, whether you're looking through log files or parsing the output of some other command. It's a way for the busy user to focus on specific information. Given just how much data there is in the computing world, there's no wonder it's a popular command. Go grok grep by reading my [introductory article][5], and then download the [cheat sheet][6].
### file
Use the `file` command when you need to know what type of data a file contains:
```
$ file example.foo
example.foo: RIFF (little-endian) data, Web/P image [...]
$ file example.bar
example.bar: ELF 64-bit LSB executable, x86-64 [...]
```
The `file` command isn't magic, of course. It only reports based on how a file identifies itself, and files can be wrong, corrupted, or disguised. A rigorous inspection with [`hexdump`][7] provides more certainty, but for casual use, the `file` command is convenient.
### awk
Awk isn't just a command; it's a literal [programming language][8]. [Download our free Awk ebook][9], learn it, and you'll be writing scripts you never thought possible.
### curl
The `curl` command is a [non-interactive web browser][10] for your terminal. It's a [development tool][11] for web and API developers. It's a complex command for its flexibility, but it's worth learning if you want to interact with network services from your terminal smoothly.
Download our free [`curl` cheat sheet][12], so you can internalize its many options.
### ps
Managing your system's resources is mostly up to the kernel, but when you prefer or require a manual approach, there's the `ps` command. Learn about `ps` in my [monitor your Linux system with procps-ng][13] article.
### cat
The [`cat` command][14] is short for _concatenate_, and it was very useful once for joining files that had been split (with a command intuitively called `split`) into several small files due to size limitations. Today, `cat` is mostly used as a way to dump the contents of a text file into your terminal for quick reference, unless you use `head`, `tail`, `more`, or `less` for that.
Despite its almost deprecated original purpose, and despite that several other commands also perform its secondary function, `cat` is still a useful utility. For instance, it can be a stand-in for the copy (`cp`) command:
```
`$ cat myfile.ogg > /backups/myfile.ogg`
```
It can reveal inconvenient invisible characters in files. The **Tab** character, which breaks [YAML][15], shows up as `^I` with the `--show-tabs` option:
```
$ cat --show-tabs my.yaml
\---
\- hosts: all
  tasks:
  - name: Make sure the current version of 'sysstat' is installed.
    dnf:
     name:
^I- sysstat
^I- httpd
^I- mariadb-server
     state: latest
```
It can show non-printing characters with `--show-nonprinting`, mark the ends of lines with `--show-ends`, provide line numbers with `--number`, and more.
### find
The `find` command helps you find files, but thanks to its many options, it can help you find files with a variety of filters and parameters. Learn the basics from my [introductory article][16].
And in case you've been wondering why the most fundamental command of all, the humble [`ls` command][17], isn't on this list, it's because of the flexibility of `find`. Not only can find list files:
```
$ find .
./bar.txt
./baz.xml
./foo.txt
[...]
```
It can also provide long listings:
```
$ find . -ls
3014803  464 -rw-rw-r--   1 tux users  473385 Jul 26 07:25 ./foo.txt
3014837  900 -rwxrwxr-x   1 tux users  918217 Nov  6  2019 ./baz.xml
3026891  452 -rw-rw-r--   1 tux users  461354 Aug 10 13:41 ./foo.txt
[...]
```
It's a technicality, but a neat trick to know.
### tar
People sometimes joke about Linux commands by citing BSD's `tar` syntax. In spite of its reputation, the `tar` command can actually be very intuitive. Read my [how to unzip a tar.gz file][18] article to learn the simple secret to rattling off a `tar` command on demand.
### more or less or most
Pagers are like `cat`, except they pause their output at the bottom of your screen until you scroll down for more. It's a simple application, but there's nuance to each implementation. Do you scroll with arrow keys or the spacebar? Do you have to quit manually, or does the pager exit at the end of the file it's displaying? What's your preferred search behavior? Choose your favorite pager and set it in your `.bashrc`!
### ssh and scp
OpenSSH not only helps secure connections to remote systems it also enables other commands. For instance, for many users, it's their `.ssh` directory that makes it possible for them to interact smoothly with Git repositories, post updates to a website, or log in to their cloud's control plane.
### mv
The `mv` command does double-duty: It both [moves files][19] and it [renames files][20]. It has several available safeguards, including `--interactive` and `--no-clobber` options to avoid clobbering an existing file, a `--backup` command to ensure data is preserved until it is verified at its new location, and the `--update` option to ensure that an older version doesn't replace a newer file.
### sudo
When you have a single user with a known user name and _all_ the privileges on a system, that user quickly becomes the target of attacks. By eliminating the need for a literal `root` user, the `sudo` command elegantly removes important information about your system from general knowledge. That's not all it does, though. With `sudo`, you can easily manage privileges down to individual commands, users, and groups. You can enable password-less execution of select commands, record user sessions, verify commands with digest validation, [and more][21].
### alias
Turn long commands into easy-to-remember shortcuts by using the `alias` command:
```
`$ alias ls='ls --classify --almost-all --ignore-backups --color'`
```
### clear
Sometimes your terminal gets cluttered. There's nothing like a nice, fresh screen after typing `clear` (or pressing **Ctrl+L** in some shells).
### setfacl
Traditionally, POSIX file permissions were determined by `chown` and `chmod`. Systems have become more complex, though, so there's a command to provide a little more flexibility. The `setfacl` command lets you create an [Access Control List (ACL)][22], granting permissions to arbitrary users and setting default permissions for folders and the contents created within them.
### netcat
Not every user needs netcat (`nc`), but few who use it ever want to give it up. The `nc` command is an all-purpose network connection tool.
It can connect to a port, similar to `telnet`:
```
`$ nc -u 192.168.0.12 80`
```
It can ping a port, similar to `ping`:
```
`$ nc -zvn 192.168.0.12 25`
```
It can probe for open ports, similar to `nmap`:
```
`$ nc -zv 192.168.0.12 25-80`
```
And that's just a small sample.
### you
The Linux terminal is, in part, about creative problem-solving. When you learn commands, you're also learning building blocks you can use to create your own commands. Many of the commands in my [shell history][23] are shell scripts I've written myself. The result is that my workflow is customized to how I want to work. Essential commands in your shell can also be the ones you design for your own efficacy and comfort. Spend some time getting to know some great commands, and then build your own. And when you hit upon something really good, make it open source so you can share your ideas with others!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/essential-linux-commands
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: https://opensource.com/article/20/12/sed
[4]: https://opensource.com/article/21/3/sed-cheat-sheet
[5]: https://opensource.com/article/21/3/grep-cheat-sheet
[6]: https://opensource.com/downloads/grep-cheat-sheet
[7]: https://opensource.com/article/19/8/dig-binary-files-hexdump
[8]: https://opensource.com/article/21/1/learn-awk
[9]: https://opensource.com/article/20/9/awk-ebook
[10]: https://opensource.com/article/20/5/curl-cheat-sheet
[11]: https://www.redhat.com/sysadmin/use-curl-api
[12]: https://opensource.com/downloads/curl-command-cheat-sheet
[13]: https://opensource.com/article/21/8/linux-procps-ng
[14]: https://opensource.com/article/19/2/getting-started-cat-command
[15]: https://www.redhat.com/sysadmin/yaml-beginners
[16]: https://opensource.com/article/21/8/find-files-and-directories-find
[17]: https://opensource.com/article/19/7/master-ls-command
[18]: https://opensource.com/article/17/7/how-unzip-targz-file
[19]: https://opensource.com/article/21/8/move-files-linux
[20]: https://opensource.com/article/21/8/rename-file-linux-terminal
[21]: https://opensource.com/article/19/10/know-about-sudo
[22]: https://opensource.com/article/20/3/external-drives-linux
[23]: https://opensource.com/article/18/6/history-command

View File

@ -1,97 +0,0 @@
[#]: subject: "What are container runtimes?"
[#]: via: "https://opensource.com/article/21/9/container-runtimes"
[#]: author: "Nived V https://opensource.com/users/nivedv"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
What are container runtimes?
======
Take a deep dive into container runtimes so you can understand how
container environments are built.
![Ships at sea on the web][1]
In my examination of [container images][2], I discussed container fundamentals, but now it's time to delve deeper into container runtimes so you can understand how container environments are built. The information in this article is in part extracted from the [official documentation][3] of the Open Container Initiative (OCI), the open standard for containers, so this information is relevant regardless of your container engine.
### Container runtimes
So what really happens in the backend when you run a command like `podman run` or `docker run` command? Here is a step-by-step overview for you:
1. The image is pulled from an image registry if it not available locally
2. The image is extracted onto a copy-on-write filesystem, and all the container layers overlay each other to create a merged filesystem
3. A container mount point is prepared
4. Metadata is set from the container image, including settings like overriding CMD, ENTRYPOINT from user inputs, setting up SECCOMP rules, etc., to ensure container runs as expected
5. The kernel is alerted to assign some sort of isolation, such as process, networking, and filesystem, to this container (namespaces)
6. The kernel is also alerted to assign some resource limits like CPU or memory limits to this container (cgroups)
7. A system call (syscall) is passed to the kernel to start the container
8. SELinux/AppArmor is set up
Container runtimes take care of all of the above. When we think about container runtimes, the things that come to mind are probably runc, lxc, containerd, rkt, cri-o, and so on. Well, you are not wrong. These are container engines and container runtimes, and each is built for different situations.
_Container runtimes_ focus more on running containers, setting up namespace and cgroups for containers, and are also called lower-level container runtimes. Higher-level container runtimes or container engines focus on formats, unpacking, management, and image-sharing. They also provide APIs for developers.
### Open Container Initiative (OCI)
The Open Container Initiative (OCI) is a Linux Foundation project. Its purpose is to design certain open standards or a structure around how to work with container runtimes and container image formats. It was established in June 2015 by Docker, rkt, CoreOS, and other industry leaders.
It does this using two specifications:
#### 1\. Image Specification (image-spec)
The goal of this specification is to enable the creation of interoperable tools for building, transporting, and preparing a container image to run.
The high-level components of the spec include:
* [Image Manifest][4] — a document describing the elements that make up a container image
* [Image Index][5] — an annotated index of image manifests
* [Image Layout][6] — a filesystem layout representing the contents of an image
* [Filesystem Layer][7] — a changeset that describes a containers filesystem
* [Image Configuration][8] — a document determining layer ordering and configuration of the image suitable for translation into a [runtime bundle][9]
* [Conversion][10] — a document explaining how this translation should occur
* [Descriptor][11] — a reference that describes the type, metadata, and content address of referenced content
#### 2\. Runtime specification (runtime-spec)
This specification aims to define the configuration, execution environment, and lifecycle of a container. The config.json file provides the container configuration for all supported platforms and details the field that enables the creation of a container. The execution environment is detailed along with the common actions defined for a containers lifecycle to ensure that applications running inside a container have a consistent environment between runtimes.
The Linux container specification uses various kernel features, including namespaces, cgroups, capabilities, LSM, and filesystem jails to fulfill the spec.
### Now you know
Container runtimes are managed by the OCI specifications to provide consistency and interoperability. Many people use containers without the need to understand how they work, but understanding containers is a valuable advantage when you need to troubleshoot or optimize how you use them.
* * *
_This article is based on a [techbeatly][12] article and has been adapted with permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/container-runtimes
作者:[Nived V][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/nivedv
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kubernetes_containers_ship_lead.png?itok=9EUnSwci (Ships at sea on the web)
[2]: https://opensource.com/article/21/8/container-fundamentals-2
[3]: https://github.com/opencontainers
[4]: https://github.com/opencontainers/image-spec/blob/master/manifest.md
[5]: https://github.com/opencontainers/image-spec/blob/master/image-index.md
[6]: https://github.com/opencontainers/image-spec/blob/master/image-layout.md
[7]: https://github.com/opencontainers/image-spec/blob/master/layer.md
[8]: https://github.com/opencontainers/image-spec/blob/master/config.md
[9]: https://github.com/opencontainers/runtime-spec
[10]: https://github.com/opencontainers/image-spec/blob/master/conversion.md
[11]: https://github.com/opencontainers/image-spec/blob/master/descriptor.md
[12]: https://medium.com/techbeatly/container-runtimes-deep-dive-77eb0e511939

View File

@ -0,0 +1,341 @@
[#]: subject: "Get started programming with DOS conio"
[#]: via: "https://opensource.com/article/21/9/programming-dos-conio"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Get started programming with DOS conio
======
Create various practical and exciting applications by programming with
conio.
![Person using a laptop][1]
One of the reasons so many DOS applications sported a text user interface (or TUI) is because it was so easy to do. The standard way to control **con**sole **i**nput and **o**utput (**conio**) was with the `conio` library for many C programmers. This is a de-facto standard library on DOS, which gained popularity as implemented by Borland's proprietary C compiler as `conio.h`. You can also find a similar `conio` implementation in TK Chia's IA-16 DOS port of the GNU C Compiler in the `libi86` library of non-standard routines. The library includes implementations of `conio.h` functions that mimic Borland Turbo C++ to set video modes, display colored text, move the cursor, and so on.
For years, FreeDOS included the OpenWatcom C Compiler in the standard distributions. OpenWatcom supports its own version of `conio`, implemented in `conio.h` for particular console input and output functions, and in `graph.h` to set colors and perform other manipulation. Because the OpenWatcom C Compiler has been used for a long time by many developers, this `conio` implementation is also quite popular. Let's get started with the OpenWatcom `conio` functions.
### Setting the video mode
Everything you do is immediately displayed on-screen via hardware. This is different from the `ncurses` library on Linux, where everything is displayed through terminal emulation. On DOS, everything is running on hardware. And that means DOS `conio` programs can easily access video modes and leverage screen regions in ways that are difficult using Linux `ncurses`.
To start, you need to set the _video mode_. On OpenWatcom, you do this with the `_setvideomode` function. This function takes one of several possible values, but for most programs that run in color mode in a standard 80x25 screen, use `_TEXTC80` as the mode.
```
#include &lt;conio.h&gt;
#include &lt;graph.h&gt;
int
main()
{
  _setvideomode(_TEXTC80);
  … 
```
When you're done with your program and ready to exit back to DOS, you should reset the video mode back to whatever values it had before. For that, you can use `_DEFAULTMODE` as the mode.
```
 _setvideomode(_DEFAULTMODE);
  return 0;
}
```
### Setting the colors
Every PC built after 1981's Color/Graphics Adapter supports [16 text colors and 8 background colors][2]. Background colors are addressed with color indices 0 through 7, and text colors can be any value from 0 to 15:
| | | | | | | --------- | | ----------------- | | | 0 Black | | 8 Bright Black | | | 1 Blue | | 9 Bright Blue | | | 2 Green | | 10 Bright Green | | | 3 Cyan | | 11 Bright Cyan | | | 4 Red | | 12 Bright Red | | | 5 Magenta | | 13 Bright Magenta | | | 6 Brown | | 14 Yellow | | | 7 White | | 15 Bright White |
You can set both the text color and the color behind it. Use the `_settextcolor` function to set the text "foreground" color and `_setbkcolor` to set the text "background" color. For example, to set the colors to yellow text on a red background, you would use this pair of functions:
```
 _settextcolor(14);
 _setbkcolor(4);
```
### Positioning text
In `conio`, screen coordinates are always _row_,_col_ and start with 1,1 in the upper-left corner. For a standard 80-column display with 25 lines, the bottom-right corner is 25,80.
Use the `_settextposition` function to move the cursor to a specific screen coordinate, then use `_outtext` to print the text you want to display. If you've set the colors, your text will use the colors you last defined, regardless of what's already on the screen.
For example, to print the text "FreeDOS" at line 12 and column 36 (which is more or less centered on the screen) use these two functions:
```
  _settextposition(12, 36);
  _outtext("FreeDOS");
```
Here's a small example program:
```
#include &lt;conio.h&gt;
#include &lt;graph.h&gt;
int
main()
{
    _setvideomode(_TEXTC80);
    _settextcolor(14);
    _setbkcolor(4);
    _settextposition(12, 36);
    _outtext("FreeDOS");
    [getch][3]();
    _setvideomode(_DEFAULTMODE);
    return 0;
}
```
Compile and run the program to see this output:
![Print to the screen with conio][4]
(Jim Hall, [CC BY-SA 4.0][5])
### Text windows
The trick to unleashing the power of `conio` is to leverage a feature of the PC video display where a program can control the video hardware by region. These are called text windows and are a really cool feature of `conio`.
A text window is just an area of the screen, defined as a rectangle starting at a particular _row_,_col_ and ending at a different _row_,_col_. These regions can take up the whole screen or be as small as a single line. Once you define a window, you can clear it with a background color and position text in it.
To define a text window starting at row 5 and column 10, and extending to row 15 and column 70, you use the `_settextwindow` function like this:
```
`  _settextwindow(5, 10, 15, 70);`
```
Now that you've defined the window, any text you draw in it uses 1,1 as the upper-left corner of the text window. Placing text at 1,1 will actually position that text at row 5 and column 10, where the window starts on the screen.
You can also clear the window with a background color. The `_clearscreen` function does double duty to clear either the full screen or just the window that's currently defined. To clear the entire screen, give the value `_GCLEARSCREEN` to the function. To clear just the window, use `_GWINDOW`. With either usage, you'll fill that region with whatever background color you last set. For example, to clear the whole screen with cyan (color 3) and a smaller text window with blue (color 1) you could use this code:
```
  _clearscreen(_GCLEARSCREEN);
  _setbkcolor(3);
  _settextwindow(5, 10, 15, 70);
  _setbkcolor(1);
  _clearscreen(_GWINDOW);
```
This makes it really easy to fill in certain areas of the screen. In fact, defining a window and filling it with color is such a common thing to do that I often create a function to do both at once. Many of my `conio` programs include some variation of these two functions to clear the screen or window:
```
#include &lt;conio.h&gt;
#include &lt;graph.h&gt;
void
clear_color(int fg, int bg)
{
  _settextcolor(fg);
  _setbkcolor(bg);
  _clearscreen(_GCLEARSCREEN);
}
void
textwindow_color(int top, int left, int bottom, int right, int fg, int bg)
{
  _settextwindow(top, left, bottom, right);
  _settextcolor(fg);
  _setbkcolor(bg);
  _clearscreen(_GWINDOW);
}
```
A text window can be any size, even a single line. This is handy to define a title bar at the top of the screen or a status line at the bottom of the screen. Again, I find this to be such a useful addition to my programs that I'll frequently write functions to do it for me:
```
#include &lt;conio.h&gt;
#include &lt;graph.h&gt;
#include &lt;string.h&gt;                    /* for strlen */
void
clear_color(int fg, int bg)
{
  … 
}
void
textwindow_color(int top, int left, int bottom, int right, int fg, int bg)
{
  … 
}
void
print_header(int fg, int bg, const char *text)
{
  textwindow_color(1, 1, 1, 80, fg, bg);
  _settextposition(1, 40 - (strlen(text) / 2));
  _outtext(text);
}
void
print_status(int fg, int bg, const char *text)
{
  textwindow_color(25, 1, 25, 80, fg, bg);
  _settextposition(1, 1);
  _outtext(text);
}
```
### Putting it all together
With this introduction to `conio`, and with the set of functions we've defined above, you can create the outlines of almost any program. Let's write a quick example that demonstrates how text windows work with `conio`. We'll clear the screen with a color, then print some sample text on the second line. That leaves room to put a title line at the top of the screen. We'll also print a status line at the bottom of the screen.
This is the basics of many kinds of applications. Placing a text window towards the right of the screen could be useful if you were writing a "monitor" program, such as part of a control system, like this:
```
#include &lt;conio.h&gt;
#include &lt;graph.h&gt;
int
main()
{
  _setvideomode(_TEXTC80);
  clear_color(7, 1);                   /* white on blue */
  _settextposition(2, 1);
  _outtext("test");
  print_header(0, 7, "MONITOR");       /* black on white */
  textwindow_color(3, 60, 23, 79, 15, 3);       /* br white on cyan */
  _settextposition(3, 2);
  _outtext("hi mom");
  print_status(0, 7, "press any key to quit...");       /* black on white */
  getch();
  _setvideomode(_DEFAULTMODE);
  return 0;
}
```
Having already written our own window functions to do most of the repetitive work, this program becomes very straightforward: clear the screen with a blue background, then print "test" on the second line. There's a header line and a status line, but the interesting part is in the middle where the program defines a text window near the right edge of the screen and prints some sample text. The `getch()` function waits for the user to press a key on the keyboard, useful when you need to wait until the user is ready:
![Conio mon][6]
(Jim Hall, [CC BY-SA 4.0][5])
We can change only a few values to completely change the look and function of this program. By setting the background to green and red text on a white window, we have the start of a solitaire card game:
```
#include &lt;conio.h&gt;
#include &lt;graph.h&gt;
int
main()
{
  _setvideomode(_TEXTC80);
  clear_color(7, 2);                   /* white on green */
  _settextposition(2, 1);
  _outtext("test");
  print_header(14, 4, "SOLITAIRE");    /* br yellow on red */
  textwindow_color(10, 10, 17, 22, 4, 7);       /* red on white */
  _settextposition(3, 2);
  _outtext("hi mom");
  print_status(7, 6, "press any key to quit...");       /* white on brown */
  getch();
  _setvideomode(_DEFAULTMODE);
  return 0;
}
```
You could add other code to this sample program to print card values and suits, place cards on top of other cards, and other functionality to create a complete game. But for this demo, we'll just draw a single "card" displaying some text:
![Conio solitaire][7]
(Jim Hall, [CC BY-SA 4.0][5])
You can create other effects using text windows. For example, before drawing a message window, you could first draw a black window that's offset by one row and one column. The text window will appear to create a shadow over that area of the screen to the user. And we can do it all by changing only a few values in our sample program:
```
#include &lt;conio.h&gt;
#include &lt;graph.h&gt;
int
main()
{
  _setvideomode(_TEXTC80);
  clear_color(7, 1);                   /* white on blue */
  _settextposition(2, 1);
  _outtext("test");
  print_header(15, 3, "PROGRAMMING IN CONIO");  /* br white on cyan */
  textwindow_color(11, 36, 16, 46, 7, 0);       /* shadow */
  textwindow_color(10, 35, 15, 45, 7, 4);       /* white on red */
  _settextposition(3, 2);
  _outtext("hi mom");
  print_status(0, 7, "press any key to quit...");       /* black on white */
  getch();
  _setvideomode(_DEFAULTMODE);
  return 0;
}
```
You often see this "shadow" effect used in DOS programs as a way to add some visual flair:
![Conio Window with shadow][8]
(Jim Hall, [CC BY-SA 4.0][5])
The DOS `conio` functions can do much more than I've shown here, but with this introduction to `conio` programming, you can create various practical and exciting applications. Direct screen access means your programs can be more interactive than a simple command-line utility that scrolls text from the bottom of the screen. Leverage the flexibility of `conio` programming and make your next DOS program a great one.
### Download the conio cheat sheet
As you explore programming with `conio`, it's helpful to have a list of common functions close at hand. I've created a double-sided cheat sheet with all the basics of `conio`, so **[download it][9]** and use it on your next `conio` project.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/programming-dos-conio
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
[2]: https://opensource.com/article/21/6/freedos-sixteen-colors
[3]: http://www.opengroup.org/onlinepubs/009695399/functions/getch.html
[4]: https://opensource.com/sites/default/files/conio-hello.png (Print to the screen with conio)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://opensource.com/sites/default/files/uploads/conio-mon.png (Conio mon)
[7]: https://opensource.com/sites/default/files/uploads/conio-sol.png (Conio solitaire)
[8]: https://opensource.com/sites/default/files/uploads/conio-win.png (Conio Window with shadow)
[9]: https://opensource.com/downloads/dos-conio-cheat-sheet

View File

@ -0,0 +1,97 @@
[#]: subject: "How to Completely Uninstall Google Chrome From Ubuntu"
[#]: via: "https://itsfoss.com/uninstall-chrome-from-ubuntu/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Completely Uninstall Google Chrome From Ubuntu
======
So, you managed to [install Google Chrome on Ubuntu][1]. It is the most popular web browser in the world, after all.
But perhaps you dislike Google products for the heavy tracking and data mining they employ on its users. You decided to opt for [other web browsers on Ubuntu][2], perhaps a [non-Chromium browser][3].
Now that you are no longer using it, it would be wise to remove [Google Chrome][4] from Ubuntu.
How to do that? Let me show you the steps.
### Remove Google Chrome completely from Ubuntu
![Illustration for removing Google Chrome from Ubuntu][5]
You probably installed Google Chrome graphically. Unfortunately, youll have to resort to command line for removing it, unless you opt to [use Synaptic Package Manager][6].
It is not too difficult. Press the [Ctrl+Alt+T keyboard shortcut in Ubuntu to open a terminal][7].
Type the following command in the terminal:
```
sudo apt purge google-chrome-stable
```
It asks for a password. It is your user accounts password, the one which you use to log in to your Ubuntu system.
When you type the password, nothing is displayed on the screen. This is normal behavior in Linux. Just type the password blindly and press enter.
It will ask you to confirm the removal of Google Chrome by entering Y or simply pressing the enter key.
![Removing Google Chrome for Ubuntu][8]
This will remove Google Chrome from your Ubuntu Linux system along with most of the system files.
However, the personal setting files remain in your home directory. This includes things like cookie sessions, bookmarks and other Chrome related settings for your user account. If you install Google Chrome again, the same files could be used by Chrome again.
![Google Chrome leftover settings in Ubuntu][9]
If you want to completely uninstall Google Chrome, you may want to remove these files as well. Heres what you should do.
Change to the .config directory. _**Mind the dot before config**_. Thats the [way to hide files and folders in Linux][10].
```
cd ~/.config
```
And now remove the google-chrome directory:
```
rm -rf google-chrome
```
![Removing the leftover Google Chrome settings from Ubuntu][11]
You could have also used rm -rf ~/.config/google-chrome to delete it in one single command. Since this tutorial is focused on absolute beginners, I made it in two steps to reduce the error margin because of a typo.
Tip
Want to make your terminal look beautiful like the ones in the screenshot? Use these [terminal customization tips][12].
I hope this quick beginner tip helped you to get rid of Google Chrome from Ubuntu Linux.
--------------------------------------------------------------------------------
via: https://itsfoss.com/uninstall-chrome-from-ubuntu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/install-chrome-ubuntu/
[2]: https://itsfoss.com/best-browsers-ubuntu-linux/
[3]: https://itsfoss.com/open-source-browsers-linux/
[4]: https://www.google.com/chrome/index.html
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/removing-google-chrome-ubuntu.png?resize=800%2C450&ssl=1
[6]: https://itsfoss.com/synaptic-package-manager/
[7]: https://itsfoss.com/open-terminal-ubuntu/
[8]: https://itsfoss.com/wp-content/uploads/2021/09/remove-google-chrome-ubuntu.webp
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/google-chrome-ubuntu-leftover-settings.png?resize=800%2C518&ssl=1
[10]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/remove-google-chrome-leftover-settings-from-Ubuntu.png?resize=800%2C277&ssl=1
[12]: https://itsfoss.com/customize-linux-terminal/

View File

@ -0,0 +1,211 @@
[#]: subject: "Install ONLYOFFICE Docs on Fedora Linux with Podman and connect it with Nextcloud"
[#]: via: "https://fedoramagazine.org/instal-onlyoffice-docs-on-fedora-linux-with-podman/"
[#]: author: "kseniya_fedoruk https://fedoramagazine.org/author/kseniya_fedoruk/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Install ONLYOFFICE Docs on Fedora Linux with Podman and connect it with Nextcloud
======
![][1]
Photo by [Chris Leggat][2] on [Unsplash][3]
If you need a reliable office suite for online editing and collaboration within your sync &amp; share platform, you can try ONLYOFFICE Docs. In this tutorial, we learn how to install it on your Fedora Linux with Podman and discover the ONLYOFFICE-Nextcloud integration.
### What is ONLYOFFICE Docs
[ONLYOFFICE Docs][4] (Document Server) is an open-source office suite distributed under GNU AGPL v3.0. It is comprised of web-based viewers and collaborative editors for text documents, spreadsheets, and presentations. The suite is highly compatible with OOXML formats (docx, xlsx, pptx).
A brief features overview includes:
* Full set of editing and styling tools, operations with fonts and styles, paragraph and text formatting.
* Inserting and customizing all kinds of objects: shapes, charts, text art, text boxes, etc.
* Academic formatting and navigation: endnotes, footnotes, table of contents, bookmarks.
* Content Controls for creating digital forms and templates.
* Extending functionality with plugins, building your own plugins using API.
* Collaborative features: real-time and paragraph-locking co-editing modes, review and track changes, comments and mentions, integrated chat, version history.
* Flexible access permissions: edit, view, comment, fill forms, review, restriction on copying, downloading, and printing, custom filter for spreadsheets.
![][5]
You can integrate ONLYOFFICE Docs with various cloud services such as Nextcloud, ownCloud, Seafile, Alfresco, Plone, etc. Whats more, developers can embed the editors into their own solutions. 
You can also use the suite together with [ONLYOFFICE Groups][6], a free open-source collaboration platform distributed under Apache 2.0. The complete solution is available as [ONLYOFFICE Workspace.][7]
### What is Podman
Podman is a daemonless container engine for developing, managing, and running OCI containers on your Linux system. Users can run containers either as root or in rootless mode. 
It is available by default on Fedora Workstation. If its not the case, install podman with the command:
```
sudo dnf install podman
```
### What you need for ONLYOFFICE Docs installation
* CPU: single core 2 GHz or better
* RAM: 2 GB or more
* HDD: at least 40 GB of free space
* At least 4 GB of swap
### Install and run ONLYOFFICE Docs
Start with the following commands for the root-privileged deployment. This creates directories for mounting from the container to the host system:
```
$ sudo mkdir -p /app/onlyoffice/DocumentServer/logs \
/app/onlyoffice/DocumentServer/data \
/app/onlyoffice/DocumentServer/lib \
/app/onlyoffice/DocumentServer/db
```
Now mount these directories via podman. When prompted, select the image from docker.io):
```
$ sudo podman run -i -t -d -p 80:80 -p 443:443 --restart=always \
-v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice:Z \
-v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data:Z \
-v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice:Z \
-v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql:Z \
-u root onlyoffice/documentserver:latest
```
Please note that rootless deployment is NOT recommended for ONLYOFFICE Docs.
To check that ONLYOFFICE is working correctly, run:
```
$ sudo podman exec $(sudo podman ps -q) sudo supervisorctl start ds:example
```
Then, open <http://localhost/welcome> and click the word “here” in the line _Once started the example will be available here_. Or look for the orange “button” that says “GO TO TEST EXAMPLE”. This opensthe test example where you can create a document.
Alternatively, to install ONLYOFFICE Docs, you can build an image in podman:
```
$ git clone https://github.com/ONLYOFFICE/Docker-DocumentServer.git
$ cd Docker-DocumentServer/
$ sudo podman build --tag oods6.2.0:my -f ./Dockerfile
```
Or build an image from the Docker file in buildah (you need root access):
```
$ buildah bud --tag oods6.2.0buildah:mybuildah -f ./Dockerfile
```
### Activate HTTPS
To secure the application via SSL basically two things are needed:
* Private key (.key)
* SSL certificate (.crt)
So you need to create and install the following files:
```
/app/onlyoffice/DocumentServer/data/certs/onlyoffice.key
/app/onlyoffice/DocumentServer/data/certs/onlyoffice.crt
```
You can get certificates in several ways depending on your requirements: buy from certification centers, request from [Lets Encrypt,][8] or create a [self-signed certificate][9] through OpenSSL (note that self-signed certificates are not recommended for production use).
Secure ONLYOFFICE Docs switching to the HTTPS protocol:
```
$ sudo mkdir /app/onlyoffice/DocumentServer/data/certs
$ sudo cp onlyoffice.crt /app/onlyoffice/DocumentServer/data/certs/
$ sudo cp onlyoffice.key /app/onlyoffice/DocumentServer/data/certs/
$ sudo chown -R 100108:100111 /app/onlyoffice/DocumentServer/data/certs/
# find the podman container id
$ sudo podman ps -a
# restart the container to use the new certificate
$ sudo podman restart {container_id}
```
Now you can integrate ONLYOFFICE Docs with the platform you already use and start working with your documents.
### ONLYOFFICE-Nextcloud integration example
To connect ONLYOFFICE Docs and Nextcloud (or any other DMS), you need a connector. This is an integration app that functions like a bridge between two services.  
In case youre new to Nextcloud, you can install it with Podman following [this tutorial][10].   
If you already have Nextcloud installed, you just need to install and activate the connector. Do this with the following steps:
1. launch your Nextcloud as an admin,
2. click your user icon in the upper right corner,
3. switch to + Apps,
4. find ONLYOFFICE in the list of available applications in the section “Office &amp; text”,
5. click the Download and enable button. 
ONLYOFFICE now appears in the Active apps section and you can go ahead with the configuration. 
Select your user icon again in the upper right corner -&gt; Settings -&gt; Administration -&gt; ONLYOFFICE. On the settings page, you can configure:
* The address of the machine with ONLYOFFICE installed
* Secret key (JWT that protects docs from unauthorized access)
* ONLYOFFICE and Nextcloud addresses for internal requests
![][11]
You can also adjust additional settings which are not mandatory but will make your user experience more comfortable:
* Restrict access to the editors to user groups
* Enable/disable the Open file in the same tab option
* Select file formats that will be opened by default with ONLYOFFICE
* Customize editor interface
* Enable watermarking
![][12]
### Conclusion
Installing ONLYOFFICE Docs on Fedora Linux with Podman is quite easy. It will give you a powerful office suite for integration into any Document Managemet System.
```
```
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/instal-onlyoffice-docs-on-fedora-linux-with-podman/
作者:[kseniya_fedoruk][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/kseniya_fedoruk/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/08/onlyoffice-podman-nextcloud-816x345.jpg
[2]: https://unsplash.com/@chris_legs?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/sharing-writing?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://www.onlyoffice.com/office-suite.aspx
[5]: https://fedoramagazine.org/wp-content/uploads/2021/07/ONLYOFFICE-Docs-dark-theme-1024x585.png
[6]: https://www.onlyoffice.com/collaboration-platform.aspx
[7]: https://www.onlyoffice.com/workspace.aspx
[8]: https://letsencrypt.org/
[9]: https://www.server-world.info/en/note?os=Fedora_31&p=ssl&f=1
[10]: https://fedoramagazine.org/nextcloud-20-on-fedora-linux-with-podman/
[11]: https://fedoramagazine.org/wp-content/uploads/2021/07/1-server-settings-1024x611.png
[12]: https://fedoramagazine.org/wp-content/uploads/2021/07/nc-settings-1-1024x574.png

View File

@ -0,0 +1,191 @@
[#]: subject: "Monitor your Linux server with Checkmk"
[#]: via: "https://opensource.com/article/21/8/monitor-linux-server-checkmk"
[#]: author: "Ferdinand https://opensource.com/users/ferdinand-kunz"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Monitor your Linux server with Checkmk
======
Install Checkmk, the monitoring tool from tribe29, to monitor servers
and network devices
![People work on a computer server with devices][1]
Monitoring IT assets is an essential task for any IT department. Still, due to the growing number of devices in corporate networks, it is getting more and more challenging to find an approach that is flexible enough to monitor the wide range of available systems properly. It's essential to have a monitoring tool that is flexible, scalable, and easy to use.
In this article, I demonstrate how to install [Checkmk][2], the monitoring tool from [tribe29][3], and how to monitor servers and network devices with it.
### Install Checkmk on Linux
For this article, I use the [Checkmk Raw Edition,][4] the community GPLv2 edition (the enterprise edition has extra features and paid support), and installing it on a Linux server. Checkmk runs on Linux, including RHEL, CentOS, Debian, and others, as well as in a container, or as a virtual appliance. You can download the latest Checkmk version for all platforms from the official [Checkmk website][2]. 
### Getting started
It doesn't take long to get started because Checkmk already supports most monitoring use cases thanks to its almost 2,000 plug-ins. Checkmk also provides preconfigured thresholds for alerts and warnings, so you don't have to waste time configuring these yourself, and of course, you can customize these as required. 
Besides these official integrations, you can also use monitoring expansions created and shared by other users on the [Checkmk Exchange][5]. If you want to know more about the Checkmk tool or contribute to it, you can check out the [GitHub repository][6].
This tutorial does not require any monitoring experience. If you do want to follow this procedure, though, you must have root access to the server you're using as the host. 
#### Select and download the Checkmk Raw Edition
1. [Download][7] either the Checkmk Raw Edition (it's free and open source) or the Checkmk Free Edition* *of the Enterprise Edition.
2. Next, send the installer file to the server you want to host Checkmk on. I use the scp command. In this tutorial, the IP address for my host is 10.0.2.15. [code]`$ scp check-mk-raw-X.Y.Zp8_0.focal_amd64.deb tux@10.0.2.15:/tmp`
```
All further actions in this tutorial are performed on the host server. 
3. Log in to your host using `ssh`. [code]`$ ssh tux@10.0.2.15`
```
#### Install the Checkmk package 
1. Now you must install the package including all of its dependencies. This can be done with your distribution's package manager, such as `apt` or `dnf`: [code]`$ sudo apt install /tmp/check-mk-raw-X.Y.Zp8_0.focal_amd64.deb`
```
2. Once the installation is complete, you can perform a test using the `omd` command. [code]`$ omd version`
```
The `omd` command for [Open Monitoring Distribution][8] is an open source project created by Mathias Kettner, the founder of Checkmk. It helps you install a monitoring solution assembled from various open source components. 
#### Create a Checkmk monitoring site
1. The next step is to start an initial monitoring site (a "site" is an _instance_). Use `omd create` to create a new Checkmk site and name it as you wish. In this example, I use `checkmk_demo`. [code]`$ sudo omd create checkmk_demo`
```
2. As a response, you're provided with helpful information about how to start and access your Checkmk site. You could follow the steps to change your admin password right now, but I prefer to do that in the Checkmk user interface. So, for now, copy the randomly generated password (you need it in the next step) and start your monitoring site. [code]`$ sudo omd start checkmk_demo`
```
Should you want to drill deeper into Checkmk later on, it is important to understand what has just taken place.
* You created a new user, known as the _site user_, and a group with the site's name on your server.
* A directory for the site has been created under `/omd/sites`, (for example, `/omd/sites/checkmk_demo`).
Checkmk also copied its default configuration into the new directory.
* A user with the name _cmkadmin_ was created for the Checkmk web interface. 
#### Start monitoring with Checkmk
It's time to switch to the Checkmk user interface in your web browser. Every Checkmk site has its own URL, composed of the IP address or hostname of your monitoring server and the name of the Checkmk site. In this example, my Checkmk install is located at _monitoring-host-server/checkmk_demo/_.
1. Open the link to your Checkmk site in your browser. You can open the link shown on your terminal.
2. Log in as the _cmkadmin_ user, using the password you copied from the terminal.
Once you're logged in, you see an empty dashboard.
3. Click on the **User** category in the sidebar on the left, and then click on **Change password** under **Profile**. Here, you can change your password.
### Monitoring setup
Checkmk supports several ways of monitoring servers, and the best method for server monitoring is usually by using the Checkmk agents. Before adding a server, you need to install the agent. 
1. In the sidebar on the left, click **Setup** (the button with a gearwheel).
This is the control panel where you perform all of the configurations and find monitoring agents. There are some UI differences between the Raw Edition and the Enterprise Edition, but all screenshots in this article are from the open source Raw Edition.
2. Click on **Agents** and select the appropriate package for your operating system.
The packaged agents for Linux are provided in both RPM and DEB file formats.
![Select an agent][9]
(Ferdinand Kunz, [CC-BY SA 4.0][10])
3. Download and install the agent on your monitoring host.
You can test whether the agent works correctly by executing the `check_mk_agent` command in the terminal on your server.
### Adding a host
Once the agent has been installed, return to the **Setup** screen and select **Hosts**. 
1. Click on **Add host**. 
2. Add the name of your server under **Hostname***. *
If you have DNS set up in your network, Checkmk resolves the IP address for your hostname automatically. Otherwise, add the IP address by clicking the checkbox next to** IPv4 Address**. If you add an IP address, you can choose any hostname you like. Leave the other areas unchanged.
 
![Add host][11]
(Ferdinand Kunz, [CC-BY SA 4.0][10])
3. Click on **Save &amp; go to service configuration**. Checkmk now automatically discovers any relevant monitoring services on that host and lists them as _Undecided services_. Also, as you can see in the screenshot, Checkmk automatically adds labels depending on the type of device.
4. Click on **Fix all*** _to monitor all of these. This adds all detected services and host labels to your monitoring dashboard and removes services that have vanished. Of course, you can manage the services manually, but the_* Fix all **function makes it a lot easier. 
![Host monitoring fix all][12]
(Ferdinand Kunz, [CC-BY SA 4.0][10])
5. Next, activate your changes by clicking on the highlighted field with the yellow exclamation point (**!)** at the top right corner. Click on **Activate on selected sites**, and you've successfully added the first server to your monitor.
Requiring explicit activation for changes is a safety mechanism. All changes made are listed first under **Pending changes** so you can review any changes before they affect your monitoring. Checkmk differentiates between _Setup_ as a configuration environment, in which you manage the hosts, services, and settings, and the area called _Monitor_, in which the actual operational monitoring takes place. New hosts and other changes in the configuration initially do not affect the monitoring. You must activate these before they go into production. 
### SNMP monitoring
Besides server monitoring, another essential monitoring task is network monitoring. As an example, I would like to show you how to monitor a switch over SNMP. All you need to do is make sure the SNMP agent on the device you aim to monitor is activated and that your Checkmk server can reach this device.
1. Go to _**Setup &gt; Hosts**_ and click on **Add host**.
2. Type in the hostname and the IP address (as needed).
By default, Checkmk assumes you use a Checkmk agent, so you need to edit that under **Monitoring agents**. 
3. Activate the check box next to _SNMP_ and switch the box to your SNMP version (very likely ʻSNMP v2 or v3ʼ).
Checkmk also assumes by default that your SNMP Community is _public_ because it is also the default on most SNMP devices. If that is the case, you can leave the box _SNMP credentials_ unchecked (like I have). Otherwise, you have to check this box and add your SNMP credentials here. 
![Add SNMP host][13]
(Ferdinand Kunz, [CC-BY SA 4.0][10])
4. As before, click on **Save &amp; go to service configuration**, and Checkmk discovers all of the currently online interfaces, the uptime, and the SNMP Info check.
If a monitoring plug-in for a particular type of device exists, Checkmk detects more monitoring services automatically. 
5. Click on **Fix all** and accept the changes.
### Happy monitoring
Now you will have your Checkmk site up and running and have added two hosts. This tutorial ends here, but your real monitoring experience has only just started. You may have noticed that Checkmk provides agents for almost all operating systems so that you can add more hosts. The procedure is similar to other systems. Checkmk also supports SNMP, IPMI, HTML, and many other standards, so you always have an efficient method available for monitoring a particular system. Have a look at the [Checkmk][14] [handbook][14], as well as in the [official Checkmk forum][15]. Happy monitoring!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/8/monitor-linux-server-checkmk
作者:[Ferdinand][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/ferdinand-kunz
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices)
[2]: https://checkmk.com/
[3]: https://tribe29.com/
[4]: https://checkmk.com/product/raw-edition
[5]: https://exchange.checkmk.com/
[6]: https://github.com/tribe29/checkmk
[7]: https://checkmk.com/download?edition=cre&version=stable&dist=ubuntu&os=focal
[8]: https://checkmk.com/guides/open-monitoring-distribution
[9]: https://opensource.com/sites/default/files/uploads/checkmk_agent.png (Select an agent)
[10]: https://creativecommons.org/licenses/by-sa/4.0/
[11]: https://opensource.com/sites/default/files/uploads/checkmk_hosts.png (Add host)
[12]: https://opensource.com/sites/default/files/uploads/checkmk_fix-all.png (Host monitoring fix all)
[13]: https://opensource.com/sites/default/files/uploads/checkmk_add-host-snmp.png (Add SNMP host)
[14]: https://docs.checkmk.com/latest/en/
[15]: https://forum.checkmk.com/

View File

@ -0,0 +1,161 @@
[#]: subject: "Print files from your Linux terminal"
[#]: via: "https://opensource.com/article/21/9/print-files-linux"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Print files from your Linux terminal
======
To print a file from your terminal, use the lpr command.
![Typewriter with hands][1]
[Printing on Linux is easy][2], but sometimes it feels like a lot of work to launch an application, open a file, find the **Print** selection in the menu, click a confirmation button, and so on. When you're a Linux terminal user, you often want to perform complex actions with simple triggers. Printing is complex, and there's little as simple as the `lpr` command.
### Print using the lpr command
To print a file from your terminal, use the `lpr` command:
```
`$ lpr myfile.odt`
```
Should that fail, you need to set a default printer or specify a printer manually.
### Setting a default printer
According to my well-worn copy of a Berkeley 4.2 manual printed in 1984, the `lpr` command paginated and sent a file to a printer spool, which streamed data to something called a _line printer_.
![book page displaying lpr command information][3]
The lpr command.
These days, the actual `lpr` command is insufficient because modern computers are likely to have access to several printers, and certainly to printers a lot more complex than a dot-matrix line printer. Now there's a subsystem, called the Common Unix Printing System (CUPS), to keep track of all the printers that you want your computer to access, which driver your computer should use to communicate with each printer, which printer to use by default, and so on. The `lpr.cups` or `lpr-cups` commands, bundled with CUPS and usually symlinked to `lpr`, allow you to print from a terminal by referencing your Common Unix Printing System (CUPS) configuration first.
To print a file with `lpr`, you should first set a default printer. You can set a default printer in your system's printer settings:
![dialog box to set default printer][4]
Set a default printer.
Alternately, you can mark a printer as the default with the `lpadmin` command:
```
$ sudo lpadmin -d HP_LaserJet_P2015_Series
$ lpstat -v
device for HP_LaserJet_P2015_Series: ipp://10.0.1.222:631/printers/HP_LaserJet_P2015_Series
```
### Setting a default destination with environment variables
You aren't permitted to set your own default printer on systems you don't have an admin account on because changing print destinations is considered a privileged task. Before `lpr` references CUPS for a destination, it queries your system for the **PRINTER** [environment variable][5].
In this example, `HP_LaserJet_P2015_Series` is the human-readable name given to the printer. Set **PRINTER** to that value:
```
$ PRINTER=HP_LaserJet_P2015_Series
$ export PRINTER
```
Once the **PRINTER** variable has been set, you can print:
```
`$ lpr myfile.pdf`
```
### Get a list of attached printers
You can see all the printers that are accepting print jobs and that are attached to your system with the `lpstat` command:
```
$ lpstat -a
HP_LaserJet_P2015_Series accepting requests since Sun 1 Aug 2021 10:11:02 PM NZST
r1060 accepting requests since Wed 18 Aug 2021 04:43:57 PM NZST
```
### Printing to an arbitrary printer
Once you have added printers to your system, and now that you know how to identify them, you can print to any one of them, whether you have a default destination set or not:
```
`$ lpr -P HP_LaserJet_P2015_Series myfile.txt`
```
### How printers are defined
CUPS has a user-friendly front-end accessible through a web browser such as Firefox. Even though it uses a web browser as its user interface, it's actually a service running locally on your computer (a location called **localhost**) on port 631. CUPS manages printers attached to your computer, and it stores its configuration in `/etc/cups/printers.conf`.
The `printers.conf` file consists of definitions detailing the printing devices your computer can access. You're not meant to edit it directly, but if you do, then you must stop the `cupsd` daemon first.
A typical entry looks something like this:
```
&lt;Printer r1060&gt;
  Info Ricoh 1060
  Location Downstairs
  MakeModel Ricoh Aficio 1060 - CUPS+Gutenprint v5.2.6
  DeviceURI lpd://192.168.4.8
  State Idle
  StateTime 1316011347
  Type 12308
  Filter application/vnd.cups-raw 0 -
  Filter application/vnd.cups-raster 100 rastertogutenprint.5.2
  Accepting Yes
  Shared No
  JobSheets none none
  QuotaPeriod 0
  PageLimit 0
  KLimit 0
  OpPolicy default
  ErrorPolicy stop-printer
&lt;/Printer&gt;
```
In this example, the printer's name is `r1060`, a human-readable identifier for a Ricoh Aficio 1060.
The _MakeModel_ attribute is pulled from the `lpinfo` command, which lists all available printer drivers on your system. Assuming you know that you have a Ricoh Aficio 1060 that you want to print to, then you would issue this command:
```
$ lpinfo -m | grep 1060
gutenprint.5.2://brother-hl-1060/expert Brother HL-1060 - CUPS+Gutenprint v5.2.11
gutenprint.5.2://ricoh-afc_1060/expert Ricoh Aficio 1060 - CUPS+Gutenprint v5.2.11
```
This command lists the relevant drivers you have installed.
The _MakeModel_ is the last half of the result. In this example, that's `Ricoh Aficio 1060 - CUPS+Gutenprint v5.2.11`.
The _DeviceURI_ attribute identifies where the printer is found on the network (or physical location, such as the USB port). In this example, the _DeviceURI_ is `lpd://192.168.4.8` because I'm using the `lpd` (line printer daemon) protocol to send data to a networked printer. On a different system, I have an HP LaserJet attached by a USB cable, so the _DeviceURI_ is DeviceURI `hp:/usb/HP_LaserJet_P2015_Series?serial=00CNCJM26429`.
### Printing from the terminal
Sending a job to a printer is an easy process, as long as you understand the devices attached to your system and how to identify them. Printing from the terminal is fast, efficient, and easily scripted or done as a batch job. Try it out!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/print-files-linux
作者:[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/typewriter-hands.jpg?itok=oPugBzgv (Typewriter with hands)
[2]: https://opensource.com/article/21/8/setup-your-printer-linux
[3]: https://opensource.com/sites/default/files/berkeley-1984-lpr.jpeg
[4]: https://opensource.com/sites/default/files/printer-default.jpeg
[5]: https://opensource.com/article/19/8/what-are-environment-variables

View File

@ -0,0 +1,64 @@
[#]: subject: "Essential open source tools for an academic organization"
[#]: via: "https://opensource.com/article/21/9/open-source-tools-ospo"
[#]: author: "Quinn Foster https://opensource.com/users/quinn-foster"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Essential open source tools for an academic organization
======
A look into the digital infrastructure of an academic open source
programs office (OSPO).
![Wratchet set tools][1]
As an academic open source programs office (OSPO), [Open@RIT][2]'s mission is to assist faculty, staff, and students at the Rochester Institute of Technology in creating and maintaining communities for their open projects. We accomplish this by offering consultation and documents that teach our clients the best ways to operate their communities and projects. None of this would be feasible, however, if not for the systems of digital infrastructure we have created and adopted to facilitate these interactions.
Whether you're starting your own academic OSPO or an open source project, finding the right tools and methods for managing your unique community can be challenging if you don't know where to look. Therefore, in the spirit of openness, the Open@RIT team is happy to share the experiences and strategies used to build our digital infrastructure right here.
To begin, much of what we have built is thanks to our collaboration with the open source experts at the Institute of Electrical and Electronics Engineers ([IEEE][3]). Founded back in the 19th century during the advent of widespread electricity use, IEEE remains the largest technical professional organization globally and strives to advance technology for the benefit of humanity. The utilization of open source is an integral part of this goal. [IEEE SA OPEN][4], the IEEE sub-group which has created a dedicated open source collaboration platform, aims to create a unified infrastructure stack for open source communities.
As a participant in IEEE SA OPEN's open technical advisory group, Open@RIT has worked with the group by advising in selecting and approving a variety of software tools they are considering supporting in their standards.
> "We're trying to learn about how they operate within the academic sector, and then because they're open source, we can really easily contribute back and contribute these findings,"
>
> Mike Nolan, assistant director of Open@RIT.
The tools IEEE SA OPEN and Open@RIT select help develop Open@RIT's digital infrastructure and assist its clients in an academic environment. In turn, Open@RIT provides feedback and even technical contributions to IEEE SA OPEN to extend their infrastructure effectively. Each tool, all of which are open source, carries out a key role:
* [Mattermost][5] is a collaboration platform built with project developers in mind. We've been using Mattermost to communicate and share work, and we highly recommend it for anybody developing an open source project.
* [Gitlab][6] allows you to store files of code and develop them collaboratively with your team.
* [Nextcloud][7] is a cloud-based file hosting service where you can create and share documents with your team and manage projects and deadlines. Adapting Nextcloud into the standards is still in process and not yet approved, but it holds tremendous potential for IEEE SA OPEN.
A crucial benefit we've experienced using these tools alongside IEEE SA OPEN is finding ways to interact with each other. For example, Mattermost's ChatOps function allows you to install a Gitlab plugin into your Mattermost servers, allowing notifications of issues, merge requests, direct mentions, and other changes made in Gitlab to appear in your message boards. This, among potential future additions, demonstrates how these tools can become a cohesive standard in building open infrastructure.
In addition to working with IEEE SA OPEN, we have also made inroads with CHAOSS Software and utilized their community analysis software, [GrimoireLab.][8] Their tool is a community health analytics software that calculates and reports metrics of open source project communities. This includes things like the time it takes to resolve reported issues, contributor affiliations, code management, and more.
Open@RIT uses GrimoireLab and provides feedback and contributions to the CHAOSS community based upon our unique position of monitoring community health in academia. One of our more significant contributions is Mystic, a digital portal and dashboard of our design. Anyone at RIT can submit their open source projects and receive generated community health statistics. Mystic leverages GrimoireLab to take these projects and reports the community metrics and analytics back to the user. Using GrimoireLab in this way helps build the open source community at RIT while contributing back to CHAOSS to make their tools more applicable to academic institutions.
We hope the information shared here has provided you with the tips and tricks to kickstart your open source project. Whether it's academic in nature or not, these tools can be great additions to the digital infrastructure holding your project community together.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/open-source-tools-ospo
作者:[Quinn Foster][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/quinn-foster
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4 (Wratchet set tools)
[2]: https://www.rit.edu/research/open
[3]: https://www.ieee.org/
[4]: https://saopen.ieee.org/
[5]: https://mattermost.com/
[6]: https://about.gitlab.com/
[7]: https://opensource.com/tags/nextcloud
[8]: https://chaoss.github.io/grimoirelab/

View File

@ -0,0 +1,116 @@
[#]: subject: "How to Install Dropbox on Ubuntu Linux"
[#]: via: "https://itsfoss.com/install-dropbox-ubuntu/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install Dropbox on Ubuntu Linux
======
Dropbox is one of the [most popular cloud storage services available for Linux][1] and other operating systems.
In fact, Dropbox is one of the earliest services to provide a native Linux application. It still [supports 32-bit Linux systems][2] that is also a commendable job.
In this beginners tutorial, Ill show the steps for installing Dropbox on Ubuntu. The steps are really simple but some websites make it unnecessarily complicated.
### Install Dropbox on Ubuntu desktop
Lets see the installation procedure, step by step.
#### Step 1: Get Dropbox installer for Ubuntu
Dropbox offers DEB files for its installer. Go to the download section of its website:
[Dropbox Download][3]
And download the appropriate DEB file. Considering that you are using 64 bit Ubuntu, get the deb file for 64-bit version.
![Download the Dropbox installer][4]
#### Step 2: Install Dropbox installer
The deb file you downloaded is just an installer for Dropbox. Actual Dropbox installation starts later, similar to [installing Steam on Ubuntu][5].
To [install the downloaded deb file][6], either double click on it or right click and select open with Software Install.
![Installing the downloaded Dropbox deb file][7]
It will open the software center and you can click the install button.
![Installing Dropbox deb file][8]
Wait for the installation to finish.
#### Step 3: Start Dropbox installation
Dropbox installer is now installed. Press the Windows key (also known as super key) and search for Dropbox and click on it.
![Start Dropbox for installation][9]
On the first launch, it shows two popups. One about restarting Nautilus (the file explorer in Ubuntu) and the other about Dropbox installation.
![Starting Dropbox installation][10]
Clicking either Restart Nautilus/Close (on the Nautilus popup) or OK (on the installation popup) starts the actual Dropbox client download and installation. If the Nautilus Restart does not close on clicking Close button, click the x button.
Wait for the Dropbox installation to finish.
![Installing Dropbox][11]
Oh! Nautilus restart is required because Dropbox adds some extra features like showing the synchronization status in the file explorer.
Once Dropbox is installed, it should either take you to the Dropbox login page automatically or you can hit the Dropbox icon at the top and select sign in option.
![Sign in to Dropbox after installation][12]
In fact, this is how you would be accessing Dropbox settings in the future.
#### Step 4: Start using Dropbox on Ubuntu
![Sign in into Dropbox][13]
**Note**: Dropbox wont work until you successfully sign in. Heres a catch. The free version of Dropbox limits the number of devices you can link to your account. **If you already have 3 linked devices, you should remove some of the older ones that you do not use.**
Once you are successfully signed in, you should see a Dropbox folder created in your home directory and your files from the cloud starts appearing here.
![Dropbox folder is created under home directory][14]
If you want to save disk space or bandwidth, you can go to the Preferences and choose the Selective Sync option. The selective sync option allows you only sync selected folders from Dropbox cloud on your local system.
![Using selective sync in Dropbox][15]
Dropbox automatically starts at each boot. This is the behavior you should expect from any cloud service, I believe.
Thats all you need to get started with Dropbox on Ubuntu. I hope you find this tutorial helpful.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-dropbox-ubuntu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/cloud-services-linux/
[2]: https://itsfoss.com/32-bit-linux-distributions/
[3]: https://www.dropbox.com/install-linux
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/get-dropbox-for-ubuntu.png?resize=800%2C294&ssl=1
[5]: https://itsfoss.com/install-steam-ubuntu-linux/
[6]: https://itsfoss.com/install-deb-files-ubuntu/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/dropbox-installer-ubuntu.png?resize=797%2C476&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/installing-dropbox-deb-file.png?resize=800%2C346&ssl=1
[9]: https://itsfoss.com/wp-content/uploads/2021/09/start-drobox-ubuntu.webp
[10]: https://itsfoss.com/wp-content/uploads/2021/09/starting-dropbox-installation-800x599.webp
[11]: https://itsfoss.com/wp-content/uploads/2021/09/installing-dropbox.webp
[12]: https://itsfoss.com/wp-content/uploads/2021/09/sign-in-to-dropbox-after-first-installation.webp
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/sign-in-dropbox.png?resize=800%2C409&ssl=1
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/dropbox-folder-ubuntu.png?resize=800%2C491&ssl=1
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/09/Dropbox-selective-sync.png?resize=800%2C399&ssl=1

View File

@ -0,0 +1,91 @@
[#]: subject: "Create a photo collage from the Linux command line"
[#]: via: "https://opensource.com/article/21/9/photo-montage-imagemagick"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Create a photo collage from the Linux command line
======
Here's how I use ImageMagick to make photo grids for my social media
posts.
![Polaroids and palm trees][1]
ImageMagick is the "Swiss Army knife" of manipulating images on the command line. While you could use a desktop graphics program like GIMP or GLIMPSE to adjust or combine photos and graphics, sometimes it's just easier to use one of the almost dozen tools from ImageMagick.
For example, I frequently find myself creating image montages to share on social media. Let's say I wanted to share a montage or "image grid" of several screenshots. To do that, I use the ImageMagick `montage` command. 
ImageMagick is a full suite of tools, and the one I use here is the `montage` command. The general syntax of the `montage` command looks like this:
```
`montage {input} {actions} {output}`
```
In my case, my screenshots are already the same size: 320x240 pixels.  To create a montage of six of these images, in a grid that's two screenshots wide by three tall, I can use this command:
```
$ montage acronia.png \
ascii-table.png \
music.png \
programming-chess.png \
petra.png \
amb.png \
-tile 2x3 -geometry +1+1 \ 
screenshot-montage.png
```
This creates an image that's composed of the six screenshots, with a 1-pixel border around each. Doing the math, that's 644 pixels wide and 726 pixels high.
Note the order of the images: ImageMagick montage arranges the images from left-to-right and top-to-bottom.
![Screenshot montage][2]
(Jim Hall, [CC BY-SA 4.0][3])
In my example, the first row of images shows the open source 2D shooter Acronia and an ASCII programming example, the middle row is an open source music player and a chess programming example, and the third row shows the open source game Post Apocalyptic Petra and the FreeDOS AMB Help reader.
### Install ImageMagick on Linux
On Linux, you can install ImageMagick using your package manager. For instance, on Fedora or similar:
```
`$ sudo dnf install imagemagick`
```
On Debian and similar:
```
`$ sudo apt install imagemagick`
```
On macOS, use [MacPorts][4] or [Homebrew][5].
On Windows, use [Chocolatey][6].
These open source photo libraries help you stay organized while making your pictures look great.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/photo-montage-imagemagick
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/design_photo_art_polaroids.png?itok=SqPLgWxJ (Polaroids and palm trees)
[2]: https://opensource.com/sites/default/files/uploads/screenshot-montage_0.png (Screenshot montage)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://opensource.com/article/20/11/macports
[5]: https://opensource.com/article/20/6/homebrew-mac
[6]: https://opensource.com/article/20/3/chocolatey

View File

@ -0,0 +1,80 @@
[#]: subject: "Neither Windows, nor Linux! Shrine is Gods Operating System"
[#]: via: "https://itsfoss.com/shrine-os/"
[#]: author: "John Paul https://itsfoss.com/author/john/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Neither Windows, nor Linux! Shrine is Gods Operating System
======
Weve all used multiple operating systems in our lives. Some were good and some were bad. But can you say that youve ever used an operating system designed by God? Today, Id like to introduce you to Shrine.
### What is Shrine?
![Shrine interface][1]
From that introduction, youre probably wondering what the heck is going on. Well, it all started with a guy named Terry Davis. Before we go any further, Id better warn you that Terry suffered from schizophrenia during his life and often didnt take his medication. Because of this, he said or did things during his life that were not quite socially acceptable.
Anyway, back to the story line. In the early 2000s, Terry released a simple operating system. Over the years, it went through several names, including J Operating System, LoseThos, and SparrowOS. He finally settled on the name [TempleOS][2]. He chose that name because this operating system would be Gods temple. As such. God gave Terry the following [specifications][3] for the operating system:
* It would have 640×480 16 color graphics
* It would use “a single-voice 8-bit signed MIDI-like sample for sound”.
* It would follow the Commodore 64, i.e. “a non-networked, simple machine where programming was the goal, not just a means to an end”.
* It would only support one file system (named “Red Sea”).
* It would be limited to 100,000 lines of code to make it “easy to learn the whole thing”.
* “Ring-0-only. Everything runs in kernel mode, including user applications”
* The font would be limited to “one 8×8 fixed-width font”.
* The use would have “full access to everything. All memory, I/O ports, instructions, and similar things must never be off limits. All functions, variables and class members will be accessible.”
* It would only support one platform, 64-bit PCs.
Terry wrote this operating system using in a programming language that he called HolyC. TechRepublic called it a “modified version of C++ (“more than C, less than C++”)”. If you are interested in getting a flavor of HolyC, I would recommend, [this article][4] and the HolyC entry on [RosettaCode][5].
In 2013, Terry announced on his website that TempleOS was complete. Tragically, Terry died a few years later in August of 2018 when he was hit by a train. He was homeless at the time. Over the years, many people followed Terry through his work on the operating system. Most were impressed at his ability to write an operating system in such a small package.
Now, you are probably wondering what all this talk of TempleOS has to do with Shrine. Well, as the [GitHub page][6] for Shrine states, it is “A TempleOS distro for heretics”. GitHub user [minexew][7] created Shrine to add features to TempleOS that Terry had neglected. These features include:
* 99% compatibility with TempleOS programs
* Ships with Lambda Shell, which feels a bit like a classic Unix command interpreter
* TCP/IP stack &amp; internet access out of the box
* Includes a package downloader
minexew is planning to add more features in the future, but hasnt announced what exactly will be included. He has plans to make a full TempleOS environment for Linux.
### Experience
Its fairly easy to get Shrine virtualized. All you need to do is install your virtualizing software of choice. (Mine is VirtualBox.) When you create a virtual machine for Shrine, make sure that it is 64-bit and has at least 512 MB of RAM.
Once you boot into Shrine, you will be asked if you want to install to your (virtual) hard drive. Once that is finished (or not, if you choose), you will be offered a tour of the operating system. From there you can explore.
### Final Thoughts
Temple OS and (Shrine) is obviously not intended to be a replacement for Windows or Linux. Even though Terry referred to it as “Gods temple”, Im sure in his more lucid moments, he would have acknowledged that it was more of a hobby operating system. With that in mind, the finished product is fairly [impressive][8]. Over a twelve-year period, Terry created an operating system in a little over 100,000 lines of code, using a language that he had created himself. He also wrote his own compiler, graphics library and several games. All this while fighting his own personal demons.
--------------------------------------------------------------------------------
via: https://itsfoss.com/shrine-os/
作者:[John Paul][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/john/
[b]: https://github.com/lujun9972
[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/shrine.jpg?resize=800%2C600&ssl=1
[2]: https://templeos.org/
[3]: https://web.archive.org/web/20170508181026/http://www.templeos.org:80/Wb/Doc/Charter.html
[4]: https://harrisontotty.github.io/p/a-lang-design-analysis-of-holyc
[5]: https://rosettacode.org/wiki/Category:HolyC
[6]: https://github.com/minexew/Shrine
[7]: https://github.com/minexew
[8]: http://www.codersnotes.com/notes/a-constructive-look-at-templeos/

View File

@ -0,0 +1,82 @@
[#]: subject: "Getting the Top Indicator Panel Back in GNOME"
[#]: via: "https://itsfoss.com/enable-applet-indicator-gnome/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Getting the Top Indicator Panel Back in GNOME
======
GNOME is the popular desktop environment that thrives to give Linux a modern desktop experience.
While it works for the most part, some of their decisions has left the user fuming and questioning.
You cannot have icons and files on the desktop, [new document option has been removed][1] from the right click context menu. In addition to that, GNOME has also removed the applet indicator functionality.
You know what indicator applets are, dont you? Those little icons that let you access additional features of the given application. I have plenty of them in my Ubuntu system.
![Indicator applets][2]
And this creates a problem, specially for applications that rely completely on these applet indicators to function. Take [Dropbox][3] for example. The only way to access Dropbox settings is through the app-indicator and you wont find it in GNOME.
Thats a problem, but thankfully, there is a workaround for that.
### Enabling applet indicator in GNOME via extension
If you are using GNOME, you probably already know what GNOME Extension is. These are basically small add-ons developed by enthusiastic, independent developers.
If not done already, [enable GNOME extensions][4]. Its actually quite simple. Go to any GNOME extensions page using Firefox or Chrome and it will suggest downloading a browser extension. Install it and you are good to go.
![Enabling GNOME Extension browser add-on][5]
Now, there are several GNOME extensions available that allow adding applet indicators in the top panel. At the time of writing this tutorial, [AppIndicator and KStatusNotifierItem Support][6] extension is well developed and supported for the recent GNOME versions.
Go to its webpage:
[AppIndicator Extension][6]
On the page, you should see a toggle button. Click it to install it.
![][7]
There will be a pop-up. Hit install when you see it.
![Install the extension][8]
The results wont be seen immediately. Youll have to restart GNOME. On Xorg, you could just use Alt+F2 and enter r but that does not work in Wayland.
Log out of the system and log back in. Applet indicator should be activated now. If you have any applications installed that provides an indicator applet, you should see it on the top panel.
In my case, I had Dropbox already installed and hence it started showing the icon in the top panel.
![Dropbox indicator working in GNOME][9]
I hope this little tip help you gain access to the app indicators in the top panel of GNOME again.
I do not know why the GNOME developers though that dropping this essential feature was a good idea. Anyway, if one door closes, another opens (usually). Enjoy GNOME to your liking.
--------------------------------------------------------------------------------
via: https://itsfoss.com/enable-applet-indicator-gnome/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/add-new-document-option/
[2]: https://itsfoss.com/wp-content/uploads/2021/09/indicator-applet-linux.webp
[3]: https://www.dropbox.com
[4]: https://itsfoss.com/gnome-shell-extensions/
[5]: https://itsfoss.com/wp-content/uploads/2021/09/installing-gnome-extension-add-on-800x355.webp
[6]: https://extensions.gnome.org/extension/615/appindicator-support/
[7]: https://itsfoss.com/wp-content/uploads/2021/09/appindicator-extension-800x329.webp
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/installing-appindicator-extension.png?resize=800%2C269&ssl=1
[9]: https://itsfoss.com/wp-content/uploads/2021/09/gnome-dropbox-indicator-800x561.webp

View File

@ -0,0 +1,148 @@
[#]: subject: "Learn everything about computers with this Raspberry Pi kit"
[#]: via: "https://opensource.com/article/21/9/raspberry-pi-crowpi2"
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Learn everything about computers with this Raspberry Pi kit
======
The CrowPi is an amazing Raspberry Pi project system housed in a
laptop-like body.
![Teacher or learner?][1]
I like history, and I like computers, so I enjoy hearing stories about computing before computers were an everyday household appliance, much less a personal accessory. [One tale I hear often][2] is about how the computers of long ago (in computer years, anyway) were pleasantly basic. They were so basic, in fact, that it was relatively trivial for a curious user to figure out how to program one. Looking at modern computers, with object-oriented programming languages, complex GUI frameworks, network APIs, containers, and more, there's genuine concern that the tools of the computing trade have become essentially inaccessible to anyone without specialized training.
From the day the Raspberry Pi was released in 2012, it has always been intended as an educational platform. Several third-party vendors support the Pi with add-ons and training kits to help learners of all ages explore programming, physical computing, and open source. However, until recently, it's largely been up to the user to figure out how all the pieces on the market fit together. And then I got a CrowPi.
![CrowPi more than a laptop][3]
The CrowPi is not a laptop.
(Seth Kenlon, [CC BY-SA 4.0][4])
### Introducing the CrowPi2
Crows are surprisingly intelligent birds. They recognize and remember faces, mimic sounds they've heard, solve complex puzzles, and even use tools to accomplish a task. It's fitting that the CrowPi uses the crow as its logo and namesake because this device is packed with opportunities for exploration, experimentation, education, and, best of all, fun.
The design itself is clever: It looks like a laptop, but it's much more than that. When you lift the Bluetooth keyboard from the case, it reveals a hidden electronics workshop, complete with an LCD screen, 16 buttons, dials, RFID sensor, proximity sensor, breadboard, speakers, GPIO connections, a LED array, and much more. _And it's all programmable._
As its name implies, the unit itself is powered entirely by a Raspberry Pi, securely fastened within the underside of the case.
![crowpi pi board][5]
The CrowPi Pi board.
(Seth Kenlon, [CC BY-SA 4.0][4])
By default, you're meant to power the unit with a power adapter, and it ships with a wall adapter that you can plug into the case rather than powering the Pi directly. You can also use a battery supply plugged into an external micro-USB port. There's even a drawer built into the case so you can store your battery pack. When you do this, there's a USB cable popping out of the battery drawer and into the case power port, so there's no illusion that this is a "normal" laptop. However, with a device like this, that's pretty much the desired aesthetic!
### First boot
The CrowPi2 ships with Raspbian installed on a microSD card labeled **System**, although it includes a second microSD card loaded with [RetroPie][6], too. Being a responsible adult, I booted RetroPie first, naturally.
RetroPie is always fun, and the CrowPi2 ships with two SNES-style game controllers to ensure you have the optimal retro gaming experience.
Booting to the actual system is, amazingly, just as fun and arguably more so. The login manager is a custom project hub with quick links to sample coding projects, the Python and Arduino IDEs, Scratch, sample Python games, Minecraft, and more. You can also choose to exit the project hub and just use the desktop.
![CrowPi hub][7]
The CrowPi Hub.
(Seth Kenlon, [CC BY-SA 4.0][4])
The desktop is familiar to anyone used to the Raspberry Pi or Linux in general, but it's basic enough that it's easy to learn, too. There's an application menu in the top left, shortcut icons on the desktop, a system tray for network selection and volume control in the top right, and so on.
![CrowPi Desktop][8]
The CrowPi Desktop.
(Seth Kenlon, [CC BY-SA 4.0][4])
There's so much available on the CrowPi that it might be difficult to decide where to start. For me, there were four broad categories: Programming, physical electronics, Linux, and gaming.
There's an instruction manual in the box, so you know what you need to connect (for instance, the keyboard is battery-powered, so it does need charging sometimes, and it and the mouse always require a USB dongle). It's a quick read, though, and just one of the many examples of how seriously the CrowPi team takes documentation.
![CrowPi Docs][9]
The CrowPi Docs.
(Seth Kenlon, [CC BY-SA 4.0][4])
### Programming
If you're keen to learn how to code, there are many paths to success on the CrowPi. You should take the path that you find the most satisfying.
#### 1\. Scratch
[Scratch][10] is a simple visual coding application that lets you make games and interactive stories using code blocks that fit together like [Lego pieces][11]. It's the easiest way to begin coding, and I've seen kids as young as eight spend hours puzzling over the optimal algorithm for a game of their own design. Of course, it's not only great for kids! Adults can have a lot of fun with it, too. Not sure where to start? There's a 99-page booklet (printed on actual paper) in the box with Scratch lessons and projects for you to try.
#### 2\. Java and Minecraft
Minecraft is not open source (although there are [several open source projects][12] that reimplement it), but there's enough source available that it's often used to teach programming. Minecraft was written in Java, and the CrowPi ships with both [Minecraft Pi Edition][13] and the [BlueJ Java IDE][14] to make learning Java easier and more fun than ever.
#### 3\. Python and PyGame
There are several really fun games on the CrowPi that were written in Python and the [PyGame game engine][15]. You can play the games and then look at the source code to find out how the game works. The Geany, Thonny, and [Mu][16] editors are included on the CrowPi, so you can start programming in Python right away. As with Scratch, there's a booklet in the box with lessons so you can learn Python basics.
### Electronics
The physical electronics workshop concealed under the keyboard is essentially an array of Pi Hats. The whole thing is mapped out on a fold-out diagram in both English and Chinese so that you can identify all the components. There are plenty of sample projects to get you started. Here's a small list:
* **Hello** prints "hello" on the LCD screen when you speak to the CrowPi.
* **Intrusion alarm** sounds an alarm using the proximity sensor.
* **Remote controller** enables you to use a remote control (yes, this too is included in the box) to trigger events on the CrowPi.
* **RGB Tetris** lets you play a game of Tetris on an LED display.
* **Voice recognition** demonstrates natural language processing.
* **Ultrasonic music** creates a rudimentary Theramin using distance sensors and a speaker.
Those projects are just the beginning because you can build upon what exists. There's more to explore, of course. Patch cables, resistors, LEDs, and all sorts of components are included in the box so that you can learn all about the Pi's GPIO capabilities at your leisure.
One problem: The location of the sample projects is a little difficult to find. It's easy to find the demos (they're on the CrowPi hub screen), but the location of the source code isn't immediately obvious. It turns out that most of the sample projects are in `/usr/share/code`, which you can reach either through the file manager or a terminal.
![CrowPi Peripherals][17]
The CrowPi Peripherals
(Seth Kenlon, [CC BY-SA 4.0][4])
### Linux
The Raspberry Pi runs Linux. If you've been meaning to learn more about Linux, the CrowPi is a great platform for that, too. You can explore the desktop, the terminal, and nearly any Linux or open source application you can find. If you've been reading about open source for years and are ready to dive into an open source OS, this could be a platform for that (and much more, obviously).
### Gaming
The **RetroPie** SD card included in the box means you can reboot into a retro game console and play any number of old-school arcade games. It's not exactly a Steam Deck, but it's a fun and inspiring little gaming platform. Because it comes with not one but two game controllers, it's ideal for couch co-op. And best of all, you not only can play games on the CrowPi, but you can make your own games, too.
### Screwdriver included
I got to sit down with the CrowPi2 for about two weeks, and I've barely been able to get through all of the projects. There have been many nights when I've had to force myself to step away from it because even after I've tired of one project, I inevitably find something else to explore. To sum it up, I found one component in particular in the box, and I immediately knew that the CrowPi and I were well suited to one another: It was a small, humble screwdriver. There's no voiding of warranty stickers here. The CrowPi wants you to tinker, to take things apart, explore, and learn. This isn't a laptop or even just a Pi; this is a portable, low-powered, diverse, and open source learner's toolkit.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/raspberry-pi-crowpi2
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-teacher-learner.png?itok=rMJqBN5G (Teacher or learner?)
[2]: https://opensource.com/article/21/8/my-first-programming-language
[3]: https://opensource.com/sites/default/files/crowpi-not-laptop.jpeg (CrowPi more than a laptop)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://opensource.com/sites/default/files/crowpi-pi.jpeg (crowpi pi board)
[6]: https://opensource.com/article/19/1/retropie
[7]: https://opensource.com/sites/default/files/crowpi-hub.png (CrowPi hub)
[8]: https://opensource.com/sites/default/files/crowpi-desktop.png (CrowPi desktop)
[9]: https://opensource.com/sites/default/files/crowpi-docs.jpeg (CrowPi docs)
[10]: https://opensource.com/article/20/9/scratch
[11]: https://opensource.com/article/20/6/open-source-virtual-lego
[12]: https://opensource.com/alternatives/minecraft
[13]: https://www.minecraft.net/en-us/edition/pi
[14]: https://opensource.com/article/20/7/ide-java#bluej
[15]: https://opensource.com/downloads/python-gaming-ebook
[16]: https://opensource.com/article/18/8/getting-started-mu-python-editor-beginners
[17]: https://opensource.com/sites/default/files/crowpi-peripherals.jpeg (CrowPi peripherals)

View File

@ -0,0 +1,81 @@
[#]: subject: "Resize an image from the Linux terminal"
[#]: via: "https://opensource.com/article/21/9/resize-image-linux"
[#]: author: "Jim Hall https://opensource.com/users/jim-hall"
[#]: collector: "lujun9972"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Resize an image from the Linux terminal
======
Shrink an image from your terminal with the ImageMagick convert command.
![Old camera blue][1]
ImageMagick is a handy multipurpose command-line tool for all your image needs. ImageMagick supports a variety of image types, including JPG photos and PNG graphics.
### Resizing images
I often use ImageMagick on my webserver to resize images. For example, let's say I want to include a photo of my cats on my personal website. The photo from my phone is very large, about 4000x3000 pixels, at 3.3MB. That's much too large for a web page. I use the ImageMagick convert tool to change the size of my photo so that I can include it on my web page. ImageMagick is a full suite of tools, one of the most common is the `convert` command.
The ImageMagick `convert` command uses this general syntax:
```
`convert {input} {actions} {output}`
```
To resize a photo called `PXL_20210413_015045733.jpg` to a more manageable 500-pixel width, type this:
```
`$ convert PXL_20210413_015045733.jpg -resize 500x sleeping-cats.jpg`
```
The new image is now only 65KB in size. 
![Sleeping cats][2]
Jim Hall, [CC BY-SA 4.0][3]
You can provide both width and height dimensions with the `-resize` option. But, by providing only the width, ImageMagic does the math for you and automatically retains the aspect ratio by resizing the output image with a proportional height.
### Install ImageMagick on Linux
On Linux, you can install ImageMagick using your package manager. For instance, on Fedora or similar:
```
`$ sudo dnf install imagemagick`
```
On Debian and similar:
```
`$ sudo apt install imagemagick`
```
On macOS, use [MacPorts][4] or [Homebrew][5].
On Windows, use [Chocolatey][6].
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/9/resize-image-linux
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-photo-camera-blue.png?itok=AsIMZ9ga (Old camera blue)
[2]: https://opensource.com/sites/default/files/sleeping-cats.jpg (Sleeping cats)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://opensource.com/article/20/11/macports
[5]: https://opensource.com/article/20/6/homebrew-mac
[6]: https://opensource.com/article/20/3/chocolatey

View File

@ -0,0 +1,97 @@
[#]: subject: "How to Stop a Program in Linux Terminal"
[#]: via: "https://itsfoss.com/stop-program-linux-terminal/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Stop a Program in Linux Terminal
======
Its amusing how the simplest of the things could be complicated when you are new to something.
The other day, I found my friend could not figure out how to exit the top command. Instead of stopping the command, he closed the entire terminal application.
Thats not only unnecessary, it is a not good thing to do.
### Stopping programs in Linux
In Linux, you can use the Ctrl+C keys to stop a running program in the terminal. This works for Ubuntu as well as any other Linux distribution.
Take the ping command for example. If you do not stop it, it will keep on displaying the result.
Hold the Ctrl button and press the C key at the same time. It sends the [SIGKILL signal][1] to the running program to force quit the command.
![Stopping a program in the Linux terminal][2]
Do you see the ^C? The caret (^) means Ctrl. So basically, the terminal shows the Ctrl+C keystrokes as ^C.
The Ctrl+C works very well for the commands that are designed to keep on running until interrupted. You feel like you have to cancel the command, use Ctrl+C.
In a more complicated method, you can [find the process ID and kill a running process][3]. Thats more advanced stuff and used only when the process is running in the background or by another user or in another terminal window.
Apart from that, there are some other commands and command line tools that have their own exit commands. Let me briefly mention some of them here.
#### How to exit Vim editor
[Existing Vim editor][4] has made so many jokes in the Linux world. It is difficult to figure out when you are new to this powerful command line based text editor. Among several ways of quitting vim, the most common is to press the Esc key and then type a colon (:) and then type `q!` for force quit without save or `wq` for save and quit.
![][5]
#### How to exit Nano editor
Quitting the [Nano editor][6] is a bit simpler than exiting Vim. Why? Because Nano mentions the shortcut at the bottom. You may not understand it if you are new to it but at least youll be able to figure it out the next time.
To exit Nano, press Ctrl+X. It will ask if you want to save the changes made to the file or not. You can enter your choice.
![][7]
#### How to exit less command
The less is a wonderful command that lets you view without cluttering your terminal screen like the cat command. If you are inside the less command view, use the key `q` to exit less.
#### How to exit the terminal
To exit the terminal itself, instead of closing the terminal, either use Ctrl+D keyboard shortcut or type the exit command:
```
exit
```
This actually exists you from the current shell. When you [open a terminal in Ubuntu][8] or any other Linux distribution, it runs the default shell. When you exit from this shell, terminal ends as well. Ctrl+D is the shortcut to do the same and quit the terminal.
I hope you find this quick tutorial helpful. I highly recommend learning these [Linux command tips][9].
**Recommended Read:**
![][10]
#### [21 Super Handy Linux Command Tips and Tricks That Will Save you a lot of Time and Increase Your Productivity][9]
Questions or suggestions? Please leave a comment below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/stop-program-linux-terminal/
作者:[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://linuxhandbook.com/sigterm-vs-sigkill/#what-is-sigkill
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/stop-a-program-linux-terminal.png?resize=800%2C373&ssl=1
[3]: https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/
[4]: https://itsfoss.com/how-to-exit-vim/
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/05/how-to-exit-vim.png?resize=737%2C422&ssl=1
[6]: https://itsfoss.com/nano-editor-guide/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/nano-editor-save-and-exit.png?resize=799%2C503&ssl=1
[8]: https://itsfoss.com/open-terminal-ubuntu/
[9]: https://itsfoss.com/linux-command-tricks/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/07/linux-command-tips.png?fit=800%2C450&ssl=1

View File

@ -0,0 +1,93 @@
[#]: subject: "Run Web Applications in Linux Using Tangram Browser"
[#]: via: "https://itsfoss.com/tangram/"
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
[#]: collector: "lujun9972"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Run Web Applications in Linux Using Tangram Browser
======
_**Brief:** Tangram is a browser that aims to help you run and manage web applications in Linux_. _Lets take a look at how it works._
Even if we have native Linux applications available for several tools, many end up using web applications.
Maybe in the form of an electron app or directly through a web browser, native experiences are becoming an old-school thing.
Of course, running web applications, no matter the platform, needs more system resources. And, considering every service is going for a web-based approach instead of a native experience, we need solutions to manage the web apps efficiently.
An open-source Linux app, Tangram, could be the solution.
### Tangram: A Browser Tailored to Run Web Applications
![][1]
You can choose to use some of the [best Linux web browsers][2] to run web applications. But, if you want something that entirely focuses on web application experience, Tangram is an exciting option.
The developer took inspiration from GNOME Web, [Franz][3], and [Rambox][4].
You do not get any fancy features but just the ability to change the user agent and manage the web applications you have logged in to.
It can be used to access multiple social media platforms, chat messengers, work collaboration applications, and more.
### Features of Tangram
![][5]
Considering it is a minimal browser based on WebKitGTK, not much you can do here. To list some of the essentials, heres what you can do:
* Re-order tabs in the sidebar
* Easily add any web service as a web app
* Ability to tweak the user agent (Desktop/mobile)
* Keyboard shortcuts
* Change position of the sidebar (tab bar)
All you need to do is load up a web service, log in, and click on “**Done**” to add it as a web application.
![][6]
### Installing Tangram in Linux
Tangram is available as a Flatpak for every Linux distribution, and you can also find it in [AUR][7].
If you want to install it via the terminal, type in the following command:
```
flatpak install flathub re.sonny.Tangram
```
You may refer to our [Flatpak guide][8] if you do not have it enabled on your system.
To explore more about it, you can check out its [GitHub page][9].
[Tangram Browser][10]
Have you tried this yet? Do you prefer web applications or native applications? Feel free to share your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/tangram/
作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/tangram-web-app-browser.png?resize=800%2C611&ssl=1
[2]: https://itsfoss.com/best-browsers-ubuntu-linux/
[3]: https://itsfoss.com/franz-messaging-app/
[4]: https://itsfoss.com/rambox/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/09/tangram-settings.png?resize=530%2C290&ssl=1
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/09/tangram-web-app-whatsapp.png?resize=800%2C431&ssl=1
[7]: https://itsfoss.com/aur-arch-linux/
[8]: https://itsfoss.com/flatpak-guide/
[9]: https://github.com/sonnyp/Tangram
[10]: https://flathub.org/apps/details/re.sonny.Tangram

View File

@ -0,0 +1,67 @@
[#]: subject: "A guide to understanding your team's implicit values and needs"
[#]: via: "https://opensource.com/open-organization/21/8/leadership-cultural-social-norms"
[#]: author: "Ron McFarland https://opensource.com/users/ron-mcfarland"
[#]: collector: "lujun9972"
[#]: translator: "zz-air"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
了解团队隐含价值观和需求的指南
======
为了增强团队动力,开放的领导可以研究指导成员行为和决策的隐性社会规范。
![Working meetings can be effective meetings][1]
文化在[开放的组织][2]很重要。 但“文化”似乎是一个如此庞大而复杂的概念。我们该如何帮助开放式的团队组织去理解它呢?
一个解决方案可能来自于 [_Rule Makers, Rule Breakers_][4]_的作者 [Michele J. Gelfand][3]紧密和松散的文化以及指导我们生活的秘密信号_。Gelfand 把所有的国家和文化分成简单的两类, 一类是“紧密的”文化另一类是“松散的”。然后,她解释了两者的特点和社会规范,提供了它们的相对优势和劣势。通过研究两者,我们可以克服团队、组织和国家之间的分歧和冲突。
In this two-part review of _Rule Makers, Rule Breakers_, 我将解释 Gelfand 的论点,并讨论它对在开放性组织中工作的人们有用的方式。
### 了解你的社会规范
Gelfand 认为,我们的行为很大程度上取决于我们是生活在 "紧密的" 还是 "松散的" 社区文化中,因为这些文化有不同于其他文化的社会规范。这些规范————以及强制执行的严格程度————将决定我们在社会中的行为。 它们给了我们身份。它们帮助我们彼此协调,简而言之,这些价值使社区团结在一起。
它们也会影响我们的世界观,影响我们构造环境的方式,甚至影响我们大脑的处理过程。 Gelfand 写道:“无数研究表明,社会规范对于将社区团结成合作、协调良好的团体,从而实现伟大成就至关重要。” 纵观历史,社区让其公民参加看似最疯狂的仪式,除了维持群体凝聚力和合作外,别无其他原因。 这些仪式产生了更紧密的联系,使人们得以生存(特别是在狩猎、觅食和战争时期)。
社会规范包括我们所有人都会自动遵守的规则, Gelfand 称之为一种 “规范性自动驾驶仪。” 这些是我们不需要思考就能做的事情————例如,在图书馆、电影院、电梯或飞机上保持安静。 我们会自动的做这些事。 “从外面看,” Gelfand 说, “我们的社会规范通常看起来很奇怪。但在内心深处,我们认为这是理所当然的。” 她解释到,社会规范可以被编入法规和法律(“遵守停车标志”和“不要偷窃”)。还有一些基本上是默不作声的(“不要盯着火车上的人看”或“打喷嚏时捂住嘴”)。当然,它们因环境而异。
挑战在于大多数社会规范都是无形的,我们不知道这些社会规范在多大程度上控制着我们。在不知不觉中,我们常常只是跟随周围的人群。这被称为“群体思维”,在这种思维中,人们会跟随他们认同的群体,即使这个群体是错误的。他们不想站出来。
### 组织,有松有紧
Gelfand 将社会规范组织成不同的群体。她认为,一些规范具有“紧密”文化的特征,而另一些规范则具有“松散”文化的特征。为此, Gelfand 对来自五大洲 30 多个国家的约 7000 人进行了研究和抽样,他们的职业、性别、年龄、宗教、教派,以及社会阶层,以了解这些社区将自己定位在何处(以及他们的社会规范在官方和社区/社区总体上的执行力度)。 紧密和松散文化之间的差异在国家之间、国家内部(如美国及其各个地区)、组织内部、社会阶层内部甚至家庭内部都有所不同。
因为组织有文化,它们也有自己的社会规范(毕竟,如果一个组织无法协调其成员并影响其行为,它将无法生存)。 因此,组织也可以反映和灌输 Gelfand 所描述的轻松”或“松散”的文化特征。 并且如果我们有很强的能力识别这些差异,我们就能更成功地预测和解决冲突。然后,在对这些社会规范有了更高认识的情况下,我们可以将开放式组织原则付诸实践。
Gelfand 这样描述紧密和松散文化的区别:
> 从广义上讲,松散的文化倾向于开放,但它们也更加无序。另一方面,紧密的文化有令人欣慰的秩序和可预测性,但它们的容忍度较低。这就是紧-松的权衡:一个领域的优势与另一个领域的劣势并存。
她总结说,紧密的社会保持着严格的社会秩序、同步性和自律性;宽松的社会以高度宽容、富有创造力和对变化持开放态度而自豪。
虽然并非所有情况都是如此,但紧密和松散的文化通常会表现出一些权衡;每个人都有自己的长处和短处。参见下面的图 1 。
![][5]
在这两种环境中成功应用五项开放式组织原则的工作可能会有很大的不同。要取得成功,社区承诺至关重要,如果社会规范不同,承诺的原因也会不同。组织领导者必须知道社区的价值观是什么。只有这样,这个人才能充分激励他人。
在本综述的下一部分中,我将更彻底地解释紧密文化和松散文化的特征,以便领导者能够更好地了解如何将开放式组织原则运用到团队中。
--------------------------------------------------------------------------------
via: https://opensource.com/open-organization/21/8/leadership-cultural-social-norms
作者:[Ron McFarland][a]
选题:[lujun9972][b]
译者:[zz-air](https://github.com/zz-air)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ron-mcfarland
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/leader-team-laptops-conference-meeting.png?itok=ztoA0E6f (Working meetings can be effective meetings)
[2]: https://theopenorganization.org/definition/
[3]: https://www.michelegelfand.com/
[4]: https://www.michelegelfand.com/rule-makers-rule-breakers
[5]: https://opensource.com/sites/default/files/images/open-org/rule-makers-breakers-1.png

View File

@ -7,63 +7,58 @@
[#]: via: (https://opensource.com/article/20/2/external-libraries-java)
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
Using external libraries in Java
在 Java 中使用外部库
======
External libraries fill gaps in the Java core libraries.
外部库填补了 Java 核心库中的一些功能空白。
![books in a library, stacks][1]
Java comes with a core set of libraries, including those that define commonly used data types and related behavior, like **String** or **Date**; utilities to interact with the host operating system, such as **System** or **File**; and useful subsystems to manage security, deal with network communications, and create or parse XML. Given the richness of this core set of libraries, it's often easy to find the necessary bits and pieces to reduce the amount of code a programmer must write to solve a problem.
Java 自带有一组核心库,其中包含了定义常用数据类型和相关行为的库(例如 **String****Date**)、与主机操作系统交互的实用程序(例如 **System****File**),以及一些用来管理安全性、处理网络通信、创建或解析 XML的有用的子系统。鉴于核心库的丰富性程序员通常很容易在其中找到有用的组件以减少需要编写的代码量。
Even so, there are a lot of interesting Java libraries created by people who find gaps in the core libraries. For example, [Apache Commons][2] "is an Apache project focused on all aspects of reusable Java components" and provides a collection of some 43 open source libraries (as of this writing) covering a range of capabilities either outside the Java core (such as [geometry][3] or [statistics][4]) or that enhance or replace capabilities in the Java core (such as [math][5] or [numbers][6]).
即便如此,核心库仍有一些功能上的不足,因此发现这些不足的程序员们还额外创建了很多有趣的 Java 库。例如,[Apache Commons][2] <q>是一个专注于可重用 Java 组件所有方面的 Apache 项目</q>,提供了大约 43 个开源库的集合(截至撰写本文时),涵盖了 Java 核心库之外的一系列功能 (例如 [geometry][3] 或 [statistics][4]),并增强或替换了 Java 核心库中的原有功能(例如 [math][5] 或 [numbers][6])。
Another common type of Java library is an interface to a system component—for example, to a database system. This article looks at using such an interface to connect to a [PostgreSQL][7] database and get some interesting information. But first, I'll review the important bits and pieces of a library.
另一种常见的 Java 库类型是系统组件的接口(例如数据库系统接口),本文会着眼于使用此类接口连接到 [PostgreSQL][7] 数据库,并得到一些有趣的信息。首先,我们来回顾一下库的重要部分。
### What is a library?
### 什么是库?
A library, of course, must contain some useful code. But to be useful, that code needs to be organized in such a way that the Java programmer can access the components to solve the problem at hand.
库里自然包含的是一些有用的代码。但为了发挥用处,代码需要以特定方式进行组织,特定的方式使 Java 程序员可以访问其中组件来解决手头问题。
I'll boldly claim that the most important part of a library is its application programming interface (API) documentation. This kind of documentation is familiar to many and is most often produced by [Javadoc][8], which reads structured comments in the code and produces HTML output that displays the API's packages in the panel in the top-left corner of the page; its classes in the bottom-left corner; and the detailed documentation at the library, package, or class level (depending on what is selected in the main panel) on the right. For example, the [top level of API documentation for Apache Commons Math][9] looks like:
可以说,一个库最重要的部分是它的应用程序编程接口 (API) 文档。这种文档很多人都熟悉,通常是由 [Javadoc][8] 生成的。Javadoc 读取代码中的结构化注释并以 HTML 格式输出文档,通常 API 的 <ruby><rt><rp>(</rp>pacage<rp>)</rp></rt></ruby> 在页面左上角的面板中显示,<ruby><rt><rp>(</rp>class<rp>)</rp></rt></ruby> 在左下角显示,同时右侧会有库、包或类级别的详细文档(具体取决于在主面板中选择的内容)。例如,[Apache Commons Math 的顶级 API 文档][9] 如下所示:
![API documentation for Apache Commons Math][10]
Clicking on a package in the main panel shows the Java classes and interfaces defined in that package. For example, **[org.apache.commons.math4.analysis.solvers][11]** shows classes like **BisectionSolver** for finding zeros of univariate real functions using the bisection algorithm. And clicking on the [BisectionSolver][12] link lists all the methods of the class **BisectionSolver**.
单击主面板中的包会显示该包中定义的 Java 类和接口。例如,**[org.apache.commons.math4.analysis.solvers][11]** 显示了诸如 **BisectionSolver** 这样的类,该类用于使用二分算法查找单变量实函数的零点。单击 [BisectionSolver][12] 链接会列出 **BisectionSolver** 类的所有方法。
This type of documentation is useful as reference information; it's not intended as a tutorial for learning how to use the library. For example, if you know what a univariate real function is and look at the package **org.apache.commons.math4.analysis.function**, you can imagine using that package to compose a function definition and then using the **org.apache.commons.math4.analysis.solvers** package to look for zeros of the just-created function. But really, you probably need more learning-oriented documentation to bridge to the reference documentation. Maybe even an example!
这类文档可用作参考文档,不适合作为学习如何使用库的教程。比如,如果你知道什么是单变量实函数并查看包 **org.apache.commons.math4.analysis.function**,就可以试着使用该包来组合函数定义,然后使用 **org.apache.commons.math4.analysis.solvers** 包来查找刚刚创建的函数的零点。但如果你不知道,就可能需要更多学习向的文档,也许甚至是一个实际例子,来读懂参考文档。
This documentation structure also helps clarify the meaning of _package_—a collection of related Java class and interface definitions—and shows what packages are bundled in a particular library.
这种文档结构还有助于阐明 _package_(相关 Java 类和接口定义的集合)的含义,并显示特定库中捆绑了哪些包。
The code for such a library is most commonly found in a [**.jar** file][13], which is basically a .zip file created by the Java **jar** command that contains some other useful information. **.jar** files are typically created as the endpoint of a build process that compiles all the **.java** files in the various packages defined.
这种库的代码通常是在 [**.jar** 文件][13] 中,它基本上是由 Java 的 **jar** 命令创建的 .zip 文件,其中还包含一些其他有用的信息。**.jar** 文件通常被创建为构建过程的端点,该构建过程编译了所定义包中的所有 **.java** 文件。
There are two main steps to accessing the functionality provided by an external library:
要访问外部库提供的功能,有两个主要步骤:
1. Make sure the library is available to the Java compilation step—[**javac**][14]—and the execution step—**java**—via the classpath (either the **-cp** argument on the command line or the **CLASSPATH** environment variable).
2. Use the appropriate **import** statements to access the package and class in the program source code.
1. 确保通过类路径(或者命令行中的 **-cp** 参数或者 **CLASSPATH** 环境变量),库可用于 Java 编译步骤([**javac**][14])和执行步骤(**java**)。
2. 使用恰当的 **import** 语句访问程序源代码中的包和类。
其余的步骤就与使用 **String** 等 Java核心类相同使用库提供的类和接口定义来编写代码。很简单对吧不过也没那么简单。首先你需要了解库组件的预期使用模式然后才能编写代码。
### 示例:连接 PostgreSQL 数据库
The rest is just like coding with Java core classes, such as **String**—write the code using the class and interface definitions provided by the library. Easy, eh? Well, maybe not quite that easy; first, you need to understand the intended use pattern for the library components, and then you can write code.
在数据库系统中访问数据的典型使用步骤是:
### An example: Connect to a PostgreSQL database
1. 访问正在使用的特定数据库软件代码。
2. 连接到数据库服务器。
3. 构建查询字符串。
4. 执行查询字符串。
5. 针对返回的结果,做需要的处理。
6. 断开与数据库服务器的连接。
The typical use pattern for accessing data in a database system is:
所有这些面向程序员的部分由接口包 **[java.sql][15]** 提供,它独立于数据库,定义了核心客户端 Java 数据库连接 (JDBC) API。**java.sql** 包是 Java 核心库的一部分,因此无需提供 **.jar** 文件即可编译。但每个数据库提供者都会创建自己的 **java.sql** 接口实现(例如 **Connection** 接口),并且必须在运行步骤中提供这些实现。
1. Gain access to the code specific to the database software being used.
2. Connect to the database server.
3. Build a query string.
4. Execute the query string.
5. Do something with the results returned.
6. Disconnect from the database server.
接下来我们使用 PostgreSQL看看这一过程是如何进行的。
#### 访问特定数据库的代码
The programmer-facing part of all of this is provided by a database-independent interface package, **[java.sql][15]**, which defines the core client-side Java Database Connectivity (JDBC) API. The **java.sql** package is part of the core Java libraries, so there is no need to supply a **.jar** file to the compile step. However, each database provider creates its own implementation of the **java.sql** interfaces—for example, the **Connection** interface—and those implementations must be provided on the run step.
Let's see how this works, using PostgreSQL.
#### Gain access to the database-specific code
The following code uses the [Java class loader][16] (the **Class.forName()** call) to bring the PostgreSQL driver code into the executing virtual machine:
以下代码使用 [Java 类加载器][16]**Class.forName()** 调用)将 PostgreSQL 驱动程序代码加载到正在执行的虚拟机中:
```
import java.sql.*;
@ -90,10 +85,9 @@ public class Test1 {
}
```
Because the class loader can fail, and therefore can throw an exception when failing, surround the call to **Class.forName()** in a try-catch block.
If you compile the above code with **javac** and run it with Java:
因为类加载器可能失败,失败时会抛出异常,所以将对 **Class.forName()** 的调用放在 try-catch 代码块中。
如果你使用 **javac** 编译上面的代码,然后用 Java 运行,会报异常:
```
me@mymachine:~/Test$ javac Test1.java
@ -103,8 +97,7 @@ java.lang.ClassNotFoundException: org.postgresql.Driver
me@mymachine:~/Test$
```
The class loader needs the **.jar** file containing the PostgreSQL JDBC driver implementation to be on the classpath:
类加载器要求类路径中有包含 PostgreSQL JDBC 驱动程序实现的 **.jar** 文件:
```
me@mymachine:~/Test$ java -cp ~/src/postgresql-42.2.5.jar:. Test1
@ -113,10 +106,9 @@ done.
me@mymachine:~/Test$
```
#### Connect to the database server
The following code loads the JDBC driver and creates a connection to the PostgreSQL database:
#### 连接到数据库服务器
以下代码实现了加载 JDBC 驱动程序和创建到 PostgreSQL 数据库的连接:
```
import java.sql.*;
@ -161,8 +153,7 @@ public class Test2 {
}
```
Compile and run it:
编译并运行上述代码:
```
me@mymachine:~/Test$ javac Test2.java
@ -174,19 +165,18 @@ done.
me@mymachine:~/Test$
```
Some notes on the above:
关于上述的一些注意事项:
* The code following comment [2] uses system properties to set up connection parameters—in this case, the PostgreSQL username and password. This allows for grabbing those parameters from the Java command line and passing all the parameters in as an argument bundle. There are other **Driver.getConnection()** options for passing in the parameters individually.
* JDBC requires a URL for defining the database, which is declared above as **String database** and passed into the **Driver.getConnection()** method along with the connection parameters.
* The code uses try-with-resources, which auto-closes the connection upon completion of the code in the try-catch block. There is a lengthy discussion of this approach on [Stack Overflow][23].
* The try-with-resources provides access to the **Connection** instance and can execute SQL statements there; any errors will be caught by the same **catch** statement.
* 注释 [2] 后面的代码使用系统属性来设置连接参数(在本例中参数为 PostgreSQL 用户名和密码)。代码也可以从 Java 命令行获取这些参数并将所有参数作为参数包传递,同时还有一些其他 **Driver.getConnection()** 选项可用于单独传递参数。
* JDBC 需要一个用于定义数据库的 URL它在上述代码中被声明为 **String database** 并与连接参数一起传递给 **Driver.getConnection()** 方法。
* 代码使用 try-with-resources 语句,它会在 try-catch 块中的代码完成后自动关闭连接。[Stack Overflow][23] 上对这种方法进行了长期的讨论。
* try-with-resources 语句提供对 **Connection** 实例的访问,并可以在其中执行 SQL 语句;所有错误都会被同一个 **catch** 语句捕获。
#### Do something fun with the database connection
#### 用数据库的连接处理一些有趣的事情
In my day job, I often need to know what users have been defined for a given database server instance, and I use this [handy piece of SQL][24] for grabbing a list of all users:
日常工作中,我经常需要知道为给定的数据库服务器实例定义了哪些用户,这里我使用这个 [简便的 SQL][24] 来获取所有用户的列表:
```
import java.sql.*;
@ -264,10 +254,9 @@ public class Test3 {
}
```
In the above, once it has the **Connection** instance, it defines a query string (comment [4] above), creates a **Statement** instance and uses it to execute the query string, then puts its results in a **ResultSet** instance, which it can iterate through to analyze the results returned, and ends by closing both the **ResultSet** and **Statement** instances (comment [5] above).
Compiling and executing the program produces the following output:
在上述代码中,一旦有了 **Connection** 实例,它就会定义一个查询字符串(上面的注释 [4]),创建一个 **Statement** 实例并用其来执行查询字符串,然后将其结果放入一个 **ResultSet** 实例。程序可以遍历该 **ResultSet** 实例来分析返回的结果,并以关闭 **ResultSet****Statement** 实例结束(上面的注释 [5])。
编译和执行程序会产生以下输出:
```
me@mymachine:~/Test$ javac Test3.java
@ -284,7 +273,7 @@ done.
me@mymachine:~/Test$
```
This is a (very simple) example of using the PostgreSQL JDBC library in a simple Java application. It's worth emphasizing that it didn't need to use a Java import statement like **import org.postgresql.jdbc.*;** in the code because of the way the **java.sql** library is designed. Because of that, there's no need to specify the classpath at compile time. Instead, it uses the Java class loader to bring in the PostgreSQL code at run time.
这是在一个简单的 Java 应用程序中使用 PostgreSQL JDBC 库的(非常简单的)示例。要注意的是,由于 **java.sql** 库的设计方式,它不需要在代码中使用像 **import org.postgresql.jdbc.*;** 这样的 Java 导入语句,而是使用 Java 类加载器在运行时引入 PostgreSQL 代码的方式,也正因此无需在代码编译时指定类路径。
--------------------------------------------------------------------------------

View File

@ -1,381 +0,0 @@
[#]: subject: (Analyze the Linux kernel with ftrace)
[#]: via: (https://opensource.com/article/21/7/linux-kernel-ftrace)
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
[#]: collector: (lujun9972)
[#]: translator: (mengxinayan)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
通过 `ftrace` 来分析 Linux 内核
======
通过 `ftrace` 来了解 Linux 内核内部工作方式是一个好方法。
![Linux keys on the keyboard for a desktop computer][1]
一个操作系统的内核是最难以理解的软件之一。自从你的系统启动后,它会一直在后台运行。尽管每个用户都不与内核直接交互,但他们在内核的帮助下完成自己的计算任务。与内核的交互发生在调用系统调用或者用户日常使用的各种库或应用间接调用了系统调用。
在之前的文章里我介绍了如何使用 `strace` 来追踪系统调用。然而,使用 `strace` 时你的可见性是受限的。它允许你查看特定参数的系统调用。并在工作完成后,看到其返回值或状态,来表明是通过还是失败。但是你无法知道内核在这段时间内发生了什么。除了系统调用外,内核中还有很多其他活动发生时却被忽略了。
### `ftrace` 介绍
本文的目的是通过使用一个名为 `ftrace` 的机制来追踪内核函数。任何 Linux 用户可以通过使用它来轻松地追踪内核,并且了解更多关于 Linux 内核内部如何工作。
`ftrace` 默认产生的输出是巨大的,因为内核总是忙的。为了节省空间,很多情况下我会通过截断来给出最小输出。
我使用 Fedora 来演示下面的例子,但是它们应该在其他最新的 Linux 发行版上同样可以运行。
### 启用 `ftrace`
`ftrace` 现在已经是内核中的一部分了,你不再需要事先安装它了。也就是说,如果你在使用最近的 Linux 系统,那么 `ftrace` 是已经启动了的。为了验证 `ftrace` 是否可用,运行 `mount` 命令并查找 `tracefs`。如果你看到类似下面的输出,表示 `ftrace` 已经启用,你可以轻松地尝试本文中下面的例子。下面的命令需要在 root 用户下使用(`sudo` 是不够的)
```
$ sudo mount | grep tracefs
none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel)
```
要想使用 `ftrace`,你首先需要进入上面 `mount` 命令中找到的特定目录中,在那个目录下运行文章中的其他命令。
```
`$ cd /sys/kernel/tracing`
```
### 一般的工作流程
首先,你需要理解捕捉踪迹和获取输出的一般流程。如果你直接运行 `ftrace`,没有任何特定的 `ftrace-` 命令会被运行。相反的,你基本上是通过标准 Linux 命令来写入或读取一些文件。
通用的步骤如下:
1. 通过写入一些特定文件来启用/结束追踪
2. 通过写入一些特定文件来设置/取消追踪时的过滤规则
3. 读取基于第 1 和 2 步的追踪输出
4. 清除输出的文件或缓存
5. 缩小到特定用例你要追踪的内核函数重复1,2,3,4 步
First of all, you must understand the general workflow of capturing a trace and obtaining the output. If you're using `ftrace` directly, there isn't any special `ftrace-`specific commands to run. Instead, you basically write to some files and read from some files using standard command-line Linux utilities.
### 可用的追踪器类型
有多种不同的追踪器可供你使用。之前提到,在运行任何命令前,你需要进入一个特定的目录下,因为文件在这些目录下。我在我的例子中使用相对路径(与绝对路径相反)
你可以查看 `available_tracers` 文件内容来查看所有可用的追踪器类型。你可以可以看下面列出了几个。不需要担心有这么多。
```
$ pwd
/sys/kernel/tracing
$ sudo cat available_tracers
hwlat blk mmiotrace function_graph wakeup_dl wakeup_rt wakeup function nop
```
在所有输出的追踪器中,我会聚焦于下面三个特殊的:启用追踪的 `function``function_graph`,以及停止追踪的 `nop`
### 确认当前的追踪器
通常情况默认的追踪器设定为 `nop`。即在特殊文件中 `current_tracer` 中的 “无操作”,这意味着追踪目前是关闭的。
```
$ pwd
/sys/kernel/tracing
$ sudo cat current_tracer
nop
```
### 查看追踪输出
在启用任何追踪功能之前,请你看一下保存追踪输出的文件。你可以用 [cat](2) 命令查看名为 `trace` 的文件的内容。
```
$ sudo cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0   #P:8
#
#                                _-----=&gt; irqs-off
#                               / _----=&gt; need-resched
#                              | / _---=&gt; hardirq/softirq
#                              || / _--=&gt; preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
```
### 启用 `function` 追踪器
你可以通过向 `current_tracer` 文件写入 `function` 来启用第一个追踪器 `function`(文件原本内容为 `nop`,意味着追踪是关闭的)。把这个操作看成是启用追踪的一种方式。
```
$ pwd
/sys/kernel/tracing
$ sudo cat current_tracer
nop
$ echo function &gt; current_tracer
$
$ cat current_tracer
function
```
### 查看 `function` 追踪器的更新追踪输出
现在你已启动追踪,是时候查看输出了。如果你查看 `trace` 文件内容,你将会看到许多被连续写入的内容。我通过管道只展示了文件内容的前 20 行。根据左边输出的标题,你可以看到在某个 CPU 上运行的任务和进程 ID。根据右边输出的内容你可以看到具体的内核函数和其副函数。中间显示了时间信息。
```
$ sudo cat trace | head -20
# tracer: function
#
# entries-in-buffer/entries-written: 409936/4276216   #P:8
#
#                                _-----=&gt; irqs-off
#                               / _----=&gt; need-resched
#                              | / _---=&gt; hardirq/softirq
#                              || / _--=&gt; preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
          &lt;idle&gt;-0       [000] d...  2088.841739: tsc_verify_tsc_adjust &lt;-arch_cpu_idle_enter
          &lt;idle&gt;-0       [000] d...  2088.841739: local_touch_nmi &lt;-do_idle
          &lt;idle&gt;-0       [000] d...  2088.841740: rcu_nocb_flush_deferred_wakeup &lt;-do_idle
          &lt;idle&gt;-0       [000] d...  2088.841740: tick_check_broadcast_expired &lt;-do_idle
          &lt;idle&gt;-0       [000] d...  2088.841740: cpuidle_get_cpu_driver &lt;-do_idle
          &lt;idle&gt;-0       [000] d...  2088.841740: cpuidle_not_available &lt;-do_idle
          &lt;idle&gt;-0       [000] d...  2088.841741: cpuidle_select &lt;-do_idle
          &lt;idle&gt;-0       [000] d...  2088.841741: menu_select &lt;-do_idle
          &lt;idle&gt;-0       [000] d...  2088.841741: cpuidle_governor_latency_req &lt;-menu_select
```
请记住当追踪打开后,这意味着追踪结果会被一直连续写入直至你关闭追踪。
### 关闭追踪
关闭追踪是简单的。你只需要在 `current_tracer` 文件中用 `nop` 替换 `function` 追踪器即可:
```
$ sudo cat current_tracer
function
$ sudo echo nop &gt; current_tracer
$ sudo cat current_tracer
nop
```
### 启用 `function_graph` 追踪器
现在尝试第二个名为 `function_graph` 的追踪器。你可以使用和上面相同的步骤:在 `current_tracer` 文件中写入 `function_graph`
```
$ sudo echo function_graph &gt; current_tracer
$ sudo cat current_tracer
function_graph
```
### `function_tracer` 追踪器的追踪输出
注意到目前 `trace` 文件的输出格式已经发生变化。现在,你可以看到 CPU ID 和内核函数的执行时间。接下来,一个花括号表示一个函数的开始,以及它内部调用了哪些其他函数。
```
$ sudo cat trace | head -20
# tracer: function_graph
#
# CPU  DURATION                  FUNCTION CALLS
# |     |   |                     |   |   |   |
 6)               |              n_tty_write() {
 6)               |                down_read() {
 6)               |                  __cond_resched() {
 6)   0.341 us    |                    rcu_all_qs();
 6)   1.057 us    |                  }
 6)   1.807 us    |                }
 6)   0.402 us    |                process_echoes();
 6)               |                add_wait_queue() {
 6)   0.391 us    |                  _raw_spin_lock_irqsave();
 6)   0.359 us    |                  _raw_spin_unlock_irqrestore();
 6)   1.757 us    |                }
 6)   0.350 us    |                tty_hung_up_p();
 6)               |                mutex_lock() {
 6)               |                  __cond_resched() {
 6)   0.404 us    |                    rcu_all_qs();
 6)   1.067 us    |                  }
```
### 启用追踪的设置来增加追踪的深度
你可以使用下面的步骤来调整追踪器以看到更深层次的函数调用。完成之后,你可以查看 `trace` 文件的内容并发现输出变得更加详细了。为了文章的可读性,这个例子的输出被省略了:
```
$ sudo cat max_graph_depth
0
$ sudo echo 1 &gt; max_graph_depth
$ # or
$ sudo echo 2 &gt; max_graph_depth
$ sudo cat trace
```
### 查找要追踪的函数
上面的步骤足以让你开始追踪。但是它产生的输出内容是巨大的,当你想试图找到自己感兴趣的内容时,往往会很困难。通常你更希望能够之追踪特定的函数,而忽略其他函数。但如果你不知道它们确切的名称,你怎么知道要追踪哪些进程?有一个文件可以帮助你解决这个问题 —— `available_filter_functions` 文件提供了一个可供追踪的函数列表。
```
$ sudo wc -l available_filter_functions  
63165 available_filter_functions
```
### 查找一般的内核函数
现在试着搜索一个你所知道的简单内核函数。用户空间有 `malloc` 函数用来分配内存,而内核有 `kmalloc` 函数,它提供类似的功能。下面是所有与 `kmalloc` 相关的函数。
```
$ sudo grep kmalloc available_filter_functions
debug_kmalloc
mempool_kmalloc
kmalloc_slab
kmalloc_order
kmalloc_order_trace
kmalloc_fix_flags
kmalloc_large_node
__kmalloc
__kmalloc_track_caller
__kmalloc_node
__kmalloc_node_track_caller
[...]
```
### 查找内核模块或者驱动相关函数
`available_filter_functions` 文件的输出中,你可以看到一些以括号内文字结尾的行,例如下面的例子中的 `[kvm_intel]`。这些函数与当前加载的内核模块 `kvm_intel` 有关。你可以运行 `lsmod` 命令来验证。
```
$ sudo grep kvm available_filter_functions | tail
__pi_post_block [kvm_intel]
vmx_vcpu_pi_load [kvm_intel]
vmx_vcpu_pi_put [kvm_intel]
pi_pre_block [kvm_intel]
pi_post_block [kvm_intel]
pi_wakeup_handler [kvm_intel]
pi_has_pending_interrupt [kvm_intel]
pi_update_irte [kvm_intel]
vmx_dump_dtsel [kvm_intel]
vmx_dump_sel [kvm_intel]
$ lsmod  | grep -i kvm
kvm_intel             335872  0
kvm                   987136  1 kvm_intel
irqbypass              16384  1 kvm
```
### 仅追踪特定的函数
为了实现对特定函数或模式的追踪,你可以利用 `set_ftrace_filter` 文件来指定你要追踪上述输出中的哪些函数。这个文件也接受 `*` 模式它可以扩展到包括具有给定模式的其他函数。作为一个例子我在我的机器上使用ext4文件系统。我可以用下面的命令指定ext4的特定内核函数来追踪。
```
$ sudo mount | grep home
/dev/mapper/fedora-home on /home type ext4 (rw,relatime,seclabel)
$ pwd
/sys/kernel/tracing
$ sudo cat set_ftrace_filter
#### all functions enabled ####
$
$ echo ext4_* &gt; set_ftrace_filter
$
$ cat set_ftrace_filter
ext4_has_free_clusters
ext4_validate_block_bitmap
ext4_get_group_number
ext4_get_group_no_and_offset
ext4_get_group_desc
[...]
```
现在当你可以看到追踪输出时,你只能看到与内核函数有关的 `ext4` 函数,而你之前已经为其设置了一个过滤器。所有其他的输出都被忽略了。
```
$ sudo cat trace |head -20
# tracer: function
#
# entries-in-buffer/entries-written: 3871/3871   #P:8
#
#                                _-----=&gt; irqs-off
#                               / _----=&gt; need-resched
#                              | / _---=&gt; hardirq/softirq
#                              || / _--=&gt; preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
           cupsd-1066    [004] ....  3308.989545: ext4_file_getattr &lt;-vfs_fstat
           cupsd-1066    [004] ....  3308.989547: ext4_getattr &lt;-ext4_file_getattr
           cupsd-1066    [004] ....  3308.989552: ext4_file_getattr &lt;-vfs_fstat
           cupsd-1066    [004] ....  3308.989553: ext4_getattr &lt;-ext4_file_getattr
           cupsd-1066    [004] ....  3308.990097: ext4_file_open &lt;-do_dentry_open
           cupsd-1066    [004] ....  3308.990111: ext4_file_getattr &lt;-vfs_fstat
           cupsd-1066    [004] ....  3308.990111: ext4_getattr &lt;-ext4_file_getattr
           cupsd-1066    [004] ....  3308.990122: ext4_llseek &lt;-ksys_lseek
           cupsd-1066    [004] ....  3308.990130: ext4_file_read_iter &lt;-new_sync_read
```
### 排除要被追踪的函数
你并不总是知道你想追踪什么,但是,你肯定知道你不想追踪什么。因此,有一个 `set_ftrace_notrace` —— 请注意其中的 "no"。你可以在这个文件中写下你想要的模式,并启用追踪。这样除了所提到的模式外,任何其他东西都会被追踪到。这通常有助于删除那些使我们的输出变得混乱的普通功能。
```
$ sudo cat set_ftrace_notrace
#### no functions disabled ####
```
### 具有目标性的追踪
到目前为止,你一直在追踪内核中发生的一切。但是,他无法帮助你追踪与某个特定命令有关的事件。为了达到这个目的,你可以按需打开和关闭跟踪,并且在它们之间,运行我们选择的命令,这样你就不会在跟踪输出中得到额外的输出。你可以通过向 `tracing_on` 写入 `1` 来启用跟踪,写 `0` 来关闭跟踪。
```
$ sudo cat tracing_on
0
$ sudo echo 1 &gt; tracing_on
$ sudo cat tracing_on
1
$ # Run some specific command that we wish to trace here
$ sudo echo 0 &gt; tracing_on
$ cat tracing_on
0
```
### 追踪特定的 PID
如果你想追踪与正在运行的特定进程有关的活动,你可以将该 PID 写入一个名为 `set_ftrace_pid` 的文件然后启用追踪。这样一来追踪就只限于这个PID这在某些情况下是非常有帮助的。
```
`$ sudo echo $PID > set_ftrace_pid`
```
### 总结
`ftrace` 是一个了解 Linux 内核内部工作的很好方式。通过一些练习,你可以学会对 `ftrace` 进行调整以缩小搜索范围。要想更详细地了解 `ftrace` 和它的高级用法,请看 `ftrace` 的核心作者 Steven Rostedt 写的这些优秀文章。
* [调试 Linux 内核,第一部分](3)
* [调试 Linux 内核,第二部分](4)
* [调试 Linux 内核,第三部分](5)
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/7/linux-kernel-ftrace
作者:[Gaurav Kamathe][a]
选题:[lujun9972][b]
译者:[萌新阿岩](https://github.com/mengxinayan)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/gkamathe
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
[2]: https://opensource.com/article/19/2/getting-started-cat-command
[3]: https://lwn.net/Articles/365835/
[4]: https://lwn.net/Articles/366796/
[5]: https://lwn.net/Articles/370423/

Some files were not shown because too many files have changed in this diff Show More