Merge pull request #23 from LCTT/master

Update from LCTT
This commit is contained in:
chen ni 2019-12-25 22:11:40 +08:00 committed by GitHub
commit c3317acc42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 2253 additions and 793 deletions

View File

@ -1,28 +1,28 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11711-1.html)
[#]: subject: (Install Android 8.1 Oreo on Linux To Run Apps & Games)
[#]: via: (https://fosspost.org/tutorials/install-android-8-1-oreo-on-linux)
[#]: author: (Python Programmer;Open Source Software Enthusiast. Worked On Developing A Lot Of Free Software. The Founder Of Foss Post;Foss Project. Computer Science Major. )
在 Linux 上安装 Android 8.1 Oreo 来运行应用程序和游戏
在 Linux 上安装安卓 8.1 Oreo 来运行应用程序和游戏
======
![](https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/android-8.1-oreo-x86-on-linux.png?resize=1237%2C527&ssl=1)
[android x86][1] 是一个自由开放源码的项目将谷歌制作的android系统从 ARM 架构移植到 x86 架构, 运行用户在他们的桌面机器上运行 android 系统来享受所有的 android 功能和应用程序及游戏。
[android x86][1] 是一个自由而开源的项目,将谷歌制作的安卓系统从 ARM 架构移植到了 x86 架构,可以让用户在他们的桌面电脑上运行安卓系统来享受所有的安卓功能和应用程序及游戏。
几周前android x86 项目完成 android 8.1 Oreo 系统到 x86 架构的移植。在这篇文章中,我们将解释如何在你的 Linux 系统上安装它,以便你能够随时使用你的 android 应用程序和游戏。
在前一段时间android x86 项目完成了安卓 8.1 Oreo 系统的 x86 架构移植。在这篇文章中,我们将解释如何在你的 Linux 系统上安装它,以便你能够随时使用你的安卓 用程序和游戏。
### 在 Linux 上安装 Android x86 8.1 Oreo
### 在 Linux 上安装安卓 x86 8.1 Oreo
#### 准备环境
首先,让我们下载 android x86 8.1 Oreo 系统镜像。你可以从[这个页面][2]下载它,只需单击 android-x86_64-8.1-r1.iso 文件下 “View” 按钮。
首先,让我们下载 android x86 8.1 Oreo 系统镜像。你可以从[这个页面][2]下载它,只需单击 android-x86_64-8.1-r1.iso 文件下 “View” 按钮。
我们将在我们的 Linux 系统上使用 QEMU 来运行 android x86 。QEMU 是一个非常好的模拟器软件,它也是自由和开放源码的,并且在所有主要的 Linux 发行版存储库中都是可用的。
我们将在我们的 Linux 系统上使用 QEMU 来运行 android x86。QEMU 是一个非常好的模拟器软件,它也是自由而开源的,并且在所有主要的 Linux 发行版存储库中都是可用的。
在 Ubuntu/Linux Mint/Debian 上安装 QEMU
@ -36,115 +36,115 @@ sudo apt-get install qemu qemu-kvm libvirt-bin
sudo dnf install qemu qemu-kvm
```
对于其它发行版,只需要搜索 qemu 和 qemu-kvm 软件包,并安装它们。
对于其它发行版,只需要搜索 qemuqemu-kvm 软件包,并安装它们。
在你安装 QEMU 后,我们将需要运行下面的命令来创建 android.img 文件,它就像某种分配给 android 系统的磁盘空间。所有 android 文件和系统都将位于该镜像文件中:
在你安装 QEMU 后,我们将需要运行下面的命令来创建 `android.img` 文件,它就像某种分配给安卓系统的磁盘空间。所有安卓文件和系统都将位于该镜像文件中:
```
qemu-img create -f qcow2 android.img 15G
```
我们在这里说,我们想为 android 分配一个最大 15GB 的磁盘空间,但是,你可以更改它到你想要的任意大小(确保它至少大于5GB)
我们在这里的意思是,我们想为该安卓系统分配一个最大 15GB 的磁盘空间,但是,你可以更改它到你想要的任意大小(确保它至少大于 5GB
现在,首次启动运行 android 系统,运行:
现在,首次启动运行该安卓系统,运行:
```
sudo qemu-system-x86_64 -m 2048 -boot d -enable-kvm -smp 3 -net nic -net user -hda android.img -cdrom /home/mhsabbagh/android-x86_64-8.1-r1.iso
```
将 /home/mhsabbagh/android-x86_64-8.1-r1.iso 替换为你从 android x86 网站下载的文件的路径。我们在这里正在使用的其它选项的解释,你可以参考[这篇文章][3]。
`/home/mhsabbagh/android-x86_64-8.1-r1.iso` 替换为你从 android x86 网站下载的文件的路径。关于我们在这里正在使用的其它选项的解释,你可以参考[这篇文章][3]。
在你运行上面的命令后,android 系统将启动:
在你运行上面的命令后,该安卓系统将启动:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 39 android 8.1 oreo on linux][4]
![][4]
#### 安装系统
从这个窗口中,选择 “Advanced options”, 它将引导到下面的菜单,你应如下在其中选择 “Auto_installation”
![Install Android 8.1 Oreo on Linux To Run Apps & Games 41 android 8.1 oreo on linux][5]
![][5]
在这以后,安装器将告知你是否想要继续,选择 Yes
在这以后,安装器将告知你是否想要继续,选择 “Yes”
![Install Android 8.1 Oreo on Linux To Run Apps & Games 43 android 8.1 oreo on linux][6]
![][6]
接下来,安装器将无需你的指示而继续进行:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 45 android 8.1 oreo on linux][7]
![][7]
最后,你将收到这个信息,它表示你已经成功安装 android 8.1
最后,你将收到这个信息,它表示你已经成功安装安卓 8.1
![Install Android 8.1 Oreo on Linux To Run Apps & Games 47 android 8.1 oreo on linux][8]
![][8]
现在,完全关闭 QEMU 窗口。
现在,关闭 QEMU 窗口即可
#### 启动和使用 Android 8.1 Oreo
#### 启动和使用 安卓 8.1 Oreo
现在,android 系统已经完全安装在你的 android.img 文件中,你应该使用下面的 QEMU 命令来启动它,而不是前面的命令:
现在,安卓系统已经完全安装在你的 `android.img` 文件中,你应该使用下面的 QEMU 命令来启动它,而不是前面的命令:
```
sudo qemu-system-x86_64 -m 2048 -boot d -enable-kvm -smp 3 -net nic -net user -hda android.img
```
注意,我们所做的只是移除 -cdrom 选项和它的参数。这是告诉 QEMU ,我们不再想从我们下载的 ISO 文件启动,相反,从安装的 android 系统启动。
注意,我们所做的只是移除 `-cdrom` 选项及其参数。这是告诉 QEMU我们不再想从我们下载的 ISO 文件启动,相反,从这个安装的安卓系统启动。
你现在能够看到 android 启动菜单:
你现在能够看到安卓的启动菜单:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 49 android 8.1 oreo on linux][9]
![][9]
然后,你将带去第一个准备向导,选择你的语言并继续:
然后,你将进入第一个准备向导,选择你的语言并继续:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 51 android 8.1 oreo on linux][10]
![][10]
从这里,选择 “Set up as new” 选项:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 53 android 8.1 oreo on linux][11]
![][11]
然后,android 将询问你是否想登陆到你当前的谷歌账号。这步骤是可选的,但是这很重要,以便你随后可以使用 Play Store
然后,安卓将询问你是否想登录到你当前的谷歌账号。这步骤是可选的,但是这很重要,以便你随后可以使用谷歌 Play 商店
![Install Android 8.1 Oreo on Linux To Run Apps & Games 55 android 8.1 oreo on linux][12]
![][12]
然后,你将需要接受条款:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 57 android 8.1 oreo on linux][13]
![][13]
现在,你可以选择你当前的时区:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 59 android 8.1 oreo on linux][14]
![][14]
系统将询问你是否想启动一些数据收集功能。如果我是你的话,我将简单地关闭它们,像这样:
系统将询问你是否想启动一些数据收集功能。如果我是你的话,我将简单地全部关闭它们,像这样:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 61 android 8.1 oreo on linux][15]
![][15]
最后,你将有两种启动类型可供选择,我建议你选择 Launcher3 选项,并使其成为默认项:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 63 android 8.1 oreo on linux][16]
![][16]
然后,你将看到完整工作的 android 系统主屏幕:
然后,你将看到完整工作的安卓系统主屏幕:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 65 android 8.1 oreo on linux][17]
![][17]
从现在起,你可以做你想做的任何事情;你可以使用内置的 android 应用程序,或者你可以浏览你是系统设置来根据你的喜好进行调整。你可以更改你的系统的外观和体验,或者你可以像示例一样运行 Chrome
从现在起,你可以做你想做的任何事情;你可以使用内置的安卓应用程序,或者你可以浏览你的系统设置来根据你的喜好进行调整。你可以更改你的系统的外观和体验,或者你可以像示例一样运行 Chrome
![Install Android 8.1 Oreo on Linux To Run Apps & Games 67 android 8.1 oreo on linux][18]
![][18]
你可以从 Google Play store 开始安装一些应用程序程序,像 WhatsApp 和其它的应用程序,以供你自己使用:
你可以开始从谷歌 Play 商店安装一些应用程序程序,像 WhatsApp 和其它的应用程序,以供你自己使用:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 69 android 8.1 oreo on linux][19]
![][19]
你现在可以用你的系统做任何你想做的事。恭喜!
### 以后如何轻松地运行 Android 8.1 Oreo
### 以后如何轻松地运行安卓 8.1 Oreo
我们不想总是不得不打开终端窗口,并写那些长长的 QEMU 命令来运行 android 系统,相反,我们想在我们需要时一次单击就运行它。
我们不想总是不得不打开终端窗口,并写那些长长的 QEMU 命令来运行安卓系统,相反,我们想在我们需要时一次单击就运行它。
为此,我们将使用下面的命令在 /usr/share/applications 下创建一个名为 android.desktop 的新文件:
为此,我们将使用下面的命令在 `/usr/share/applications` 下创建一个名为 `android.desktop` 的新文件:
```
sudo nano /usr/share/applications/android.desktop
```
并在其中粘贴下面的内容(右键单击然后粘贴)
并在其中粘贴下面的内容(右键单击然后粘贴)
```
[Desktop Entry]
@ -158,33 +158,32 @@ StartupNotify=true
Categories=GTK;
```
再强调一次,你必需使用你系统上的本地镜像路径来替换 /home/mhsabbagh/android.img 。然后保存文件 (Ctrl + X ,然后按 Y ,然后按 Enter)
再强调一次,你必需使用你系统上的本地镜像路径来替换 `/home/mhsabbagh/android.img` 。然后保存文件(`Ctrl+X`,然后按 `Y`,然后按回车)
注意,我们需要使用 “pkexec” 来使用 root 权限运行 QEMU ,因为从较新的版本开始,普通用户不允许通过 libvirt 访问 KVM 技术;这就是为什么它将每次要求你输入 root 密码的原因。
注意,我们需要使用 `pkexec` 来使用 root 权限运行 QEMU ,因为从较新的版本开始,普通用户不允许通过 libvirt 访问 KVM 技术;这就是为什么它将每次要求你输入 root 密码的原因。
现在,你将在应用程序菜单中看到 android 图标,你可以在你想使用 android 的任何时间来简单地单击图标QEMU 程序将启动:
现在,你将在应用程序菜单中看到安卓图标,你可以在你想使用安卓的任何时间来简单地单击该图标QEMU 程序将启动:
![Install Android 8.1 Oreo on Linux To Run Apps & Games 71 android 8.1 oreo on linux][20]
![][20]
### 总结
我们向你展示如何你的 Linux 系统上安装和运行 android 8.1 Oreo 。从现在起,在没有其它一些软件的(像 Blutsticks 和类似的方法)的情况下,你应该更容易地完成基于 android 的任务。在这里,你有一个完整工作和功能的 android 系统,你可以随心所欲地操作它,如果一些东西出差,你可以简单地核弹攻击镜像文件,然后随时再一次重新运行安装程序。
你之前尝试过 android x86 吗?你的经验如何?
我们向你展示如何在你的 Linux 系统上安装和运行安卓 8.1 Oreo 。从现在起,在没有其它一些软件的(像 Blutsticks 和类似的方法)的情况下,你可以更容易地完成基于安卓的任务。在这里,你有一个完整工作和功能的安卓系统,你可以随心所欲地操作它,如果一些东西出错,你可以简单地干掉该镜像文件,然后随时再一次重新运行安装程序。
你之前尝试过 android x86 吗?你的体验如何?
--------------------------------------------------------------------------------
via: https://fosspost.org/tutorials/install-android-8-1-oreo-on-linux
作者:[Python Programmer;Open Source Software Enthusiast. Worked On Developing A Lot Of Free Software. The Founder Of Foss Post;Foss Project. Computer Science Major.][a]
作者:[M.Hanny Sabbagh][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:
[a]: https://fosspost.org/author/mhsabbagh
[b]: https://github.com/lujun9972
[1]: http://www.android-x86.org/
[2]: http://www.android-x86.org/download

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11708-1.html)
[#]: subject: (Netboot a Fedora Live CD)
[#]: via: (https://fedoramagazine.org/netboot-a-fedora-live-cd/)
[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/)
@ -12,40 +12,38 @@
![](https://fedoramagazine.org/wp-content/uploads/2019/02/netboot-livecd-816x345.jpg)
[Live CD][1] 对于很多任务是很有用的,例如:
[Live CD][1] 对于很多任务是很有用的例如:
* 将操作系统安装到一个硬盘驱动器
* 修复一个启动加载程序或执行其它救援模式操作
* 为网络浏览提供一个相适应的最小环境
* …以及[更多的东西][2]。
* 将操作系统安装到一个硬盘驱动器
* 修复一个启动加载程序或执行其它救援模式操作
* 为 Web 浏览提供一个相适应的最小环境
* …以及[更多的东西][2]。
因为使用 DVD 和 USB 驱动器来存储你的 Live CD 镜像是一个替代方案,你可以上传它们到一个不太可能丢失或损坏的 [iSCSI][3] 服务器中。这个指南向你展示如何加载你的 Live CD 镜像到一个 ISCSI 服务器上,并使用 [iPXE][4] 启动加载程序来访问它们。
作为使用 DVD 和 USB 驱动器来存储你的 Live CD 镜像是一个替代方案,你可以上传它们到一个不太可能丢失或损坏的 [iSCSI][3] 服务器中。这个指南向你展示如何加载你的 Live CD 镜像到一个 ISCSI 服务器上,并使用 [iPXE][4] 启动加载程序来访问它们。
### 下载一个 Live CD 镜像
```
$ MY_RLSE=27
$ MY_LIVE=$(wget -q -O - https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/$MY_RLSE/Workstation/x86_64/iso | perl -ne '/(Fedora[^ ]*?-Live-[^ ]*?\.iso)(?{print $^N})/;')
$ MY_NAME=fc$MY_RLSE
$ MY_NAME=fc$MY_RLSE
$ wget -O $MY_NAME.iso https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/$MY_RLSE/Workstation/x86_64/iso/$MY_LIVE
```
上面的命令下载 Fedora-Workstation-Live-x86_64-27-1.6.iso Fedora Live 镜像,并保存为 fc27.iso 。更改 MY_RLSE 的值来下载其它档案版本。或者,你可以浏览 <https://getfedora.org/> 来下载最新的 Fedora live 镜像。在21之前的版本使用不同的命名约定必需[在这里手动下载][5]。如果你手动下载一个 Live CD 镜像,设置 MY_NAME 变量为不带有扩展名的文件的基本名称。用此方法,下面部分中命令将引用正确的文件。
上面的命令下载 `Fedora-Workstation-Live-x86_64-27-1.6.iso` Fedora Live 镜像,并保存为 `fc27.iso`。更改 `MY_RLSE` 的值来下载其它档案版本。或者,你可以浏览 <https://getfedora.org/> 来下载最新的 Fedora live 镜像。在 21 之前的版本使用不同的命名约定,必需[在这里手动下载][5]。如果你手动下载一个 Live CD 镜像,设置 `MY_NAME` 变量为不带有扩展名的文件的基本名称。用此方法,下面部分中命令将引用正确的文件。
### 转换 Live CD 镜像
使用 livecd-iso-to-disk 工具来转换 ISO 文件为一个磁盘镜像,并添加 netroot 参数到嵌入的内核命令行:
使用 `livecd-iso-to-disk` 工具来转换 ISO 文件为一个磁盘镜像,并添加 `netroot` 参数到嵌入的内核命令行:
```
$ sudo dnf install -y livecd-tools
$ MY_SIZE=$(du -ms $MY_NAME.iso | cut -f 1)
$ dd if=/dev/zero of=$MY_NAME.img bs=1MiB count=0 seek=$(($MY_SIZE+512))
$ MY_SRVR=server-01.example.edu
$ MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR})
$ MY_LOOP=$(sudo losetup --show --nooverlap --find $MY_NAME.img)
$ sudo livecd-iso-to-disk --format --extra-kernel-args netroot=iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME $MY_NAME.iso $MY_LOOP
$ dd if=/dev/zero of=$MY_NAME.img bs=1MiB count=0 seek=$(($MY_SIZE+512))
$ MY_SRVR=server-01.example.edu
$ MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR})
$ MY_LOOP=$(sudo losetup --show --nooverlap --find $MY_NAME.img)
$ sudo livecd-iso-to-disk --format --extra-kernel-args netroot=iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME $MY_NAME.iso $MY_LOOP
$ sudo losetup -d $MY_LOOP
```
@ -53,21 +51,21 @@ $ sudo losetup -d $MY_LOOP
在你的 ISCSI 服务器上创建一个目录来存储你的 live 镜像,随后上传你修改的镜像到其中。
**对于 21 及更高发布版本:**
对于 21 及更高发布版本:
```
$ MY_FLDR=/images
$ MY_FLDR=/images
$ scp $MY_NAME.img $MY_SRVR:$MY_FLDR/
```
**对于 21 以前发布版本:**
对于 21 以前发布版本:
```
$ MY_FLDR=/images
$ MY_LOOP=$(sudo losetup --show --nooverlap --find --partscan $MY_NAME.img)
$ sudo tune2fs -O ^has_journal ${MY_LOOP}p1
$ sudo e2fsck ${MY_LOOP}p1
$ sudo dd status=none if=${MY_LOOP}p1 | ssh $MY_SRVR "dd of=$MY_FLDR/$MY_NAME.img"
$ MY_FLDR=/images
$ MY_LOOP=$(sudo losetup --show --nooverlap --find --partscan $MY_NAME.img)
$ sudo tune2fs -O ^has_journal ${MY_LOOP}p1
$ sudo e2fsck ${MY_LOOP}p1
$ sudo dd status=none if=${MY_LOOP}p1 | ssh $MY_SRVR "dd of=$MY_FLDR/$MY_NAME.img"
$ sudo losetup -d $MY_LOOP
```
@ -76,89 +74,86 @@ $ sudo losetup -d $MY_LOOP
在你的 iSCSI 服务器上运行下面的命令:
```
$ sudo -i
# MY_NAME=fc27
# MY_FLDR=/images
# MY_SRVR=`hostname`
# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR})
# cat << END > /etc/tgt/conf.d/$MY_NAME.conf
$ sudo -i
# MY_NAME=fc27
# MY_FLDR=/images
# MY_SRVR=`hostname`
# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR})
# cat << END > /etc/tgt/conf.d/$MY_NAME.conf
<target iqn.$MY_RVRS:$MY_NAME>
backing-store $MY_FLDR/$MY_NAME.img
readonly 1
allow-in-use yes
</target>
END
backing-store $MY_FLDR/$MY_NAME.img
readonly 1
allow-in-use yes
</target>
END
# tgt-admin --update ALL
```
### 创建一个可启动 USB 驱动器
[iPXE][4] 启动加载程序有一个 [sanboot][6] 命令,你可以使用它来连接,并启动你 ISCSI 服务器上运行的live 镜像。它可以用很多不同的[格式][7]编译。最好的工作格式依赖于你正在运行的硬件。例如,下面的说明向你展示如何在一个 USB 驱动器上从 [syslinux][9] 中 [链式加载][8] iPXE。
[iPXE][4] 启动加载程序有一个 [sanboot][6] 命令,你可以使用它来连接并启动托管于你 ISCSI 服务器上运行的 live 镜像。它可以以很多不同的[格式][7]编译。最好的工作格式依赖于你正在运行的硬件。例如,下面的说明向你展示如何在一个 USB 驱动器上从 [syslinux][9] 中 [链式加载][8] iPXE。
首先,下载 iPXE ,并以它的 lkrn 格式构建。这应该作为一个工作站上的普通用户完成:
首先,下载 iPXE并以它的 lkrn 格式构建。这应该作为一个工作站上的普通用户完成:
```
$ sudo dnf install -y git
$ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe
$ sudo dnf install -y git
$ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe
$ sudo dnf groupinstall -y "C Development Tools and Libraries"
$ cd $HOME/ipxe/src
$ make clean
$ make bin/ipxe.lkrn
$ cd $HOME/ipxe/src
$ make clean
$ make bin/ipxe.lkrn
$ cp bin/ipxe.lkrn /tmp
```
接下来,准备一个带有一个 MSDOS 分区表和一个 FAT32 文件系统的 USB 驱动器。下面的命令假设你已经连接将要格式化的 USB 驱动器。**注意:你要格式正确的驱动器!**
```
$ sudo -i
# dnf install -y parted util-linux dosfstools
$ sudo -i
# dnf install -y parted util-linux dosfstools
# echo; find /dev/disk/by-id ! -regex '.*-part.*' -name 'usb-*' -exec readlink -f {} \; | xargs -i bash -c "parted -s {} unit MiB print | perl -0 -ne '/^Model: ([^(]*).*\n.*?([0-9]*MiB)/i && print \"Found: {} = \$2 \$1\n\"'"; echo; read -e -i "$(find /dev/disk/by-id ! -regex '.*-part.*' -name 'usb-*' -exec readlink -f {} \; -quit)" -p "Drive to format: " MY_USB
# umount $MY_USB?
# wipefs -a $MY_USB
# parted -s $MY_USB mklabel msdos mkpart primary fat32 1MiB 100% set 1 boot on
# umount $MY_USB?
# wipefs -a $MY_USB
# parted -s $MY_USB mklabel msdos mkpart primary fat32 1MiB 100% set 1 boot on
# mkfs -t vfat -F 32 ${MY_USB}1
```
最后,在 USB 驱动器上安装并配置 syslinux ,来链式加载 iPXE
最后,在 USB 驱动器上安装并配置 syslinux ,来链式加载 iPXE
```
# dnf install -y syslinux-nonlinux
# syslinux -i ${MY_USB}1
# dd if=/usr/share/syslinux/mbr.bin of=${MY_USB}
# MY_MNT=$(mktemp -d)
# mount ${MY_USB}1 $MY_MNT
# MY_NAME=fc27
# MY_SRVR=server-01.example.edu
# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR})
# dnf install -y syslinux-nonlinux
# syslinux -i ${MY_USB}1
# dd if=/usr/share/syslinux/mbr.bin of=${MY_USB}
# MY_MNT=$(mktemp -d)
# mount ${MY_USB}1 $MY_MNT
# MY_NAME=fc27
# MY_SRVR=server-01.example.edu
# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR})
# cat << END > $MY_MNT/syslinux.cfg
ui menu.c32
default $MY_NAME
timeout 100
menu title SYSLINUX
label $MY_NAME
menu label ${MY_NAME^^}
kernel ipxe.lkrn
append dhcp && sanboot iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME
END
# cp /usr/share/syslinux/menu.c32 $MY_MNT
# cp /usr/share/syslinux/libutil.c32 $MY_MNT
# cp /tmp/ipxe.lkrn $MY_MNT
menu label ${MY_NAME^^}
kernel ipxe.lkrn
append dhcp && sanboot iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME
END
# cp /usr/share/syslinux/menu.c32 $MY_MNT
# cp /usr/share/syslinux/libutil.c32 $MY_MNT
# cp /tmp/ipxe.lkrn $MY_MNT
# umount ${MY_USB}1
```
通过简单地编辑 syslinux.cfg 文件,并添加附加的菜单入口,你应该能够使用这同一个 USB 驱动器来网络启动附加的 ISCSI 目标。
通过简单地编辑 `syslinux.cfg` 文件,并添加附加的菜单项,你应该能够使用这同一个 USB 驱动器来网络启动附加的 ISCSI 目标。
这仅是加载 IPXE 的一种方法。你可以直接在你的工作站上安装 syslinux 。再一种选项是编译 iPXE 为一个 EFI 可执行文件,并直接放置它到你的 [ESP][10]中。又一种选项是编译 iPXE 为一个 PXE 加载器,并放置它到你的能够被 DHCP 引用的 TFTP 服务器。最佳的选项依赖于的环境
这仅是加载 IPXE 的一种方法。你可以直接在你的工作站上安装 syslinux 。再一种选项是编译 iPXE 为一个 EFI 可执行文件,并直接放置它到你的 [ESP][10] 中。又一种选项是编译 iPXE 为一个 PXE 加载器,并放置它到你的能够被 DHCP 引用的 TFTP 服务器。最佳的选项依赖于的环境
### 最后说明
* 如果你以 IPXE 的 EFI 格式编译 IPXE ,你可能想添加 filename \EFI\BOOT\grubx64.efi 参数到 sanboot 命令。
* 能够创建自定义 live 镜像。更多信息参考[创建和使用 live CD][11] 。
* 有可能添加 overlay-size-mb 和 home-size-mb 参数到 livecd-iso-to-disk 命令来创建永久存储的 live 镜像。然而,如果你有多个并发用户,你将需要设置你的 ISCSI 服务器来管理独立的每个用户可写覆盖。这与 “[如何构建一个网络启动服务器,部分 4][12]” 一文所示类似。
* Live 镜像在它们的内核命令行中支持一个 persistenthome 选项(例如, persistenthome=LABEL=HOME)。与经过 CHAP 身份验证的 iSCSI 目标一起使用对于集权控制主目录persistenthome 选项为 NFS 提供一个有趣的替代方案。
* 如果你以 IPXE 的 EFI 格式编译 IPXE ,你可能想添加 `filename \EFI\BOOT\grubx64.efi` 参数到 `sanboot` 命令。
* 能够创建自定义 live 镜像。更多信息参考[创建和使用 live CD][11]。
* 可以添加 `overlay-size-mb``home-size-mb` 参数到 `livecd-iso-to-disk` 命令来创建永久存储的 live 镜像。然而,如果你有多个并发用户,你将需要设置你的 ISCSI 服务器来管理独立的每个用户的可写覆盖。这与 “[如何构建一个网络启动服务器,部分 4][12]” 一文所示类似。
* Live 镜像在它们的内核命令行中支持一个 `persistenthome` 选项(例如, `persistenthome=LABEL=HOME`)。与经过 CHAP 身份验证的 iSCSI 目标一起使用,对于中心控制主目录,`persistenthome` 选项为 NFS 提供一个有趣的替代方案。
--------------------------------------------------------------------------------
@ -167,7 +162,7 @@ via: https://fedoramagazine.org/netboot-a-fedora-live-cd/
作者:[Gregory Bartholomew][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11709-1.html)
[#]: subject: (How To Set Password Complexity On Linux?)
[#]: via: (https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
@ -12,13 +12,12 @@ Linux 如何设置密码复杂度?
对于 Linux 系统管理员来说,用户管理是最重要的事之一。这涉及到很多因素,实现强密码策略是用户管理的其中一个方面。移步后面的 URL 查看如何 [在 Linux 上生成一个强密码][1]。它会限制系统未授权的用户的访问。
所有人都知道 Linux 的默认策略很安全,然而我们还是要做一些微调,这样才更安全。弱密码有安全隐患,因此,请特别注意。移步后面的 URL 查看生成的强密码的 [密码长度和分值][2]。本文将教你在 Linux 中如何实现最安全的策略。
所有人都知道 Linux 的默认策略很安全,然而我们还是要做一些微调,这样才更安全。弱密码有安全隐患,因此,请特别注意。移步后面的 URL 查看生成的强密码的[密码长度和分值][2]。本文将教你在 Linux 中如何实现最安全的策略。
在大多数 Linux 系统中,我们可以用 PAMpluggable authentication module译注可插拔认证模块)来加强密码策略。在下面的路径可以找到这个文件。
在大多数 Linux 系统中,我们可以用 PAM<ruby>可插拔认证模块<rt>pluggable authentication module</rt></ruby>)来加强密码策略。在下面的路径可以找到这个文件。
在红帽系列的系统中,路径:`/etc/pam.d/system-auth`。
Debian 系列的系统中,路径:`/etc/pam.d/common-password`。
- 在红帽系列的系统中,路径:`/etc/pam.d/system-auth`。
- Debian 系列的系统中,路径:`/etc/pam.d/common-password`。
关于默认的密码过期时间,可以在 `/etc/login.defs` 文件中查看详细信息。
@ -33,32 +32,30 @@ PASS_MIN_LEN 5
PASS_WARN_AGE 7
```
**详细解释:**
* **`PASS_MAX_DAYS:`**` ` 一个密码可使用的最大天数。
* **`PASS_MIN_DAYS:`**` ` 两次密码修改之间最小的间隔天数。
* **`PASS_MIN_LEN:`**` ` 密码最小长度。
* **`PASS_WARN_AGE:`**` ` 密码过期前给出警告的天数。
详细解释:
* `PASS_MAX_DAYS`:一个密码可使用的最大天数。
* `PASS_MIN_DAYS`:两次密码修改之间最小的间隔天数。
* `PASS_MIN_LEN`:密码最小长度。
* `PASS_WARN_AGE`:密码过期前给出警告的天数。
我们将会展示在 Linux 中如何实现下面的 11 个密码策略。
* 一个密码可使用的最大天数
* 两次密码修改之间最小的间隔天数
* 密码过期前给出警告的天数
* 密码历史记录/拒绝重复使用密码
* 密码最小长度
* 最少的大写字母个数
* 最少的小写字母个数
* 最少的数字个数
* 最少的其他字符(符号)个数
* 账号锁定 — 重试
* 账号解锁时间
* 一个密码可使用的最大天数
* 两次密码修改之间最小的间隔天数
* 密码过期前给出警告的天数
* 密码历史记录/拒绝重复使用密码
* 密码最小长度
* 最少的大写字母个数
* 最少的小写字母个数
* 最少的数字个数
* 最少的其他字符(符号)个数
* 账号锁定 — 重试
* 账号解锁时间
### 密码可使用的最大天数是什么?
这一参数限制一个密码可使用的最大天数。它强制用户在过期前修改他/她的密码。如果他们忘记修改,那么他们会登录不了系统。他们需要联系管理员才能正常登录。这个参数可以在 `/etc/login.defs` 文件中设置。我把这个参数设置为 `90 天`
这一参数限制一个密码可使用的最大天数。它强制用户在过期前修改他/她的密码。如果他们忘记修改,那么他们会登录不了系统。他们需要联系管理员才能正常登录。这个参数可以在 `/etc/login.defs` 文件中设置。我把这个参数设置为 90 天。
```
# vi /etc/login.defs
@ -68,7 +65,7 @@ PASS_MAX_DAYS 90
### 密码最小天数是什么?
这个参数限制两次修改之间的最少天数。举例来说,如果这个参数被设置为 15 天,用户今天修改了密码,那么在 15 天之内他都不能修改密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 `15 天`
这个参数限制两次修改之间的最少天数。举例来说,如果这个参数被设置为 15 天,用户今天修改了密码,那么在 15 天之内他都不能修改密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 15 天。
```
# vi /etc/login.defs
@ -78,7 +75,7 @@ PASS_MIN_DAYS 15
### 密码警告天数是什么?
这个参数控制密码警告的前置天数,在密码即将过期时会给用户警告提示。在警告天数结束前,用户会收到日常警告提示。这可以提醒用户在密码过期前修改他们的密码,否则我们就需要联系管理员来解锁密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 `10 天`
这个参数控制密码警告的前置天数,在密码即将过期时会给用户警告提示。在警告天数结束前,用户会收到日常警告提示。这可以提醒用户在密码过期前修改他们的密码,否则我们就需要联系管理员来解锁密码。这个参数可以在 `/etc/login.defs` 文件中设置。我设置为 10 天。
```
# vi /etc/login.defs
@ -90,7 +87,7 @@ PASS_WARN_AGE 10
### 密码历史或拒绝重复使用密码是什么?
这个参数控制密码历史。它记录曾经使用过的密码(禁止使用的曾用密码的个数)。当用户设置新的密码时,它会检查密码历史,如果他们要设置的密码是一个曾经使用过的旧密码,将会发出警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码历史为 `5`
这个参数控制密码历史。它记录曾经使用过的密码(禁止使用的曾用密码的个数)。当用户设置新的密码时,它会检查密码历史,如果他们要设置的密码是一个曾经使用过的旧密码,将会发出警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码历史为 5。
```
# vi /etc/pam.d/system-auth
@ -100,7 +97,7 @@ password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok r
### 密码最小长度是什么?
这个参数表示密码的最小长度。当用户设置新密码时,系统会检查这个参数,如果新设的密码长度小于这个参数设置的值,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置最小密码长度为 `12`
这个参数表示密码的最小长度。当用户设置新密码时,系统会检查这个参数,如果新设的密码长度小于这个参数设置的值,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置最小密码长度为 12。
```
# vi /etc/pam.d/system-auth
@ -108,11 +105,11 @@ password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok r
password requisite pam_cracklib.so try_first_pass retry=3 minlen=12
```
**try_first_pass retry=3** : 在密码设置交互界面,用户有 3 次机会重设密码。
`try_first_pass retry=3`在密码设置交互界面,用户有 3 次机会重设密码。
### 设置最少的大写字母个数?
这个参数表示密码中至少需要的大写字母的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有大写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码(中大写字母)的最小长度为 `1` 个字母。
这个参数表示密码中至少需要的大写字母的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有大写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置密码(中大写字母)的最小长度为 1 个字母。
```
# vi /etc/pam.d/system-auth
@ -122,7 +119,7 @@ password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 ucredit=
### 设置最少的小写字母个数?
这个参数表示密码中至少需要的小写字母的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有小写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1` 个字母。
这个参数表示密码中至少需要的小写字母的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有小写字母,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 1 个字母。
```
# vi /etc/pam.d/system-auth
@ -132,7 +129,7 @@ password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 lcred
### 设置密码中最少的数字个数?
这个参数表示密码中至少需要的数字的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有数字,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1`
这个参数表示密码中至少需要的数字的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有数字,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 1 个数字
```
# vi /etc/pam.d/system-auth
@ -142,7 +139,7 @@ password requisite pam_cracklib.so try_first_pass retry=3 minlen=12 dcred
### 设置密码中最少的其他字符(符号)个数?
这个参数表示密码中至少需要的特殊符号的个数。这些是密码长度增长参数,可以让密码更长。当用户设置新密码时,系统会检查这个参数,如果密码中没有特殊符号,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 `1` 个字符。
这个参数表示密码中至少需要的特殊符号的个数。这些是密码强度参数,可以让密码更健壮。当用户设置新密码时,系统会检查这个参数,如果密码中没有特殊符号,会收到警告提示。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。我设置为 1 个字符。
```
# vi /etc/pam.d/system-auth
@ -163,7 +160,7 @@ account required pam_tally2.so
### 设定账号解锁时间?
这个参数表示用户解锁时间。如果一个用户账号在连续认证失败后被锁定了,当过了设定的解锁时间后,会解锁。设置被锁定中的账号的解锁时间900 秒 = 15分钟。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。
这个参数表示用户解锁时间。如果一个用户账号在连续认证失败后被锁定了,当过了设定的解锁时间后,会解锁。设置被锁定中的账号的解锁时间900 秒 = 15分钟。这个参数可以在 `/etc/pam.d/system-auth` 文件中设置。
```
# vi /etc/pam.d/system-auth
@ -179,7 +176,7 @@ via: https://www.2daygeek.com/how-to-set-password-complexity-policy-on-linux/
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,77 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11712-1.html)
[#]: subject: (Customize your Linux desktop with FVWM)
[#]: via: (https://opensource.com/article/19/12/fvwm-linux-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 FVWM 自定义 Linux 桌面
======
> 本文是 24 天 Linux 桌面特别系列的一部分。如果你正在寻找轻巧、快速且简单的 Linux 窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入、探索和魔改的窗口管理器,那么 FVWM 是必须的。
![](https://img.linux.net.cn/data/attachment/album/201912/25/062800dwh3yhfcpx3ggjxp.jpg)
[FVWM][2] 窗口管理器最早脱胎于对 1993 年的 [TWM][3] 的修改。经过几年的迭代,诞生了一个可高度自定义的环境,它可以配置任何行为、动作或事件。它支持自定义键绑定、鼠标手势、主题、脚本等。
尽管 FVWM 在安装后即可投入使用但默认分发版本仅提供了极其少的配置。这是开始自定义桌面环境的良好基础但是如果你只想将其用作桌面那么可能要安装由其它用户发布的完整配置版本。FVWM 有几种不同的分发版,包括模仿 Windows 95 的 FVWM95至少在外观和布局上。我尝试了 [FVWM-Crystal][4],这是一个具有一些现代 Linux 桌面约定的现代主题。
可以从 Linux 发行版的软件仓库中安装要尝试的 FVWM 分发版。如果找不到特定的 FVWM 分发版,那么可以安装基础的 FVWM2 包,然后进入 [Box-Look.org][5] 手动下载主题包。这样就需要更多的工作,但比从头开始构建要少。
安装后,请注销当前的桌面会话,以便你可以登录 FVWM。默认情况下会话管理器KDM、GDM、LightDM 或 XDM取决于你的设置将继续登录到以前的桌面因此你必须在登录之前覆盖该桌面。
对于 GDM
![Select your desktop session in GDM][6]
对于 KDM
![Select your desktop session with KDM][7]
### FVWM 桌面
无论你使用什么主题和配置当你在桌面上单击鼠标左键时FVWM 至少会显示一个菜单。菜单的内容取决于你所安装的内容。FVWM-Crystal 分发版中的菜单包含对常用首选项的快速访问,例如屏幕分辨率、壁纸设置、窗口装饰等。
同 FVWM 中的几乎所有东西一样,你可以编辑菜单中你要想的内容,但 FVWM-Crystal 的特色在于其应用菜单栏。应用菜单位于屏幕的左上角每个图标都包含了相关的应用启动器的菜单。例如GIMP 图标表示图像编辑器KDevelop 图标表示集成开发环境IDEGNU 图标表示文本编辑器,等等,具体取决于你在系统上安装的程序。
![FVWM-crystal running on Slackware 14.2][8]
FVWM-Crystal 还提供了虚拟桌面、任务栏、时钟和应用栏。
关于背景,你可以使用与 FVWM-Crystal 捆绑在一起的壁纸,也可以使用 `feh` 命令设置自己的壁纸(你可能需要从仓库中安装它)。此命令有一些设置背景的选项,包括 `--bg-scale` 使用你选择的图片缩放填充屏幕,`--bg-fill` 直接填充而不缩放图片,等等。
```
$ feh --bg-scale ~/Pictures/wallpapers/mybackground.jpg
```
大多数配置文件都包含在 `$HOME/.fvwm-crystal` 中,某些系统范围的默认文件位于 `/usr/share/fvwm-crystal`
### 自己尝试一下
FVWM 是大多作为一个桌面构建平台,它也是窗口管理器。它不会为你做到面面俱到,它期望你来配置尽可能的一切。
如果你正在寻找轻巧、快速且简单的窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入、探索和魔改的窗口管理器,那么 FVWM 是必须的。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/fvwm-linux-desktop
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer)
[2]: http://www.fvwm.org/
[3]: https://en.wikipedia.org/wiki/Twm
[4]: https://www.box-look.org/p/1018270/
[5]: http://box-look.org
[6]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM)
[7]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM)
[8]: https://opensource.com/sites/default/files/advent-fvwm-crystal.jpg (FVWM-crystal running on Slackware 14.2)

View File

@ -1,3 +1,12 @@
[#]: collector: (lujun9972)
[#]: translator: (runningwater)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Create and manage MacOS LaunchAgents using Go)
[#]: via: (https://ieftimov.com/post/create-manage-macos-launchd-agents-golang/)
[#]: author: (https://ieftimov.com/about)
Create and manage MacOS LaunchAgents using Go
============================================================
@ -287,7 +296,7 @@ This is where I write about software development, programming languages and ever
via: https://ieftimov.com/create-manage-macos-launchd-agents-golang
作者:[Ilija Eftimov ][a]
译者:[译者ID](https://github.com/译者ID)
译者:[runningwater](https://github.com/runningwater)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -302,4 +311,4 @@ via: https://ieftimov.com/create-manage-macos-launchd-agents-golang
[7]:https://golang.org/x/sys
[8]:https://docs.google.com/document/d/1QXzI9I1pOfZPujQzxhyRy6EeHYTQitKKjHfpq0zpxZs/edit
[9]:https://golang.org/x/sys
[10]:https://github.com/jteeuwen/go-bindata
[10]:https://github.com/jteeuwen/go-bindata

View File

@ -1,73 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( XLCYun )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (DevOps for introverted people)
[#]: via: (https://opensource.com/article/19/7/devops-introverted-people)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo)
DevOps for introverted people
======
We asked the Opensource.com DevOps team to talk about their experience
as DevOps introverts and to give DevOps extroverts some advice. Here are
their answers.
![Q and A letters][1]
We asked members of our [DevOps team][2] to talk about their experience as introverts and to give extroverts some advice. Before we get into their responses, though, lets first define the term.
### What does being introverted mean?
Being an introvert is commonly defined as someone who finds it more energy depleting, as opposed to energizing, to be around people. It can be a helpful term when we think about how we recharge: introverted people may require more alone time to recharge, especially after spending a lot of time around groups of people. A big myth about introverts is that they are necessarily shy, but [science suggests][3] that is a separate personality trait.
Introversion and extraversion were popularized by the [Myers Briggs Type Indicators][4] and are now more commonly referred to as two ends of the same [spectrum][5]. Even though it may seem that there are more extroverted people in the world than introverts, psychologists tend to believe that a majority of us fall along the spectrum closer to [ambiverts or introverts][6].
Now, on to the questions and answers.
### What are some techniques DevOps leaders can use to make sure introverts feel like part of the team and increase their willingness to share ideas?
"Everyone is a little different, so its important to be observant. Someone from GitLab once told me their philosophy is that if you arent offering your opinion, then theyre being exclusionary. If someone isnt offering an opinion in a meeting, then find ways to include them. **When I know an introvert is interested in a topic were meeting about, Ill ask in advance for written input. A lot of meetings can be avoided by moving the discussion to slack or GitLab where introverts are more willing to engage.** In stand-up, everyone gives an update, and introverts seem to do fine in this context. So we sometimes do the same thing in other meetings just to make sure everyone has time to speak. I also encourage introverts to speak in front of small groups either at work or in the community in order to build those skills." —Dan Barker
"**I think the best thing that anyone ever did for me was to make sure I had the skills necessary to answer the big questions when they came.** As a very young enlisted Air Force member I was giving status briefings to my units senior leadership. That required that I have a number of data points available at any given moment as well as the why behind any delays or deviations on the way towards established objectives. That propelled me from a behind the scenes person into being willing to share my opinion and thoughts with others." —Chris Short
"**Lead through culture. Design and try out a ritual for your co-workers.** You can design a smaller weekly ritual for groups or teams or a bigger yearly event for your department or organization. The point is to try something and observe your leadership role in it. Identify gaps or tensions in your culture. Look back at the beliefs and behaviors of teams. Where do you observe tension? Whats missing from your culture? Start with a simple statement 'I see a tension between X and Y'. Or 'My team is missing Z'. Next, flip the gap or tension into a question: write down 3 'How might wes (HMWs)'." —Catherine Louis
"Introverts are not a different class of people, they are either people who think or wait too much before they share their mind or people who have no idea what's going on. I was one among the first category, I thought too much and sometimes worried about what if my opinion is laughed upon or not entertained or thought otherwise. It was hard coming up of that kind of mindset but it was also eating my chances of learning better things. Once, we were discussing in the team about an implementation issue. My then manager asked me one on one, why I am not participating as I am one of the more experienced people on the team, and I opened up (after I gathered all the power in the universe to say something) saying everything I wanted to say was already shared. He suggested 'I could use a repetition sometimes, as there are many things going on, it would be helpful if you just repeat your thought even if it is discussed'. Well, that was not a very persuasive way but that gave me a bit of confidence that someone at-least wants to hear me.
"Now, the way I used to make people speak in my team, is **I often ask the introvert person for help, even if I know the resolution, and appreciate them in team meetings and discussions to boost up their confidence encouraging them to share more knowledge with the team, by slowly giving them time to come out of their reserved nature**. They may still remain a bit isolated in the outer world but within a team, some emerge a player we can count on." —Abhishek Tamrakar
"My advice to introverts when participating in conferences is to find friends/colleagues who are also attending so you have people to talk to comfortably, reach out prior to the event to schedule some smaller meetings/meals with other attendees (friends, industry contacts, former colleagues, etc.), **be mindful of your exhaustion level and take care of yourself**: skip the social/evening events if you need to recharge, write about your experience in a post-event retrospective." —Elizabeth Joseph
### What are some tips for increasing productivity when working with a teammate who tends to be more of an introvert?
"Productivity is increasingly challenging to really qualify. In many cases, a break from work or a casual conversation can be the spark needed in our creative endeavors. Again, I find slack and GitLab to be very helpful mediums for exchanging ideas and interacting with others when you have introverts on your team. **I also find pair programming to be very useful for most introverts as one on one interactions arent usually as taxing but the product quality and efficiency gains are substantial.** However, when an introvert is working alone, everyone on the team should be discouraged from interrupting them. Its best to send them an email or some non-intrusive medium." —Dan Barker
"Give them great tools for doing and documenting their work. **Enable them to be the best they can be at their job.** Check in with them frequently enough to make sure theyre on the right track but also be mindful its a bigger distraction to them than it is more extroverted people." —Chris Short
"**Dont interrupt me when I am heads down.** Really, dont. It could take me 2 hours minimally to get my brain back to where I was when I was knee deep in something. It feels painful. Really. Instead, email me and ask me to come to a place where there is a whiteboard. Share the problem from the customer's point of view—draw it—not from your point of view. I may have dozens of customer issues niggling in the back of my brain. If your issues sound like 'make me look good to my upper management', it will get less attention from me than the true customer's issues I already have. Draw a picture. Give me time to think. Make sure there is more than one marker in case I am ready to share. Be prepared that your hypothesis about the problem is completely wrong." —Catherine Louis
"Appreciation and encouragement is the way out, appreciation may not be an appraisal, but an appreciation that encourages people to feel comfortable in presence of more than one living entities, **so that everyone feels heard and not laughed or underrated**." —Abhishek Tamrakar
### Final thoughts
The biggest takeaway from our conversations on introverted DevOps enthusiasts is one of equity: Treat people as they need to be treated, and ask people to treat you as you want to be treated. Whether you are extroverted or introverted, we all need to respect the fact that we do not all experience the world in the same way. Our colleagues deserve the space they need to get the work done, and knowing how to support them starts with a discussion on their needs. Our differences are what make our communities so special and it makes our work more useful for more people. The most effective way to communicate with others is to communicate in a style that works well for both of you.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/devops-introverted-people
作者:[Matthew Broberg][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/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_QandAorange_520x292_0311LL.png?itok=qa3hHSou (Q and A letters)
[2]: https://opensource.com/devops-team
[3]: https://www.inc.com/melanie-curtin/are-you-shy-or-introverted-science-says-this-is-1-primary-difference.html
[4]: https://www.myersbriggs.org/my-mbti-personality-type/mbti-basics/extraversion-or-introversion.htm?bhcp=1
[5]: https://lifehacker.com/lets-quit-it-with-the-introvert-extrovert-nonsense-1713772952
[6]: https://www.psychologytoday.com/us/blog/the-gen-y-guide/201710/the-majority-people-are-not-introverts-or-extroverts

View File

@ -1,220 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Build a retro Apple desktop with the Linux MLVWM)
[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Build a retro Apple desktop with the Linux MLVWM
======
This article is part of a special series of 24 days of Linux desktops.
What if old-school Apple computers were built around open source POSIX?
You can find out by building the Macintosh-like Virtual Window Manager.
![Person typing on a 1980's computer][1]
Imagine traveling into an alternate history where the Apple II GS and MacOS 7 were built upon open source [POSIX][2], using all the same conventions as modern Linux, like plain-text configuration files and modular system design. What would such an OS have enabled for its users? You can answer these questions (and more!) with the [Macintosh-like Virtual Window Manager (MLVWM)][3].
![MLVWM running on Slackware 14.2][4]
### Installing MLVWM
MLVWM is not an easy installation, and it's probably not in your distribution's software repository. If you have the time to decipher a poorly translated README file, edit some configuration files, gather and resize some old **.xpm** images, and edit an Xorg preference or two, then you can experience MLVWM. Otherwise, this is a novelty window manager with its latest release back in 2000.
To compile MLVWM, you must have **imake** installed, which provides the **xmkmf** command. You can install imake from your distribution's software repository, or get it directly from [Freedesktop.org][5]. Assuming you have the **xmkmf** command, change into the directory containing the MLVWM source code, and run these commands to build it:
```
$ xmkmf -a
$ make
```
After building, the compiled **mlvwm** binary is located in the **mlvwm** directory. Move it to any location [in your path][6] to install it:
```
`$ mv mlvwm/mlvwm /usr/local/bin/`
```
#### Editing the config files
MLVWM is now installed, but it won't launch correctly without adjusting several configuration files and carefully arranging required image files. Sample config files are located in the **sample_rc** directory of the source code you downloaded. Copy the files **Mlvwm-Netscape** and **Mlvwm-Xterm** to your home directory:
```
`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME`
```
Move the **Mlvwmrc** file to **$HOME/.mlvwmrc** (yes, you must use a lower-case "m" even though the sample file deceptively begins with a capital letter):
```
`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc`
```
Open **.mlwmrc** and find lines 5455, which define the path (the "IconPath") for the pixmap images that MLVWM uses in its menus and UI:
```
# Set icon search path. It needs before "Style".
IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap
```
Adjust the path to match a directory you will fill with your own images (I suggest using **$HOME/.local/share/pixmaps**). MLVWM doesn't provide pixmaps, so it's up to you to provide pixmap icons for the desktop you're building.
Do this even if you have pixmaps located elsewhere on your system (such as **/usr/share/pixmaps**), because you're going to have to adjust the size of the pixmaps, and you probably don't want to do that on a system-wide level.
```
# Set icon search path. It needs before "Style".
IconPath /home/seth/.local/share/pixmaps
```
#### Choosing the pixmaps
You've defined the **.local/share/pixmaps** directory as the source of pixmaps, but neither the directory nor the images exist yet. Create the directory:
```
`$ mkdir -p $HOME/.local/share/pixmaps`
```
Right now, the config file assigns images to menu entries and UI elements, but none of those images exist on your system. To fix this, read through the configuration file and locate every **.xpm** image. For each image listed in the config, add an image with the same file name (or change the file name in the config file) to your IconPath directory.
The **.mlvwmrc** file is well commented, so you can get a general idea of what you're editing. This is just a first pass, anyway. You can always come back and change the look of your desktop later.
Here are some examples.
This code block sets the icon in the upper-left corner of the screen:
```
# Register the menu
Menu Apple, Icon label1.xpm, Stick
```
The **label1.xpm** image is actually provided in the source code download's **pixmap** directory, but I prefer to use **Penguin.xpm** from **/usr/share/pixmaps** (on Slackware). Whatever you use, you must place your custom pixmap in **~/.local/share/pixmaps** and either change the pixmap's name in the configuration or rename the pixmap file to match what's currently in the config file.
This code block defines the applications listed in the left menu:
```
"About this Workstation..." NonSelect, Gray, Action About
"" NonSelect
"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls
"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm
"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm
END
```
By following the same syntax as what you see in the configuration file, you can customize the pixmaps and add your own applications to the menu (for instance, I changed **mule** to **emacs**). This is your gateway to your applications in the MLVWM GUI, so list everything you want quick access to. You may also wish to include a shortcut to your **/usr/share/applications** folder.
```
`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications`
```
Once you're finished editing the configuration file and adding your own images to your IconPath directory, your pixmaps must all be resized to roughly 16x16 pixels. (MLVWM isn't consistent in its defaults, so there's room for variation.) You can do this as a bulk action using ImageMagick:
```
`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done`
```
### Starting MLVWM
The easiest way to get up and running with MLVWM is to let Xorg do the bulk of the work. First, you must create a **$HOME/.xinitrc** file. I borrowed this one from Slackware, which borrowed it from Xorg:
```
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
    xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi
# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  exec ck-launch-session /usr/local/bin/mlvwm
else
  exec /usr/local/bin/mlvwm
fi
```
According to this file, the default action for the **startx** command is to launch MLVWM. However, your distribution may have other ideas about what happens when your graphic server launches (or is killed to be restarted), so this file may do you little good. On many distributions, you can add a **.desktop** file to **/usr/share/xsessions** to have it listed in the GDM or KDM menu, so create a file called **mlvwm.desktop** and enter this text:
```
[Desktop Entry]
Name=Mlvwm
Comment=Macintosh-like virtual window manager
Exec=/usr/local/bin/mlvwm
TryExec=ck-launch-session /usr/local/bin/mlvwm
Type=Application
```
Log out from your desktop session and log back into MLVWM. By default, your session manager (KDM, GDM, or LightDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in.
With GDM:
![][7]
With SDDM:
![][8]
#### Launching with brute force
If MLVWM fails to start, try installing XDM, a lightweight session manager that doesn't look at **/usr/share/xsessions** and instead just does whatever the authenticated user's **.xinitrc** proscribes.
![MLVWM][9]
### Build your own retro Apple
The MLVWM desktop is unpolished, imperfect, accurate, and loads of fun. Many of the menu options you see are unimplemented, but you can make them active and meaningful.
This is your chance to step back in time, change history, and make the old-school Apple line of computers a bastion of open source. Be a revisionist, design your own retro Apple desktop, and, most importantly, have fun.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-mlvwm-desktop
作者:[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/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html
[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2)
[5]: http://cgit.freedesktop.org/xorg/util/imake
[6]: https://opensource.com/article/17/6/set-path-linux
[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg
[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg
[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM)

View File

@ -1,183 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/start-stop-restart-services-linux/)
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions
======
Services are essential background processes that are usually run while booting up and shut down with the OS.
If you are a sysadmin, youll deal with the service regularly.
If you are a normal desktop user, you may come across the need to restart a service like [setting up Barrier for sharing mouse and keyboard between computers][1]. or when you are [using ufw to setup firewall][2].
Today I will show you two different ways you can manage services. Youll learn to start, stop and restart services in Ubuntu or any other Linux distribution.
systemd vs init
Ubuntu and many other distributions these days use systemd instead of the good old init.
In systemd, you manage sevices with systemctl command.
In init, you manage service with service command.
Youll notice that even though your Linux system uses systemd, it is still able to use the service command (intended to be used with init system). This is because service command is actually redirect to systemctl. Its sort of backward compatibility introduced by systemd because sysadmins were habitual of using the service command.
Ill show both systemctl and service command in this tutorial.
_I am Ubuntu 18.04 here, but the process (no pun intended) is the same for other versions._
### Method 1: Managing services in Linux with systemd
I am starting with systemd because of the obvious reason of its widespread adoption.
#### 1\. List all services
In order to manage the services, you first need to know what services are available on your system.
You can use the systemd command to list all the services on your Linux system:
```
systemctl list-unit-files --type service -all
```
![systemctl list-unit-files][3]
This command will output the state of all services. The value of a services state can be enabled, disabled, masked (inactive until mask is unset), static and generated.
Combine it with the [grep command][4] and you can **display just the running services**:
```
sudo systemctl | grep running
```
![Display running services systemctl][5]
Now that you know how to reference all different services, you can start actively managing them.
**Note:** ***&lt;service-***_**name&gt;**_ _in the commands should be replaced by the name of the service you wish to manage (e.g. network-manager, ufw etc.)._
#### **2\. Start a** service
To start a service in Linux, you just need to use its name like this:
```
systemctl start <service-name>
```
#### 3\. **Stop** a service
To stop a systemd service, you can use the stop option of systemctl command:
```
systemctl stop <service-name>
```
#### 4\. Re**start** a service
To restart a service in Linux with systemd, you can use:
```
systemctl restart <service-name>
```
#### 5\. Check the status of a service
You can confirm that you have successfully executed a certain action by printing the service status:
```
systemctl status <service-name>
```
This will output information in the following manner:
![systemctl status][6]
That was systemd. Lets switch to init now.
### Method 2: Managing services in Linux with init
The commands in init are also as simple as system.
#### 1\. List all services
To list all the Linux services, use
```
service --status-all
```
![service status-all][7]
The services preceded by **[ ]** are **disabled** and those with **[ + ]** are **enabled**.
#### **2\. Start** a service
To start a service in Ubuntu and other distributions, use this command:
```
service <service-name> start
```
#### **3\. Stop** a service
Stopping a service is equally easy.
```
service <service-name> stop
```
#### 4\. Re**start** a service
If you want to restart a service, the command is:
```
service <service-name> restart
```
#### 5\. Check the status of a service
Furthermore, to check if your intended result was achieved, you can output the service ****status**:**
```
service <service-name> status
```
This will output information in the following manner:
![service status][8]
This will, most importantly, tell you if a certain service is active **(**running**)** or not.
**Wrapping Up**
Today I detailed two very simple methods of managing services on Ubuntu or any other Linux system. I hope this article was helpful to you.
Which method do you prefer? Let us know in the comment section below!
--------------------------------------------------------------------------------
via: https://itsfoss.com/start-stop-restart-services-linux/
作者:[Sergiu][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/sergiu/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/
[2]: https://itsfoss.com/set-up-firewall-gufw/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_list_services.png?ssl=1
[4]: https://linuxhandbook.com/grep-command-examples/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_grep_running.jpg?ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_status.jpg?ssl=1
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status_all.png?ssl=1
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status.jpg?ssl=1

View File

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

View File

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

View File

@ -1,66 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why your Python code needs to be beautiful and explicit)
[#]: via: (https://opensource.com/article/19/12/zen-python-beauty-clarity)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
Why your Python code needs to be beautiful and explicit
======
Welcome to Pythonukkah, a special series about the Zen of Python. On the
first day, we celebrate the first two principles: beauty and
explicitness.
![Searching for code][1]
Python contributor Tim Peters introduced us to the [Zen of Python][2] in 1999. Twenty years later, its 19 guiding principles continue to be relevant within the community. We start our Pythonukkah celebration—like Hanukkah, a festival of lights—with the first two principles in the Zen of Python: on beauty and explicitness.
> "Hanukkah is the Festival of Lights,
> Instead of one day of presents, we get eight crazy nights."
> —Adam Sandler, [_The Hanukkah Song_][3]
### Beautiful is better than ugly.
It was in _[Structure and Interpretation of Computer Programs][4]_ (_SICP_) that the point was made: "Programs must be written for people to read and only incidentally for machines to execute." Machines do not care about beauty, but people do.
A beautiful program is one that is enjoyable to read. This means first that it is consistent. Tools like [Black][5], [flake8][6], and [Pylint][7] are great for making sure things are reasonable on a surface layer.
But even more important, only humans can judge what humans find beautiful. Code reviews and a collaborative approach to writing code are the only realistic way to build beautiful code. Listening to other people is an important skill in software development.
Finally, all the tools and processes are moot if the _will_ is not there. Without an appreciation for the importance of beauty, there will never be an emphasis on writing beautiful code.
This is why this is the first principle: it is a way of making "beauty" a value in the Python community. It immediately answers: "Do we _really_ care about beauty?" We do.
### Explicit is better than implicit.
We humans celebrate light and fear the dark. Light helps us make sense of vague images. In the same way, programming with more explicitness helps us make sense of abstract ideas. It is often tempting to make things implicit.
"Why is **self** explicitly there as the first parameter of methods?"
There are many technical explanations, but all of them are wrong. It is almost a Python programmer's rite of passage to write a metaclass that makes explicitly listing **self** unnecessary. (If you have never done this before, do so; it makes a great metaclass learning exercise!)
The reason **self** is explicit is not because the Python core developers did not want to make a metaclass like that the "default" metaclass. The reason it is explicit is because there is one less special case to teach: the first argument is _explicit_.
Even when Python does allow non-explicit things, such as context variables, we must always ask: Are we sure we need them? Could we not just pass arguments explicitly? Sometimes, for many reasons, this is not feasible. But prioritizing explicitness means, at the least, asking the question and estimating the effort.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/zen-python-beauty-clarity
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code)
[2]: https://www.python.org/dev/peps/pep-0020/
[3]: https://en.wikipedia.org/wiki/The_Chanukah_Song
[4]: https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs
[5]: https://opensource.com/article/19/5/python-black
[6]: https://opensource.com/article/19/5/python-flake8
[7]: https://opensource.com/article/19/10/python-pylint-introduction

View File

@ -0,0 +1,96 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 articles to learn Linux your way)
[#]: via: (https://opensource.com/article/19/12/learn-linux)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
10 articles to learn Linux your way
======
It's been a good year for Linux, so take a look back at the top 10 Linux
articles on Opensource.com from 2019.
![Penguins gathered together in the Artic][1]
The year 2019 has been good for Linux with Opensource.com readers. Obviously, the term "Linux" itself is weighted: Does it refer to the kernel or the desktop or the ecosystem? In this look back at the top Linux articles of the year, I've intentionally taken a broad view in defining the top 10 Linux articles (for some definition of "top" and some definition of "Linux"). Here they are, offered in no particular order.
### A beginner's guide to Linux permissions
[_A beginner's guide to Linux permissions_][2] by Bryant Son introduces new users to the concept of file permissions with graphics and charts to illustrate each point. It can be hard to come up with visuals for concepts that are, at their core, purely text-based, and this article is friendly for the visual learners out there. I also like how Bryant stays focused. Any discussion of file permissions can lead to several related topics (like ownership and access control lists and so on), but this article is dedicated to explaining one thing and explaining it well.
### Why I made the switch from Mac to Linux
Matthew Broberg offers an insightful and honest look at his migration to Linux from MacOS in [_Why I made the switch from Mac to Linux_][3]. Changing platforms is always tough, and it's important to record what's behind the decision to switch. Matt's article, I think, serves several purposes, but the two most important for me: it's an invitation for the Linux community to support him by answering questions and offering potential solutions, and it's a good data point for others who are considering Linux adoption.
### Troubleshooting slow WiFi on Linux
In [_Troubleshooting slow WiFi on Linux_][4], David Clinton provides a useful analysis of a problem everyone has on every platform—and has tips on how to solve it. It's a good example of an "incidentally Linux" tip that not only helps everyday people with everyday problems but also shows non-Linux users how approachable troubleshooting (on any platform) is.
### How GNOME uses Git
[_How GNOME uses Git_][5] by Molly de Blanc takes a look behind the scenes, revealing how one of the paragons of open source software (the GNOME desktop) uses one of the other paragons of open source (Git) for development. It's always heartening to me to hear about an open source project that defaults to an open source solution for whatever needs to be done. Believe it or not, this isn't always the case, but for GNOME, it's an important and welcoming part of the project's identity.
### Virtual filesystems in Linux: Why we need them and how they work
Alison Chaiken masterfully explains what is considered incomprehensible to many users in [_Virtual filesystems in Linux: Why we need them and how they work_][6]. Understanding what a filesystem is and what it does is one thing, but _virtual_ ones aren't even, by definition, real. And yet Linux delivers them in a way that even casual users can benefit from, and Alison's article explains it in a way that anyone can understand. As a bonus, Alison goes even deeper in the second half of the article and demonstrates how to use bcc scripts to monitor everything she just taught you.
### Understanding file paths and how to use them
I thought [_Understanding file paths and how to use them_][7] was important to write about because it's a concept most users (on any platform) don't seem to be taught. It's a strange phenomenon, because now, more than ever, the _file path_ is something people see literally on a daily basis: Nearly all internet URLs contain a file path telling you exactly where within the domain you are. I often wonder why computer education doesn't start with the internet, the most familiar app of all and arguably the most heavily used supercomputer in existence, and use it to explain the appliances we interface with each day. (I guess it would help if those appliances were running Linux, but we're working on that.)
### Inter-process communication in Linux
[_Inter-process communication in Linux: Shared storage_][8] by Marty Kalin delves into the developer side of Linux, explaining IPC and how to interact with it in your code. I'm cheating by including this article because it's actually a three-part series, but it's the best explanation of its kind. There is very little documentation that manages to explain how Linux handles IPC, much less what IPC is, why it's important, or how to take advantage of it when programming. It's normally a topic you work your way up to in university. Now you can read all about it here instead.
### Understanding system calls on Linux with strace
[_Understanding system calls on Linux with strace_][9] by Gaurav Kamathe is highly technical in ways I wish that every conference talk I've ever seen about **strace** was. This is a clear and helpful demonstration of a complex but amazingly useful command. To my surprise, the command I've found myself using since this article isn't the titular command, but **ltrace** (to see which functions are called by a command). Obviously, this article's packed with information and is a handy reference for developers and QA testers.
### How the Linux desktop has grown
[_How the Linux desktop has grown_][10] by Jim Hall is a visual journey through the history of the Linux desktop. It starts with [TWM][11] and passes by [FVWM][12], [GNOME][13], [KDE][14], and others. If you're new to Linux, this is a fascinating history lesson from someone who was there (and has the screenshots to prove it). If you've been with Linux for many years, then this will definitely bring back memories. In the end, though, one thing is certain: Anyone who can still locate screenshots from 20 years ago is a superhuman data archivist.
### Create your own video streaming server with Linux
[_Create your own video streaming server with Linux_][15] by Aaron J. Prisk breaks down more than just a few preconceptions most of us have about the services we take for granted. Because services like YouTube and Twitch exist, many people assume that those are the only gateways to broadcasting video to the world. Of course, people used to think that Windows and Mac were the only gateways into computing, and that, thankfully, turned out to be a gross miscalculation. In this article, Aaron sets up a video-streaming server and even manages to find space to talk about [OBS][16] in so you can create videos to stream. Is it a fun weekend project or the start of a new career? You decide.
### 10 moments that shaped Linux history
[_10 moments that shaped Linux history_][17] by Alan Formy-Duval attempts the formidable task of choosing just 10 things to highlight in the history of Linux. It's an exercise in futility, of course, because there have been so many important moments, so I love how Alan filters it through his own experience. For example, when was it obvious that Linux was going to last? When Alan realized that all the systems he maintained at work were running Linux. There's a beauty to interpreting history this way because the moments of importance will differ for each person. There's no definitive list for Linux, or articles about Linux, or for open source. You make your own list, and you make yourself a part of it.
### What do you want to learn?
What else do you want to know about Linux? Please tell us about it in the comments, or [write an article][18] for Opensource.com about your experience with Linux.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/learn-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/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png?itok=p7cWyQv9 (Penguins gathered together in the Artic)
[2]: https://opensource.com/article/19/6/understanding-linux-permissions
[3]: https://opensource.com/article/19/10/why-switch-mac-linux
[4]: http://opensource.com/article/19/4/troubleshooting-wifi-linux
[5]: https://opensource.com/article/19/10/how-gnome-uses-git
[6]: https://opensource.com/article/19/3/virtual-filesystems-linux
[7]: https://opensource.com/article/19/8/understanding-file-paths-linux
[8]: https://opensource.com/article/19/4/interprocess-communication-linux-storage
[9]: https://opensource.com/article/19/2/linux-backup-solutions
[10]: https://opensource.com/article/19/8/how-linux-desktop-grown
[11]: https://github.com/freedesktop/twm
[12]: http://www.fvwm.org/
[13]: http://gnome.org
[14]: http://kde.org
[15]: https://opensource.com/article/19/1/basic-live-video-streaming-server
[16]: https://opensource.com/life/15/12/real-time-linux-video-editing-with-obs-studio
[17]: https://opensource.com/article/19/4/top-moments-linux-history
[18]: https://opensource.com/how-submit-article

View File

@ -0,0 +1,77 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 resources to become a better Bash user)
[#]: via: (https://opensource.com/article/19/12/bash-resources)
[#]: author: (David Both https://opensource.com/users/dboth)
10 resources to become a better Bash user
======
Take a look through our top 10 Bash articles from 2019.
![bash logo on green background][1]
As another great year wraps up at Opensource.com, my fascination with all things [Bash][2] has me looking back at the top 10 Bash articles we published in 2019. These articles include basic how-to articles, tools, shortcuts, and even a way to build your own command-line game with Bash.
I didn't select these articles based solely on the number of hits they had but rather on a number of criteria. In the true spirit of top 10 countdowns, the top Bash article from 2019 is at the end for the final reveal.
10. [_Bash vs. Python: Which language should you use?_][3] by Archit Modi looks at the strengths and weaknesses of these popular languages. Although both have many good points, the bottom line—as with most things Linux—is, "it depends."
9. [_How to program with Bash: Logical operators and shell expansions_][4] is the second in a three-part series I wrote about Bash programming. This article lists all of the Bash logical operators and provides some easy examples for using them. It also discusses five of the seven types of shell expansions and includes easy-to-understand examples that help to clarify how these expansions work.
8. Abhishek Tamrakar shows us how to _[Hone advanced Bash skills by building Minesweeper][5]._ This is an interesting, fun, and informative way to improve the Bash skills you already have. When finished, you have a working command-line game of Minesweeper and some serious skills. This article is one of my favorites because it not only stretches our skills, but it illustrates the power of Bash as a programming language.
7. [_How to program with Bash: Syntax and tools_][6] is the first article in my Bash programming series. In addition to introducing Bash as a programming language, it looks at the basic syntax of Bash programming, the use of variables, and flow control.
6. Matthew Broberg's [_The birth of the Bash shell_][7] delves into the history of the Bash shell with a look at how it all started with Unix and the original (Ken) Thompson shell. As someone who appreciates the historical roots of Linux and many of its components, I gained some new insights from this article.
5. Seth Kenlon contributed _[How to write a loop in Bash][8],_ which explores the _for_ loop in some detail. A _for_ loop is a recipe detailing what actions you want your computer to take for each data object (such as a file) you specify. This article has some excellent examples to get you started and shows the power that loops can bring to Bash scripts.
4. _[7 Bash history shortcuts you will actually use][9]_ shows how to save time on the command line by using Bash shortcuts. Ian Miell describes time-saving tools that go far beyond just simple command-line recall. These are very cool, and I especially like the easy method for reissuing the previous command while reordering the arguments.
3. Seth Kenlon also shows some [_Bash aliases you can't live without_][10] that will save even more time. This article takes us through one of the ways that we "lazy sysadmins" can become even more efficient than we already are. This is all about less typing while getting more results.
2. I always recommend testing scripts to ensure that they do what they are intended to—and that they don't create any other problems while doing so. Darin London introduces us to _[Testing Bash with BATS][11],_ the Bash Automated Testing System, a TAP-compliant testing framework for Bash. The [Test Anything Protocol][12] is also used for testing many other Unix languages. This article is loaded with examples and recommendations for structuring Bash programs so that they can be tested easily with this tool.
1. Our number 1 spot for 2019 is—drum-roll—Seth Kenlon with [_3 command line games for learning Bash the fun way_][13]. Learning is work, but it can be fun. If you are into games (and it seems that we sysadmins like to have fun), this article looks at three tools for learning more about Bash for everyone from noobs to gurus. Everything you do in the game of Bashcrawl, for example, is a valid Bash command that you can use later in real life, and playing the game provides Bash practice because the "game" is made out of actual directories and files on your computer.
These articles can help you learn Bash and some of its many powerful features. I have certainly learned a lot from them.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/bash-resources
作者:[David Both][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/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
[2]: https://opensource.com/downloads/bash-cheat-sheet
[3]: https://opensource.com/article/19/4/bash-vs-python
[4]: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions
[5]: https://opensource.com/article/19/9/advanced-bash-building-minesweeper
[6]: https://opensource.com/article/19/10/programming-bash-syntax-tools
[7]: https://opensource.com/19/9/command-line-heroes-bash
[8]: https://opensource.com/article/19/6/how-write-loop-bash
[9]: https://opensource.com/article/19/10/bash-history-shortcuts
[10]: https://opensource.com/article/19/7/bash-aliases
[11]: https://opensource.com/article/19/2/testing-bash-bats
[12]: https://testanything.org/producers.html
[13]: https://opensource.com/article/19/10/learn-bash-command-line-games

View File

@ -0,0 +1,70 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Best of 2019: Fedora for system administrators)
[#]: via: (https://fedoramagazine.org/best-of-2019-fedora-for-system-administrators/)
[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/)
Best of 2019: Fedora for system administrators
======
![][1]
The end of the year is a perfect time to look back on some of the Magazines most popular articles of 2019. One of the Fedora operating systemss many strong points is its wide array of tools for system administrators. As your skills progress, youll find that the Fedora OS has even more to offer. And because Linux is the sysadmins best friend, youll always be in good company. In 2019, there were quite a few articles about sysadmin tools our readers enjoyed. Heres a sampling.
### Introducing Fedora CoreOS
If you follow modern IT topics, you know that containers are a hot topic — and [containers mean Linux][2]. This summer brought the first preview release of [Fedora CoreOS][3]. This new edition of Fedora can run containerized workloads. You can use it to deploy apps and services in a modern way.
> [Introducing Fedora CoreOS][4]
### InitRAMFS, dracut and the dracut emergency shell
To be a good sysadmin, you need to understand system startup and the boot process. From time to time, youll encounter software errors, configuration problems, or other issues that keep your system from starting normally. With the information in the article below, you can do some life-saving surgery on your system, and restore it to working order.
> [InitRAMFS, Dracut, and the Dracut Emergency Shell][5]
### How to reset your root password
Although this article was published a few years ago, it continues to be one of the most popular. Apparently, were not the only people who sometimes get locked out of our own system! If this happens to you, and you need to reset the root password, the article below should do the trick.
> [How to reset a root password on Fedora][6]
### Systemd: unit dependencies and order
This article is part of [an entire series][7] on systemd, the modern system and process manager in Fedora and other distributions. As you may know, systemd has sophisticated but easy to use methods to start up or shut own services in the right order. This article shows you how they work. That way you can apply the right options to unit files you create for systemd.
> [systemd: Unit dependencies and order][8]
### Setting kernel command line arguments
Fedora 30 introduced new ways to change the boot options for your kernel. This article from Laura Abbott on the Fedora kernel team explains the new Bootloader Spec (BLS). It also tells you how to use it to set options on your kernel for boot time.
> [Setting kernel command line arguments with Fedora 30][9]
Stay tuned to the Magazine for other upcoming “Best of 2019” categories. All of us at the Magazine hope you have a great end of year and holiday season.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/best-of-2019-fedora-for-system-administrators/
作者:[Paul W. Frields][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/pfrields/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/2019top-sysadmins.png-816x345.jpg
[2]: https://www.redhat.com/en/blog/containers-are-linux
[3]: https://getfedora.org/coreos/
[4]: https://fedoramagazine.org/introducing-fedora-coreos/
[5]: https://fedoramagazine.org/initramfs-dracut-and-the-dracut-emergency-shell/
[6]: https://fedoramagazine.org/reset-root-password-fedora/
[7]: https://fedoramagazine.org/series/systemd-series/
[8]: https://fedoramagazine.org/systemd-unit-dependencies-and-order/
[9]: https://fedoramagazine.org/setting-kernel-command-line-arguments-with-fedora-30/

View File

@ -0,0 +1,109 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Get back to basics with the TWM Linux desktop)
[#]: via: (https://opensource.com/article/19/12/twm-linux-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Get back to basics with the TWM Linux desktop
======
This article is part of a special series of 24 days of Linux desktops.
TWM may be bare-bones by default, but it's a great foundation for a
customized Linux desktop that has all your favorite bits and pieces.
![Penguin driving a car with a yellow background][1]
The most humble of window managers, TWM, is a little akin to those sample photographs you get when you buy a picture frame. It's basic, almost a bare-minimum proof of concept that Xorg ships with the [X11][2] Windows System to demonstrate that a desktop can indeed be created for a graphical user interface (GUI).
Some distributions treat it as a fallback window manager that can be launched in a pinch if you break your usual desktop and need a terminal just long enough for repairs. Now that Xorg is basically bulletproof and moving aside for [Wayland][3], sometimes TWM isn't even included at all. And yet, amazingly, TWM, short for either _Timeless Window Manager_ or _Tabbed Window Manager_, depending on who you ask, has some fun features and configuration options.
![TWM][4]
Your distribution (XQuartz on Mac OS included) may discreetly include TWM as a fallback window manager. Otherwise, you are likely to find it in your software repository, and you can also get it from the [Freedesktop][5] GitHub repository. If you're already running a different desktop, it's safe to install TWM on the same system because it doesn't include any bundled applications aside from a few configuration panels.
After installing, log out of your current desktop session so you can log into TWM. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging into your new one.
With GDM:
![Selecting your desktop in GDM][6]
With SDDM:
![Selecting your desktop in KDM][7]
### Desktop tour
TWM's basic configuration is usually unspectacular. Here's TWM on my Slackware system:
![TWM by default][8]
You can get a pop-up menu with a left-click on the desktop. By default, it has one application listed: xterm. When you launch xterm, the outline of a window appears until you click to place it on the desktop.
More actions are available with a right-click or a middle-click on the desktop or a window's title bar. For instance, to resize a window, you can middle-click the title bar and select **Resize**; this places you into resize mode so you can drag your mouse across the edge of the window you want to make smaller or larger. Click again to confirm the new size.
When you right-click the icon in the upper-left corner of any window, that window is minimized into a desktop icon (a precursor to the OS X dock). You can drag this icon anywhere on your desktop and right-click on it to restore it back to a full-sized window.
These are all old Unix conventions; tricks of the visual interface that long-time Unix users will remember fondly but are utterly baffling at first to new users. You can learn to love them by using TWM, but if you do that, you'll no doubt want something a little prettier and more tailored to your daily workflow.
### TWM configuration
One of my favorite sites is [Linux Questions][9], a tried-and-true Linux support forum. I stumbled across a post there about TWM, where user **rkfb** was, apparently in all seriousness, praising TWM as his favorite lightweight window manager. What's more, **rkfb** had [the config file to prove it][10].
I downloaded the sample **.twmrc** file and discovered that there are a surprising number of options and features in TWM. Like other "building-block" window managers, such as [FVWM][11] or [MLVWM][12], it takes a lot of work to customize it and bring it up to modern expectations. You can also add the usual laundry list of applications to TWM. For instance, you could run [Tint2][13] or [Xfce-panel][14] to provide a traditional taskbar and other applets, or [stalonetray][15] for a system tray, and [vdesk][16] to provide virtual desktops, but then again, TWM isn't meant to be a _modern_ window manager, but a _timeless_ window manager. You may not want to make it too modern.
There are _lots_ of options and definitions in the config file for TWM. Two of my favorites are **RandomPlacement** (an option to activate random placement of windows, so you don't have to manually click to set the location of each window you launch) and **ShowIconManager** (which displays a vertical taskbar).
The syntax to define the contents of the menus is pretty easy to understand:
```
menu "Shells" {
   "Shells"     f.title
   "rxvt"               f.exec "urxvt -fg cyan -bg black -cr white &amp;"
   "Konsole"    f.exec "konsole &amp;"
}
```
Color themes are similarly intuitive from the sample file.
You can set a background using the **feh** command (you probably need to install it first):
```
`$ feh --bg-fill ~/christopher-burns_unsplash.jpg`
```
### Old TWM is new TWM
TWM looks and feels like an artifact of a bygone era, when desktops were simpler in design but complex in configuration. It's probably not the best or the most flexible window manager available, but it's surprisingly configurable. You can use it as the foundation of a customized desktop consisting of all your favorite desktop bits and pieces. You can spend the time to make TWM something you enjoy using, and you'll learn a lot about interface design, Unix history, and pixmap bit depth along the way. Give TWM another look, and make that look beautiful.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/twm-linux-desktop
作者:[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/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background)
[2]: https://en.wikipedia.org/wiki/X_Window_System
[3]: https://wayland.freedesktop.org/
[4]: https://opensource.com/sites/default/files/uploads/advent-twm.jpg (TWM)
[5]: https://github.com/freedesktop/twm
[6]: https://opensource.com/sites/default/files/uploads/advent-gdm_3.jpg (Selecting your desktop in GDM)
[7]: https://opensource.com/sites/default/files/uploads/advent-kdm_2.jpg (Selecting your desktop in KDM)
[8]: https://opensource.com/sites/default/files/uploads/advent-twm-basic.jpg (TWM by default)
[9]: http://linuxquestions.org
[10]: https://www.linuxquestions.org/questions/linux-desktop-74/share-your-configuration-file-of-twm-best-x-windows-manager-4175585974
[11]: https://opensource.com/article/19/12/fvwm-linux-desktop
[12]: https://opensource.com/article/19/12/linux-mlvwm-desktop
[13]: https://opensource.com/article/19/1/productivity-tool-tint2
[14]: https://opensource.com/article/19/12/xfce-linux-desktop
[15]: http://stalonetray.sourceforge.net/
[16]: https://offog.org/code/vdesk

View File

@ -0,0 +1,59 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Prioritizing simplicity in your Python code)
[#]: via: (https://opensource.com/article/19/12/zen-python-simplicity-complexity)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
Prioritizing simplicity in your Python code
======
This is the second part of a special series about the Zen of Python
focusing on the third and fourth principles: simplicity and complexity.
![Person reading a book and digital copy][1]
> "Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y plus rien à retrancher."
>
> "It seems that perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away."
> —Antoine de Saint-Exupéry, _[Terre des Hommes][2]_, 1939
A common concern in programming is the struggle with complexity. It is easy for any programmer to make a program so complicated no expert can debug it or modify it. The [Zen of Python][3] would not be complete if it did not touch on this.
### Simple is better than complex.
When it is possible to choose at all, choose the simple solution. Python is rarely in the business of _disallowing_ things. This means it is possible, and even straightforward, to design baroque programs to solve straightforward problems.
It is worthwhile to remember at each point that simplicity is one of the easiest things to lose and the hardest to regain when writing code.
This can mean choosing to write something as a function, rather than introducing an extraneous class. This can mean avoiding a robust third-party library in favor of writing a two-line function that is perfect for the immediate use-case. Most often, it means avoiding predicting the future in favor of solving the problem at hand.
It is much easier to change the program later, especially if simplicity and beauty were among its guiding principles than to load the code down with all possible future variations.
### Complex is better than complicated.
This is possibly the most misunderstood principle because understanding the precise meanings of the words is crucial. Something is _complex_ when it is composed of multiple parts. Something is _complicated_ when it has a lot of different, often hard to predict, behaviors.
When solving a hard problem, it is often the case that no simple solution will do. In that case, the most Pythonic strategy is to go "bottom-up." Build simple tools and combine them to solve the problem.
This is where techniques like _object composition_ shine. Instead of having a complicated inheritance hierarchy, have objects that forward some method calls to a separate object. Each of those can be tested and developed separately and then finally put together.
Another example of "building up" is using [singledispatch][4], so that instead of one complicated object, we have a simple, mostly behavior-less object and separate behaviors.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/zen-python-simplicity-complexity
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy)
[2]: https://en.wikipedia.org/wiki/Wind,_Sand_and_Stars
[3]: https://www.python.org/dev/peps/pep-0020/
[4]: https://opensource.com/article/19/5/python-singledispatch

View File

@ -0,0 +1,121 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (App Highlight: Falkon Open Source Web Browser from KDE)
[#]: via: (https://itsfoss.com/falkon-browser/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
App Highlight: Falkon Open Source Web Browser from KDE
======
_**Formerly known as Qupzilla, Falkon is a web browser based on QtWebEngine. In this weeks App Highlight, we take a look at this open source software.**_
### Falkon: Open Source Web Browser for Linux (and Windows)
![][1]
First thing first, [Falkon][2] is not a new web browser. It has been in development since 2010 but it was known as Qupzilla.
In 2017, QupZilla moved under KDE umbrella and changed its name to Falkon. Being under KDE umbrella means that project is actively maintained following KDE standards.
It uses the [QtWebEngine][3] rendering engine which is a striped down version of Chromium core.
In this article, I shall take a closer look at what it offers and how its different than other dominant web browsers on Linux out there.
### Features of Falkon Browser
Thought it may not be a popular browser, I did find it capable enough to browse modern web services.
Let me highlight the key features of Falkon and if you find it interesting enough, give it a try.
#### Simple User Interface
![][4]
I know its not exactly a “feature” but the user experience (UX) matters a lot. Despite being a lightweight browser, you have a decent looking interface here. You wont feel like you are using a browser from the early 2000s.
#### AdBlock Extension
![][5]
It comes packed in with the AdBlock extension that works pretty well if you want to get rid of the advertisements while browsing a website. You can also customize the behavior of the AdBlock extension.
#### DuckDuckGo Default Search Engine
Its a good thing to have one of the [privacy-oriented search engines][6] as the default search engine if you do not like using Google.
#### Session Manager
![][7]
Falkon includes a useful session manager from the available options in the browser menu. You can restore a specific recent session using this which should come in handy.
#### Extension Support
![][8]
It does support adding extensions but you cannot add extensions from Chrome/Firefox add-on marketplace. You have a limited set of extensions to choose from.
#### Theme Support
Falkon also lets you customize the appearance to some extent. You can try them out if you want to change the appearance of the browser.
![][9]
#### Other Essential Settings
![][10]
I also explored other settings/functionalities like adding a bookmark or being able to manage the passwords.
Or, maybe manage the notification access of a webpage.
Oh, I also tried using YouTube with no problems whatsoever.
Of course, this isnt an extensive review but yes, Falkon does have all the essential options that you will need in a browser (unless you have a specific requirements).
### Installing Falkon Browser
You can easily find Falkon browser available in your Software Center.
In case you dont, you can find Flatpak/Snap packages available from its [official download page][11]. Youll also find Windows installer files on the download page.
[Download Falkon Browser][11]
**Wrapping Up**
As a KDE product, Falkon is tailored for KDE desktop environment. Some KDE distributions like OpenMandriva use Falkon as the default web browser.
Falkon browser is for the ones looking for a lightweight and feature-rich web browser. An alternative worth taking a look is [Midori][12].
In my opinion, it is a good alternative browser unless you need tons of extensions, cross-platform synchronization and require to access some browser-specific websites.
What do you think about the Falkon browser? Let me know your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/falkon-browser/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-screenshot.jpg?ssl=1
[2]: https://www.falkon.org/
[3]: https://wiki.qt.io/QtWebEngine
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser.png?ssl=1
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-adblock.jpg?ssl=1
[6]: https://itsfoss.com/privacy-search-engines/
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/session-manager-falkon.jpg?ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-extensions.png?ssl=1
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-theme.png?ssl=1
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/falkon-browser-preference.png?ssl=1
[11]: https://www.falkon.org/download/
[12]: https://itsfoss.com/midori-browser/

View File

@ -0,0 +1,95 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Chill out with the Linux Equinox Desktop Environment)
[#]: via: (https://opensource.com/article/19/12/ede-linux-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Chill out with the Linux Equinox Desktop Environment
======
This article is part of a special series of 24 days of Linux desktops.
EDE is not the most glamorous, minimal, nor efficient desktop. But its
soft, muted tones are calming, its familiarity soothing, and its icon
theme fun.
![Linux penguin at the north pole beside an igloo][1]
I haven't used the Fast Light Toolkit ([FLTK][2]) for anything serious yet, but I'm a fan of the C++ GUI toolkit that's pretty simple to learn and (in my experience) reliable even across updates. When I found out that there was a desktop environment built with FLTK, I was eager to try it—and I was quickly glad I did. The [Equinox Desktop Environment (EDE)][3] is a fast and simple desktop written in C++ and FLTK for Unix desktops. It uses common desktop conventions, so it looks and feels familiar right away, and after only a few days of using it, I found its simplicity provides a minimal elegance that I enjoy.
![EDE desktop][4]
### Installing EDE
You are likely to find EDE included in your distribution's software repository, but you can also find it in its [SourceForge repository][5]. If you're already running a different desktop, it's safe to install EDE on the same system because it brings along just a few extra applications, which are specific to EDE so they won't get in your way on other desktops.
EDE is only the desktop, and it uses the [Pekwm][6] window manager to handle layout.
After installing EDE, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in.
With GDM:
![][7]
With SDDM:
![][8]
When EDE first boots, you might be prompted to confirm some startup tasks. On my Slackware workstation, KDE had marked some services as startup tasks (such as the HPLIP print monitor and a Bluetooth daemon), and EDE imported them with just one confirmation box.
![Importing desktop services in EDE][9]
After setting it up once, you won't need to do it again.
### EDE desktop tour
EDE's layout is exactly what most people expect from a desktop: application menu on the left, taskbar in the middle, system tray on the right. It's the standard off-the-shelf layout that confuses nobody; this is a desktop that's safe to install on a Linux computer and hand over, with confidence, to someone who's never used Linux in their life. They'll fall right into this desktop with a soft and gentle landing.
You can bring up a small desktop menu with a right-click. This allows you to make an application launcher on the desktop, create a folder, and set some theme options.
The panel at the bottom of the screen is retractable, so you can work full-screen if you prefer. Click the clock in the bottom-right of the screen to bring up a calendar and time-zone settings.
EDE has a small Configuration Place application that provides access to a few simple preferences:
* Background and icon settings
* Screensaver settings
* Time and clock
* System bell
* Keyboard
* Preferred applications
![EDE Configuration Place][10]
There's not much more to EDE. There's no file manager, no text editor, or paint program, or game of solitaire. You must bring anything you want to run on your desktop. That means you get to pick and choose from the wide array of Linux applications and use whatever you love the most.
### EDE as a statement
I found the simplicity of EDE oddly comforting, at least as a kind of "holiday" desktop; it's a nice place to visit. It's not the most glamorous desktop available, nor the most minimal, nor the most efficient. But its soft, muted tones are calming, its familiarity soothing, and its icon theme fun and exuberant. EDE is a desktop that's proud of its slow and steady pace.
If you're in the mood to put your feet up and enjoy a clean and pleasant interface, try EDE.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/ede-linux-desktop
作者:[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/penguin.igloo_.png?itok=K92O7H6b (Linux penguin at the north pole beside an igloo)
[2]: https://www.fltk.org/
[3]: https://sourceforge.net/projects/ede/
[4]: https://opensource.com/sites/default/files/uploads/advent-ede.jpg (EDE desktop)
[5]: http://ede.sf.net
[6]: https://opensource.com/article/19/12/pekwm-linux-desktop
[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg
[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg
[9]: https://opensource.com/sites/default/files/uploads/advent-ede-init.jpg (Importing desktop services in EDE)
[10]: https://opensource.com/sites/default/files/uploads/advent-ede-conf.jpg (EDE Configuration Place)

View File

@ -0,0 +1,72 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top articles for learning Python in 2020)
[#]: via: (https://opensource.com/article/19/12/learn-python)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
Top articles for learning Python in 2020
======
No matter where you are in your Python programming journey,
Opensource.com's top Python articles from 2019 will help you along the
way.
![Hands on a keyboard with a Python book ][1]
Python had a big year in 2019. According to popular resources like [GitHub][2] and [Stack Overflow][3], it's trending as the second most popular language in the world.
> "Python, the fastest-growing major programming language, has risen in the ranks of programming languages in our survey yet again, edging out Java this year and standing as the second most loved language (behind Rust)."
> — [Stack Overflow Insights][3]
Similarly, Python grew in readership on Opensource.com by leaps and bounds. Here are the top Python articles from 2019, grouped by topic, for your perusal.
### Why choose Python?
There are many languages out there, so what makes Python such a destination? If the most-read articles tell us anything, it's that people enjoy its flexibility. There are [multiple paradigms][4] that are accessible to Python developers, as Jigyasa Grover explains, including the popular [object-oriented programming][5] Seth Kenlon's tutorial shows.
If you're a long-time user and looking for advanced examples of why Python is a perfect language, Moshe Zadka covers his [top 5 reasons for loving Python][6]. If that's not enough, you can also use it play around with powerful tools without a lot of code, like in Parul Pandey's tutorial on [image manipulation][7].
### Configuring Python
As Python's popularity continues to rise, more people are starting with the language than ever before. Many of those first-timers are doing so on the Mac operating system and are using a [guide to setting up Python 3][8] that Moshe and I wrote.
After installing Python, decisions on where to write your code come next. There are many options when it comes to text editors and integrated development environments (IDEs), but readers appear to favor graphical options, as Stephan Avenwedde's article about [Pythonic][9] and my article on [JupyterLab][10] were the most read articles on that topic in 2019.
On the path to getting confident with the language, developers will have to face the multitude of options available for how to manage versions of the language and project dependencies. Luckily, László Kiss Kollár's article makes [managing Python packages][11] a bit simpler.
When you're ready to configure an IDE with all of the features you'll want to make the most of the language, be sure to give the [opinionated linter Black][12] a try, as Moshe explains, to keep your code clean.
### Wrapping up
No matter where you are in your path to enjoying Python programming, the top Python articles from 2019 are here to help you along the way. I can't wrap this up without at least one acknowledgment of the importance of testing, and Moshe offers another well-read article [on tox][13] for that purpose.
Thank you to all the authors who wrote for Opensource.com in 2019! If you're just learning to program in Python, let us know in the comments what you want to know. And, if you're a seasoned veteran, consider sharing your tips and tricks with us by [writing an article][14] about your favorite Python topic.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/learn-python
作者:[Matthew Broberg][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/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book )
[2]: https://octoverse.github.com/#top-languages
[3]: https://insights.stackoverflow.com/survey/2019
[4]: https://opensource.com/article/19/10/python-programming-paradigms
[5]: https://opensource.com/article/19/7/get-modular-python-classes
[6]: https://opensource.com/article/19/10/why-love-python
[7]: https://opensource.com/article/19/3/python-image-manipulation-tools
[8]: https://opensource.com/article/19/5/python-3-default-mac
[9]: https://opensource.com/article/19/5/graphically-programming-pythonic
[10]: https://opensource.com/article/19/5/jupyterlab-python-developers-magic
[11]: https://opensource.com/article/19/4/managing-python-packages
[12]: https://opensource.com/article/19/5/python-black
[13]: https://opensource.com/article/19/5/python-tox
[14]: https://opensource.com/how-submit-article

View File

@ -0,0 +1,87 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why your Python code should be flat and sparse)
[#]: via: (https://opensource.com/article/19/12/zen-python-flat-sparse)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
Why your Python code should be flat and sparse
======
This is part of a special series about the Zen of Python focusing on the
fifth and sixth principles: flatness and sparseness.
![Digital creative of a browser on the internet][1]
The [Zen of Python][2] is called that for a reason. It was never supposed to provide easy-to-follow guidelines for programming. The rules are specified tersely and are designed to engage the reader in deep thought.
In order to properly appreciate the Zen of Python, you must read it and then meditate upon the meanings. If the Zen was designed to be a set of clear rules, it would be a fault that it has rules that contradict each other. However, as a tool to help you meditate on the best solution, contradictions are powerful.
### Flat is better than nested.
Nowhere is the pressure to be "flat" more obvious than in Python's strong insistence on indentation. Other languages will often introduce an implementation that "cheats" on the nested structure by reducing indentation requirements. To appreciate this point, let's take a look at JavaScript.
JavaScript is natively async, which means that programmers write code in JavaScript using a lot of callbacks.
```
a(function(resultsFromA) {
  b(resultsFromA, function(resultsfromB) {
    c(resultsFromC, function(resultsFromC) {
      console.log(resultsFromC)
   }
  }
}
```
Ignoring the code, observe the pattern and the way indentation leads to a right-most point. This distinctive "arrow" shape is tough on the eye to quickly walk through the code, so it's seen as undesirable and even nicknamed "callback hell." However, in JavaScript, it is possible to "cheat" and not have indentation reflect nesting.
```
a(function(resultsFromA) {
b(resultsFromA,
  function(resultsfromB) {
c(resultsFromC,
  function(resultsFromC) {
    console.log(resultsFromC)
}}}
```
Python affords no such options to cheat: every nesting level in the program must be reflected in the indentation level. So deep nesting in Python _looks_ deeply nested. That makes "callback hell" was a worse problem in Python than in JavaScript: nesting callbacks mean indenting with no options to "cheat" with braces.
This challenge, in combination with the Zen principle, has led to an elegant solution by a library I worked on. In the [Twisted][3] framework, we came up with the _deferred_ abstraction, which would later inspire the popular JavaScript _promise_ abstraction. In this way, Python's unwavering commitment to clear code forces Python developers to discover new, powerful abstractions.
```
future_value = future_result()
future_value.addCallback(a)
future_value.addCallback(b)
future_value.addCallback(c)
```
(This might look familiar to modern JavaScript programmers: Promises were heavily influenced by Twisted's deferreds.)
### Sparse is better than dense.
The easiest way to make something less dense is to introduce nesting. This habit is why the principle of sparseness follows the previous one: after we have reduced nesting as much as possible, we are often left with _dense_ code or data structures. Density, in this sense, is jamming too much information into a small amount of code, making it difficult to decipher when something goes wrong.
Reducing that denseness requires creative thinking, and there are no simple solutions. The Zen of Python does not offer simple solutions. All it offers are ways to find what can be improved in the code, without always giving guidance for "how."
Take a walk. Take a shower. Smell the flowers. Sit in a lotus position and think hard, until finally, inspiration strikes. When you are finally enlightened, it is time to write the code.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/zen-python-flat-sparse
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet)
[2]: https://www.python.org/dev/peps/pep-0020/
[3]: https://twistedmatrix.com/trac/

View File

@ -0,0 +1,416 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (8 Commands to Check Memory Usage on Linux)
[#]: via: (https://www.2daygeek.com/linux-commands-check-memory-usage/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
8 Commands to Check Memory Usage on Linux
======
Linux is not like Windows and you will not get a GUI always, especially in a server environment.
As a Linux administrator, it is important to know how to check your available and used resources, such as memory, CPU, disk space, etc.
If there are any applications that use too much resources on the system to run your system at the optimum level you need to find and fix.
If you want to **[find out the top 10 memory (RAM) consumption processes in Linux][1]**, go to the following article.
In Linux, there are commands for everything, so use the corresponding commands.
In this tutorial, we will show you eight powerful commands to check memory usage on a Linux system, including RAM and swap.
**[Creating swap space on a Linux system][2]** is very important.
The following commands can help you check memory usage in Linux in different ways.
* free Command
* /proc/meminfo File
* vmstat Command
* ps_mem Command
* smem Command
* top Command
* htop Command
* glances Command
### 1) How to Check Memory Usage on Linux Using the free Command
**[Free command][3]** is the most powerful command widely used by the Linux administrator. But it provides very little information compared to the “/proc/meminfo” file.
Free command displays the total amount of free and used physical and swap memory on the system, as well as buffers and caches used by the kernel.
These information is gathered from the “/proc/meminfo” file.
```
# free -m
total used free shared buff/cache available
Mem: 15867 9199 1702 3315 4965 3039
Swap: 17454 666 16788
```
* **total:** Total installed memory
* **used:** Memory is currently in use by running processes (used= total free buff/cache)
* **free:** Unused memory (free= total used buff/cache)
* **shared:** Memory shared between two or more processes (multiple processes)
* **buffers:** Memory reserved by the kernel to hold a process queue request.
* **cache:** Size of the page cache that holds recently used files in RAM
* **buff/cache:** Buffers + Cache
* **available:** Estimation of how much memory is available for starting new applications, without swapping.
### 2) How to Check Memory Usage on Linux Using the /proc/meminfo File
The “/proc/meminfo” file is a virtual file that contains various real-time information about memory usage.
It shows memory stats in kilobytes, most of which are somewhat difficult to understand.
However it contains useful information about memory usage.
```
# cat /proc/meminfo
MemTotal: 16248572 kB
MemFree: 1764576 kB
MemAvailable: 3136604 kB
Buffers: 234132 kB
Cached: 4731288 kB
SwapCached: 28516 kB
Active: 9004412 kB
Inactive: 3552416 kB
Active(anon): 8094128 kB
Inactive(anon): 2896064 kB
Active(file): 910284 kB
Inactive(file): 656352 kB
Unevictable: 80 kB
Mlocked: 80 kB
SwapTotal: 17873388 kB
SwapFree: 17191328 kB
Dirty: 252 kB
Writeback: 0 kB
AnonPages: 7566736 kB
Mapped: 3692368 kB
Shmem: 3398784 kB
Slab: 278976 kB
SReclaimable: 125480 kB
SUnreclaim: 153496 kB
KernelStack: 23936 kB
PageTables: 73880 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 25997672 kB
Committed_AS: 24816804 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
Percpu: 3392 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 1059088 kB
DirectMap2M: 14493696 kB
DirectMap1G: 2097152 kB
```
### 3) How to Check Memory Usage on Linux Using the vmstat Command
The **[vmstat command][4]** is another useful tool for reporting virtual memory statistics.
vmstat reports information about processes, memory, paging, block IO, traps, disks, and cpu functionality.
vmstat does not require special permissions, and it can help identify system bottlenecks.
```
# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 682060 1769324 234188 4853500 0 3 25 91 31 16 34 13 52 0 0
```
If you want to understand this in detail, read the field description below.
**Procs**
* **r:** The number of runnable processes (running or waiting for run time).
* **b:** The number of processes in uninterruptible sleep.
**Memory**
* **swpd:** the amount of virtual memory used.
* **free:** the amount of idle memory.
* **buff:** the amount of memory used as buffers.
* **cache:** the amount of memory used as cache.
* **inact:** the amount of inactive memory. (-a option)
* **active:** the amount of active memory. (-a option)
**Swap**
* **si:** Amount of memory swapped in from disk (/s).
* **so:** Amount of memory swapped to disk (/s).
**IO**
* **bi:** Blocks received from a block device (blocks/s).
* **bo:** Blocks sent to a block device (blocks/s).
**System**
* **in:** The number of interrupts per second, including the clock.
* **cs:** The number of context switches per second.
**CPU : These are percentages of total CPU time.**
* **us:** Time spent running non-kernel code. (user time, including nice time)
* **sy:** Time spent running kernel code. (system time)
* **id:** Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
* **wa:** Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
* **st:** Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
Run the following command for detailed information.
```
# vmstat -s
16248580 K total memory
2210256 K used memory
2311820 K active memory
2153352 K inactive memory
11368812 K free memory
107584 K buffer memory
2561928 K swap cache
17873388 K total swap
0 K used swap
17873388 K free swap
44309 non-nice user cpu ticks
164 nice user cpu ticks
14332 system cpu ticks
382418 idle cpu ticks
1248 IO-wait cpu ticks
1407 IRQ cpu ticks
2147 softirq cpu ticks
0 stolen cpu ticks
1022437 pages paged in
260296 pages paged out
0 pages swapped in
0 pages swapped out
1424838 interrupts
4979524 CPU context switches
1577163147 boot time
3318 forks
```
### 4) How to Check Memory Usage on Linux Using the ps_mem Command
**[ps_mem][5]** is a simple Python script that allows you to get core memory usage accurately for a program in Linux.
This can determine how much RAM is used per program (not per process).
It calculates the total amount of memory used per program, total = sum (private RAM for program processes) + sum (shared RAM for program processes).
The shared RAM is problematic to calculate, and the tool automatically selects the most accurate method available for the running kernel.
```
# ps_mem
Private + Shared = RAM used Program
180.0 KiB + 30.0 KiB = 210.0 KiB xf86-video-intel-backlight-helper (2)
192.0 KiB + 66.0 KiB = 258.0 KiB cat (2)
312.0 KiB + 38.5 KiB = 350.5 KiB lvmetad
380.0 KiB + 25.5 KiB = 405.5 KiB crond
392.0 KiB + 32.5 KiB = 424.5 KiB rtkit-daemon
852.0 KiB + 117.0 KiB = 969.0 KiB gnome-session-ctl (2)
928.0 KiB + 56.5 KiB = 984.5 KiB gvfs-mtp-volume-monitor
1.0 MiB + 42.5 KiB = 1.0 MiB dconf-service
1.0 MiB + 106.5 KiB = 1.1 MiB gvfs-goa-volume-monitor
1.0 MiB + 180.5 KiB = 1.2 MiB gvfsd
.
.
5.3 MiB + 3.0 MiB = 8.3 MiB evolution-addressbook-factory
8.5 MiB + 1.2 MiB = 9.7 MiB gnome-session-binary (4)
7.5 MiB + 3.1 MiB = 10.5 MiB polkitd
7.4 MiB + 3.3 MiB = 10.7 MiB pulseaudio (2)
7.0 MiB + 7.0 MiB = 14.0 MiB msm_notifier
12.7 MiB + 2.3 MiB = 15.0 MiB evolution-source-registry
13.3 MiB + 2.5 MiB = 15.8 MiB gnome-terminal-server
15.8 MiB + 1.0 MiB = 16.8 MiB tracker-miner-fs
18.7 MiB + 1.8 MiB = 20.5 MiB python3.7
16.6 MiB + 4.0 MiB = 20.5 MiB evolution-calendar-factory
22.3 MiB + 753.0 KiB = 23.0 MiB gsd-keyboard (2)
22.4 MiB + 832.0 KiB = 23.2 MiB gsd-wacom (2)
20.8 MiB + 2.5 MiB = 23.3 MiB blueman-tray
22.0 MiB + 1.8 MiB = 23.8 MiB blueman-applet
23.1 MiB + 934.0 KiB = 24.0 MiB gsd-xsettings (2)
23.7 MiB + 1.2 MiB = 24.9 MiB gsd-media-keys (2)
23.4 MiB + 1.6 MiB = 25.0 MiB gsd-color (2)
23.9 MiB + 1.2 MiB = 25.1 MiB gsd-power (2)
16.5 MiB + 8.9 MiB = 25.4 MiB evolution-alarm-notify
27.2 MiB + 2.0 MiB = 29.2 MiB systemd-journald
28.7 MiB + 2.8 MiB = 31.5 MiB c
29.6 MiB + 2.2 MiB = 31.8 MiB chrome-gnome-sh (2)
43.9 MiB + 6.8 MiB = 50.7 MiB WebExtensions
46.7 MiB + 6.7 MiB = 53.5 MiB goa-daemon
86.5 MiB + 55.2 MiB = 141.7 MiB Xorg (2)
191.4 MiB + 24.1 MiB = 215.4 MiB notepadqq-bin
306.7 MiB + 29.0 MiB = 335.7 MiB gnome-shell (2)
601.6 MiB + 77.7 MiB = 679.2 MiB firefox
1.0 GiB + 109.7 MiB = 1.1 GiB chrome (15)
2.3 GiB + 123.1 MiB = 2.5 GiB Web Content (8)
----------------------------------
5.6 GiB
==================================
```
### 5) How to Check Memory Usage on Linux Using the smem Command
**[smem][6]** is a tool that can provide numerous reports of memory usage on Linux systems. Unlike existing tools, smem can report Proportional Set Size (PSS), Unique Set Size (USS) and Resident Set Size (RSS).
Proportional Set Size (PSS): refers to the amount of memory used by libraries and applications in the virtual memory system.
Unique Set Size (USS) : Unshared memory is reported as USS (Unique Set Size).
Resident Set Size (RSS) : The standard measure of physical memory (it typically shared among multiple applications) usage known as resident set size (RSS) will significantly overestimate memory usage.
```
# smem -tk
PID User Command Swap USS PSS RSS
3383 daygeek cat 0 92.0K 123.0K 1.7M
3384 daygeek cat 0 100.0K 129.0K 1.7M
1177 daygeek /usr/lib/gnome-session-ctl 0 436.0K 476.0K 4.6M
1171 daygeek /usr/bin/dbus-daemon --conf 0 524.0K 629.0K 3.8M
1238 daygeek /usr/lib/xdg-permission-sto 0 592.0K 681.0K 5.9M
1350 daygeek /usr/lib/gsd-screensaver-pr 0 652.0K 701.0K 5.8M
1135 daygeek /usr/lib/gdm-x-session --ru 0 648.0K 723.0K 6.0M
.
.
1391 daygeek /usr/lib/evolution-data-ser 0 16.5M 25.2M 63.3M
1416 daygeek caffeine-ng 0 28.7M 31.4M 66.2M
4855 daygeek /opt/google/chrome/chrome - 0 38.3M 46.3M 120.6M
2174 daygeek /usr/lib/firefox/firefox -c 0 44.0M 50.7M 120.3M
1254 daygeek /usr/lib/goa-daemon 0 46.7M 53.3M 80.4M
3416 daygeek /opt/google/chrome/chrome - 0 44.7M 54.2M 103.3M
4782 daygeek /opt/google/chrome/chrome - 0 57.2M 65.8M 142.3M
1137 daygeek /usr/lib/Xorg vt2 -displayf 0 77.2M 129.6M 192.3M
3376 daygeek /opt/google/chrome/chrome 0 117.8M 131.0M 210.9M
4448 daygeek /usr/lib/firefox/firefox -c 0 124.4M 133.8M 224.1M
3558 daygeek /opt/google/chrome/chrome - 0 157.3M 165.7M 242.2M
2310 daygeek /usr/lib/firefox/firefox -c 0 159.6M 169.4M 259.6M
4331 daygeek /usr/lib/firefox/firefox -c 0 176.8M 186.2M 276.8M
4034 daygeek /opt/google/chrome/chrome - 0 179.3M 187.9M 264.6M
3911 daygeek /opt/google/chrome/chrome - 0 183.1M 191.8M 269.4M
3861 daygeek /opt/google/chrome/chrome - 0 199.8M 208.2M 285.2M
2746 daygeek /usr/bin/../lib/notepadqq/n 0 193.5M 217.5M 261.5M
1194 daygeek /usr/bin/gnome-shell 0 203.7M 219.0M 285.1M
2945 daygeek /usr/lib/firefox/firefox -c 0 294.5M 308.0M 410.2M
2786 daygeek /usr/lib/firefox/firefox -c 0 341.2M 354.3M 459.1M
4193 daygeek /usr/lib/firefox/firefox -c 0 417.4M 427.6M 519.3M
2651 daygeek /usr/lib/firefox/firefox -c 0 417.0M 430.1M 535.6M
2114 daygeek /usr/lib/firefox/firefox -c 0 430.6M 473.9M 610.9M
2039 daygeek /usr/lib/firefox/firefox -- 0 601.3M 677.5M 840.6M
-------------------------------------------------------------------------------
90 1 0 4.8G 5.2G 8.0G
```
### 6) How to Check Memory Usage on Linux Using the top Command
**[top command][7]** is one of the most frequently used commands by Linux administrators to understand and view the resource usage for a process on a Linux system.
It displays the total memory of the system, current memory usage, free memory and total memory used by the buffers.
In addition, it displays total swap memory, current swap usage, free swap memory, and total cached memory by the system.
```
# top -b | head -10
top - 11:04:39 up 40 min, 1 user, load average: 1.59, 1.42, 1.28
Tasks: 288 total, 2 running, 286 sleeping, 0 stopped, 0 zombie
%Cpu(s): 13.3 us, 1.5 sy, 0.0 ni, 84.4 id, 0.0 wa, 0.3 hi, 0.5 si, 0.0 st
KiB Mem : 16248572 total, 7755928 free, 4657736 used, 3834908 buff/cache
KiB Swap: 17873388 total, 17873388 free, 0 used. 9179772 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2114 daygeek 20 3182736 616624 328228 R 83.3 3.8 7:09.72 Web Content
2039 daygeek 20 4437952 849616 261364 S 13.3 5.2 7:58.54 firefox
1194 daygeek 20 4046856 291288 165460 S 4.2 1.8 1:57.68 gnome-shell
4034 daygeek 20 808556 273244 88676 S 4.2 1.7 1:44.72 chrome
2945 daygeek 20 3309832 416572 150112 S 3.3 2.6 4:04.60 Web Content
1137 daygeek 20 564316 197292 183380 S 2.5 1.2 2:55.76 Xorg
2651 daygeek 20 3098420 547260 275700 S 1.7 3.4 2:15.96 Web Content
2786 daygeek 20 2957112 463912 240744 S 1.7 2.9 3:22.29 Web Content
1 root 20 182756 10208 7760 S 0.8 0.1 0:04.51 systemd
442 root -51 S 0.8 0:05.02 irq/141-iw+
1426 daygeek 20 373660 48948 29820 S 0.8 0.3 0:03.55 python3
2174 daygeek 20 2466680 122196 78604 S 0.8 0.8 0:17.75 WebExtensi+
```
### 7) How to Check Memory Usage on Linux Using the htop Command
The **[htop command][8]** is an interactive process viewer for Linux/Unix systems. It is a text-mode application and requires the ncurses library, it was developed by Hisham.
It is designed as an alternative to the top command.
This is similar to the top command, but allows you to scroll vertically and horizontally to see all the processes running the system.
htop comes with Visual Colors, which have added benefits and are very evident when it comes to tracking system performance.
You are free to carry out any tasks related to processes, such as process killing and renicing without entering their PIDs.
[![][9]][10]
### 8) How to Check Memory Usage on Linux Using the glances Command
**[Glances][11]** is a cross-platform system monitoring tool written in Python.
You can see all information in one place such as CPU usage, Memory usage, running process, Network interface, Disk I/O, Raid, Sensors, Filesystem info, Docker, System info, Uptime, etc,.
![][9]
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/linux-commands-check-memory-usage/
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/magesh/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/
[2]: https://www.2daygeek.com/add-extend-increase-swap-space-memory-file-partition-linux/
[3]: https://www.2daygeek.com/free-command-to-check-memory-usage-statistics-in-linux/
[4]: https://www.2daygeek.com/linux-vmstat-command-examples-tool-report-virtual-memory-statistics/
[5]: https://www.2daygeek.com/ps_mem-report-core-memory-usage-accurately-in-linux/
[6]: https://www.2daygeek.com/smem-linux-memory-usage-statistics-reporting-tool/
[7]: https://www.2daygeek.com/linux-top-command-linux-system-performance-monitoring-tool/
[8]: https://www.2daygeek.com/linux-htop-command-linux-system-performance-resource-monitoring-tool/
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[10]: https://www.2daygeek.com/wp-content/uploads/2019/12/linux-commands-check-memory-usage-2.jpg
[11]: https://www.2daygeek.com/linux-glances-advanced-real-time-linux-system-performance-monitoring-tool/

View File

@ -0,0 +1,149 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Khadas VIM3L: An Open Source HTPC Device)
[#]: via: (https://itsfoss.com/vim3l/)
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
Khadas VIM3L: An Open Source HTPC Device
======
If youve read our list of [Raspberry Pi alternatives][1], you might have come across VIM by Khadas.
China-based [Khadas][2] is becoming increasingly popular for its single board computers (SCB). Apart from the generic do-it-yourself (DIY) VIM series, Khadas also has [Tone boards][3] that can be utilized for DJing and [Edge][4] boards for AI and other related projects.
As discussed in [Raspberry Pi projects][5], one of the most popular use of a single board computer is to use it as a media center. You can turn your TV in more than just a smart TV (without being monitored) and play local music, videos, pictures and even games on your TV. You can also watch streaming services through these media center.
You can always configure VIm (or any other SCB) as a media center. Its a good DIY exercise but not everyone would like it.
This is why Khadas has introduced [VIM3L][6] which is a ready to use media center device based on VIM 3. In this article, well have a look at this device and see how to set it up.
### VIM 3L specifications
One of the strong point of Khadas is its emphasis on open source. All their source code, including [U-Boot][7], mainline Linux and Android is available on [their GitHub repository][8].
VIM3L comes with [CoreELEC][9] operating system. CoreELEC is a custom Linux distribution that comes with software like [Kodi][10] and its add-ons to give you a complete HTPC (home theatre PC) experience.
![][11]
You are not restricted to CoreELEC though. You can get the barebon version of VIM 3L and use Android or install your a Linux distribution of your choice.
* Amlogic S905D3 SoC with quad-core Cortex-A55 CPU clocked at 1.9GHz
* 16GB eMMC
* 2GB RAM
* 2x WiFi antennas
* PCIe 2.0 and M.2 NVMe SSD support
* HDMI port
* Dolby Audio
The HTPC version costs slightly more than the bare board but it consists of some additional hardware along with CoreELEC operating system:
* Transparent DIY case
* Metal DIY case
* Heatsink
* IR Remote
![VIM3L HTPC Kit][12]
VIM3L is capable of running 4K video at 75 fps. It also includes TrustZone based security for DRM video streaming. Both Android and CoreELEC are capable of [OTA updates][13].
[VIM3L HTPC version costs $89.99][14] and the bare board (with Android) costs $69.99. Its FOSS readers can _**get $6 off with itsfossfuns coupon code**_ that can be used at the checkout page of Khadas shop.
[Khadas VIM3 Series][15]
You may opt for the free shipping option but it will take 2-3 weeks for the device to reach you from China. You can pay $20 extra for an express DHL shipping. The shipping options are available at checkout. I think you might have to pay custom tax depending on your countrys rules so ordering one from Amazon would be better in such a case but you wont get the Its FOSS special discount on Amazon.
Now that you are aware of the specifications, let me show you how to set it up and how was my experience with it.
_The amazon links in this article are affiliate links. Please read our [affiliate policy][16]._
### Setting up VIM3L and using it as home theatre PC
Initially, when you start VIM3L, a window appears on the screen which consists of a series of questions and options. Everything you choose determines the initial state of its operation. In each case, however, you can modify your options from the settings menu. Better not to rush through the settings, since the multitude of options you have at startup seem to turn the VIM3L into a superpower device.
![Setting up proxy network][17]
The addition of the proxy connectivity in the internet settings is a welcome option. As a enthusiast of user privacy, I enabled it to connect through the [Tor network][18]. The choice is of course yours.
![Peripheral devices][19]
You can modify how many and which peripheral devices you have on that device. For example, in addition to the handheld control, you can mount a keyboard or even a console controller. Correct! A console controller that will allow you to play games.
![Option to save logs][20]
An important addition is the log storage option. With this, the users can consult the logs in case of an event of an error or malfunction. This could help in troubleshooting the issue.
![Plenty of add-ons][21]
On the left, a user can see options such as music, videos, radio, photos, games and many other options that we would like to take some time to cover.
Add-ons further extends the capabilities of your HTPC. Here, you can find music libraries, documentaries, games, open-source software and more. The software includes various graphics, audio, and video editors, simulators etc.
You have the freedom to choose whether you want to download them through 3rd party repositories, or from the environment of the accessory. Also, if you try to install software, you will most likely notice that along with the program, appropriate libraries and software are also installed. As you can see, this is not an accessory from scratch, but an accessory that is ready to cope with its users choices.
VIM3L has different configuration profile consisting of a standard, intermediate, expert profile. As you climb into difficulty, your choices are multiplied, giving you total freedom.
### Thoughts on VIM3L
![][22]
I liked VIM3L for what it offers. This is not to say that it is a perfect device.
I found that some point, the controller is not fully accurate in signal transmission. As a result, after pressing a button twice, the signal is sent later and there is a quick change of screen. Maybe the controller I received was faulty.
In conclusion, I would like to say that its not an expensive device and the feature it offers are good enough to provide you with entertainment, fun, productivity, and creativity. Most importantly, the software it offers are free and open source.
If you like what you see here, you can either order it from [its own shop that ships from China][6] or get it from [Amazon][23].
Preview | Product | Price |
---|---|---|---
![Khadas Amlogic S905D3 VIM3L HTPC Kit][24] ![Khadas Amlogic S905D3 VIM3L HTPC Kit][24] | [Khadas Amlogic S905D3 VIM3L HTPC Kit][25] | $89.99[][26] | [Buy on Amazon][27]
Have you used VIM3L or any other pre-built media center device? Or do you prefer making your own HTPC? Do share your views.
--------------------------------------------------------------------------------
via: https://itsfoss.com/vim3l/
作者:[Community][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/itsfoss/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/raspberry-pi-alternatives/
[2]: https://www.khadas.com/
[3]: https://www.amazon.com/dp/B07K6GQNH3?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Tone boards)
[4]: https://www.khadas.com/edge
[5]: https://itsfoss.com/raspberry-pi-projects/
[6]: https://www.khadas.com/vim3l
[7]: https://www.denx.de/wiki/U-Boot
[8]: https://github.com/khadas
[9]: https://coreelec.org/
[10]: https://itsfoss.com/install-kodi-ubuntu/
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/VIM3L_OS_Freedom_graphic.jpg?ssl=1
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/VIM3L-Htpc-Kit.jpg?ssl=1
[13]: https://source.android.com/devices/tech/ota
[14]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (VIM3L HTPC version costs $89.99)
[15]: https://www.khadas.com/shop-vim3
[16]: https://itsfoss.com/affiliate-policy/
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_3.jpg?ssl=1
[18]: https://itsfoss.com/tor-guide/
[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_2.jpg?ssl=1
[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_4.jpg?ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/khadas_vim3l_1.jpg?ssl=1
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/VIM3L.jpg?ssl=1
[23]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Amazon)
[24]: https://i0.wp.com/m.media-amazon.com/images/I/41YC-mlA2PL._SL160_.jpg?ssl=1
[25]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Khadas Amlogic S905D3 VIM3L HTPC Kit)
[26]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime)
[27]: https://www.amazon.com/dp/B081H66D7Q?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon)

View File

@ -0,0 +1,72 @@
[#]: collector: (lujun9972)
[#]: translator: (XLCYun)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (DevOps for introverted people)
[#]: via: (https://opensource.com/article/19/7/devops-introverted-people)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo)
内向者的 DevOps
======
我们邀请 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。
![问答][1]
我们请求我们的 [DevOps 团队][2] 谈一谈他们作为一个内向者的体验,并给外向者们一些建议。但是在我们开始了解他们的回答之前,让我们先来定义一下这些词汇。
### “内向者”是什么意思?
内向者通常指的是一部分人群,当他们和别人相处的时候,会使他们的能量耗尽,而不是激发他们更多的能量。当我们思考我们是如何恢复能量时,这是一个非常有用的词汇:内向者通常需要更多的独处时间来恢复能量,特别是和一群人在一起很长时间后。关于内向者的一个非常大的误解就是他们一定是“害羞的”,但是科学表明,那不过是另一种不同的性格特征。
内向性与外向性是通过 [Myers Briggs 类型指标][4] 而为人所知的,现在也常常被称作一个 [光谱][5] 的两端。虽然这个世界看起来好像外向者比内向者要多,但是心理学者则倾向于认为大部分人在光谱上的位置是落在 [中间性格或偏内向性格的][6]。
现在,我们来看看问答。
### DevOps 技术主管可以通过哪些方式来让内向者感觉他们是团队的一部分并且愿意分享他们的想法?
“每个人都会不大一样,所以观察敏锐就很重要了。从 GitLab 过来的一个人告诉我,他们的哲学就是如果他们没有提供任何意见,那么他们就是被排除在外的。如果有人在一个会议上没有提供任何的意见,那就想办法让他们加入进来。**当我知道一个内向者对我们将要讨论的会议论题感兴趣的时候,我会提前请他写一些书面文本。有非常多的会议其实是可以避免的,只要通过把讨论放到 Slack 或者 GitLab 上就行了,内向者会更愿意参与进来**。在站立会议中,每个人都会交代最新的进展,在这个环境下,内向者表现得很好。有时候我们在其实会议上会重复做一些事情,仅仅是为了保证每个人都有时间发言。我同时也会鼓励内向者在工作小组或者社区小组面前发言,以此来锻炼他们的这些技能。—— 丹·巴克
“**我觉得别人对我做的最好的事情,就是他们保证了当重大问题来临的时候,我拥有必要的技能去回答它**。彼时,我作为一名非常年轻的入伍空军的一员,我需要给我们部队的高级领导做状态简报的汇报。我必须在任何时候都有一些可用的数据点,以及在实现我们确立的目标的过程中,产生延误以及偏差的背后的原因。那样的经历推动着我从一个“幕后人员”逐渐变得更加愿意和别人分享自己的观点和想法。
“**通过文化去领导。为你的同僚一起设计和尝试仪式。**你可以为给你的小组或团队设计一个小的每周仪式,甚至给你的部门或组织设计一个年度的大仪式。它的意义在于去尝试一些事物,并观察你在其中的领导角色。去找到你们文化当中的代沟以及对立。回顾团队的信仰和行为。你能从哪里观察到对立?你们的文化中缺失了什么?从一个小陈述开始‘我从 X 和 Y 之间看到了对立’,或者‘我的团队缺少了 Z。接着将代沟与对立转换为问题写下三个我们如何能……(How might we's, HMWs)’。”——凯瑟琳·路易斯
“内向者不是一个不同的群体,他们要么是在分享他们的想法之前想得太多或等得太久的一些人,要么就是一些根本不知道发生了什么的人。我就是第一种,我想太多了,有时候还担心我的意见会被其他人嘲笑,或者没有什么意思,或者想偏了。形成那样的思维方式很难,但它同时也在吞噬着我学习更好事物的机会。有一次,我们团队在讨论一个实现问题。我当时的老大一次又一次地问我,为什么我没有作为团队中更具经验的人参与进来,然后我就(集齐了全宇宙的力量之后)开口说我想说的大家都已经说过了。他说,有时候我可以重复说一次,事情纷繁,如果你能够重复一遍你的想法,即使它已经被讨论过了,也会大有裨益。好吧,虽然它不是一种特别信服的方式,但是我知道了至少有人想听听我怎么说,它给了我一点信心。
“现在,我所使用的让团队中的人发言的方法是**我经常向内向的人求助,即使我知道解决方法,并且在团队会议和讨论中感谢他们来建立他们的自信心,通过给他们时间让他们一点一点的从他们寡言的本性中走出来,从而跟团队分享很多的知识**。他们在外面的世界中可能仍然会有一点点孤立,但是在团队里面,有些会成为我们可以信赖的人。——阿布希什克·塔姆拉卡尔
“我给参加会议的内向者的建议是,找一个同样要参加会议的朋友或者同事,这样到时你就会有人可以跟你一起舒服地交谈,在会议开始之前,提前跟其他的与会者(朋友,行业联系人,前同事等等)约着见个面或者吃顿饭,**要注意你的疲劳程度,并且照顾好自己**:如果你需要重新恢复能量,就跳过那些社交或者夜晚的活动,在事后回顾中记录一下自己的感受。”——伊丽莎白·约瑟夫
### 和一个内向者倾向的同事一起工作时,有什么提高生产效率的小建议?
“在保证质量时,生产效率会越来越具备挑战性。在大多数时候,工作中的一个小憩或者轻松随意的交谈,可能正是我们的创造性活动中需要的一个火花。再说一次,我发现当你的团队中有内向者时, Slack 和 Github 会是一个非常有用的用于交换想法以及和其他人互动的媒介。**我同时也发现,结对编程对于大部分的内向者也非常有用,虽然一对一的交流对于他们来说,并不像交税那么频繁,但是生产质量和效率的提升却是重大的**。但是,当一个内向者在独自工作的时间,团队中的所有人都不应该去打断他们。最好是发个邮件,或者使用没有那么强的侵入性的媒介。——丹·巴克
“给他们趁手的工具,让他们工作并归档他们的工作。**让他们能够在他们的工作上做到最好**。要足够经常地去检查一下,保证他们没有走偏路,但是要记住,相比外向者而言,这样做是更大的一种让人分心的困扰。
“**当我低着头的时候,不要打断我。真的,别打断我**!当我沉浸在某件事物中时,这样做会造成我至少需要花费两个小时,才能让我的大脑重新回到之前的状态。感觉很痛苦。真的。你可以发个邮件让我去有白板的地方。然后从客户的角度而不是你的角度——通过画图的方式——分享下有什么问题。要知道,可能同时会有十几个客户问题缠绕在我的脑海中,如果你的问题听起来就是“这样子做会让我在我的领导面前显得很好”的那一类问题,那么相比我脑袋中已经有的真正的客户问题而言,它不会得到更多的关注的。画个图,给我点时间思考。当我准备分享我的看法的时候,保证有多支马克笔可以使用。准备好接受你对问题的假设有可能完全是错误的。”——凯瑟琳·路易斯
“感谢和鼓励就是解决的方法,感谢可能不是一份工作评估,但是感谢能让人舒服地感受到自己并不仅仅是一个活着的独立实体,**因而每个人都能够感觉到自己是被倾听的,而不是被嘲笑或者低估的**。”——阿布希什克·塔姆拉卡尔
### 结语
在与内向的 DevOps 爱好者的这次交谈中,我们最大的启迪就是平等:其他人需要被怎样对待,就怎样对待他们,同时你想被怎样对待,就去要求别人怎样对待你。无论你是内向还是外向,我们都需要承认我们并非全以相同的一种方式体验这个世界。我们的同事应当被给予足够的空间以完成他们的工作,通过讨论他们的需求作为了解如何支持他们的开始。我们的差异正是我们的社区如此特别的原因,它让我们的工作对更多的人更加的有用。与别人沟通最有效的方式,就是对于你们两者而言都可行的方式。
--------------------------------------------------------------------------------
转载自: https://opensource.com/article/19/7/devops-introverted-people
作者:[Matthew Broberg][a]
选题:[lujun9972][b]
译者:[XLCYun](https://github.com/XLCYun)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_QandAorange_520x292_0311LL.png?itok=qa3hHSou (Q and A letters)
[2]: https://opensource.com/devops-team
[3]: https://www.inc.com/melanie-curtin/are-you-shy-or-introverted-science-says-this-is-1-primary-difference.html
[4]: https://www.myersbriggs.org/my-mbti-personality-type/mbti-basics/extraversion-or-introversion.htm?bhcp=1
[5]: https://lifehacker.com/lets-quit-it-with-the-introvert-extrovert-nonsense-1713772952
[6]: https://www.psychologytoday.com/us/blog/the-gen-y-guide/201710/the-majority-people-are-not-introverts-or-extroverts

View File

@ -1,75 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Customize your Linux desktop with FVWM)
[#]: via: (https://opensource.com/article/19/12/fvwm-linux-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 FVWM 自定义 Linux 桌面
======
本文是 24 天 Linux 桌面特别系列的一部分。如果你正在寻找轻巧,快速且简单的 Linux 窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入,探索和破解,那么 FVWM 是必须的。
![Coding on a computer][1]
[FVWM][2] 窗口管理器最早是对早在 1993 年的 [TWM][3] 的修改。经过几年的迭代,出现了一个可高度自定义的环境,它可以配置任何行为、动作或事件。它支持自定义键绑定、鼠标手势、主题、脚本等。
尽管 FVWM 在安装后即可使用但默认发行版仅提供最小的配置。这是开始自定义桌面环境的良好基础但是如果你只想将其用作桌面那么可能要安装另一个用户发布的完整配置。FVWM 有几种不同的发行版,包括模仿 Windows 95 的 FVWM95至少在外观和布局上。我尝试了 [FVWM-Crystal][4],这是一个具有一些现代 Linux 桌面约定的现代主题。
从 Linux 发行版的软件仓库中安装要尝试的 FVWM 发行版。如果找不到特定的 FVWM 发行版,那么可以安装基础的 FVWM2 包,然后进入 [Box-Look.org][5] 手动下载主题包。这样就需要更多的工作,但比从头开始构建要少。
安装后,请注销当前的桌面会话,以便你可以登录 FVWM。默认情况下会话管理器KDM、GDM、LightDM 或 XDM取决于你的设置将继续登录到以前的桌面因此你必须在登录之前覆盖该桌面。
对于 GDM
![Select your desktop session in GDM][6]
对于 KDM
![Select your desktop session with KDM][7]
### FVWM 桌面
无论你使用什么主题和配置当你在桌面上单击鼠标左键时FVWM 至少会显示一个菜单。菜单的内容取决于你所安装的。FVWM-Crystal 分发中的菜单包含对常用首选项的快速访问,例如屏幕分辨率、壁纸设置、窗口装饰等。
与 FVWM 中的几乎所有东西一样,你可以在菜单中编辑你要想的内容,但 FVWM-Crystal 倾向应用菜单栏。应用菜单位于屏幕的左上角每个图标都包含相关应用启动器的菜单。例如GIMP 图标表示图像编辑器KDevelop 图标表示集成开发环境IDEGNU 图标表示文本编辑器,等等,具体取决于你在系统上安装的程序。
![FVWM-crystal running on Slackware 14.2][8]
FVWM-Crystal 还提供虚拟桌面、任务栏、时钟和应用栏。
关于背景,你可以使用与 FVWM-Crystal 捆绑在一起的壁纸,也可以使用 **feh** 命令设置自己的壁纸(你可能需要从仓库中安装它)。此命令有一些设置背景的选项,包括 **\-bg-scale** 使用缩放填充屏幕,**\-bg-fill** 直接填充而不缩放图片,等等。
```
`$ feh --bg-scale ~/Pictures/wallpapers/mybackground.jpg`
```
大多数配置文件都包含在 **$HOME/.fvwm-crystal** 中,某些系统范围的默认文件位于 **/usr/share/fvwm-crystal**。
### 自己尝试一下
FVWM 是桌面构建平台,也是窗口管理器。它不会为你做什么事情,它期望你来配置尽可能的一切。
如果你正在寻找轻巧,快速且简单的窗口管理器,那么 FVWM 可以胜任。但是,如果你正在寻找可以深入,探索和破解,那么 FVWM 是必须的。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/fvwm-linux-desktop
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer)
[2]: http://www.fvwm.org/
[3]: https://en.wikipedia.org/wiki/Twm
[4]: https://www.box-look.org/p/1018270/
[5]: http://box-look.org
[6]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM)
[7]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM)
[8]: https://opensource.com/sites/default/files/advent-fvwm-crystal.jpg (FVWM-crystal running on Slackware 14.2)

View File

@ -0,0 +1,218 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Build a retro Apple desktop with the Linux MLVWM)
[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 Linux MLVWM 打造复古苹果桌面
======
本文是 24 天 Linux 桌面特别系列的一部分。如果老式的苹果电脑用开源 POSIX 构建如何?你可以通过构建类 Macintosh 虚拟窗口管理器来实现。
![Person typing on a 1980's computer][1]
想象一下进入另外一个历史Apple II GS 和 MacOS 7 是基于开源 [POSIX][2] 构建的,它使用了与现代 Linux 相同的所有约定,例如纯文本配置文件和模块化系统设计。这样的操作系统将为其用户带来什么?你可以使用[类 Macintosh 虚拟窗口管理器MLVWM][3]来回答这些问题(甚至更多!)。
![MLVWM running on Slackware 14.2][4]
### 安装 MLVWM
MLVWM 安装并不容易,并且可能不在发行版的软件仓库中。如果你有时间理解翻译不佳的 README 文件,编辑一些配置文件,收集并调整一些旧的 **.xpm**图像,编辑一两个 Xorg 选项,那么你就可以体验 MLVWM。否则这是一个新奇的窗口管理器其最新版本可以追溯到 2000 年。
要编译 MLVWM你必须安装 **imake**,它提供 **xmkmf** 命令。你可以从发行版的软件仓库中安装 imake也可以直接从 [Freedesktop.org][5] 获得。假设你已经有 **xmkmf**命令,请进入包含 MLVWM 源码的目录,然后运行以下命令进行构建:
```
$ xmkmf -a
$ make
```
构建后,编译后的 **mlvwm** 二进制文件位于 **mlvwm** 目录中。将其移动到[你的 PATH ][6]的任何位置:
```
`$ mv mlvwm/mlvwm /usr/local/bin/`
```
#### 编辑配置文件
现在已经安装 MLVWM但是如果不调整几个配置文件并仔细排列所需的图像文件它将无法正确启动。示例配置文件位于你下载的源代码的 **sample_rc** 目录中。将文件 **Mlvwm-Netscape****Mlvwm-Xterm** 复制到你的主目录:
```
`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME`
```
**Mlvwmrc** 移动到 **$HOME/.mlvwmrc**(是的,即使示例文件的名称看似是大写字母,但你也必须使用小写的 “m”
```
`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc`
```
打开 **.mlwmrc** 并找到第 54-55 行,它们定义了 MLVWM 在菜单和 UI 中使用的像素图的路径“IconPath”
```
# Set icon search path. It needs before "Style".
IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap
```
调整路径以匹配你填充图像的路径(我建议使用 **$HOME/.local/share/pixmaps**。MLVWM 不提供像素图,因此需要你提供构建桌面所需图标。
即使你有位于系统其他位置的像素图(例如 **/usr/share/pixmaps**)),也要这样做,因为你需要调整像素图的大小,你可能也不想在系统范围内执行此操作。
```
# Set icon search path. It needs before "Style".
IconPath /home/seth/.local/share/pixmaps
```
#### 选择像素图
你已将 **.local/share/pixmaps** 目录定义为像素图源路径,但是该目录和图像均不存在。创建目录:
```
`$ mkdir -p $HOME/.local/share/pixmaps`
```
现在,配置文件将图像分配给菜单项和 UI 元素,但是系统中不存在这些图像。要解决此问题,请通读配置文件并找到每个 **.xpm** 图像。对于配置中列出的每个图像,将具有相同文件名的图像(或更改配置文件中的文件名)添加到你的 IconPath 目录。
**.mlvwmrc** 文件的注释很好,因此你可以大致了解要编辑的内容。无论如何,这只是第一步。你可以随时回来更改桌面外观。
这有些例子
此代码块设置屏幕左上角的图标:
```
# Register the menu
Menu Apple, Icon label1.xpm, Stick
```
**label1.xpm** 图像实际上在源代码的 **pixmap**目录中,但我更喜欢使用来自 **/usr/share/pixmaps** 的 **Penguin.xpm**(在 Slackware 上)。无论使用什么,都必须将自定义像素图放在 **~/.local/share/pixmaps** 中,并在配置中更改像素图的名称,或者重命名像素图以匹配配置文件中当前的名称。
此代码块定义了左侧菜单中列出的应用:
```
"About this Workstation..." NonSelect, Gray, Action About
"" NonSelect
"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls
"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm
"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm
END
```
通过遵循与配置文件中相同的语法,你可以自定义像素图并将自己的应用添加到菜单中(例如,我将 **mule** 更改为 **emacs**)。 这是你在 MLVWM GUI 中打开应用的入口,因此请列出你要快速访问的所有内容。你可能还希望包括指向 **/usr/share/applications** 文件夹的快捷方式。
```
`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications`
```
完成编辑配置文件并将自己的图像添加到 IconPath 目录后,必须将所有像素图的大小都调整为大约 16x16 像素。MLVWM 的默认设置不一致,因此存在变化空间。)你可以使用 ImageMagick 进行批量操作:
```
`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done`
```
### 启动 MLVWM
最简单的运行 MLVWM 的方式是让 Xorg 完成大部分工作。首先,你必须创建一个 **$HOME/.xinitrc** 文件。我从 Slackware 复制了这个,它也是从 Xorg 来的:
```
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
    xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi
# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  exec ck-launch-session /usr/local/bin/mlvwm
else
  exec /usr/local/bin/mlvwm
fi
```
根据此文件,**startx** 命令的默认操作是启动 MLVWM。但是你的发行版可能对于图形服务器启动或被终止重新启动时会发生的情况有其他做法因此此文件可能对你没有什么帮助。在许多发行版上你可以添加 **.desktop** 文件到 **/usr/share/xsessions** 中,以将其列在 GDM 或 KDM 菜单中,因此创建名为 **mlvwm.desktop** 的文件并输入:
```
[Desktop Entry]
Name=Mlvwm
Comment=Macintosh-like virtual window manager
Exec=/usr/local/bin/mlvwm
TryExec=ck-launch-session /usr/local/bin/mlvwm
Type=Application
```
从桌面会话注销并重新登录到 MLVWM。默认情况下会话管理器KDM、GDM 或 LightDM具体取决于你的设置将继续登录到以前的桌面因此在登录之前必须覆盖它。
对于 GDM
![][7]
对于 SDDM
![][8]
#### 强制启动
如果 MLVWM 无法启动,请尝试安装 XDM这是一个轻量级会话管理器它不会查询 **/usr/share/xsessions** 的内容,而是执行经过身份验证用户的所有 **.xinitrc** 操作。
![MLVWM][9]
### 打造自己的复古苹果
MLVWM 桌面未经打磨、不完美、准确且充满乐趣。你看到的许多菜单项都是未实现的,但你可以使它们变得活跃且有意义。
这是一次让你时光倒流,改变历史,让老式苹果系列电脑成为开源堡垒的机会。成为一名修正主义者,设计你自己的复古苹果桌面,最重要的是,它有乐趣。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-mlvwm-desktop
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html
[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2)
[5]: http://cgit.freedesktop.org/xorg/util/imake
[6]: https://opensource.com/article/17/6/set-path-linux
[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg
[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg
[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM)

View File

@ -0,0 +1,183 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/start-stop-restart-services-linux/)
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
如何在 Ubuntu 和其他 Linux 发行版中启动、停止和重启服务
======
服务是必不可少的后台进程,它通常随系统启动,并在关机时关闭。
如果你是系统管理员,那么你会定期处理服务。
如果你是普通桌面用户,你可能会遇到需要重启服务的情况,例如[安装 Barrier 来用于在计算机之间共享鼠标和键盘][1]。或[在使用 ufw 设置防火墙][2]时。
今天,我将向你展示两种管理服务的方式。你将学习在 Ubuntu 或任何其他 Linux 发行版中启动、停止和重启服务。
systemd 与 init
如今Ubuntu 和许多其他发行版都使用 systemd 而不是旧的 init。
在 systemd 中,可以使用 systemctl 命令管理服务。
在 init 中,你可以使用 service 命令管理服务。
你会注意到,即使你的 Linux 系统使用 systemd它仍然可以使用 service 命令(为了与 init 系统一起使用)。这是因为 service 命令实际上已重定向到 systemctl。systemd 引入了向后兼容性,因为系统管理员们习惯使用 service 命令。
在本教程中,我将同时展示 systemctl 和 service 命令。
_我的是 Ubuntu 18.04但其他版本的过程也一样_。
### 方法 1使用 systemd 在 Linux 中管理服务
我从 systemd 开始,因为它被广泛接受。
#### 1\. 列出所有服务
为了管理服务,你首先需要知道系统上有哪些服务可用。
你可以使用 systemd 命令列出 Linux 系统上的所有服务:
```
systemctl list-unit-files --type service -all
```
![systemctl list-unit-files][3]
此命令将输出所有服务的状态。服务状态有启用、禁用、屏蔽(在取消掩码之前处于非活动状态)、静态和已生成。
与 [grep 命令][4] 结合,你可以**仅显示正在运行的服务**
```
sudo systemctl | grep running
```
![Display running services systemctl][5]
现在,你知道了如何引用所有不同的服务,你可以开始主动管理它们。
**注意:** 命令中的 **&lt;service-name&gt;** 应该用你想管理的服务名代替。比如network-manager、ufw 等)
#### 2\. 启动服务
要在 Linux 中启动服务,你只需使用它的名字:
```
systemctl start <service-name>
```
#### 3\. 停止服务
要停止 systemd 服务,可以使用 systemctl 命令的 stop 选项:
```
systemctl stop <service-name>
```
#### 4\. 重启服务
要重启 systemd 服务,可以使用:
```
systemctl restart <service-name>
```
#### 5\. 检查服务状态
你可以通过打印服务状态来确认你已经成功执行特定操作:
```
systemctl status <service-name>
```
这将以以下方式输出:
![systemctl status][6]
这是 systemd 的内容。现在切换到 init。
### 方法 2使用 init 在 Linux 中管理服务
init 的命令和 systemd 的一样简单。
#### 1\. 列出所有服务
要列出所有 Linux 服务,使用:
```
service --status-all
```
![service status-all][7]
前面的 **[ ]** 代表**禁用****[ + ]** 代表**启用**。
#### 2\. 启动服务
要在 Ubuntu 和其他发行版中启动服务,使用命令:
```
service <service-name> start
```
#### 3\. 停止服务
停止服务同样简单。
```
service <service-name> stop
```
#### 4\. 重启服务
如果你想重启服务,命令是:
```
service <service-name> restart
```
#### 5\. 检查服务状态
此外,要检查是否达到了预期的结果,你可以输出服务**状态**
```
service <service-name> status
```
这将以以下方式输出:
![service status][8]
最重要的是,这将告诉你某项服务是否处于活跃状态(**正在运行**)。
**总结**
今天,我详细介绍了两种在 Ubuntu 或任何其他 Linux 系统上管理服务的非常简单的方法。 希望本文对你有所帮助。
你更喜欢哪种方法? 让我在下面的评论中知道!
--------------------------------------------------------------------------------
via: https://itsfoss.com/start-stop-restart-services-linux/
作者:[Sergiu][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sergiu/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/
[2]: https://itsfoss.com/set-up-firewall-gufw/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_list_services.png?ssl=1
[4]: https://linuxhandbook.com/grep-command-examples/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_grep_running.jpg?ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/systemctl_status.jpg?ssl=1
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status_all.png?ssl=1
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/service_status.jpg?ssl=1

View File

@ -0,0 +1,65 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why your Python code needs to be beautiful and explicit)
[#]: via: (https://opensource.com/article/19/12/zen-python-beauty-clarity)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
为什么 Python 代码要写得美观而明确
======
欢迎阅读“Python 光明节Pythonukkah”系列文章这个系列文章将会讨论《Python 之禅》。我们首先来看《Python 之禅》里的前两个原则:美观与明确。
![Searching for code][1]
早在 1999 年Python 的贡献者之一Tim Peters 就提出了《[Python 之禅][2]》直到二十年后的今天《Python 之禅》中的 19 条原则仍然对整个社区都产生着深远的影响。为此我们举行了这一次的“Python 光明节”。首先我们会讨论《Python 之禅》中的前两个原则:美观和明确。
> "Hanukkah is the Festival of Lights,
> Instead of one day of presents, we get eight crazy nights."
> —亚当·桑德勒, [光明节之歌][3]
### 美观胜于丑陋
著名的《[<ruby>计算机程序的构造和解释<rt>Structure and Interpretation of Computer Programs</rt></ruby>][4]》中有这么一句话代码是写给人看的只是恰好能让机器运行Programs must be written for people to read and only incidentally for machines to execute.)。毕竟机器并不在乎代码的美观性,但人类在乎。
阅读美观的代码对人们来说是一种享受,这就要求在整套代码中保持一致的风格。使用诸如 [Black][5]、[flake8][6]、[Pylint][7] 这一类工具能够有效地接近这一个目标。
但实际上,只有人类自己才知道什么才是真正的美观。因此,代码审查和协同开发是其中的不二法门,同时,在开发过程中倾听别人的意见也是必不可少的。
最后,个人的主观能动性也很重要,否则一切工具和流程都会变得毫无意义。只有意识到美观的重要性,才能主动编写出美观的代码。
这就是为什么美观在众多原则当中排到了首位,它让“美”成为了 Python 社区的一种价值。如果有人要问,”我们真的在乎美吗?“社区会以代码给出肯定的答案。
### 明确胜于隐晦
人类会欢庆光明、惧怕黑暗,那是因为光能够让我们看到难以看清的事物。同样地,尽管有些时候我们会不自觉地把代码写得含糊不清,但明确地编写代码确实能够让我们理解很多抽象的概念。
“为什么类方法中要将 `self` 显式指定为第一个参数?”
这个问题已经是老生常谈了,但网络上很多流传已久的回答都是不准确的。在编写<ruby>元类<rt>metaclass</rt></ruby>时,显式指定 `self` 参数就显得毫无意义。如果你没有编写过元类,希望你可以尝试一下,这是很多 Python 程序员的必经之路。
显式指定 `self` 参数的原因并不是 Python 的设计者不想将这样的元类视为“默认”元类,而是因为第一个参数必须是显式的。
即使 Python 中确实允许非显式的情况存在(例如上下文变量),但我们还是应该提出疑问:某个东西是不是有存在的必要呢?如果非显式地传递参数会不会出现问题呢?有些时候,由于种种原因,这是会有问题的。总之,在写代码时一旦能够优先考虑到明确性,至少意味着能对不明确的地方提出疑问并对结果作出有效的估计。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/zen-python-beauty-clarity
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[HankChow](https://github.com/HankChow)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV "Searching for code"
[2]: https://www.python.org/dev/peps/pep-0020/
[3]: https://en.wikipedia.org/wiki/The_Chanukah_Song
[4]: https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs
[5]: https://opensource.com/article/19/5/python-black
[6]: https://opensource.com/article/19/5/python-flake8
[7]: https://opensource.com/article/19/10/python-pylint-introduction

View File

@ -0,0 +1,111 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Unix is turning 50. What does that mean?)
[#]: via: (https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
Unix 即将迎来 50 岁
======
Unix 时间(又称为“<ruby>纪元时间<rt>epoch time</rt></ruby>”)是自 1970 年 1 月 1 日以来经过的秒数。当 Unix 即将 50 岁时,让我们看一下让内核开发人员担心的地方。
[cbaquiran][1]
对于 Unix 而言2020 年是重要的一年。在这一年年初Unix 进入 50 岁。
尽管 Unix 的某些早期开发早于其“纪元”的正式开始,但 1970 年 1 月 1 日仍然是 POSIX 时间的零点,也是公认的 Unix 的万物之始。自那一刻算起2020 年 1 月 1 日将是其 50 周年。
### Unix 时间与人类时间
就人类时间而言50 年是很重要的。就 Unix 时间而言50 年没有什么特别的。48.7 年同样重要。
Unix包括 Linux系统将日期/时间值存储为自 1970-01-01 00:00:00 UTC 以来经过的秒数32 位二进制)。要确定自该时间以来经过了几秒钟,看看 Unix 时间值是什么样子,你可以发出如下命令:
```
$ date +%s
1576883876
```
`s` 参数告诉 `date` 命令将当前日期/时间显示为自 1970-01-01 开始以来的秒数。
### Unix 系统可以管理多少时间?
要了解 Unix 系统可以容纳多少时间,我们需要查看 32 位字段的容量。可以这样计算:
```
$ echo '2^32' | bc
4294967296
```
但是,由于 Unix 需要容纳负数,因此它会为数字的符号保留一位,从而将其减少为:
```
$ echo '2^31' | bc
2147483648
```
并且,由于 Unix 计数以 0 开头,这意味着我们有 2,147,483,648 个值,但最大的可能值为 2,147,483,647 个。Unix 日期/时间值不能超过该数字——就像汽车上的里程表可能不能超过 999,999 英里一样。加 1 该值就变为了 -2147483648。LCTT 译注:此处原文描述有误,已修改。在达到最大值之后,即 2018/1/19 03:14:07下 1 秒导致符号位变为 1其余 31 位为 0即 -2147483648时间变为 1901/12/13 20:45:52这就是 Y2K38 问题。)
### 一年有多少秒?
大多数年份的秒数可以这样计算:每天的小时数乘以每小时的分钟数乘以每分钟的秒数乘以一年中的天数:
```
$ expr 24 \* 60 \* 60 \* 365
31536000
```
在闰年,我们再增加一天:
```
$ expr 24 \* 60 \* 60 \* 366
31622400
```
### Unix 将如何庆祝其 50 岁生日?
2020 年 1 月 1 日中午 12:00 是纪元时间的 1577836800。这个计算有些棘手但主要是因为我们必须适应闰年。自该纪元开始以来我们经历了 12 个闰年,从 1972 年开始,到上一个闰年是 2016 年。而且,当我们达到 2020 年时,我们将有 38 个常规年份。
这是使用 `expr` 命令进行的计算,以计算这 50 年的秒数:
```
$ expr 24 \* 60 \* 60 \* 365 \* 38 + 24 \* 60 \* 60 \* 366 \* 12
1577836800
```
前半部分是计算 38 个非闰年的秒数。然后,我们加上闰年的 366 天的类似计算。或者,你可以使用前面介绍的每年秒数,然后执行以下操作:
```
$ expr 31536000 \* 38 + 31622400 \* 12
1577836800
```
这种跟踪日期和时间的方式使 Unix 系统完全不受 Y2K 恐慌的影响1999 年末人们开始担心进入 2000 年会对计算机系统造成严重破坏。但是实际遇到的问题比人们担心的少得多。实际上,只有以两位数格式存储年份的应用程序才会将年份变为 00以表示时间倒退。尽管如此许多应用程序开发人员还是做了很多额外的繁琐工作以确保 2000 年到来时,他们的系统不会出现严重问题。
### Unix 时间何时会遇到问题?
在 2038 年之前Unix 系统不会遇到 Y2K 类型的问题,直到如上所述存储的日期将超过其 32 位空间分配。但这距离现在已经只有 18 年了,内核开发人员已经在研究如何避免灾难。但现在开始恐慌还为时过早。
2038 年的问题有时称为 Y2K38 问题。我们必须在 2038 年 1 月 19 日星期二之前解决这个问题。如果问题到时候仍未解决,则该日期之后的系统可能会认为是 1901 年。解决该问题的一种方法是切换为日期/时间信息的 64 位表示形式。有些人认为即使那样也会有比听起来更复杂的问题。无论如何恐慌还为时过早。并且与此同时也许在新年前夜演唱了《Auld Lang Syne》之后你可以向 Unix 唱《生日快乐》歌了。Unix 50 岁了,这仍然是大事。
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://images.idgesg.net/images/article/2017/10/birthday-cake-candles-100739452-large.jpg
[2]: https://creativecommons.org/publicdomain/zero/1.0/
[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage)
[4]: https://www.facebook.com/NetworkWorld/
[5]: https://www.linkedin.com/company/network-world