mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
Merge branch 'master' of https://github.com/LCTT/TranslateProject into translating
This commit is contained in:
commit
7947990a63
116
published/20210719 Apps for daily needs part 2- office suites.md
Normal file
116
published/20210719 Apps for daily needs part 2- office suites.md
Normal 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
|
389
published/20210727 Analyze the Linux kernel with ftrace.md
Normal file
389
published/20210727 Analyze the Linux kernel with ftrace.md
Normal 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
|
@ -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/) 荣誉推出
|
||||
|
@ -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/) 荣誉推出
|
||||
|
@ -3,18 +3,20 @@
|
||||
[#]: author: "Ankush Das https://itsfoss.com/author/ankush/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13750-1.html"
|
||||
|
||||
Zulip:一个有趣的开源的 Slack 替代品
|
||||
Zulip:一个不错的开源的 Slack 替代品
|
||||
======
|
||||
|
||||
_**简介:** Zulip 是一个开源的协作平台,它把自己定位为 Slack 的一个更好的替代品。让我们仔细看看。_
|
||||
> Zulip 是一个开源的协作平台,它把自己定位为一个更好的 Slack 替代品。让我们来了解一下。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202109/04/083746lbheeynx13jmn3xn.jpg)
|
||||
|
||||
当涉及到你的工作时,消息和协作平台有很大的不同。
|
||||
|
||||
虽然有几个选择,但 Slack 是许多组织使用的一个流行选择。但是,你可以自托管的 Slack 的开源替代方案如何呢?
|
||||
虽然有几个选择,但 Slack 是许多组织使用的一个流行选择。但是,可以自托管的 Slack 的开源替代方案如何呢?
|
||||
|
||||
Zulip 就是这样一个软件。
|
||||
|
||||
@ -22,11 +24,11 @@ Zulip 就是这样一个软件。
|
||||
|
||||
![][1]
|
||||
|
||||
如果你想探索,我必须提到还有更多的 [Slack 开源替代品][2]。
|
||||
如果你想多了解,我必须提到还有更多的 [Slack 开源替代品][2]。
|
||||
|
||||
在这里,我重点介绍 Zulip。
|
||||
但在这里,我重点介绍 Zulip。
|
||||
|
||||
Zulip 是一个免费开源的消息应用,有付费托管选项和自我托管的能力。
|
||||
Zulip 是一个自由而开源的消息应用,有付费托管选项和自托管的能力。
|
||||
|
||||
它旨在提供与 Slack 类似的体验,同时努力帮助你利用话题提高对话的有效性。
|
||||
|
||||
@ -44,38 +46,36 @@ Zulip 是一个免费开源的消息应用,有付费托管选项和自我托
|
||||
* 代码块
|
||||
* 集成 GitHub 来跟踪问题
|
||||
* 支持电子邮件通知
|
||||
* 自我托管选项
|
||||
* 自托管选项
|
||||
* 信息编辑
|
||||
* GIPHY 集成
|
||||
* 集成 GIPHY
|
||||
* 用 Zoom、Jitsi 或 BigBlueButton 进行视频通话
|
||||
|
||||
|
||||
|
||||
除了上述功能外,你应该期待你通常在 Slack 和其他方面得到的基本选项。
|
||||
除了上述功能外,你可以预期得到你通常在 Slack 和其他方面得到的基本选项。
|
||||
|
||||
此外,如果你愿意,你还可以将它与 Matrix 和 IRC 整合。
|
||||
|
||||
![][4]
|
||||
|
||||
在我简短的测试使用中,用户界面对于有效的沟通来说是足够好的。然而,我没能找到任何黑暗模式或改变主题的能力。
|
||||
在我简短的测试使用中,其用户界面对于有效的沟通来说是足够好的。然而,我没能找到任何黑暗模式或改变主题的能力。
|
||||
|
||||
它看起来比 Slack 更直接,这样可以改善用户体验方面的问题。
|
||||
它看起来比 Slack 更简单直白,这样可以改善用户体验方面的问题。
|
||||
|
||||
### 在 Linux 中安装 Zulip
|
||||
|
||||
Zulip 在其官方网站上以 AppImage 文件的形式提供。如果你需要帮助,可以参考我们关于[在 Linux 中使用 AppImage][5] 的指南。
|
||||
Zulip 在其官方网站上以 AppImage 文件的形式提供。如果你需要帮助,可以参考我们关于 [在 Linux 中使用 AppImage][5] 的指南。
|
||||
|
||||
它也有一个 snap 包。所以,你可以在任何一个 Linux 发行版上使用它们中的任何一个。
|
||||
它也有一个 Snap 包。所以,你可以在任何一个 Linux 发行版上使用它们中的任何一个。
|
||||
|
||||
你也可以使用 APT 通过终端为基于 Ubuntu/Debian 的发行版安装它。如果你想这样做,请看它的[官方说明][6]。
|
||||
你也可以使用 APT 通过终端为基于 Ubuntu/Debian 的发行版安装它。如果你想这样做,请看它的 [官方说明][6]。
|
||||
|
||||
Zulip 可用于 Windows、Mac 和 Linux。你也应该发现它可用于 Android 和 iOS 手机。
|
||||
|
||||
[Zulip][7]
|
||||
- [Zulip][7]
|
||||
|
||||
考虑到你可以在网络、桌面和智能手机上使用 Zulip,它是 Slack 的合适替代品。
|
||||
你可以在网络、桌面和智能手机上使用 Zulip,所以可以把它当做 Slack 的合适替代品。
|
||||
|
||||
_你试过了吗?你用什么消息平台来进行工作协作?欢迎在评论中分享你的想法。_
|
||||
你试过了吗?你用什么消息平台来进行工作协作?欢迎在评论中分享你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -84,7 +84,7 @@ via: https://itsfoss.com/zulip/
|
||||
作者:[Ankush Das][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/) 荣誉推出
|
||||
|
@ -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
|
@ -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. That’s 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
|
@ -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
|
@ -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
|
@ -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 & 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. What’s 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 it’s 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 [Let’s 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 you’re 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 & 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 -> Settings -> Administration -> 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
|
191
sources/tech/20210903 Monitor your Linux server with Checkmk.md
Normal file
191
sources/tech/20210903 Monitor your Linux server with Checkmk.md
Normal 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 & 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 > 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 & 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/
|
161
sources/tech/20210903 Print files from your Linux terminal.md
Normal file
161
sources/tech/20210903 Print files from your Linux terminal.md
Normal 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:
|
||||
|
||||
|
||||
```
|
||||
<Printer r1060>
|
||||
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
|
||||
</Printer>
|
||||
```
|
||||
|
||||
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
|
@ -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/
|
116
sources/tech/20210904 How to Install Dropbox on Ubuntu Linux.md
Normal file
116
sources/tech/20210904 How to Install Dropbox on Ubuntu Linux.md
Normal 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: " "
|
||||
[#]: 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 beginner’s tutorial, I’ll 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
|
||||
|
||||
Let’s 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 won’t work until you successfully sign in. Here’s 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.
|
||||
|
||||
That’s 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
|
@ -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
|
@ -0,0 +1,80 @@
|
||||
[#]: subject: "Neither Windows, nor Linux! Shrine is ‘God’s 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 ‘God’s Operating System’
|
||||
======
|
||||
|
||||
We’ve all used multiple operating systems in our lives. Some were good and some were bad. But can you say that you’ve ever used an operating system designed by God? Today, I’d like to introduce you to Shrine.
|
||||
|
||||
### What is Shrine?
|
||||
|
||||
![Shrine interface][1]
|
||||
|
||||
From that introduction, you’re probably wondering what the heck is going on. Well, it all started with a guy named Terry Davis. Before we go any further, I’d better warn you that Terry suffered from schizophrenia during his life and often didn’t 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 God’s 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 & internet access out of the box
|
||||
* Includes a package downloader
|
||||
|
||||
|
||||
|
||||
minexew is planning to add more features in the future, but hasn’t announced what exactly will be included. He has plans to make a full TempleOS environment for Linux.
|
||||
|
||||
### Experience
|
||||
|
||||
It’s 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 “God’s temple”, I’m 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/
|
@ -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, don’t 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 won’t find it in GNOME.
|
||||
|
||||
That’s 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]. It’s actually quite simple. Go to any GNOME extension’s 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 won’t be seen immediately. You’ll 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
|
@ -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
|
@ -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 代码的方式,也正因此无需在代码编译时指定类路径。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
#
|
||||
# _-----=> 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 和内核函数的执行时间。接下来,一个花括号表示一个函数的开始,以及它内部调用了哪些其他函数。
|
||||
|
||||
```
|
||||
$ 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 > max_graph_depth
|
||||
$ # or
|
||||
$ sudo 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的特定内核函数来追踪。
|
||||
|
||||
```
|
||||
$ 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_* > 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
|
||||
#
|
||||
# _-----=> 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` 来关闭跟踪。
|
||||
|
||||
```
|
||||
$ sudo cat tracing_on
|
||||
0
|
||||
|
||||
$ sudo echo 1 > tracing_on
|
||||
$ sudo cat tracing_on
|
||||
1
|
||||
|
||||
$ # Run some specific command that we wish to trace here
|
||||
|
||||
$ sudo 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)
|
||||
校对:[校对者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/
|
@ -0,0 +1,118 @@
|
||||
[#]: 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: " "
|
||||
|
||||
在 Linux 上使用 stat 命令查看文件状态
|
||||
======
|
||||
只需要一个 Linux 命令,你就可以获取到任何文件或文件系统的所有信息。
|
||||
![Hand putting a Linux file folder into a drawer][1]
|
||||
|
||||
命令 `stat` 被包含在 GNU `coreutils` 软件包里,它提供了关于文件和文件系统的各种元数据,包括文件大小、结点位置、访问权限和 SELinux 上下文以及创建和修改时间。通常情况下,你需要多个不同命令获取的信息,这一个命令就可以实现。
|
||||
|
||||
### 在 Linux 上安装 stat 命令
|
||||
|
||||
在 Linux 系统中,可能早已安装了 `state` 命令,因为它是核心功能软件包的一部分,默认情况下,通常包含在 Linux 发行版里。
|
||||
|
||||
如果系统中没有安装 `stat` 命令,你可以使用包管理器安装 `coreutils` 软件包。
|
||||
|
||||
另外,你可以 [ 使用源码编译 coreutils 包 ][2]。
|
||||
|
||||
### 获取文件状态
|
||||
|
||||
运行 `stat` 命令可以获取指定文件或目录易于理解的输出。
|
||||
|
||||
|
||||
```
|
||||
$ 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
|
||||
```
|
||||
|
||||
输出的信息很容易理解,但是包含了很多的信息,这里是 `stat` 所包含的项:
|
||||
|
||||
* **File**: 文件名
|
||||
* **Size**: 文件大小,以字节表示
|
||||
* **Blocks**: 在硬盘驱动器上为文件保留的数据块的数量
|
||||
* **IO Block**: 文件系统块大小
|
||||
* **regular file**: 文件类型(普通文件,目录,文件系统)
|
||||
* **Device**: 文件所在的设备
|
||||
* **Inode**: 文件所在的 Inode 号
|
||||
* **Links**: 文件的链接数
|
||||
* **Access, UID, GID**: 文件权限,用户和组的所有者
|
||||
* **Context**: SELinux 上下文
|
||||
* **Access, Modify, Change, Birth**: 文件被访问、修改、更改状态以及创建时的时间戳
|
||||
|
||||
|
||||
|
||||
### 精简输出
|
||||
|
||||
对于非常了解输出或者想要使用其它工具(例如:[awk][3])解析输出的人,这里可以使用 `--terse`(短参数为 `-t`) 参数,实现没有标题或换行符的格式化输出。
|
||||
|
||||
|
||||
```
|
||||
$ 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
|
||||
```
|
||||
|
||||
### 选择自己的格式
|
||||
|
||||
你可以使用 `--printf` 参数以及与 [printf][4] 类似的语法定义自己的输出格式。`stat` 的每一个属性都有一个格式序列(`%C` 表示 SELinux 上下文,`%n` 表示文件名等等),所以,你可以选择你想要的输出格式。
|
||||
|
||||
|
||||
```
|
||||
$ 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
|
||||
```
|
||||
|
||||
下面是一些常见的格式序列:
|
||||
|
||||
* **%a** 访问权限
|
||||
* **%F** 文件类型
|
||||
* **%n** 文件名
|
||||
* **%U** 用户名
|
||||
* **%u** 用户 ID
|
||||
* **%g** 组 ID
|
||||
* **%w** 创建时间
|
||||
* **%y** 修改时间
|
||||
|
||||
|
||||
|
||||
在 `stat` 手册和 `coreutils` 信息页中都有完整的格式化序列列表。
|
||||
|
||||
### 文件信息
|
||||
|
||||
如果你曾经尝试解析过 `ls -l` 的输出,那么,你会很喜欢 `stat` 命令的灵活性。你并不是每次都需要 `stat` 提供的所有信息,但是,当你需要其中一些或全部的时候它是非常有用的。不管你是读取默认输出,还是你自己创建的查询输出,`stat` 命令都可以让你访问想要的数据。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/8/linux-stat-file-status
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[New-World-2019](https://github.com/New-World-2019)
|
||||
校对:[校对者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
|
@ -0,0 +1,242 @@
|
||||
[#]: 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: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
用户必会的 20 个 Linux 命令
|
||||
======
|
||||
无论新手老手,这 20 个 Linux 命令都能让你的操作更轻松。
|
||||
![Command line prompt][1]
|
||||
|
||||
在黝黑的终端窗口中输入命令,这样的方式对某些人群来说可能好像过时了,但对许多专业计算机用户来说,这几乎是计算机完成能够执行的所有任务的最有效、最简便和最清晰的方式。如今,一些项目将开源命令引入了 macOS 和 Windows 等非开放平台,因此终端命令不仅仅是针对 Linux 和 BSD 用户,更是与每个人都息息相关。你可能会惊讶地发现,在一台普通的 [POSIX][2] 计算机上安装了数千个命令,当然,其中很多命令并不是真的有用,至少不是直接或定期性被使用。而其中的一部分命令虽然不是有效终端必须使用的命令,但相比其他命令而言使用频率较高,值得大家学习一下。
|
||||
|
||||
以下是终端用户最可能会使用的前 20 个命令:
|
||||
|
||||
### cd
|
||||
|
||||
在终端外,你可以单击图标从一个文件夹移动到另一个文件夹,但在终端中,你需要使用 `cd`。`cd` 命令代表 _change directory_(变更目录),是用户在 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` 代表 _print working directory_(打印工作目录),这正是它的作用。`--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]。因为灵活性,它是一个复杂的命令,但如果你想从你的终端顺利地与网络服务交互,该命令是很值得学习的。
|
||||
|
||||
下载我们免费的 [`curl` 备忘录][12],你可以从中学会 `curl` 的许多选项。
|
||||
|
||||
### ps
|
||||
|
||||
管理系统资源主要由内核负责,当你更喜欢或更需要手动管理时,可以使用 `ps` 命令。读者可以在我的 [使用 procps-ng 监控 Linux 系统][13] 文章中了解 `ps`。
|
||||
|
||||
### cat
|
||||
|
||||
[`cat` 命令][14] 是 _concatenate_(连接)的缩写,它曾因为能将由于大小限制而被(使用 `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 or less or most
|
||||
|
||||
这些统称为 pager 命令。pager 命令与 `cat` 类似,但前者会在屏幕底部暂停输出,直到你向下滚动查看更多内容。这些命令比较简单,但每个之间都有细微差别。用户是用箭头键还是空格键滚动?是必须手动退出,还是在显示的文件末尾自动退出?用户的首选搜索行为是什么样的?选择你最喜欢的 pager 命令并将其设置在 `.bashrc` 中吧!
|
||||
|
||||
### ssh and 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 history][23] 中的许多命令都是自己编写的 shell 脚本,从而我实现了根据自己想要的工作方式定制工作流程。你为自己的效率和舒适度而设计的命令也可以作为 shell 中的基本命令。花些时间了解一些很棒的命令,然后试着构建自己的命令吧。当你构建出的命令非常好用时,把它开源,这样就可以与他人分享你的想法啦!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/9/essential-linux-commands
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[unigeorge](https://github.com/unigeorge)
|
||||
校对:[校对者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
|
Loading…
Reference in New Issue
Block a user