Merge remote-tracking branch 'upstream/master'

This commit is contained in:
zgj 2019-01-05 23:38:38 +08:00
commit 69ac18100d
44 changed files with 3181 additions and 1667 deletions

View File

@ -0,0 +1,136 @@
下载 Linux 游戏的最佳网站
======
> 新接触 Linux 游戏并想知道从哪里来 **下载 Linux 游戏**?我们列出了最好的资源,在这里你既能 **下载免费的 Linux 游戏** ,也能购买优质的 Linux 游戏。
Linux 和游戏?从前,很难想象这两者走到一起。然而随着时间流逝,很多事情都在变化。到如今,有成千上万在 Linux 上可以玩的游戏,而大公司和独立开发者们正在开发更多的游戏。
[在 Linux 上玩游戏][1] 现在已经是现实。今天我们将去看看,你在哪里可以找到 Linux 平台游戏、搜索到你喜欢的游戏。
### 在哪里来下载 Linux 游戏?
![下载 Linux 游戏的网站][2]
首先,看看你的 Linux 发行版的软件中心(如果有的话)。在这里你也能找到大量的游戏。
但是,这不意味着你应该将自己的视野局限于软件中心上。让我们来为你列出一些可以下载 Linux 游戏网站。
#### 1. Steam
如果你是老练的玩家,你应该听过 Steam。如果你还不知道的话没错Steam 在 Linux 上也是可用的。Steam 推荐运行在 Ubuntu 上,但是它也能运行在其它主要的发行版上。如果你真的对 Steam 很狂热,这里甚至还有一个玩 Steam 游戏的专用操作系统:[SteamOS][3]。我们在上一年 [最佳的 Linux 游戏发行版][4] 文章中提及了它。
![Steam 商店][5]
Steam 有最大的 Linux 游戏商店。当写这篇文章的时候,在 Linux 平台上,确切地说有 3487 款游戏,这真的是很多了。你可以从宽广的类型中寻找游戏。至于 [数字版权管理DRM][6],大多数的 Steam 游戏都有某种 DRM 。
对于使用 Steam ,要么你必须在你的 Linux 系统上安装 [Steam 客户端][7],要么使用 SteamOS。Steam 的一个优势是,在初始化安装后,对于大多数的游戏,你不需要担心依赖关系和复杂的安装过程。 Steam 客户端将为你做这些繁重的任务。
- [Steam 商店][8]
#### 2. GOG
如果你只对免 DRM 的游戏感兴趣GOG 收集了相当多的这种游戏。此刻GOG 在它们的库中有 1978 种免 DRM 游戏。GOG 因它大量收集了免 DRM 游戏而闻名。
![GOG 商店][9]
GOG 游戏官方支持 Ubuntu LTS 版本和 Linux Mint。所以Ubuntu 和它的衍生版在安装它们时将没有问题。在其他发行版上安装它们时可能需要一些额外的工作,例如,你需要安装正确的依赖关系。
从 GOG 中下载游戏,你不需要额外的客户端。所有购买的游戏都可在你的账户区内找到。你可以使用你最爱的下载管理器直接下载它们。
- [GOG 商店][10]
#### 3. Humble 商店
Humble 商店是另一个你可以查找各种各样 Linux 游戏的地方。在 Humble 商店中有免 DRM 和非免 DRM 的游戏。非免 DRM 游戏通常来自 Steam。在 Humble 商店中,当前有超过 1826 款 Linux 游戏。
![Humble 商店][11]
Humble 商店因另一个原因而著名。它们有一个被称为 [Humble 独立包][12]的活动,其中打包提供了一批游戏,带有令人不可抗拒的限时优惠。关于 Humble 的另一件事是,当你购买时,你的购买金额的 10% 将捐给慈善机构。
Humble 不需要额外的客户端来下载它们的游戏。
- [Humble 商店][13]
#### 4. itch.io 商店
itch.io 是给独立数字创作者的一个开放市场其致力于独立视频游戏。itch.io 有一些你能找到的最有趣、最独特的游戏。在 itch.io 的大多数游戏是免 DRM 的。
![itch.io 商店][14]
现今itch.io 在它的商店中有 9514 款 Linux 平台的游戏。
itch.io 有它自己的 [客户端][15],可以轻松地下载、安装、更新和玩它们的游戏。
- [itch.io 商店][16]
#### 5. LGDB
LGDB 是 <ruby>Linux 游戏数据库<rt>Linux Game DataBase</rt></ruby>的缩写。虽然从技术上说它不是一个游戏商店,它收集有大量的 Linux 游戏,以及关于它们的各种各样的信息。每一款游戏都有你可以在哪里找到它们的链接。
![Linux 游戏数据库][17]
如今,在该数据库中有 2046 款游戏。它们也有很长的关于 [模拟器][18]、[工具][19] 和 [游戏引擎][20] 的列表。
- [LGDB][21]
#### 6. Game Jolt 商店
Game Jolt 有一个非常可观的集合,在它的库藏中大约有 5000 个 Linux 独立游戏。
![Game Jolt 商店][22]
Game Jolt 有一个(预览版)[客户端][23],可用于轻松地下载、安装、更新和玩游戏。
- [Game Jolt 商店][24]
### 其他
有很多其他的销售 Linux 游戏的商店。也有很多你能找到免费游戏的地方。这是它们中的两个:
* [Bundle Stars][25]:当前有 814 个 Linux 游戏和 31 个游戏包。
* [GamersGate][26]:现在有 595 个 Linux 游戏。既有免 DRM 的,也有非免 DRM 的。
#### 应用商店、软件中心 & 软件库
Linux 发行版有它们自己的应用商店或软件库。尽管不是很多,但是在这里你也能找到各种各样的游戏。
今天到此为止。你知道这里有这么多 Linux 上可玩的游戏吗?你使用一些其他的网站来下载 Linux 游戏吗?与我们分享你的收藏。
--------------------------------------------------------------------------------
via: https://itsfoss.com/download-linux-games/
作者:[Munif Tanjim][a]
译者:[robsean](https://github.com/robsean)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/munif/
[1]:https://linux.cn/article-7316-1.html
[2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg
[3]:http://store.steampowered.com/steamos/
[4]:https://itsfoss.com/linux-gaming-distributions/
[5]:https://itsfoss.com/wp-content/uploads/2017/05/Steam-Store-800x382.jpg
[6]:https://www.wikiwand.com/en/Digital_rights_management
[7]:http://store.steampowered.com/about/
[8]:http://store.steampowered.com/linux
[9]:https://itsfoss.com/wp-content/uploads/2017/05/GOG-Store-800x366.jpg
[10]:https://www.gog.com/games?system=lin_mint,lin_ubuntu
[11]:https://itsfoss.com/wp-content/uploads/2017/05/The-Humble-Store-800x393.jpg
[12]:https://www.humblebundle.com/?partner=itsfoss
[13]:https://www.humblebundle.com/store?partner=itsfoss
[14]:https://itsfoss.com/wp-content/uploads/2017/05/itch.io-Store-800x485.jpg
[15]:https://itch.io/app
[16]:https://itch.io/games/platform-linux
[17]:https://itsfoss.com/wp-content/uploads/2017/05/LGDB-800x304.jpg
[18]:https://lgdb.org/emulators
[19]:https://lgdb.org/tools
[20]:https://lgdb.org/engines
[21]:https://lgdb.org/games
[22]:https://itsfoss.com/wp-content/uploads/2017/05/GameJolt-Store-800x357.jpg
[23]:http://gamejolt.com/client
[24]:http://gamejolt.com/games/best?os=linux
[25]:https://www.bundlestars.com/en/games?page=1&platforms=Linux
[26]:https://www.gamersgate.com/games?state=available
[27]:https://itsfoss.com/linux-gaming-problems/

View File

@ -0,0 +1,112 @@
如何用 Gonimo 创建一个免费的婴儿监视系统
======
> 当你可以用两个设备、浏览器和网络连接就能免费搭建一个婴儿监视器时,谁还会花钱去买呢?
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE)
新父母和准父母很快就会知道将会有一个既长且昂贵的新生儿所需设备的清单清单中的首位是一个婴儿监视器借此他们可以在做其他事情时照看自己的婴儿但这儿有一件不必消耗你的婴儿经费的设备Gonimo 是一个可以将现有的设备转换成婴儿监控系统的自由开源解决方案,附近大型婴儿用品商店的过道中有数以千计的其他必备或时尚物品,就可以为其中某一个腾出一些婴儿的预算。
Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题:
* 现有硬件婴儿监视器价格昂贵,使用范围有限,需要您带着额外的设备。
* 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,不太容易找到开源产品。
* 如果您有两个小孩(例如双胞胎),您将需要两台监视器,使您的成本翻倍。
Gonimo 是作为一个解决典型的监视器的缺点的开源解决方案而创建的:
* 昂贵?不,它是免费的!
* 使用范围有限?不,它适用于互联网 / WiFi无论您身在何处。
* 下载并安装应用程序?噢不,它适用于您现有的网络浏览器。
* 购买新设备?不用,你可以使用任何笔记本电脑、手机或平板电脑与网络浏览器和麦克风和/或相机。
注意遗憾的是Apple iOS 设备尚不支持,但预计很快就会发生变化 —— 请继续阅读,了解如何帮实现这一目标。)
### 开始
将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome访问 [gonimo.com][1] 并单击 “Start baby monitor” 以访问该 Web 应用程序。
1、创建家庭在首次启动的屏幕上你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 “+” 按钮并接受随机生成的姓氏或键入您自己的选择。
![Start screen][3]
*从开始屏幕创建一个新家庭*
2、邀请设备建立完家庭以后下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到消息中。对其他设备,只需打开该链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。
![Invite screen][5]
*邀请家庭成员*
3、启动婴儿站流接下来通过转到 [Gonimo 主屏][6]点击带有奶嘴的按钮并允许网络浏览器访问设备的麦克风和摄像头选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床或关闭它以节省设备电池音频仍将流式传输。点击“Start”。该流现在处于活动状态。
![Select baby station][8]
*选择婴儿站*
![Press Start][10]
*按“Start”开始以流式传输视频*
4、连接到父母站流要查看婴儿站流请转到 Gonimo 家族中的另外的设备 —— 即父母站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表旁边有一个闪动的“Connect”按钮的是活跃的婴儿站。选择“Connect”您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。
![Select parent station][12]
*选择父母站*
![Press Connect][14]
*按下“Connect”开始观看婴儿流。*
5、恭喜您已成功将设备直接通过网络浏览器转换为婴儿监视器无需下载或安装任何应用程序
有关重命名设备,从系列中删除设备或删除系列的详细信息和详细说明,请查看 gonimo.com 的[视频教程][15]。
### 家庭系统的灵活性
Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的家庭系统。
* 多婴儿:如果你想留意你在两个不同房间睡觉的两个小孩怎么办?在每个孩子的房间放一个设备,并将其设置为婴儿站。第三个设备将充当父母站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向该家庭系统提供更多设备,并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个、第四个、第五个和第五个等)设备,并自动建立分屏。酷!
* 多父母:如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。
* 多家庭:单个设备也可以是几个家庭系统的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与奶奶或约翰叔叔的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。
### 想要参加吗?
Gonimo 团队喜欢开源。代码来自社区代码用于社区。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。
目前我们特别需要那些愿意成为 iOS 11 测试者的人的帮助,因为 Apple 在 iOS 11 中对 WebRTC 的支持意味着我们最终将能够支持 iOS 设备。如果可以,请帮助我们实现这个令人赞叹的里程碑。
如果您了解 Haskell 或想要了解它,您可以查看 [GitHub 上我们的代码][16]。欢迎发起拉取请求、审查代码以及提出问题。
最后,请通过向新父母和开源世界宣传 Gonimo 婴儿监视器是易于使用并且便携的。
### 关于作者
Robert Klotzner我是双胞胎的父亲一个程序员。当我听到普通人可以给计算机编程时我买了一本 1200 页的关于 C++ 的书开始学习,我当时才十五岁。我坚持用 C++ 相当长的一段时间,学习了 Java 又回归到 C++,学习了 D、Python 等等,最终学习了 Haskell。我喜欢 Haskell 是因为它丰富的类型系统,这几乎可以避免我书写错误的代码。强壮的静态类型和性能让我爱上了 C++……
--------------------------------------------------------------------------------
via: https://opensource.com/article/17/9/gonimo
作者:[Robert Klotzner][a]
译者:[lintaov587](https://github.com/lintaov587)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/robert-klotzner
[1]:https://gonimo.com/
[2]:/file/371256
[3]:https://opensource.com/sites/default/files/u128651/start-screen.png (Start screen)
[4]:/file/371236
[5]:https://opensource.com/sites/default/files/u128651/invite-screen.png (Invite screen)
[6]:https://app.gonimo.com/
[7]:/file/371231
[8]:https://opensource.com/sites/default/files/u128651/baby-select.png (Select baby station)
[9]:/file/371226
[10]:https://opensource.com/sites/default/files/u128651/baby-screen.png (Press Start)
[11]:/file/371251
[12]:https://opensource.com/sites/default/files/u128651/parent-select.png (Select parent station)
[13]:/file/371241
[14]:https://opensource.com/sites/default/files/u128651/parent-screen.png (Press Connect)
[15]:https://gonimo.com/index.php#intro
[16]:https://github.com/gonimo/gonimo

View File

@ -1,159 +1,141 @@
用 PGP 保护代码完整性(五):将子密钥移到一个硬件设备中
======
> 在这个系列教材中,将为你提供使用 PGP 和保护你的私钥的最佳体验。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pgp-keys.jpg?itok=aS6IWGpq)
在本系列教程中,我们将提供一个使用 PGP 的实用指南。如果你没有看过前面的文章,你可以通过下面的链接去查看。在这篇文章中,我们将继续讨论如何保护你的密钥,谈一谈将你的子密钥移到一个专门的硬件设备中的一些技巧。
[第一部分:基本概念和工具][1]
- [第一部分:基本概念和工具][1]
- [第二部分:生成你的主密钥][2]
- [第三部分:生成 PGP 子密钥][3]
- [第四部分:将主密钥移到离线存储中][4]
[第二部分:生成你的主密钥][2]
[第三部分:生成 PGP 子密钥][3]
[第四部分:将主密钥移到离线存储中][4]
### 清单
#### 清单
* 取得一个 GnuPG 兼容的硬件设备(必要)
* 配置 GnuPG 在设备上工作(必要)
* 设置 user 和 admin 的 PIN必要
* 设置用户和管理员的 PIN必要
* 移动子密钥到设备中(必要)
#### 考虑事项
### 考虑事项
虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的 Home 目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre
虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的家目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre
完全保护密钥的最好方式就是,将它移到一个专门的硬件设备中,这种硬件设备是一个可操作的智能卡。
#### 智能卡的好处
##### 智能卡的好处
一个智能卡包含一个加密芯片,它能够存储私钥,并且直接在智能卡内部执行秘密操作。因为密钥内容从来没有离开过智能卡,计算机操作系统并不能检索你插入的智能卡上的私钥。这与前面用于备份目的的加密 USB 存储是不同的 —— 虽然 USB 设备也是插入并解密的,但操作系统是能够去访问私钥内容的。使用外置的加密 USB 介质并不能代替智能卡设备的功能。
智能卡的一些其它好处:
* 它们很便宜且易于获得
* 它们小巧且易于携带
* 它们可以用于多种设备上
* 它们中的很多都具有防篡改功能(取决于制造商)
#### 可用的智能卡设备
智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你总是可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。
智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你肯定可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。
由于这个原因,制造商开始推出小型 USB 设备,它的大小和 U 盘类似,内置有微型智能卡,并且在芯片上简单地实现了智能卡协议特性。下面推荐几个这样的设备:
* [Nitrokey Start][5]:开源硬件和自由软件,可用于 GnuPG 的最便宜的选择之一,但是额外的安全特性很少。
* [Nitrokey Pro][6]:类似于 Nitrokey Start它提供防篡改及更多的安全特性但没有 U2F具体查看指南的 U2F 节)。
* [Yubikey 4][7]:专利硬件和软件,但比 Nitrokey Pro 便宜,并且可以用在最新的笔记本电脑上的 USB-C 接口;也提供像 U2F 这样的额外的安全特性。
我们推荐选一个同时具备智能卡功能和 U2F 的设备,在写这篇文章时,只能选择 Yubikey 4。
#### 配置智能卡设备
你的智能卡设备插入任何一台现代的 Linux 或 Mac 工作站上都应该能正常工作。你可以通过运行如下的命令去验证它:
```
$ gpg --card-status
```
如果你没有收到错误,有一个完整的卡列表,就表示一切正常。不幸的是,排除为什么设备不能正常工作的所有可能原因,已经超出了本指南的范围。如果你的智能卡使用 GnuPG 时有问题,请通过你的操作系统的常见支持通道寻求支持。
##### PIN 不一定是数字
注意,尽管名为 “PIN”暗示你它必须是一个“数字”不论是 user PIN 还是 admin PIN 都不必非要是数字。
注意,尽管名为 “PIN”暗示你它必须是一个“数字”不论是用户 PIN 还是管理员 PIN 都不必非要是数字。
当你收到一个新设备时,它可能设置有一个默认的 user 和 admin PIN对于 Yubikeys它分别是 123456 和 12345678。如果它们的 PIN 不是默认的,请查看设备附带的说明书。
当你收到一个新设备时,它可能设置有一个默认的用户和管理员 PIN对于 Yubikey它分别是 `123456``12345678`。如果它们的 PIN 不是默认的,请查看设备附带的说明书。
##### 快速设置
为配置你的智能卡,你需要使用 GnuPG 菜单系统,因此这里并没有更方便的命令行开关:
```
$ gpg --card-edit
[...omitted...]
gpg/card> admin
Admin commands are allowed
gpg/card> passwd
```
你应该去设置 user PIN (1)、admin PIN (3)、和 Reset Code (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是 Admin PIN 和 Reset Code它允许你去擦除整个智能卡内容。你很少使用到 Admin PIN因此如果你不记录下来很可能会忘掉它。
你应该去设置用户 PIN (1)、管理员 PIN (3)、和重置码 (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是管理员 PIN 和重置码(它允许你去擦除整个智能卡内容)。你很少使用到管理员 PIN因此如果你不记录下来很可能会忘掉它。
返回到智能卡主菜单,你也可以设置其它值(比如名字、性别、登入日期、等等),但是这些都不是必需的,一旦你的智能卡丢失了,将导致额外的信息泄露。
#### 将子密钥移到你的智能卡中
退出卡菜单(使用 “q” 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到 admin PIN。记住那个 [fpr] 表示你的密钥的完整的 40 个字符的指纹。
退出卡菜单(使用 `q` 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到管理员 PIN。记住那个 `[fpr]` 表示你的密钥的完整的 40 个字符的指纹。
```
$ gpg --edit-key [fpr]
Secret subkeys are available.
pub rsa4096/AAAABBBBCCCCDDDD
created: 2017-12-07 expires: 2019-12-07 usage: C
trust: ultimate validity: ultimate
ssb rsa2048/1111222233334444
created: 2017-12-07 expires: never usage: E
ssb rsa2048/5555666677778888
created: 2017-12-07 expires: never usage: S
pub rsa4096/AAAABBBBCCCCDDDD
created: 2017-12-07 expires: 2019-12-07 usage: C
trust: ultimate validity: ultimate
ssb rsa2048/1111222233334444
created: 2017-12-07 expires: never usage: E
ssb rsa2048/5555666677778888
created: 2017-12-07 expires: never usage: S
[ultimate] (1). Alice Engineer <alice@example.org>
[ultimate] (2) Alice Engineer <allie@example.net>
[ultimate] (2) Alice Engineer <allie@example.net>
gpg>
```
使用 --edit-key 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 gpg> 提示符来表示。
使用 `--edit-key` 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 `gpg>` 提示符来表示。
首先,我们来选择移到智能卡中的密钥 —— 你可以通过键入 `key 1`(它表示选择清单中的第一个密钥)来实现:
```
gpg> key 1
```
这个输出会有一点细微的差别:
```
pub rsa4096/AAAABBBBCCCCDDDD
created: 2017-12-07 expires: 2019-12-07 usage: C
trust: ultimate validity: ultimate
pub rsa4096/AAAABBBBCCCCDDDD
created: 2017-12-07 expires: 2019-12-07 usage: C
trust: ultimate validity: ultimate
ssb* rsa2048/1111222233334444
created: 2017-12-07 expires: never usage: E
ssb rsa2048/5555666677778888
created: 2017-12-07 expires: never usage: S
created: 2017-12-07 expires: never usage: E
ssb rsa2048/5555666677778888
created: 2017-12-07 expires: never usage: S
[ultimate] (1). Alice Engineer <alice@example.org>
[ultimate] (2) Alice Engineer <allie@example.net>
[ultimate] (2) Alice Engineer <allie@example.net>
```
注意与密钥对应的 ssb 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。
注意与密钥对应的 `ssb` 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。
现在,我们来将密钥移到智能卡中:
```
gpg> keytocard
Please select where to store the key:
(2) Encryption key
(2) Encryption key
Your selection? 2
```
由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的 admin PIN。如果命令没有返回错误表示你的密钥已经被移到智能卡中了。
由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的管理员 PIN。如果命令没有返回错误表示你的密钥已经被移到智能卡中了。
**重要:** 现在再次输入 `key 1` 去取消选中第一个密钥,并输入 `key 2` 去选择 [S] 密钥:
@ -162,42 +144,41 @@ gpg> key 1
gpg> key 2
gpg> keytocard
Please select where to store the key:
(1) Signature key
(3) Authentication key
(1) Signature key
(3) Authentication key
Your selection? 1
```
你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (1)。完成后,如果你的命令没有返回错误,表示操作已成功。
你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (`1`)。完成后,如果你的命令没有返回错误,表示操作已成功。
最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 `q`
最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 “q"
```
gpg> q
Save changes? (y/N) y
```
保存变更将把你的子密钥移到智能卡后,把你的 Home 目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。
保存变更将把你的子密钥移到智能卡后,把你的目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。
##### 验证移动后的密钥
现在,如果你执行一个` --list-secret-keys` 操作,你将看到一个稍有不同的输出:
```
$ gpg --list-secret-keys
sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06]
111122223333444455556666AAAABBBBCCCCDDDD
uid [ultimate] Alice Engineer <alice@example.org>
uid [ultimate] Alice Engineer <allie@example.net>
ssb> rsa2048 2017-12-06 [E]
ssb> rsa2048 2017-12-06 [S]
sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06]
111122223333444455556666AAAABBBBCCCCDDDD
uid [ultimate] Alice Engineer <alice@example.org>
uid [ultimate] Alice Engineer <allie@example.net>
ssb> rsa2048 2017-12-06 [E]
ssb> rsa2048 2017-12-06 [S]
```
在 ssb> 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换:
`ssb>` 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换:
```
$ cd ~/.gnupg/private-keys-v1.d
$ strings *.key
```
这个输出将包含一个影子私钥,它表示那个文件仅是个存根,真正的内容在智能卡中。
@ -205,29 +186,29 @@ $ strings *.key
#### 验证智能卡的功能
验证智能卡能否如期正常运行,你可以通过创建一个签名来验证:
```
$ echo "Hello world" | gpg --clearsign > /tmp/test.asc
$ gpg --verify /tmp/test.asc
```
首次运行这个命令时将询问你智能卡的 PIN在你运行 `gpg —verify` 之后,它将显示 "Good signature”。
首次运行这个命令时将询问你智能卡的 PIN在你运行 `gpg —verify` 之后,它将显示 Good signature”。
祝贺你,你已经成功将窃取你的开发者数字身份变得更加困难了!
### 其它常见 GnuPG 操作
#### 其它常见 GnuPG 操作
下面是使用你的 PGP 密钥需要做的一些常见操作的快速指南。
在下面的所有命令中,[fpr] 表示你的密钥指纹。
在下面的所有命令中,`[fpr]` 表示你的密钥指纹。
#### 挂载主密钥离线存储
##### 挂载主密钥离线存储
下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 `mount` 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的家目录:
下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 mount 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的 Home
```
$ export GNUPGHOME=/media/disk/name/gnupg-backup
$ gpg --list-secret-keys
```
确保你在输出中看到的是 `sec` 而不是 `sec#`(这个 `#` 表示密钥不可用,仍然使用的是惯常的那个 Home 目录)。
@ -235,53 +216,53 @@ $ gpg --list-secret-keys
##### 更新你惯常使用的那个 GnuPG 工作目录
在你的离线存储上做了任何更改之后,你应该将这些更改同步应用到你惯常使用的工作目录中:
```
$ gpg --export | gpg --homedir ~/.gnupg --import
$ unset GNUPGHOME
```
#### 延长密钥过期日期
##### 延长密钥过期日期
我们创建的主密钥的默认过期日期是自创建之日起两年后。这样做都是为安全考虑,这样将使淘汰密钥最终从密钥服务器上消失。
延长你的密钥过期日期,从当前日期延长一年,只需要运行如下命令:
```
$ gpg --quick-set-expire [fpr] 1y
```
如果为了好记住你也可以使用一个特定日期比如你的生日、1 月 1 日、或加拿大国庆日):
```
$ gpg --quick-set-expire [fpr] 2020-07-01
```
记得将更新后的密钥发送到密钥服务器:
```
$ gpg --send-key [fpr]
```
#### 吊销身份
##### 吊销身份
如果你需要吊销一个身份(比如,你换了雇主并且旧的邮件地址不再有效了),你可以使用一行命令搞定:
```
$ gpg --quick-revoke-uid [fpr] 'Alice Engineer <aengineer@example.net>'
```
你也可以通过使用 `gpg --edit-key [fpr]` 在菜单模式下完成同样的事情。
完成后,记得将更新后的密钥发送到密钥服务器上:
```
$ gpg --send-key [fpr]
```
下一篇文章中,我们将谈谈 Git 如何支持 PGP 的多级别集成。
通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][8]学习更多 Linux 知识。
通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门][8]学习更多 Linux 知识。
--------------------------------------------------------------------------------
@ -289,15 +270,15 @@ via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-p
作者:[KONSTANTIN RYABITSEV][a]
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com/users/mricon
[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools
[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key
[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys
[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage
[1]:https://linux.cn/article-9524-1.html
[2]:https://linux.cn/article-9529-1.html
[3]:https://linux.cn/article-9607-1.html
[4]:https://linux.cn/article-10402-1.html
[5]:https://shop.nitrokey.com/shop/product/nitrokey-start-6
[6]:https://shop.nitrokey.com/shop/product/nitrokey-pro-3
[7]:https://www.yubico.com/product/yubikey-4-series/

View File

@ -0,0 +1,86 @@
使用 Xfce Linux 桌面环境的 8 个理由
============================
> 整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易地知道如何做好一件事。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22)
由于某些原因(也包括好奇),几周前我开始使用 [Xfce][1] 作为我的 Linux 桌面。促使我更换 Linux 桌面环境的原因之一是桌面相关的守护进程占据了我的性能非常强大的主工作站的绝大部分 CPU 资源和 I/O 带宽。当然,有些不稳定性可能是因为我删除了提供这些守护进程的 RPM 包。然而,事实是在我删除这些 RPM 包之前KDE 就已经很不稳定了而且还导致了一系列其他方面的性能和稳定性问题。所以我需要换一个桌面来避免这些问题。
在回顾了我为 Linux 桌面所写的一系列文章后我才意识到我忽略了 Xfce。这篇文章也是力图能够纠正弥补这个疏忽。我非常喜欢 Xfce 也很享受它所带给我超乎预期的快速、轻量的体验。
作为研究的一部分,我有尝试过在 Google 上查询 Xfce 对应什么意思。有个历史参考是它对应着 “XForms Common Environment”但 Xfce 早已不在使用 XForms 工具。几年前,我找到另一个参考是 “Xtra fine computing environment” 而且我也很喜欢这个解释。我将会用它作为 Xfce 的全称(尽管再也找不到这个参考页面)。
### 推荐 Xfce 的 8 个理由
#### 1、轻量级架构
Xfce 相对于其他的桌面如 KDE 和 GNOME不管是内存还是 CPU 的占用率都非常小。在我的系统中,组成 Xfce 桌面的程序仅占用了少量内存就构成一个如此强大的桌面。超低的 CPU 占用率也是 Xfce 桌面的一个特点。了解到 Xfce 内存占用特别低后,我对它的 CPU 占用率也非常低这个特性自然而言也就不感到奇怪了。
#### 2、简洁
Xfce 桌面很简单,就像绒毛整洁的动物让人一目了然、赏心悦目。基础的桌面有两个面板和一条在左边垂直的图标行。面板 0 在底部,并由一些基础的应用启动程序和能访问到系统里对应程序的图标组成。面板 1 在顶部,由一个应用程序启动器和一个能够允许用户在多个工作区之间来回切换的工作区切换器组成。面板可以通过补充项自定义修改,比如增加个新的应用启动器或者更改它们的宽高。
桌面左侧的图标对应是家目录和垃圾桶。它也可以显示其他的图标,如完整的文件系统目录树和已连接上系统的可插拔的任意 USB 存储设备。这些图标可以用来挂载和卸载设备,也可以用来打开默认的文件管理器。如果你愿意,它们都可以被隐藏,同时文件系统、垃圾箱、家目录对应的图标都可以逐个控制管理。所有的可移动设备也可以被隐藏或作为一个组显示。
#### 3、文件管理
作为 Xfce 的默认文件管理器 Thunar它很简单既易于使用和配置也非常容易学习。尽管它并不像其他的文件管理器比如 Konqueror 或者 Dolphin 那样效果华丽但它很强大也很快。Thunar 并不能在一个窗口里面打开多个面板但它提供了选项卡来支持多个目录的同时打开。Thunar 也有一个非常漂亮的侧边栏,其上同样的图标就像桌面那样能够显示完整的文件系统目录树和所有已连接的 USB 存储设备。设备能够被挂载和卸载,可移动媒介如 CD 也能够被弹出。Thunar 也可以使用类似 Ark 这种帮助软件来在你点击归档文件的时候打开它们。比如 ZIP、TAR、RPM 这种归档文件都可以被浏览也可以从中复制单个文件。
![Xfce desktop][3]
*Xfce 桌面及 Thunar 和 Xfce 下的终端模拟器。*
在我的[文件管理器系列][4]文章中,我已经使用体验过很多不同的文件管理器软件,我不得不说 Thunar 的简单易用让你无法不喜欢上它。它可以让你通过使用侧边栏来很容易地浏览文件系统。
#### 4、稳定
Xfce 桌面非常稳定。新版本的发布周期似乎是三年,但也会根据需要发布相关更新。最新的版本是于 2015 年 2 月发布的 4.12。在使用 KDE 遇到一系列问题后,稳如磐石的 Xfce 桌面环境显得让人格外放心。在我使用 Xfce 的过程中,它从来没有崩溃过,也不会产生额外的守护进程占据过多的系统资源。这正是我想要的:它安安静静地工作,不会给你带来额外的困扰。
#### 5、优雅
Xfce 简单优雅。在我的今年秋天将面世的新书《系统管理员的 Linux 哲学》中我谈到了关于简单的一系列好处,包括简单事实上也是优雅的诸多标志之一。很明确能够确定的就是 Xfce 及相关组件程序的开发者和维护者也是极力推崇简单至上。这种简单特性很可能也是 Xfce 如此稳定的主要原因,但它也给用户带来了一个整洁的桌面外观,一个反应灵敏的操作界面,一个会让人感觉很自然也很易用的导航结构,而且 Xfce 整体上的优雅特性也会让用户的使用过程中充满愉悦感。
#### 6、终端仿真程序
Xfce4 的终端仿真程序非常强大,而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix、Terminator、Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如,从 host1=>host2=>host3=>host4会准确地在选项卡显示了 “host4”。但其他的终端仿真程序最多也就显示 “host2”。
至于这个终端仿真程序功能和外观的其他方面都可以根据你的需要很容易配置成你想要的。当然同 Xfce 的其他组件一样,这款终端仿真程序占用了系统资源的很少一部分。
#### 7、可配置性
Xfce 能够配置的范围极大。虽然 Xfce 桌面的可配置性比不上 KDE但依旧远超 GNOME而且比它更容易配置。比如我发现设置管理器是 Xfce 配置一切的入口。虽然每个配置程序都可以单独使用,但是设置管理器把他们都放在一个窗口里以便快速访问。关于 Xfce 桌面很多重要的部分都可以通过配置来满足我的需求。
#### 8、模块化
Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌面发行版中也未必安装了 Xfce 的所有组件。[Xfce 项目][5] 的主页列出了主要的项目,所以你可以根据需要安装你想安装的附加组件。比如在我的 Fedora 28 workstation 版本上我安装的 Xfce 组时就没有 [Xfce 项目][5] 主页最下面的说明的一些程序。
这里还有个关于 Xfce 的 [文档页面][6] 和 一个被称为 [Xfce 超值项目][7] 的 wiki 列举了其他的 Xfce 相关的项目,它们为 Xfce 的面板及 Thunar 提供了很多不错的应用程序、精美的插图、好用的插件。
### 总结
整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易地知道如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和内存资源。这也使得 Xfce 非常适合那种由于硬件有限而无法分配给桌面太多资源的旧主机。然而Xfce 又是足够的灵活和强大的,能够满足高级用户的需要。
我知道,更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置:比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。
我觉得切换 Linux 的桌面环境就像我在工作中换个办公工位或者办公室一样。别人把我的东西装箱从旧办公室搬到新办公室,然后我在我的新办公室里组装连接好我的电脑,打开箱子再把里面的东西放在合适的位置。而切换到 Xfce 桌面大概就是我做过的最简单省事容易的桌面环境更换了。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/6/xfce-desktop
作者:[David Both][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[WangYueScream](https://github.com/WangYueScream)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/dboth
[1]:https://xfce.org/
[2]:/file/401856
[3]:https://opensource.com/sites/default/files/uploads/xfce-desktop-01.png (Xfce desktop)
[4]:https://opensource.com/sitewide-search?search_api_views_fulltext=David%20Both%20File%20managers
[5]:https://xfce.org/projects
[6]:https://docs.xfce.org/
[7]:https://goodies.xfce.org/

View File

@ -0,0 +1,335 @@
使用 Node.js 构建交互式命令行工具
======
> 使用 Node.js 构建一个根据询问创建文件的命令行工具。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A)
当用于构建命令行界面CLINode.js 十分有用。在这篇文章中,我将会教你如何使用 [Node.js][1] 来构建一个问一些问题并基于回答创建一个文件的命令行工具。
### 开始
首先,创建一个新的 [npm][2] 包NPM 是 JavaScript 包管理器)。
```
mkdir my-script
cd my-script
npm init
```
NPM 将会问一些问题。随后,我们需要安装一些包。
```
npm install --save chalk figlet inquirer shelljs
```
这是我们需要的包:
* Chalk正确设定终端的字符样式
* Figlet使用普通字符制作大字母的程序LCTT 译注:使用标准字符,拼凑出图片)
* Inquirer通用交互式命令行用户界面的集合
* ShellJSNode.js 版本的可移植 Unix Shell 命令行工具
### 创建一个 index.js 文件
现在我们要使用下述内容创建一个 `index.js` 文件。
```
#!/usr/bin/env node
const inquirer = require("inquirer");
const chalk = require("chalk");
const figlet = require("figlet");
const shell = require("shelljs");
```
### 规划命令行工具
在我们写命令行工具所需的任何代码之前,做计划总是很棒的。这个命令行工具只做一件事:**创建一个文件**。
它将会问两个问题:文件名是什么以及文件后缀名是什么?然后创建文件,并展示一个包含了所创建文件路径的成功信息。
```
// index.js
const run = async () => {
// show script introduction
// ask questions
// create the file
// show success message
};
run();
```
第一个函数只是该脚本的介绍。让我们使用 `chalk``figlet` 来把它完成。
```
const init = () => {
console.log(
chalk.green(
figlet.textSync("Node JS CLI", {
font: "Ghost",
horizontalLayout: "default",
verticalLayout: "default"
})
)
);
}
const run = async () => {
// show script introduction
init();
// ask questions
// create the file
// show success message
};
run();
```
然后,我们来写一个函数来问问题。
```
const askQuestions = () => {
const questions = [
{
name: "FILENAME",
type: "input",
message: "What is the name of the file without extension?"
},
{
type: "list",
name: "EXTENSION",
message: "What is the file extension?",
choices: [".rb", ".js", ".php", ".css"],
filter: function(val) {
return val.split(".")[1];
}
}
];
return inquirer.prompt(questions);
};
// ...
const run = async () => {
// show script introduction
init();
// ask questions
const answers = await askQuestions();
const { FILENAME, EXTENSION } = answers;
// create the file
// show success message
};
```
注意,常量 `FILENAME``EXTENSIONS` 来自 `inquirer` 包。
下一步将会创建文件。
```
const createFile = (filename, extension) => {
const filePath = `${process.cwd()}/${filename}.${extension}`
shell.touch(filePath);
return filePath;
};
// ...
const run = async () => {
// show script introduction
init();
// ask questions
const answers = await askQuestions();
const { FILENAME, EXTENSION } = answers;
// create the file
const filePath = createFile(FILENAME, EXTENSION);
// show success message
};
```
最后,重要的是,我们将展示成功信息以及文件路径。
```
const success = (filepath) => {
console.log(
chalk.white.bgGreen.bold(`Done! File created at ${filepath}`)
);
};
// ...
const run = async () => {
// show script introduction
init();
// ask questions
const answers = await askQuestions();
const { FILENAME, EXTENSION } = answers;
// create the file
const filePath = createFile(FILENAME, EXTENSION);
// show success message
success(filePath);
};
```
来让我们通过运行 `node index.js` 来测试这个脚本,这是我们得到的:
![](https://opensource.com/sites/default/files/uploads/nodejs_output.png)
### 完整代码
下述代码为完整代码:
```
#!/usr/bin/env node
const inquirer = require("inquirer");
const chalk = require("chalk");
const figlet = require("figlet");
const shell = require("shelljs");
const init = () => {
console.log(
chalk.green(
figlet.textSync("Node JS CLI", {
font: "Ghost",
horizontalLayout: "default",
verticalLayout: "default"
})
)
);
};
const askQuestions = () => {
const questions = [
{
name: "FILENAME",
type: "input",
message: "What is the name of the file without extension?"
},
{
type: "list",
name: "EXTENSION",
message: "What is the file extension?",
choices: [".rb", ".js", ".php", ".css"],
filter: function(val) {
return val.split(".")[1];
}
}
];
return inquirer.prompt(questions);
};
const createFile = (filename, extension) => {
const filePath = `${process.cwd()}/${filename}.${extension}`
shell.touch(filePath);
return filePath;
};
const success = filepath => {
console.log(
chalk.white.bgGreen.bold(`Done! File created at ${filepath}`)
);
};
const run = async () => {
// show script introduction
init();
// ask questions
const answers = await askQuestions();
const { FILENAME, EXTENSION } = answers;
// create the file
const filePath = createFile(FILENAME, EXTENSION);
// show success message
success(filePath);
};
run();
```
### 使用这个脚本
想要在其它地方执行这个脚本,在你的 `package.json` 文件中添加一个 `bin` 部分,并执行 `npm link`
```
{
"name": "creator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"chalk": "^2.4.1",
"figlet": "^1.2.0",
"inquirer": "^6.0.0",
"shelljs": "^0.8.2"
},
"bin": {
"creator": "./index.js"
}
}
```
执行 `npm link` 使得这个脚本可以在任何地方调用。
这就是是当你运行这个命令时的结果。
```
/usr/bin/creator -> /usr/lib/node_modules/creator/index.js
/usr/lib/node_modules/creator -> /home/hugo/code/creator
```
这会连接 `index.js` 作为一个可执行文件。这是完全可能的,因为这个 CLI 脚本的第一行是 `#!/usr/bin/env node`
现在我们可以通过执行如下命令来调用。
```
$ creator
```
### 总结
正如你所看到的Node.js 使得构建一个好的命令行工具变得非常简单。如果你希望了解更多内容,查看下列包。
* [meow][3]:一个简单的命令行助手工具
* [yargs][4]:一个命令行参数解析工具
* [pkg][5]:将你的 Node.js 程序包装在一个可执行文件中。
在评论中留下你关于构建命令行工具的经验吧!
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/node-js-interactive-cli
作者:[Hugo Dias][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[bestony](https://github.com/bestony)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/hugodias
[1]:https://nodejs.org/en/
[2]:https://www.npmjs.com/
[3]:https://github.com/sindresorhus/meow
[4]:https://github.com/yargs/yargs
[5]:https://github.com/zeit/pkg

View File

@ -1,15 +1,15 @@
Dbxfs - 在 Linux 中本地挂载 Dropbox 文件夹作为虚拟文件系统
dbxfs在 Linux 中本地挂载 Dropbox 文件夹
======
![](https://www.ostechnix.com/wp-content/uploads/2018/10/dbxfs-720x340.png)
不久前,我们总结了所有**[在本地挂载 Google Drive][1]**作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 **dbxfs**将 Dropbox 文件夹挂载到本地文件系统中。dbxfs 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[**安装 Dropbox 客户端**][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。dbxfs 是免费、开源的,并且是用 Python 3.5+ 编写的。
不久前,我们总结了所有 [在本地挂载 Google Drive][1] 作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 `dbxfs` 将 Dropbox 文件夹挂载到本地文件系统中。`dbxfs` 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[安装 Dropbox 客户端][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。`dbxfs` 是自由开源的,并且是用 Python 3.5+ 编写的。
### 安装 dbxfs
dbxfs 官方支持 Linux 和 Mac OS。但是它应该适用于任何提供 **FUSE 兼容库**或能够挂载 **SMB** 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 **pip3** 包管理器进行安装。如果尚未安装 PIP,请参阅以下指南。
`dbxfs` 官方支持 Linux 和 Mac OS。但是它应该适用于任何提供 **FUSE 兼容库**或能够挂载 SMB 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 pip3 包管理器进行安装。如果尚未安装 pip,请参阅以下指南。
[如何使用 pip 管理 Python 包][13]
- [如何使用 pip 管理 Python 包][13]
并且也要安装 FUSE 库。
@ -17,21 +17,18 @@ dbxfs 官方支持 Linux 和 Mac OS。但是它应该适用于任何提供 **
```
$ sudo apt install libfuse2
```
在 Fedora 上:
```
$ sudo dnf install fuse
```
安装完所有必需的依赖项后,运行以下命令以安装 dbxfs
安装完所有必需的依赖项后,运行以下命令以安装 `dbxfs`
```
$ pip3 install dbxfs
```
### 在本地挂载 Dropbox 文件夹
@ -40,29 +37,27 @@ $ pip3 install dbxfs
```
$ mkdir ~/mydropbox
```
然后,使用 dbxfs 在本地挂载 dropbox 文件夹,如下所示:
然后,使用 `dbxfs` 在本地挂载 dropbox 文件夹,如下所示:
```
$ dbxfs ~/mydropbox
```
你将被要求生成一个访问令牌:
![](https://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-1.png)
要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL然后单击**允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。
要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL然后单击 **允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。
下一个页面将生成新的授权码。复制代码并返回终端将其粘贴到 cli-dbxfs 提示符中以完成该过程。
然后,系统会要求你保存凭据以供将来访问。无论你是要保存还是拒绝,输入 **Y****N**。然后,你需要为新的访问令牌输入两次密码。
然后,系统会要求你保存凭据以供将来访问。根据你是要保存还是拒绝,输入 `Y``N`。然后,你需要为新的访问令牌输入两次密码。
最后,输入 **Y** 接受 **“/home/username/mydropbox”** 作为默认挂载点。如果你要设置不同的路径,输入 **N** 并输入你选择的位置。
最后,输入 `Y` 接受 `/home/username/mydropbox` 作为默认挂载点。如果你要设置不同的路径,输入 `N` 并输入你选择的位置。
[![Generate access token 2][3]][4]
![Generate access token 2][4]
完成了!从现在开始,你可以看到你的 Dropbox 文件夹已挂载到本地文件系统中。
@ -70,7 +65,7 @@ $ dbxfs ~/mydropbox
### 更改访问令牌存储路径
默认情况下dbxfs 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 **gpg** 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。
默认情况下,`dbxfs` 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 gpg 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。
![](https://www.ostechnix.com/wp-content/uploads/2018/10/access-token.png)
@ -78,30 +73,27 @@ $ dbxfs ~/mydropbox
![](https://www.ostechnix.com/wp-content/uploads/2018/10/Create-a-new-app.png)
创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [**Cryptomater**][6]、[**Cryptkeeper**][7]、[**CryptGo**][8]、[**Cryptr**][9]、[**Tomb**][10]、[**Toplip**][11] 和 [**GnuPG**][12] 等,并在你喜欢的位置保存。
创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [Cryptomater][6]、[Cryptkeeper][7]、[CryptGo][8]、[Cryptr][9]、[Tomb][10]、[Toplip][11] 和 [**GnuPG][12] 等,并在你喜欢的位置保存。
接下来编辑 dbxfs 配置文件并添加以下行:
```
"access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"]
```
你可以通过运行以下命令找到 dbxfs 配置文件:
```
$ dbxfs --print-default-config-file
```
有关更多详细信息,请参阅 dbxfs 帮助:
```
$ dbxfs -h
```
如你所见,使用 dbxfs 在你的文件系统中本地挂载 Dropfox 文件夹没什么大不了的。经过测试dbxfs 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。
如你所见,使用 `dbxfs` 在你的文件系统中本地挂载 Dropfox 文件夹并不复杂。经过测试,`dbxfs` 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。
就是这些了。希望这篇文章有用。还有更多好东西。敬请期待!
@ -116,7 +108,7 @@ via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-fil
作者:[SK][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -133,4 +125,4 @@ via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-fil
[10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/
[11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/
[12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/
[13]:https://www.ostechnix.com/manage-python-packages-using-pip/
[13]:https://www.ostechnix.com/manage-python-packages-using-pip/

View File

@ -1,21 +1,22 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10409-1.html)
[#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04)
[#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
如何在 Ubuntu 18.04 中启动到救援模式或紧急模式
======
![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png)
正如你可能已经知道的那样,**runlevel** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS中被 **systemd target** 替换。有关 runlevel 和 systemd target 的更多详细信息,请参阅[**本指南**][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。
正如你可能已经知道的那样,**运行级别** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS中被 **systemd 的目标** 替换。有关它们的更多详细信息,请参阅[这个指南][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。
### 什么是救援模式?
**救援模式**相当于使用 **SysV** 作为默认服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[**重置 root 密码**][2]。
**救援模式**相当于使用 **SysV** 作为默认服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[重置 root 密码][2]。
### 什么是紧急模式?
@ -23,13 +24,13 @@
### 在 Ubuntu 18.04 LTS 中进入救援模式
启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 **e** 进行编辑。
启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 `e` 进行编辑。
![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png)
如果你没有看到 Grub 菜单,只需在 BIOS logo 消失后立即按下 ESC 键。
如果你没有看到 Grub 菜单,只需在 BIOS logo 消失后立即按下 `ESC` 键。
找到以单词 **“linux”** 开头的行,并在该行的末尾添加以下行(要到达末尾,只需按下 **CTRL+e** 或使用 END 键或左右箭头键):
找到以单词 `linux` 开头的行,并在该行的末尾添加以下内容(要到达末尾,只需按下 `CTRL+e` 或使用 `END` 键或左右箭头键):
```
systemd.unit=rescue.target
@ -37,11 +38,11 @@ systemd.unit=rescue.target
![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png)
添加完成后,只需按下 **CTRL+x****F10** 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子:
添加完成后,只需按下 `CTRL+x``F10` 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子:
![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png)
接下来,输入以下命令将根 / 文件系统挂载成读/写模式。
接下来,输入以下命令将根 `/` 文件系统重新挂载成读/写模式。
```
mount -n -o remount,rw /
@ -49,15 +50,15 @@ mount -n -o remount,rw /
### 启动到紧急模式
将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 grub 菜单时将 “systemd.unit=rescue.target” 替换为 “systemd.unit=emergency.target” 即可。
将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 Grub 菜单时将 `systemd.unit=rescue.target` 替换为 `systemd.unit=emergency.target` 即可。
[![emergency mode][3]][4]
![emergency mode][4]
添加 “systemd.unit=emergency.target” 后,按下 **Ctrl+x****F10** 继续启动到紧急模式。
添加 `systemd.unit=emergency.target` 后,按下 `Ctrl+x``F10` 继续启动到紧急模式。
![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png)
最后,你可以使用以下命令将根文件系统挂载成读/写模式:
最后,你可以使用以下命令将根文件系统重新挂载成读/写模式:
```
mount -n -o remount,rw /
@ -65,7 +66,7 @@ mount -n -o remount,rw /
### 在救援模式和紧急模式之间切换
如果你处于救援模式,则不必像上面提到的那样编辑 grub 条目。相反,只需输入以下命令即可立即切换到紧急模式:
如果你处于救援模式,则不必像上面提到的那样编辑 Grub 条目。相反,只需输入以下命令即可立即切换到紧急模式:
```
systemctl emergency
@ -86,7 +87,6 @@ systemctl rescue
干杯!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/
@ -94,7 +94,7 @@ via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in
作者:[SK][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -103,4 +103,4 @@ via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in
[1]: https://www.ostechnix.com/check-runlevel-linux/
[2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/
[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png
[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png

View File

@ -1,28 +1,28 @@
[#]: collector: (lujun9972)
[#]: translator: (LazyWolfLin)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10406-1.html)
[#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS)
[#]: via: (https://itsfoss.com/update-ubuntu/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
如何更新 Ubuntu [终端及GUI方式] It's FOSS
初级:如何在终端及图形界面中更新 Ubuntu
======
**这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。**
> 这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。
如果你是一个新手并已经体验 Ubuntu 数天或几周,你可能想知道如何更新你的 [Ubuntu][1] 系统以获取安全补丁,错误修复和应用升级。
更新 Ubuntu 非常简单。我并不是瞎说。它简单得只要运行两个命令。让我来告诉你这两个命令的更多细节。
请注意,本教程适用于 Ubuntu 18.0416.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux MintLinux Liteelementary OS 等。
请注意,本教程适用于 Ubuntu 18.04、16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint、Linux Lite、elementary OS 等。
### 通过命令行更新 Ubuntu
![如何更新 Ubuntu][2]
在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你是登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。
在桌面上,打开终端。你可以在菜单里找到它或者使用 `Ctrl+Alt+T` [快捷键][3]。如果你是登录到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。
在终端里,你只需要使用以下命令:
@ -30,13 +30,13 @@
sudo apt update && sudo apt upgrade -y
```
它将询问密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。
它将询问密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。
现在,我来解释下上面的命令。
事实上,这不是一条命令。它由两条命令组成。符号 `&&` 是合并两条命令的一个方法,第二条命令仅在前一条命令执行成功时执行。
当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 yes。
当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 `yes`
请注意,你也可以逐条使用这两条命令:
@ -51,7 +51,7 @@ sudo apt upgrade
这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会被更新,而你的系统将不会知道是否有可用的新版本。
这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令会从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。
这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URL。这条命令会从对应的储存库你在输出中看到的 URL中获取软件包信息。
![更新 Ubuntu Linux][5]
@ -61,7 +61,7 @@ sudo apt upgrade
apt list --upgradable
```
**补充阅读:** 阅读这篇文章了解[命令 `apt update` 的输出中的 IgnHit 和 Get 是什么][6]。
**补充阅读:** 阅读这篇文章了解[命令 apt update 的输出中的 Ign、Hit 和 Get 是什么][6]。
#### 说明sudo apt upgrade
@ -69,17 +69,17 @@ apt list --upgradable
![通过命令行更新 Ubuntu Linux][7]
你可以键入 `yes``y` 或者只敲回车键去确认安装这些更新。
你可以键入 `yes``y` 或者只敲回车键去确认安装这些更新。
所以总的来说,`sudo apt update` 会检查可用的新版本,而 `sudo apt upgrade` 实际上会执行更新。
命令 `update` 可能会令人困惑,因为你可能期望通过命令 `apt update` 安装更新来更新系统,但这并不会发生。
### 通过 GUI 更新 Ubuntu[适用于桌面用户]
### 通过 GUI 更新 Ubuntu(适用于桌面用户)
如果你使用桌面版 Ubuntu你并不需要为了更新系统而打开终端。你可以仍可以使用命令行更新但这只是一个选择。
在菜单力,找到 `Software Updater` 并运行它。
在菜单里,找到 “软件更新” 并运行它。
![在 Ubuntu 中运行 Software Updater][8]
@ -91,7 +91,7 @@ apt list --upgradable
![在 Ubuntu 中通过更新管理器安装更新][10]
现在,点击 `Install`,它可能会向你询问密码。
现在,点击 “安装”,它可能会向你询问密码。
![通过 GUI 在 Ubuntu Linux 中安装更新][11]
@ -107,7 +107,7 @@ apt list --upgradable
![通过 GUI 在 Ubuntu 中安装更新][13]
提示:如果 `software updater` 返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。
提示:如果“软件更新”返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。
### 更新 Ubuntu 时要记住几件事
@ -125,7 +125,7 @@ sudo apt autoremove
如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将会是一个问题。
[热修复][15]功能允许Linux内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。
[热修复][15]功能允许 Linux 内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。
如果你在管理服务器,你可能需要[在 Ubuntu 中启用热修复][16]。
@ -148,7 +148,7 @@ via: https://itsfoss.com/update-ubuntu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[LazyWolfLin](https://github.com/LazyWolfLin)
校对:[校对者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,158 @@
[#]: collector: (lujun9972)
[#]: translator: (FSSlc)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10414-1.html)
[#]: subject: (McFly A Replacement To Ctrl+R Bash History Search Feature)
[#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
McFly利用神经网络为 Bash 提供历史命令搜索功能
======
![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png)
假如你在命令行模式下渡过了很长时间,那么你必定使用过或者听说过 BASH 的 **反向搜索** 功能,在 Bash 中执行反向搜索功能的快捷键是 `Ctrl+r`。通过使用这个特性,我们可以找到我们执行过的命令而无需再次输入它们。当然,你可以使用上下键来搜索你的 bash 命令记录,但使用 `Ctrl+r` 快捷键可以让这个搜索过程更简单快速。今天我找寻到了 Bash 历史命令搜索特性 `Ctrl+r` 的一个替代品,它就是 McFly。McFly 是一个使用 Rust 编程语言写就的简洁工具,自带一个智能的搜索引擎,用来替换默认的 `Ctrl+r` 这个 Bash 历史命令搜索功能。 McFly 提供的命令建议都是通过一个小巧的 **神经网络** 来实时排序给出的。
McFly 重新绑定了 `Ctrl+r` 快捷键,可以从你的 Bash 历史命令中找到所有最近执行过的命令。它通过追溯下面的信息来增强你的 shell 历史命令搜索特性:
* 命令结束状态
* 当你运行命令时的时间戳
* 以及你运行命令的执行目录
它将所有追溯的信息保存在一个 SQLite 数据库中。由于它追溯了命令的历史结束状态,所以你可以很轻易地忽略掉失败的命令。听起来很酷,对吧?
在给出一个命令建议时,它将考虑如下因素:
* 你在哪个目录执行的这个命令,将来你很有可能在相同的目录重复这个命令
* 在你执行这个命令之前,执行过什么命令
* 你执行这个命令有多频繁
* 你最后执行该命令的时间
* 你是否在 McFly 中选择过这个命令
* 以及这个命令的历史结束状态。因为你很有可能不会去执行失败过的命令,对吧?
McFly 维护着你的默认 Bash 历史文件所以你可以随时停止使用它。McFly 也并不只服务于 BASH 它也可以扩展到其他 shell 程序。
### 安装 McFly
在 Linux 中McFly 可以使用 Linuxbrew 来安装。如若你还没有安装过 Linuxbrew那么你可以参考下面的这个链接。LCTT 译注:从其 [GitHub 主页](https://github.com/cantino/mcfly)了解到也可以下载其二进制来使用。)
- [Linuxbrew一个用于 Linux 和 Mac OS X 的通用包管理][1]
一旦安装好了 Linuxbrew运行下面的命令来安装 McFly
```
$ brew tap cantino/mcfly https://github.com/cantino/mcfly
$ brew install mcfly
```
在安装完成后,你将看到下面的输出:
```
==> Installing mcfly from cantino/mcfly
==> Downloading https://github.com/cantino/mcfly/releases/download/v0.2.5/mcfly-v0
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.c
######################################################################## 100.0%
==> ONE MORE STEP! Edit ~/.bashrc and add the following:
if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then
. $(brew --prefix)/opt/mcfly/mcfly.bash
fi
🍺 /home/linuxbrew/.linuxbrew/Cellar/mcfly/v0.2.5: 4 files, 3.5MB, built in 33 seconds
```
![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png)
正如你上面看到的那样,在使用 McFly 之前我们需要再做一些配置。
将下面几行添加到你的 `~/.bashrc` 文件中:
```
if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then
. $(brew --prefix)/opt/mcfly/mcfly.bash
fi
```
最后,再运行下面的命令来让更改生效。
```
$ source ~/.bashrc
```
当你第一次执行上面的这个命令时,你的 BASH 历史将会被导入 McFly 的数据库。依据你的 bash 历史文件的大小,这个过程将花费一些时间。一旦导入完成,你讲看到下面的提示信息。
```
McFly: Importing Bash history for the first time. This may take a minute or two...done.
```
现在你就可以使用 McFly 了。
### 使用方法
要在你的命令历史中执行搜索,只需要键入 `mcfly search` 再加上命令名的一部分最后敲击回车键即可。Mcfly 将会基于你刚才键入的搜索查询语句给出命令建议。
```
$ mcfly search <part-of-the-command>
```
例如我键入了下面的命令:
```
$ mcfly search mk
```
下面展示的是我 Ubuntu 机子上的示例输出:
![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png)
如你所见,我已经使用过 `mkdir` 这个命令两次。假如你想从这些命令建议中执行其中之一,只需使用上下键来选择它,然后敲击**回车键**来执行它就可以了。假如你想编辑其中一个命令,则需要先选择它,然后敲 `TAB` 键将这个命令放置到终端中,最后在运行它之前更改它就行了。要从历史中删除已经选择的命令,按 `F2` 即可。
或者,输入下面的命令来打开历史搜索,然后输入任意一个命令或者命令的一部分来从你的历史命令中查看它提供的建议。
```
$ mcfly search
```
在你输入的同时, McFly 将会展示命令的提示。
下面是一个介绍 McFly 的简短演示视频:
![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif)
你还可以使用下面的命令来查看帮助:
```
$ mcfly --help
```
### 移除 McFly
不喜欢 McFly没问题可以使用下面的命令来移除它
```
$ brew uninstall mcfly
$ brew untap cantino/mcfly
```
最后,移除先前添加到 `~/.bashrc` 文件中的几行命令。
好了,这些就是所有了,更多精彩内容敬请期待,请保存关注!
干杯!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/
作者:[SK][a]
选题:[lujun9972][b]
译者:[FSSlc](https://github.com/FSSlc)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/linuxbrew-common-package-manager-linux-mac-os-x/

View File

@ -0,0 +1,101 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10418-1.html)
[#]: subject: (Working with tarballs on Linux)
[#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
在 Linux 上使用 tarball
======
> Tarball 提供了一种在 Linux 系统上备份和管理一组文件的通用方法。请按照以下提示了解如何创建它们,以及从中提取和删除单个文件。
![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg)
“tarball” LCTT 译注国内也常称为“tar 包”)一词通常用于描述备份一组选择的文件并将它们打包在一个文件中的一种文件格式。该名称来自 .tar 文件扩展名和 `tar` 命令,它用于将文件打包到一个文件中,有时还会压缩该文件,使其在移动到其它系统时更小。
tarball 通常用于备份个人或系统文件来创建存档特别是在进行可能需要撤消的更改之前。例如Linux 系统管理员通常会在更改应用之前创建包含一系列配置文件的 tarball以防必须撤消这些更改。从 tarball 中解压文件通常比在备份中搜索文件快。
### 如何在 Linux 上创建 tarball
使用如下命令,你可以在单条命令中创建 tarball 并压缩它。
```
$ tar -cvzf PDFs.tar.gz *.pdf
```
其结果是一个压缩文件gzip 压缩的),其中包含了当前目录中的所有 PDF 文件。当然,压缩是可选的。一个稍微简单的只是将 PDF 文件打包成未压缩 tarball 的命令:
```
$ tar -cvf PDFs.tar *.pdf
```
注意,选项中的 `z` 将文件变成压缩的。 `c` 表明创建文件,`v`(详细)表示你在命令运行时需要一些反馈。如果你不想查看列出的文件,请忽略 `v`
另一个常见的命名约定是给压缩的 tarball 命名成 .tgz 而不是双扩展名 .tar.gz如下所示
```
$ tar cvzf MyPDFs.tgz *.pdf
```
### 如何从 tarball 中解压文件
要从 gzip 压缩包中解压所有文件,你可以使用如下命令:
```
$ tar -xvzf file.tar.gz
```
如果使用 .tgz 命名约定,该命令将如下所示:
```
$ tar -xvzf MyPDFs.tgz
```
要从 gzip 包中解压单个文件,你可以执行几乎相同的操作,只需添加文件名:
```
$ tar -xvzf PDFs.tar.gz ShenTix.pdf
ShenTix.pdf
ls -l ShenTix.pdf
-rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf
```
如果未压缩 tarball你甚至可以从 tarball 中删除文件。例如,如果我们想从 PDFs.tar.gz 中删除我们上面解压过的文件,我们会这样做:
```
$ gunzip PDFs.tar.gz
$ ls -l PDFs.tar
-rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar
$ tar -vf PDFs.tar --delete ShenTix.pdf
$ ls -l PDFs.tar
-rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar
```
请注意,我们在删除 ShenTix.pdf 后,缩小了一点 tarball 文件占用的空间。如果我们想要,我们可以再次压缩文件:
```
$ gzip -f PDFs.tar
ls -l PDFs.tar.gz
-rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John
```
丰富的命令行选项使得 tarball 使用起来简单方便。
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html
作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.facebook.com/NetworkWorld/
[2]: https://www.linkedin.com/company/network-world

View File

@ -0,0 +1,64 @@
[#]: collector: (lujun9972)
[#]: translator: (zhs852)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10416-1.html)
[#]: subject: (Let your Linux terminal speak its mind)
[#]: via: (https://opensource.com/article/18/12/linux-toy-espeak)
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
让 Linux 终端说出它的想法
======
> eSpeak 是一个可在 Linux 命令行中使用的开源的 TTS 合成器。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ)
欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你可能不知道什么是 Linux 命令行小玩具。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。
或许你已经对一些玩具有了解了,不过我们相信,在本系列文章中总有那么几个你没见过的玩意。
年轻读者可能不知道,在 Alexa、Siri 或 Google Assistant 问世之前,计算机就能说话了。
我们也许永远不会忘记来自 [2001 太空漫游][1] 中与机组人员交流的 HAL 9000。但是在 1960 年代到今天的时间里,是存在着许多能说话的计算机的。它们有些很出色,也有些不那么出色。
其中一个我最爱的是一个叫做 [eSpeak][2] 的开源项目。它以多种形式发布,比如可以嵌入你自己项目中的库。与此同时,它也提供了可供你安装的命令行版本。在我所用的发行版中,安装十分简单,只需使用:
```
$ sudo dnf install espeak
```
你既可以与 eSpeak 交互,也可以用它来输出其它程序的信息,甚至通过简单的 `echo` 命令来使用它。[这里][3] 有一些可供 eSpeak 使用的声音文件,你可以在无聊时切换他们。甚者你可以制作一个属于你自己的声音。
在 2015 年,一些希望继续 eSpeak 开发的开发者创建了一个名为 eSpeak NG (即 “Next Generation”“下一代”的意思的项目。eSpeak 目前在 GPL v3 许可证下开源,你可以在 [SourceForge][2] 上详细了解这个项目或下载源代码。
别急,我今天还会介绍一个额外的小程序,它叫 [cava][4]。我经常希望用一张独一无二的截图作为我文章的头图更何况今天的玩具主要是关于声音的这就图片更少了。因此我需要一些东西来填补这些空白。Cava 是<ruby>基于 ALSA 的命令行音频可视化工具<rt>console-based audio visualizer for ALSA</rt></ruby>的简写(尽管它现在支持的比 ALSA 更多),它是一个优秀的命令行音频可视化工具,并且它正以 MIT 许可证开源。下面是一个将 eSpeak 输出可视化的命令:
```
$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak
```
![](https://opensource.com/sites/default/files/uploads/linux-toy-cava.gif)
你想让作者介绍你喜欢的命令行玩具吗?请前往原文下留言,作者可能会考虑介绍的。同时,你也可以去原文下评论你对文章的看法。
欢迎去看看我们昨天介绍的玩具,[在 Linux 命令行中使用 nudoku 解决谜题][5]。敬请期待我们明天的文章吧!
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/linux-toy-espeak
作者:[Jason Baker][a]
选题:[lujun9972][b]
译者:[zhs852](https://github.com/zhs852)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jason-baker
[b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_(film)
[2]: http://espeak.sourceforge.net/
[3]: http://espeak.sourceforge.net/voices.html
[4]: https://github.com/karlstav/cava
[5]: https://opensource.com/article/18/12/linux-toy-nudoku

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (zhs852)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10407-1.html)
[#]: subject: (Top 11 best Image Viewer for Ubuntu and other Linux)
[#]: via: (https://itsfoss.com/image-viewers-linux/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
@ -37,17 +37,18 @@ Linux 下最棒的 11 个图片查看器
Nomacs 是一款自由软件。虽然没有什么出众的功能,但是它的兼容性还不错,可以支持许多常见格式。
它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小)。除此之外,它还支持全屏模式、元数据调整等功能
它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小和裁剪)。除此之外,它还支持全屏模式、直方图,以及可以切换显示元数据、编辑历史等信息的许多面板
**我该如何安装它?**
简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub 界面][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装:
简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub ][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装:
```
sudo apt install nomacs
```
#### 2. Gnome 之眼
![Gnome 之眼][4]
**它有什么特点?**
@ -68,7 +69,7 @@ sudo apt install nomacs
sudo apt install eog
```
如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][5] 。
如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][5] 。
#### 3. EOM
@ -92,19 +93,20 @@ sudo apt install eog
sudo apt install eom
```
如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][7] 。
如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][7] 。
#### 4. Geeqie
![Geeqie 图像查看器][8]
**它有什么特点?**
* 可扩展
* 色彩信息显示
* 可扩展的灵活的图像查看器(其它的图像查看器支持它)
* 可以显示色彩信息
Geeqie 是一个令用户印象深刻的图片管理/查看器。支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。
Geeqie 是一个令用户印象深刻的图片管理/查看器。支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。
如果你希望获取图像的颜色信息、元数据,或是查看/管理一图片,它将会是一个不错的选择。
如果你希望获取图像的颜色信息、元数据,或是查看/管理一图片,它将会是一个不错的选择。
**我该如何安装它?**
@ -122,14 +124,14 @@ sudo apt install geeqie
**它有什么特点?**
* 多种功能(查看、编辑和管理)
* 功能(查看、编辑和管理)
* 可清除 EXIF 信息
* 图像格式转换
* 查找重复的图像
gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、颜色编辑等等)将会给你留下很深的印象。
gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、缩放、颜色编辑等等)将会给你留下很深的印象。
你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地编辑或转码图像。
你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地找到重复的图像或转码图像。
**我该如何安装它?**
@ -142,6 +144,7 @@ sudo apt install gthumb
输了没用?请参阅 [项目 GitHub 主页][11] 来获取帮助。
#### 6. Gwenview
![Gwenview 图像查看器][12]
**它有什么特点?**
@ -169,13 +172,13 @@ sudo apt install gwenview
**它有什么特点?**
* 可定制的 UI
* 可定制的基本用户界面
* 基本图像编辑工具
* 可在命令行使用
如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的查看器Mirage 是个不二之选。
如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的普通查看器Mirage 是个不二之选。
它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tifff 在内的多种图像格式。
它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tiff 在内的多种图像格式。
**我该如何安装它?**
@ -185,21 +188,22 @@ sudo apt install gwenview
sudo apt install mirage
```
访问 [项目 GitHub 页面][16] 来获取更多信息。
访问 [项目 GitHub 页面][16] 来获取更多信息。
#### 8. KPhotoAlbum
![KPhotoAlbum][17]
**它有什么特点?**
* 为图像添加标签
* 数据库支持
* 图片比较
* 合并/移除一堆图像
* 图片压缩
* 将图像合并到一组图像,或移除
确切地说KPhotoAlbum 其实不仅仅是一款图像查看器,它还能为图像添加标签并管理图像。
你可以用它来比较图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。
你可以用它来压缩图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。
**我该如何安装它?**
@ -231,7 +235,7 @@ Shotwell 是一个多功能照片管理器。在此,你能查看或管理你
sudo apt install shotwell
```
若想获取更多信息,请 [前往它的 GitHub 面][20]。
若想获取更多信息,请 [前往它的 GitHub 面][20]。
#### 10. Ristretto
@ -294,7 +298,7 @@ via: https://itsfoss.com/image-viewers-linux/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[zhs852](https://github.com/zhs852)
校对:[校对者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,83 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-10412-1.html)
[#]: subject: (Watch YouTube videos at the Linux terminal)
[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl)
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
在 Linux 终端上观看 YouTube 视频
======
> 视频只能在 GUI 下看么?再想想。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a)
我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你一直在看,如果没有,请回到[这里][1]开始,自己试试。你会发现 Linux 终端有很多游戏,消遣和奇怪的东西。
虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人至少有一个新事物。
今天我们要在昨天的玩具 [MPlayer][2] 上再加上一个 [youtube-dl][3]。
正如其名称所暗示的那样,`youtube-dl` 是一个用于下载 YouTube 视频的命令行程序,但它也可以从其他许多站点下载视频,而且它是一个有着[丰富文档][4]的功能齐全的程序,从而使视频获取变得容易。注意:请勿在任何违反你所在司法辖区的版权法的情况下使用 `youtube-dl`
`youtube-dl` 使用的是 [Unlicense][5] 这个公共领域许可,类似于 Creative Common 的 [CC0][6]。这里还有哪些公共领域贡献适用于开源领域的[法律意见][7],但它通常被认为与现有的开源许可证兼容,即使是不推荐使用它的组织也是如此。
最简单地,我们将使用 `youtube-dl` 来获取视频以便在终端中播放。首先,使用适用于你发行版的方法[安装][8]它。对我来说,在 Fedora 中,它被打包在我的仓库中,因此安装非常简单:
```
$ sudo dnf install youtube-dl
```
然后获取一个视频。YouTube 允许你按照许可证进行搜索,所以今天我们将根据知识共享署名许可证查看来自 [Gemmy's Videos][10] 中的壁炉[视频][9]。对于 YouTube 视频,你可以像这样用文件 ID 下载,我们也可以指定输出文件名。我故意选择了一个短片,因为长视频会变得很大!
```
$ youtube-dl pec8P5K4s8c -o fireplace.mp4
```
如果你昨天没有安装 [MPlayer][2],请继续安装好,如果你之前没有安装 libcaca 则需要安装它。如果你直接用 MPlayer 在命令行中播放视频 ( `$ mplayer fireplace.webm` ),它能够播放,但是会在一个自己的窗口中,这不是我们想要的。
首先,我设置将 libcaca 强制使用 ncurses 作为显示驱动,使输出保持在我的终端:
```
$ export CACA_DRIVER=ncurses
```
然后,我放大了终端(“像素”越多越好),并使用以下命令播放文件(强制使用 libcaca 并静默 MPlayer 的文本输出):
```
$ mplayer -really-quiet -vo caca fireplace.mp4
```
这就完成了!
![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif)
你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。
一定要看看昨天的玩具,[在 Linux 终端收听广播][2],明天还要再来!
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/linux-toy-youtube-dl
作者:[Jason Baker][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/jason-baker
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/12/linux-toy-boxes
[2]: https://linux.cn/article-10393-1.html
[3]: https://rg3.github.io/youtube-dl/
[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme
[5]: https://unlicense.org/
[6]: https://creativecommons.org/share-your-work/public-domain/cc0/
[7]: https://opensource.org/faq#public-domain
[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation
[9]: https://www.youtube.com/watch?v=pec8P5K4s8c
[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A

View File

@ -5,13 +5,7 @@ cd "$(dirname "$0")/../.." # 进入TP root
function file-translating-p ()
{
local file="$*"
if head -n 1 "${file}" |grep '\[^#\]:'>/dev/null 2>&1 ;then
# 新模板
head -n 12 "$file" |grep -v '\[^#\]:' |grep -E -i "translat|fanyi|翻译" >/dev/null 2>&1
else
# 旧模板
head -n 3 "$file" |grep -E -i "translat|fanyi|翻译" >/dev/null 2>&1
fi
head -n 3 "$file" | grep -iE "^[^[].*translat|^\[#\]: translator: \([^[:space:]]+\)|fanyi|翻译" >/dev/null 2>&1
}
function get_status_of()
{

View File

@ -1,87 +0,0 @@
translating by WangYueScream
===========================
8 reasons to use the Xfce Linux desktop environment
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22)
For several reasons (including curiosity), a few weeks ago I started using [Xfce][1] as my Linux desktop. One reason was trouble with background daemons eating up all the CPU and I/O bandwidth on my very powerful main workstation. Of course, some of the instability may be due to my removal of some of the RPM packages that provide those background daemons. However, even before I removed the RPMs, the fact is KDE was unstable and causing performance and stability issues. I needed to use a different desktop to avoid these problems.
I realized in looking back over my series of articles on Linux desktops that I had neglected Xfce. This article is intended to rectify that oversight. I like Xfce a lot and am enjoying the speed and lightness of it more than I thought I would.
As part of my research, I googled to try to learn what Xfce means. There is a historical reference to XForms Common Environment, but Xfce no longer uses the XForms tools. Some years ago, I found a reference to "Xtra fine computing environment," and I like that a lot. I will use that (despite not being able to find the page reference again).
### Eight reasons for recommending Xfce
#### 1\. Lightweight construction
Xfce has a very small memory footprint and CPU usage compared to some other desktops, such as KDE and GNOME. On my system, the programs that make up the Xfce desktop take a tiny amount of memory for such a powerful desktop. Very low CPU usage is also a hallmark of the Xfce desktop. With such a small memory footprint, I am not especially surprised that Xfce is also very sparing of CPU cycles.
#### 2\. Simplicity
The Xfce desktop is simple and uncluttered with fluff. The basic desktop has two panels and a vertical line of icons on the left side. Panel 0 is at the bottom and consists of some basic application launchers, as well as the Applications icon, which provides access to all the applications on the system. Panel 1 is at the top and has an Applications launcher as well as a Workspace Switcher that allows the user to switch between multiple workspaces. The panels can be modified with additional items, such as new launchers, or by altering their height and width.
The icons down the left side of the desktop consist of the Home directory and Trash icons. It can also display icons for the complete filesystem directory tree and any connected pluggable USB storage devices. These icons can be used to mount and unmount the device, as well as to open the default file manager. They can also be hidden if you prefer, and the Filesystem, Trash, and Home directory icons are separately controllable. The removable drives can be hidden or displayed as a group.
#### 3\. File management
Thunar, Xfce's default file manager, is simple, easy to use and configure, and very easy to learn. While not as fancy as file managers like Konqueror or Dolphin, it is quite capable and very fast. Thunar can't create multiple panes in its window, but it does provide tabs so multiple directories can be open at the same time. Thunar also has a very nice sidebar that, like the desktop, shows the same icons for the complete filesystem directory tree and any connected USB storage devices. Devices can be mounted and unmounted, and removable media such as CDs can be ejected. Thunar can also use helper applications such as Ark to open archive files when they are clicked. Archives, such as ZIP, TAR, and RPM files, can be viewed, and individual files can be copied out of them.
![Xfce desktop][3]
The Xfce desktop with Thunar and the Xfce terminal emulator.
Having used many different applications for my [series on file managers][4], I must say that I like Thunar for its simplicity and ease of use. It is easy to navigate the filesystem using the sidebar.
#### 4\. Stability
The Xfce desktop is very stable. New releases seem to be on a three-year cycle, although updates are provided as necessary. The current version is 4.12, which was released in February 2015. The rock-solid nature of the Xfce desktop is very reassuring after having issues with KDE. The Xfce desktop has never crashed for me, and it has never spawned daemons that gobbled up system resources. It just sits there and works—which is what I want.
#### 5\. Elegance
Xfce is simply elegant. In my new book, The Linux Philosophy for SysAdmins, which will be available this fall, I talk about the many advantages of simplicity, including the fact that simplicity is one of the hallmarks of elegance. Clearly, the programmers who write and maintain Xfce and its component applications are great fans of simplicity. This simplicity is very likely the reason that Xfce is so stable, but it also results in a clean look, a responsive interface, an easily navigable structure that feels natural, and an overall elegance that makes it a pleasure to use.
#### 6\. Terminal emulation
The Xfce4 terminal emulator is a powerful emulator that uses tabs to allow multiple terminals in a single window, like many other terminal emulators. This terminal emulator is simple compared to emulators like Tilix, Terminator, and Konsole, but it gets the job done. The tab names can be changed, and the tabs can be rearranged by drag and drop, using the arrow icons on the toolbar, or selecting the options on the menu bar. One thing I especially like about the tabs on the Xfce terminal emulator is that they display the name of the host to which they are connected regardless of how many other hosts are connected through to make that connection, e.g., `host1==>host2==>host3==>host4` properly shows `host4` in the tab. Other emulators show `host2` at best.
Other aspects of its function and appearance can be easily configured to suit your needs. Like other Xfce components, this terminal emulator uses very little in the way of system resources.
#### 7\. Configurability
Within its limits, Xfce is very configurable. While not offering as much configurability as a desktop like KDE, it is far more configurable (and more easily so) than GNOME, for example. I found that the Settings Manager is the doorway to everything needed to configure Xfce. The individual configuration apps are separately available, but the Settings Manager collects them all into one window for ease of access. All the important aspects of the desktop can be configured to meet my needs and preferences.
#### 8\. Modularity
Xfce has a number of individual projects that make up the whole, and not all parts of Xfce are necessarily installed by your distro. [Xfce's projects][5] page lists the main projects, so you can find additional parts you might want to install. The items that weren't installed on my Fedora 28 workstation when I installed the Xfce group were mostly the applications at the bottom of that page.
There is also a [documentation page][6], and a wiki called [Xfce Goodies Project][7] lists other Xfce-related projects that provide applications, artwork, and plugins for Thunar and the Xfce panels.
### Conclusions
The Xfce desktop is thin and fast with an overall elegance that makes it easy to figure out how to do things. Its lightweight construction conserves both memory and CPU cycles. This makes it ideal for older hosts with few resources to spare for a desktop. However, Xfce is flexible and powerful enough to satisfy my needs as a power user.
I've learned that changing to a new Linux desktop can take some work to configure it as I want—with all of my favorite application launchers on the panel, my preferred wallpaper, and much more. I have changed to new desktops or updates of old ones many times over the years. It takes some time and a bit of patience.
I think of it like when I've moved cubicles or offices at work. Someone carries my stuff from the old office to the new one, and I connect my computer, unpack the boxes, and place their contents in appropriate locations in my new office. Moving into the Xfce desktop was the easiest move I have ever made.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/6/xfce-desktop
作者:[David Both][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者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
[1]:https://xfce.org/
[2]:/file/401856
[3]:https://opensource.com/sites/default/files/uploads/xfce-desktop-01.png (Xfce desktop)
[4]:https://opensource.com/sitewide-search?search_api_views_fulltext=David%20Both%20File%20managers
[5]:https://xfce.org/projects
[6]:https://docs.xfce.org/
[7]:https://goodies.xfce.org/

View File

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

View File

@ -0,0 +1,145 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Plans to learn a new tech skill in 2019? What you need to know)
[#]: via: (https://opensource.com/article/18/12/tech-skills-online-learning)
[#]: author: (David Clinton https://opensource.com/users/remyd)
Plans to learn a new tech skill in 2019? What you need to know
======
Go on a tour of the current state of online technology education.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/learn-programming-code-keyboard.png?itok=xaLyptT4)
Open source software is, by definition, free. But it can sometimes cost you a king's ransom to learn how to master it. The good news? The open source ethos is alive and well in the education sector, and there are plenty of high-quality learning resources available. You just need to know where to find them.
This article—adapted from my book, [Solving for Technology: How to quickly learn valuable new skills in a madly changing technology world][1]—offers some thoughts on what's out there and how to get the most out of it.
How do you learn best—video courses? Hands-on interactive classes? And what are you usually looking for when you go hunting for knowledge—fast fixes to immediate problems? Deep understanding of an entire technology? Quick and dirty getting-starting guides?
Whatever you're after, you're more likely to find it if you know what's out there. So keep your mind open to the many categories of teaching tools that exist, and join me for a tour of the current state of online technology education.
### freeCodeCamp
Most of the heavily edited, peer-reviewed courses available online live behind paywalls—but not all. [freeCodeCamp][2], as its name suggests, is free. And by free, I don't mean the site exists to drive traffic to some revenue-generating web page—it's completely free, simply because its creators believe such opportunities should exist.
The idea behind freeCodeCamp is that "campers" work their way through realistic projects centered around coding challenges. But this site is different in a few important ways. First, campers are encouraged to join other local campers so they can code in mutually supportive groups. Once they've worked through the Front End, Data Visualization, Back End, or Full Stack certifications, campers are also encouraged to gain real-world experience by coding for non-profits. Finally, freeCodeCamp guides graduates through the job search and interviewing stages of their young careers.
### YouTube
Wondering how to change the bulb on the passenger-side brake light on your 2010 Dodge Caravan (3.8L)? There's a YouTube video that'll show you. Need to replace the pressure sensor on your ten-year-old Carrier forced-air natural gas furnace? There's another YouTube video that'll show you how to do that. In fact, there's a selection of YouTube videos that can show you how to do just about anything you can imagine—and a great many things you can't (and perhaps shouldn't).
Got a specific problem that's blocking your progress? Looking for a bird's eye overview of your next language? Someone out there has probably already been there and recorded the solution in a video. Also, keep an eye out for video authors you like and subscribe to their YouTube channels. That makes it easier to find more useful content.
Perhaps the most famous and successful YouTube channel of all is Salman Khan's [Khan Academy][3]. Although it's primarily aimed at K-12 students, there's plenty of useful content for people taking their first steps in programming (or physics or electrical engineering, for that matter).
### Top 4 MOOCs
The cost of traditional higher education programs has ballooned in recent decades. Currently, a four-year degree in the US can cost about five times the median annual household income in 2016 (around $59,000). Even if your degree ends up earning you an extra $20,000 per year beyond what you would have earned without it, it would still take you more than ten years just to break even (and perhaps many additional years to pay off the actual interest-carrying debt).
Investments like that might not make a lot of sense. But what if you could get the same knowledge at no cost at all?
Welcome to the world of the massive open online course (MOOC). A MOOC is a platform through which existing educational institutions deliver course content to anyone on the internet who's interested.
By joining a MOOC, you can view video recordings of lectures from some of the best professors at elite universities and engage in simulated interactive labs, all at no cost and from the comfort of your own home. In many cases, you can also receive credit or certification for successfully completing a course. Certification often does carry some charges, but they are much lower than what you'd pay for a traditional degree.
The downside—although not everyone will consider this a downside—is that many university-based MOOCs are less job- and industry-focused and spend more time on general theory. They sometimes also expect you to have already mastered some prerequisite STEM skills.
Here are four major MOOC portals:
* [**Coursera**][4]: Taking the 4- to 10-week Coursera courses is free, including quizzes and exercises. But they also offer fee-based add-ons such as assessments, grades, and certification. Specializations are multiple Coursera courses organized into a larger program like Data Science or Deep Learning. To earn a specialization certificate, students must complete a capstone project at the end. Coursera categories include Computer Science, Data Science, and Information Technology.
* [**edX**][5]: Originally created by MIT and Harvard University, edX is a non-profit organization that delivers courseware created by more than 100 universities and colleges. Students may audit a course for free, or for a reasonable fee, gain verified certificates of completion.
* [**MIT OpenCourseWare**][6]: OpenCourseWare isn't really a learning platform, and it won't help you much if you're looking for an organized guide through a particular topic. Rather, it's an online repository containing notes, quizzes, and some videos from thousands of MIT courses. The content can give you insights into specific questions, and if you're ambitious and determined enough, you could mine entire topics from the rich resources you'll find.
* [**Udacity**][7]: I included Udacity in this higher education section because that's where its roots lie. But while the project's founders came from the Stanford University faculty, it was originally something of a rebellion against the high costs and distracting bloat of many university degree programs. Rather than spending four (or more) years studying material that's largely out of sync with the demands of the real job market, it proposes, why not focus on the skills the industry is looking for and get it done in much less time and for a tiny fraction of the cost?
Udacity currently offers a couple dozen or so nano-degrees that can get to you beyond entry-level competence in some high-demand fields in just a few months. Because the nano-degrees are created with the direct involvement of major industry employers like Amazon, Nvidia, and Google, hard-working graduates have a decent chance of quickly landing a great job.
### Tips for using the internet
There's a world of help waiting for you out there. Don't miss it. A few tips:
#### Learn to compose smart search strings
Internet search is much more than simply typing a few related words into the search field and hitting Enter. Here are some powerful tips that will work on any major search engine (my personal favorite is [DuckDuckGo][8]):
#### Use your problem to find a solution
Thousands of people have worked with the same technology youre learning, and odds are at least some of them have encountered the same problems you have. And at least a few of those folks will likely have posted their questions to an online user forum like Stack Overflow. The quickest way to find the answers they found is to search using the same language that you encountered.
Did your problem generate an error message? Paste that exact text into your search engine. Were there any log messages? Post those, too.
#### Be precise
The internet has billions of pages, and vague search results are bound to include a lot of false positives, so be as precise as possible. One powerful trick: Enclose your error message in quotation marks, which tells the search engine that youre looking for an exact phrase rather than a single result containing all or most of the words somewhere on the page. Just dont be so specific that you end up narrowing your results down to zero.
As an example, for an entry from the Apache error log like this:
`[Fri Dec 16 02:15:44 2017] [error] [client 54.211.9.96] Client sent malformed Host header`
Leave out the date and client IP address because theres no way anyone else got those exact details. Instead, include only the `"Client sent..."` part (in quotations):
`"Client sent malformed Host header"`
If thats still too broad, consider adding the strings `Apache` and `[error]` outside the quotation marks:
`"Client sent malformed Host header" apache [error]`
#### Be timely
Search engines let you narrow down your search by time. If your problem is specific to a relatively recent release version, restrict your search to only the last week or month.
#### Search in all the right places
Sometimes an outside search engine will do a better job searching through a large website than the sites own internal tool (Im looking at you, Government of Canada). If you feel the solution to your problem is likely to be somewhere on a particular site—like Stack Overflows admin cousin, Server Fault—but you cant find it, restrict results to only that one site:
`"gssacceptsec_context(2) failed:" site:serverfault.com`
#### Leverage public code samples
Are you stuck in a way that only a developer can be stuck? You've read your code through over and over again and you just can't find the error. You've tried at least a half a dozen different design approaches and even—briefly, mind you—an entirely different language. Nothing. The application isn't working.
Haunt GitHub and other places where public repositories of code live. They're all searchable and filled with examples of great code. Of course, there will also be plenty of examples of really bad and even malicious code, so keep your guard up.
Browsing through other people's code is a great way to get new ideas and learn about best practices and coding patterns. If your search engine skills are as good as I'm guessing, then you'll probably uncover working solutions to whatever it is that ails you.
### More free stuff
You don't have to do this all by yourself. Before embarking on a significant new learning project, take a good look at your community and government to see what services are available.
Many governments offer support—both financial and practical—for people looking to upgrade their professional skills. There are also more and more state/provincial governments joining the open textbook movement, where well-written, up-to-date technical textbooks are made freely available on the internet. At this point, the quality of most collections looks a bit spotty, but the long-term goal is to cut the cost of an education by many hundreds of dollars.
Your company might be willing to sponsor your learning. Many companies provide their employees with accounts to online learning sites; sometimes it's just a matter of asking your boss or HR rep what is available.
And what about your community? You might be surprised at how many older, experienced professionals are eager to engage in mentoring. It might take a bit of courage, but go ahead and approach someone you admire to see what wisdom and practical guidance they might offer.
This article was adapted from the book [Solving for Technology: How to quickly learn valuable new skills in a madly changing technology world][1]. As an exclusive offer to the opensource.com community, feel free to [download a PDF version of the full book][9].
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/tech-skills-online-learning
作者:[David Clinton][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/remyd
[b]: https://github.com/lujun9972
[1]: https://learntech.bootstrap-it.com/
[2]: https://www.freecodecamp.org/
[3]: https://www.khanacademy.org/
[4]: https://www.coursera.org/
[5]: https://www.edx.org/
[6]: http://ocw.mit.edu/index.htm
[7]: https://www.udacity.com/
[8]: https://duckduckgo.com/
[9]: https://learntech.bootstrap-it.com/download.html

View File

@ -1,3 +1,4 @@
Moelf translating
Managing Digital Files (e.g., Photographs) in Files and Folders
======
Update 2014-05-14: added real world example

View File

@ -1,140 +0,0 @@
Translating by robsean
Best Websites to Download Linux Games
======
Brief: New to Linux gaming and wondering where to **download Linux games** from? We list the best resources from where you can **download free Linux games** as well as buy premium Linux games.
Linux and Games? Once upon a time, it was hard to imagine these two going together. Then time passed and a lot of things happened. Fast-forward to the present, there are thousands and thousands of games available for Linux and more are being developed by both big game companies and independent developers.
[Gaming on Linux][1] is real now and today we are going to see where you can find games for Linux platform and hunt down the games that you like.
### Where to download Linux games?
![Websites to download Linux games][2]
First and foremost, look into your Linux distribution's software center (if it has one). You should find plenty of games there already.
But that doesn't mean you should restrict yourself to the software center. Let me list you some websites to download Linux games.
#### 1. Steam
If you are a seasoned gamer, you have heard about Steam. Yes, if you don't know it already, Steam is available for Linux. Steam recommends Ubuntu but it should run on other major distributions too. And if you are really psyched up about Steam, there is even a dedicated operating system for playing Steam games - [SteamOS][3]. We covered it last year in the [Best Linux Gaming Distribution][4] article.
![Steam Store][5]
Steam has the largest games store for Linux. While writing this article, it has exactly 3487 games on Linux platform and that's really huge. You can find games from wide range of genre. As for [Digital Rights Management][6], most of the Steam games have some kind of DRM.
For using Steam either you will have to install the [Steam client][7] on your Linux distribution or use SteamOS. One of the advantages of Steam is that, after your initial setup, for most of the games you wouldn't need to worry about dependencies and complex installation process. Steam client will do the heavy tasks for you.
[Steam Store][8]
#### 2. GOG
If you are solely interested in DRM-free games, GOG has a pretty large collection of it. At this moment, GOG has 1978 DRM-free games in their library. GOG is kind of famous for its vast collection of DRM-free games.
![GOG Store][9]
Officially, GOG games support Ubuntu LTS versions and Linux Mint. So, Ubuntu and its derivatives will have no problem installing them. Installing them on other distributions might need some extra works, such as - installing correct dependencies.
You will not need any extra clients for downloading games from GOG. All the purchased games will be available in your accounts section. You can download them directly with your favorite download manager.
[GOG Store][10]
#### 3. Humble Store
The Humble Store is another place where you can find various games for Linux. There are both DRM-free and non-DRM-free games available on Humble Store. The non-DRM-free games are generally from the Steam. Currently there are about 1826 games for Linux in the Humble Store.
![The Humble Store][11]
Humble Store is famous for another reason though. They have a program called [**Humble Indie Bundle**][12] where they offer a bunch of games together with a compelling discount for a limited time period. Another thing about Humble is that when you make a purchase, 10% of the revenue from your purchase goes to charities.
Humble doesn't have any extra clients for downloading their games.
[The Humble Store][13]
#### 4. itch.io
itch.io is an open marketplace for independent digital creators with a focus on independent video games. itch.io has some of the most interesting and unique games that you can find. Most games available on itch.io are DRM-free.
![itch.io Store][14]
Right now, itch.io has 9514 games available in their store for Linux platform.
itch.io has their own [client][15] for effortlessly downloading, installing, updating and playing their games.
[itch.io Store][16]
#### 5. LGDB
LGDB is an abbreviation for Linux Game Database. Though technically not a game store, it has a large collection of games for Linux along with various information about them. Every game is documented with links of where you can find them.
![Linux Game Database][17]
As of now, there are 2046 games entries in the database. They also have very long lists for [Emulators][18], [Tools][19] and [Game Engines][20].
[LGDB][21]
[Annoying Experiences Every Linux Gamer Never Wanted!][27]
#### 6. Game Jolt
Game Jolt has a very impressive collection with about 5000 indie games for Linux under their belt.
![GameJolt Store][22]
Game Jolt has an (pre-release) [client][23] for downloading, installing, updating and playing games with ease.
[Game Jolt Store][24]
### Others
There are many other stores that sells Linux Games. Also there are many places you can find free games too. Here are a couple of them:
* [**Bundle Stars**][25]: Bundle Stars currently has 814 Linux games and 31 games bundles.
* [**GamersGate**][26]: GamersGate has 595 Linux games as for now. There are both DRM-free and non-DRM-free games.
#### App Stores, Software Center & Repositories
Linux distribution has their own application stores or repositories. Though not many, but there you can find various games too.
That's all for today. Did you know there are this many games available for Linux? How do you feel about this? Do you use some other websites to download Linux games? Do share your favorites with us.
--------------------------------------------------------------------------------
via: https://itsfoss.com/download-linux-games/
作者:[Munif Tanjim][a]
译者:[译者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/munif/
[1]:https://itsfoss.com/linux-gaming-guide/
[2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg
[3]:http://store.steampowered.com/steamos/
[4]:https://itsfoss.com/linux-gaming-distributions/
[5]:https://itsfoss.com/wp-content/uploads/2017/05/Steam-Store-800x382.jpg
[6]:https://www.wikiwand.com/en/Digital_rights_management
[7]:http://store.steampowered.com/about/
[8]:http://store.steampowered.com/linux
[9]:https://itsfoss.com/wp-content/uploads/2017/05/GOG-Store-800x366.jpg
[10]:https://www.gog.com/games?system=lin_mint,lin_ubuntu
[11]:https://itsfoss.com/wp-content/uploads/2017/05/The-Humble-Store-800x393.jpg
[12]:https://www.humblebundle.com/?partner=itsfoss
[13]:https://www.humblebundle.com/store?partner=itsfoss
[14]:https://itsfoss.com/wp-content/uploads/2017/05/itch.io-Store-800x485.jpg
[15]:https://itch.io/app
[16]:https://itch.io/games/platform-linux
[17]:https://itsfoss.com/wp-content/uploads/2017/05/LGDB-800x304.jpg
[18]:https://lgdb.org/emulators
[19]:https://lgdb.org/tools
[20]:https://lgdb.org/engines
[21]:https://lgdb.org/games
[22]:https://itsfoss.com/wp-content/uploads/2017/05/GameJolt-Store-800x357.jpg
[23]:http://gamejolt.com/client
[24]:http://gamejolt.com/games/best?os=linux
[25]:https://www.bundlestars.com/en/games?page=1&platforms=Linux
[26]:https://www.gamersgate.com/games?state=available
[27]:https://itsfoss.com/linux-gaming-problems/

View File

@ -1,135 +0,0 @@
How to create a free baby monitoring system with Gonimo
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE)
New and expecting parents quickly learn that there is a long--and expensive--list of equipment that a new baby needs. High on that list is a baby monitor, so they can keep an eye (and an ear) on their infant while they're doing other things. But this is one piece of equipment that doesn't have to eat into your baby fund; Gonimo is a free and open source solution that turns existing devices into a baby monitoring system, freeing up some of your baby budget for any of the thousands of other must-have or trendy items lining the aisles of the nearby big-box baby store.
Gonimo was born when its developer, an open source fan, had twins and found problems with the existing options:
* Status-quo hardware baby monitors are expensive, have limited range, and require you to carry extra devices.
* There are mobile monitoring apps, but most of the existing iOS/Android baby monitoring apps are unreliable and unsecure, with no obvious open source product in sight.
* If you have two young children (e.g., twins), you'll need two monitors, doubling your costs.
Gonimo was created as an open source solution to the shortcomings of typical monitors:
* Expensive? Nope, it is free!
* Limited range? No, it works with internet/WiFi, wherever you are.
* Download and install apps? Uh-uh, it works in your existing web browser.
* Buy new devices? No way, you can use any laptop, mobile phone, or tablet with a web browser and a microphone and/or camera.
(Note: Apple iOS devices are unfortunately not yet supported, but that's expected to change very soon--read on for how you can help make that happen.)
### Get started
Transforming your devices into a baby monitor is easy. From your device's browser (ideally Chrome), visit [gonimo.com][1] and click Start baby monitor to get to the web app.
1. **Create family:** On the first-time startup screen, you will see a cute rabbit running on the globe. This is where you create a new family. Hit the **+** button and either accept the randomly generated family name or type in your own choice.
![Start screen][3]
Create a new family from the start screen
1. **Invite devices:** After you've set up your family, the next screen directs you to invite another device to join your Gonimo family. There is a one-time invitation link that you can directly send via email or copy and paste into a message. From the other device, simply open the link and accept the invitation. Repeat this process for any other devices you'd like to invite to your family. Your devices are now in the same family, ready to cooperate as a fully working baby monitor system.
![Invite screen][5]
Invite family members
1. **Start baby station stream:** Next, choose which device will stream the baby's audio and video to the parent station by going to the [Gonimo home screen][6], clicking on the button with the pacifier, and giving the web browser permission to access the device's microphone and camera. Adjust the camera to point at your baby's bed, or turn it off to save device battery (audio will still be streamed). Hit Start. The stream is now active.
![Select baby station][8]
Select the baby station
![Press Start][10]
Press Start to stream video.
1. **Connect to parent station stream:** To view the baby station stream, go to another device in your Gonimo family --this is the parent station. Hit the "parent" button on the Gonimo home screen. You will see a list of all the devices in the family; next to the one with the active baby station will be a pulsing Connect button. Select Connect, and you can see and hear your baby over a peer-to-peer audio/video stream. A volume bar provides visualization for the transmitted audio stream.
![Select parent station][12]
Select parent station
![Press Connect][14]
Press Connect to start viewing the baby stream.
1. **Congratulations!** You have successfully transformed your devices into a baby monitor directly over a web browser without downloading or installing any apps!
For more information and detailed descriptions about renaming devices, removing devices from a family, or deleting a family, check out the [video tutorial][15] at gonimo.com.
### Flexibility of the family system
One of Gonimo's strengths is its family-based system, which offers enormous flexibility for different kinds of situations that aren't available even in commercial Android or iOS apps. To dive into these features, let's assume that you have created a family that consists of three devices.
* **Multi-baby:** What if you want to keep an eye on your two young children who sleep in separate rooms? Put a device in each child's room and set them as baby stations. The third device will act as the parent station, on which you can connect to both streams and see your toddlers via split screen. You can even extend this use case to more than two baby stations by inviting more devices to your family and setting them up as baby stations. As soon as your parent station is connected to the first baby station, return to the Device Overview screen by clicking the back arrow in the top left corner. Now you can connect to the second (and, in turn, the third, and fourth, and fifth, and so on) device, and the split screen will be established automatically. Voila!
* **Multi-parent:** What if daddy wants to watch the children while he's at work? Just invite a fourth device (e.g., his office PC) to the family and set it up as a parent station. Both parents can check in on their children simultaneously from their own devices, even independently choosing to which stream(s) they wish to connect.
* **Multi-family:** A single device can also be part of several families. This is very useful when your baby station is something that's always with you, such as a tablet, and you frequently visit relatives or friends. Create another family for "Granny's house" or "Uncle John's house," which consists of your baby station device paired with Granny's or Uncle John's devices. You can switch the baby station device among those families, whenever you want, from the baby station device's Gonimo home screen.
### Want to participate?
The Gonimo team loves open source. Code from the community, for the community. Gonimo's users are very important to us, but they are only one part of the Gonimo story. Creative brains behind the scenes are the key to creating a great baby monitor experience.
Currently we especially need help from people who are willing to be iOS 11 testers, as Apple's support of WebRTC in iOS 11 means we will finally be able to support iOS devices. If you can, please help us realize this awesome milestone.
If you know Haskell or want to learn it, you can check out [our code at GitHub][16]. Pull requests, code reviews, and issues are all welcome.
And, finally, please help by spreading the word to new parents and the open source world that the Gonimo baby monitor is simple to use and already in your pocket.
### About The Author
Robert Klotzner;I Am Father Of Twins;A Programmer. Once I Heard That Ordinary People Can Actually Program Computers;I Bought A Page Book About C;Started Learning;I Was Fifteen Back Then. I Sticked With C;For Quite A While;Learned Java;Went Back To C
--------------------------------------------------------------------------------
via: https://opensource.com/article/17/9/gonimo
作者:[Robert Klotzner][a]
译者:[译者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/robert-klotzner
[1]:https://gonimo.com/
[2]:/file/371256
[3]:https://opensource.com/sites/default/files/u128651/start-screen.png (Start screen)
[4]:/file/371236
[5]:https://opensource.com/sites/default/files/u128651/invite-screen.png (Invite screen)
[6]:https://app.gonimo.com/
[7]:/file/371231
[8]:https://opensource.com/sites/default/files/u128651/baby-select.png (Select baby station)
[9]:/file/371226
[10]:https://opensource.com/sites/default/files/u128651/baby-screen.png (Press Start)
[11]:/file/371251
[12]:https://opensource.com/sites/default/files/u128651/parent-select.png (Select parent station)
[13]:/file/371241
[14]:https://opensource.com/sites/default/files/u128651/parent-screen.png (Press Connect)
[15]:https://gonimo.com/index.php#intro
[16]:https://github.com/gonimo/gonimo

View File

@ -1,6 +1,7 @@
8 KDE Plasma Tips and Tricks to Improve Your Productivity
======
[#] leon-shi is translating
![](https://www.maketecheasier.com/assets/uploads/2018/01/kde-plasma-desktop-featured.jpg)
KDE's Plasma is easily one of the most powerful desktop environments available for Linux. It's highly configurable, and it looks pretty good, too. That doesn't amount to a whole lot unless you can actually get things done.

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (fuowang)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: subject: (An introduction to the Flask Python web app framework)

View File

@ -1,87 +0,0 @@
10 killer tools for the admin in a hurry
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT)
Administering networks and systems can get very stressful when the workload piles up. Nobody really appreciates how long anything takes, and everyone wants their specific thing done yesterday.
So it's no wonder so many of us are drawn to the open source spirit of figuring out what works and sharing it with everyone. Because, when deadlines are looming, and there just aren't enough hours in the day, it really helps if you can just find free answers you can implement immediately.
So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time.
### Server configuration and scripting
Let's jump right in.
**[NixCraft][1]**
Use the site's internal search function. With more than a decade of regular updates, there's gold to be found here—useful scripts and handy hints that can solve your problem straight away. This is often the second place I look after Google.
**[Webmin][2]**
This gives you a nice web interface to remotely edit your configuration files. It cuts down on a lot of time spent having to juggle directory paths and `sudo nano`, which is handy when you're handling several customers.
**[Windows Subsystem for Linux][3]**
The reality of the modern workplace is that most employees are on Windows, while the grown-up gear in the server room is on Linux. So sometimes you find yourself trying to do admin tasks from (gasp) a Windows desktop.
What do you do? Install a virtual machine? It's actually much faster and far less work to configure if you install the Windows Subsystem for Linux compatibility layer, now available at no cost on Windows 10.
This gives you a Bash terminal in a window where you can run Bash scripts and Linux binaries on the local machine, have full access to both Windows and Linux filesystems, and mount network drives. It's available in Ubuntu, OpenSUSE, SLES, Debian, and Kali flavors.
**[mRemoteNG][4]**
This is an excellent SSH and remote desktop client for when you have 100+ servers to manage.
### Setting up a network so you don't have to do it again
A poorly planned network is the sworn enemy of the admin who hates working overtime.
**[IP Addressing Schemes that Scale][5]**
The diabolical thing about running out of IP addresses is that, when it happens, the network's grown large enough that a new addressing scheme is an expensive, time-consuming pain in the proverbial.
Ain't nobody got time for that!
At some point, IPv6 will finally arrive to save the day. Until then, these one-size-fits-most IP addressing schemes should keep you going, no matter how many network-connected wearables, tablets, smart locks, lights, security cameras, VoIP headsets, and espresso machines the world throws at us.
**[Linux Chmod Permissions Cheat Sheet][6]**
A short but sweet cheat sheet of Bash commands to set permissions across the network. This is so when Bill from Customer Service falls for that ransomware scam, you're recovering just his files and not the entire company's.
**[VLSM Subnet Calculator][7]**
Just put in the number of networks you want to create from an address space and the number of hosts you want per network, and it calculates what the subnet mask should be for everything.
### Single-purpose Linux distributions
Need a Linux box that does just one thing? It helps if someone else has already sweated the small stuff on an operating system you can install and have ready immediately.
Each of these has, at one point, made my work day so much easier.
**[Porteus Kiosk][8]**
This is for when you want a computer totally locked down to just a web browser. With a little tweaking, you can even lock the browser down to just one website. This is great for public access machines. It works with touchscreens or with a keyboard and mouse.
**[Parted Magic][9]**
This is an operating system you can boot from a USB drive to partition hard drives, recover data, and run benchmarking tools.
**[IPFire][10]**
Hahahaha, I still can't believe someone called a router/firewall/proxy combo "I pee fire." That's my second favorite thing about this Linux distribution. My favorite is that it's a seriously solid software suite. It's so easy to set up and configure, and there is a heap of plugins available to extend it.
So, how about you? What tools, resources, and cheat sheets have you found to make the workday easier? I'd love to know. Please share in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/tools-admin
作者:[Grant Hamono][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者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/grantdxm
[1]:https://www.cyberciti.biz/
[2]:http://www.webmin.com/
[3]:http://wsl-guide.org/en/latest/
[4]:https://mremoteng.org/
[5]:https://blog.dxmtechsupport.com.au/ip-addressing-for-a-small-business-that-might-grow/
[6]:https://isabelcastillo.com/linux-chmod-permissions-cheat-sheet
[7]:http://www.vlsm-calc.net/
[8]:http://porteus-kiosk.org/
[9]:https://partedmagic.com/
[10]:https://www.ipfire.org/

View File

@ -1,531 +0,0 @@
Build an interactive CLI with Node.js
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A)
Node.js can be very useful when it comes to building command-line interfaces (CLIs). In this post, I'll teach you how to use [Node.js][1] to build a CLI that asks some questions and creates a file based on the answers.
### Get started
Let's start by creating a brand new [npm][2] package. (Npm is the JavaScript package manager.)
```
mkdir my-script
cd my-script
npm init
```
Npm will ask some questions. After that, we need to install some packages.
```
npm install --save chalk figlet inquirer shelljs
```
Here's what these packages do:
* **Chalk:** Terminal string styling done right
* **Figlet:** A program for making large letters out of ordinary text
* **Inquirer:** A collection of common interactive command-line user interfaces
* **ShellJS:** Portable Unix shell commands for Node.js
### Make an index.js file
Now we'll create an `index.js` file with the following content:
```
#!/usr/bin/env node
const inquirer = require("inquirer");
const chalk = require("chalk");
const figlet = require("figlet");
const shell = require("shelljs");
```
### Plan the CLI
It's always good to plan what a CLI needs to do before writing any code. This CLI will do just one thing: **create a file**.
The CLI will ask two questions—what is the filename and what is the extension?—then create the file, and show a success message with the created file path.
```
// index.js
const run = async () => {
  // show script introduction
  // ask questions
  // create the file
  // show success message
};
run();
```
The first function is the script introduction. Let's use `chalk` and `figlet` to get the job done.
```
const init = () => {
  console.log(
    chalk.green(
      figlet.textSync("Node JS CLI", {
        font: "Ghost",
        horizontalLayout: "default",
        verticalLayout: "default"
      })
    )
  );
}
const run = async () => {
  // show script introduction
  init();
  // ask questions
  // create the file
  // show success message
};
run();
```
Second, we'll write a function that asks the questions.
```
const askQuestions = () => {
  const questions = [
    {
      name: "FILENAME",
      type: "input",
      message: "What is the name of the file without extension?"
    },
    {
      type: "list",
      name: "EXTENSION",
      message: "What is the file extension?",
      choices: [".rb", ".js", ".php", ".css"],
      filter: function(val) {
        return val.split(".")[1];
      }
    }
  ];
  return inquirer.prompt(questions);
};
// ...
const run = async () => {
  // show script introduction
  init();
  // ask questions
  const answers = await askQuestions();
  const { FILENAME, EXTENSION } = answers;
  // create the file
  // show success message
};
```
Notice the constants FILENAME and EXTENSIONS that came from `inquirer`.
The next step will create the file.
```
const createFile = (filename, extension) => {
  const filePath = `${process.cwd()}/${filename}.${extension}`
  shell.touch(filePath);
  return filePath;
};
// ...
const run = async () => {
  // show script introduction
  init();
  // ask questions
  const answers = await askQuestions();
  const { FILENAME, EXTENSION } = answers;
  // create the file
  const filePath = createFile(FILENAME, EXTENSION);
  // show success message
};
```
And last but not least, we'll show the success message along with the file path.
```
const success = (filepath) => {
  console.log(
    chalk.white.bgGreen.bold(`Done! File created at ${filepath}`)
  );
};
// ...
const run = async () => {
  // show script introduction
  init();
  // ask questions
  const answers = await askQuestions();
  const { FILENAME, EXTENSION } = answers;
  // create the file
  const filePath = createFile(FILENAME, EXTENSION);
  // show success message
  success(filePath);
};
```
Let's test the script by running `node index.js`. Here's what we get:
### The full code
Here is the final code:
```
#!/usr/bin/env node
const inquirer = require("inquirer");
const chalk = require("chalk");
const figlet = require("figlet");
const shell = require("shelljs");
const init = () => {
  console.log(
    chalk.green(
      figlet.textSync("Node JS CLI", {
        font: "Ghost",
        horizontalLayout: "default",
        verticalLayout: "default"
      })
    )
  );
};
const askQuestions = () => {
  const questions = [
    {
      name: "FILENAME",
      type: "input",
      message: "What is the name of the file without extension?"
    },
    {
      type: "list",
      name: "EXTENSION",
      message: "What is the file extension?",
      choices: [".rb", ".js", ".php", ".css"],
      filter: function(val) {
        return val.split(".")[1];
      }
    }
  ];
  return inquirer.prompt(questions);
};
const createFile = (filename, extension) => {
  const filePath = `${process.cwd()}/${filename}.${extension}`
  shell.touch(filePath);
  return filePath;
};
const success = filepath => {
  console.log(
    chalk.white.bgGreen.bold(`Done! File created at ${filepath}`)
  );
};
const run = async () => {
  // show script introduction
  init();
  // ask questions
  const answers = await askQuestions();
  const { FILENAME, EXTENSION } = answers;
  // create the file
  const filePath = createFile(FILENAME, EXTENSION);
  // show success message
  success(filePath);
};
run();
```
### Use the script anywhere
To execute this script anywhere, add a `bin` section in your `package.json` file and run `npm link`.
```
{
  "name": "creator",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "chalk": "^2.4.1",
    "figlet": "^1.2.0",
    "inquirer": "^6.0.0",
    "shelljs": "^0.8.2"
  },
  "bin": {
    "creator": "./index.js"
  }
}
```
Running `npm link` makes this script available anywhere.
That's what happens when you run this command:
```
/usr/bin/creator -> /usr/lib/node_modules/creator/index.js
/usr/lib/node_modules/creator -> /home/hugo/code/creator
```
It links the `index.js` file as an executable. This is only possible because of the first line of the CLI script: `#!/usr/bin/env node`.
Now we can run this script by calling:
```
$ creator
```
### Wrapping up
As you can see, Node.js makes it very easy to build nice command-line tools! If you want to go even further, check this other packages:
* [meow][3] a simple command-line helper
* [yargs][4] a command-line opt-string parser
* [pkg][5] package your Node.js project into an executable
Tell us about your experience building a CLI in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/node-js-interactive-cli
作者:[Hugo Dias][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者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/hugodias
[1]:https://nodejs.org/en/
[2]:https://www.npmjs.com/
[3]:https://github.com/sindresorhus/meow
[4]:https://github.com/yargs/yargs
[5]:https://github.com/zeit/pkg

View File

@ -1,160 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (McFly A Replacement To Ctrl+R Bash History Search Feature)
[#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
McFly A Replacement To Ctrl+R Bash History Search Feature
======
![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png)
If you spend a lot of time on CLI mode, you should definitely used or heard about **reverse search** function in BASH. The keyboard shortcut to do reverse search in Bash is **Ctrl+r**. Using bash reverse search, we can bring up all commands which we used previously executed without having to re-type them every time. You can, of course, use UP/DOWN arrows to search your bash history. However, Ctrl+r will make this process much easier and faster. Today, I Stumbled upon a replacement to Ctrl+r Bash history search feature. Meet **“McFly”** , a simple tool written in **Rust** programming language that replaces the default Ctrl+r Bash history search with an intelligent search engine. All command suggestions made by McFly are prioritized in real time with a small **neural network**.
McFly rebinds Ctrl+r functionality to bring up all recently executed commands from your Bash history. It augments your shell history by tracking the following:
* Command exit status,
* timestamp (When you run the command),
* and execution directory (Where you run the command).
It saves all tracking details in a SQLite database. Since it tracks the commands historical exit status, you can simply ignore the old failed commands. Cool, yeah?
When suggesting a command, McFly considers the following facts:
* On which directory you ran the command. Youre likely to repeat that command in the same directory in future.
* What commands you typed before the command.
* How often you run the command.
* When you last ran the command.
* If youve selected the command in McFly before.
* The commands historical exit status. Because, you probably dont want to run old failed commands, right?
McFly maintains your default Bash history file, so you can stop using McFly at any time. McFly is not just for BASH, it is also extendable for other shells as well.
### Installing McFly
McFly can be installed using Linuxbrew on Linux. If you havent installed Linuxbrew yet, refer the following link.
[Linuxbrew A Common Package Manager For Linux And Mac OS X][1]
Once Linuxbrew installed, run the following commands to install McFly:
```
$ brew tap cantino/mcfly https://github.com/cantino/mcfly
$ brew install mcfly
```
After the installation is completed, you will see the following output.
```
==> Installing mcfly from cantino/mcfly
==> Downloading https://github.com/cantino/mcfly/releases/download/v0.2.5/mcfly-v0
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.c
######################################################################## 100.0%
==> ONE MORE STEP! Edit ~/.bashrc and add the following:
if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then
. $(brew --prefix)/opt/mcfly/mcfly.bash
fi
🍺 /home/linuxbrew/.linuxbrew/Cellar/mcfly/v0.2.5: 4 files, 3.5MB, built in 33 seconds
```
![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png)
As you can see, we need to do one more step before start using McFly.
Add the following lines to your **~/.bashrc** file:
```
if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then
. $(brew --prefix)/opt/mcfly/mcfly.bash
fi
```
Finally, run the following command to take effects changes:
```
$ source ~/.bashrc
```
Your BASH history will be imported to McFly database when you run this command for the first time. It will take a few moments depending upon size of your bash history file. Once the import is done, you will see the following message.
```
McFly: Importing Bash history for the first time. This may take a minute or two...done.
```
You can now start using McFly.
### Usage
To search through your command history, just type mcfly search followed by the part of the command name and hit ENTER key. Mcfly will display the command suggestions based on the search query you just type.
```
$ mcfly search <part-of-the-command>
```
For instance, I type the following command:
```
$ mcfly search mk
```
Here is the sample output from my Ubuntu machine:
![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png)
As you can see, I have used mkdir command two times. If you want to run a command from the list of suggestions, just use **UP/DOWN** arrows to select it and hit ENTER to run it immediately. If you want to edit a command, choose it and hit **TAB** key to bring it back to your Terminal and then edit before running it. To delete the selected command from the history, just press **F2**.
Alternatively, type the following command to open the history search and then type any command or part of the command to view the suggestions from your history.
```
$ mcfly search
```
McFly will display the command suggestions as you type.
Here is a short video demonstration of McFly:
![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif)
View help:
```
$ mcfly --help
```
### Remove McFly
Dont like McFly, no problem! Remove it using the following commands:
```
$ brew uninstall mcfly
$ brew untap cantino/mcfly
```
Finally, remove the lines which we added earlier from **~/.bashrc** file.
And, thats all for now. More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/
作者:[SK][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.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/linuxbrew-common-package-manager-linux-mac-os-x/

View File

@ -1,93 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 cool new projects to try in COPR for December 2018)
[#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/)
[#]: author: (Dominik Turecek https://fedoramagazine.org)
4 cool new projects to try in COPR for December 2018
======
![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg)
COPR is a [collection][1] of personal repositories for software that isnt carried in Fedora. Some software doesnt conform to standards that allow easy packaging. Or it may not meet other Fedora standards, despite being free and open source. COPR can offer these projects outside the Fedora set of packages. Software in COPR isnt supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software.
Heres a set of new and interesting projects in COPR.
### MindForger
[MindForger][2] is a Markdown editor and a notebook. In addition to features youd expect from a Markdown editor, MindForger lets you split a single file into multiple notes. Its easy to organize the notes and move them around between files, as well as search through them. Ive been using MindForger for some time for my study notes, so its nice that its available through COPR now.![][3]
#### Installation instructions
The repo currently provides MindForger for Fedora 29 and Rawhide. To install MindForger, use these commands:
```
sudo dnf copr enable deadmozay/mindforger
sudo dnf install mindforger
```
### Clingo
[Clingo][4] is a program for solving logical problems using [answer set programming][5] (ASP) modeling language. With ASP, you can declaratively describe a problem as a logical program that Clingo then solves. As a result, Clingo produces solutions to the problem in the form of logical models, called answer sets.
#### Installation instructions
The repo currently provides Clingo for Fedora 28 and 29. To install Clingo, use these commands:
```
sudo dnf copr enable timn/clingo
sudo dnf install clingo
```
### SGVrecord
[SGVrecord][6] is a simple tool for recording your screen. It allows you to either capture the whole screen or select just a part of it. Furthermore, it is possible to make the record with or without sound. Sgvrecord produces files in WebM format.![][7]
#### Installation instructions
The repo currently provides SGVrecord for Fedora 28, 29, and Rawhide. To install SGVrecord, use these commands:
```
sudo dnf copr enable youssefmsourani/sgvrecord
sudo dnf install sgvrecord
```
### Watchman
[Watchman][8] is a service for monitoring and recording when changes are done to files.
You can specify directory trees for Watchman to monitor, as well as define actions
that are triggered when specified files are changed.
#### Installation instructions
The repo currently provides Watchman for Fedora 29 and Rawhide. To install Watchman, use these commands:
```
sudo dnf copr enable eklitzke/watchman
sudo dnf install watchman
```
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/4-try-copr-december-2018/
作者:[Dominik Turecek][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
[b]: https://github.com/lujun9972
[1]: https://copr.fedorainfracloud.org/
[2]: https://www.mindforger.com/
[3]: https://fedoramagazine.org/wp-content/uploads/2018/12/mindforger.png
[4]: https://potassco.org/clingo/
[5]: https://en.wikipedia.org/wiki/Answer_set_programming
[6]: https://github.com/yucefsourani/sgvrecord
[7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png
[8]: https://facebook.github.io/watchman/

View File

@ -1,100 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Working with tarballs on Linux)
[#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
Working with tarballs on Linux
======
![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg)
The word “tarball” is often used to describe the type of file used to back up a select group of files and join them into a single file. The name comes from the **.tar** file extension and the **tar** command that is used to group together the files into a single file that is then sometimes compressed to make it smaller for its move to another system.
Tarballs are often used to back up personal or system files in place to create an archive, especially prior to making changes that might have to be reversed. Linux sysadmins, for example, will often create a tarball containing a series of configuration files before making changes to an application just in case they have to reverse those changes. Extracting the files from a tarball thats sitting in place will generally be faster than having to retrieve the files from backups.
### How to create a tarball on Linux
You can create a tarball and compress it in a single step if you use a command like this one:
```
$ tar -cvzf PDFs.tar.gz *.pdf
```
The result in this case is a compressed (gzipped) file that contains all of the PDF files that are in the current directory. The compression is optional, of course. A slightly simpler command would just put all of the PDF files into an uncompressed tarball:
```
$ tar -cvf PDFs.tar *.pdf
```
Note that its the **z** in that list of options that causes the file to be compressed or “zipped”. The **c** specifies that you are creating the file and the **v** (verbose) indicates that you want some feedback while the command is running. Omit the **v** if you don't want to see the files listed.
Another common naming convention is to give zipped tarballs the extension **.tgz** instead of the double extension **.tar.gz** as shown in this command:
```
$ tar cvzf MyPDFs.tgz *.pdf
```
### How to extract files from a tarball
To extract all of the files from a gzipped tarball, you would use a command like this:
```
$ tar -xvzf file.tar.gz
```
If you use the .tgz naming convention, that command would look like this:
```
$ tar -xvzf MyPDFs.tgz
```
To extract an individual file from a gzipped tarball, you do almost the same thing but add the file name:
```
$ tar -xvzf PDFs.tar.gz ShenTix.pdf
ShenTix.pdf
ls -l ShenTix.pdf
-rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf
```
You can even delete files from a tarball if the tarball is not compressed. For example, if we wanted to remove tile file that we extracted above from the PDFs.tar.gz file, we would do it like this:
```
$ gunzip PDFs.tar.gz
$ ls -l PDFs.tar
-rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar
$ tar -vf PDFs.tar --delete ShenTix.pdf
$ ls -l PDFs.tar
-rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar
```
Notice that we shaved a little space off the tar file while deleting the ShenTix.pdf file. We can then compress the file again if we want:
```
$ gzip -f PDFs.tar
ls -l PDFs.tar.gz
-rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John
```
The versatility of the command line options makes working with tarballs easy and very convenient.
Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.facebook.com/NetworkWorld/
[2]: https://www.linkedin.com/company/network-world

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,62 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Let your Linux terminal speak its mind)
[#]: via: (https://opensource.com/article/18/12/linux-toy-espeak)
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
Let your Linux terminal speak its mind
======
eSpeak is an open source text-to-speech synthesizer that can be invoked from the Linux command line.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ)
Greetings from another day in our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. Were figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal.
We hope that even if you've seen some of these before, there will be something new for everybody in our series.
Some of you may be too young to remember, but before there was Alexa, Siri, or the Google Assistant, computers still had voices.
Many of us will never forget HAL 9000 from [2001: A Space Odessey][1] helpfully conversing with the crew (sorry, Dave). But between 1960s science fiction and today, there was a whole generation of speaking computers. Some of them great, most of them, not so great.
One of my favorites is the open source project [eSpeak][2]. It's available in many forms, including a library version you can use to include speech technology in your own project, but it also coms as a command-line program that you can install and use easily. In my distribution, this was as simple as:
```
$ sudo dnf install espeak
```
Invoking eSpeak then can be invoked either interactively, or by piping text to it using the output of another program or a simple echo command. There are a number of [voice files][3] available for eSpeak, and if you're especially bored over the holidays, you could even create your own.
A fork of eSpeak called eSpeak NG ("Next Generation") was created in 2015 from some developers who wanted to continue development of the otherwise lightly-updated eSpeak. eSpeak is made available as open source under a GPL version 3 license, and you can find out more about the project and download the source code [on SourceForge][2].
I'll also throw in a bonus toy today, [cava][4]. Because I've been eager to give each of these articles a unique screenshot as the lead image, and today's toy outputs sound rather than something visual, I needed to find something to fill the space. Short for "console-based audio visualizer for ALSA" (although it supports more than just ALSA now), cava is a nice MIT-licensed terminal audio visualization tool that's fun to watch. Below, is a visualization of eSpeak's output of the following:
```
$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak
```
![](https://opensource.com/sites/default/files/uploads/linux-toy-cava.gif)
Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement.
Be sure to check out yesterday's toy, [Solve a puzzle at the Linux command line with nudoku][5], and come back tomorrow for another!
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/linux-toy-espeak
作者:[Jason Baker][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/jason-baker
[b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_(film)
[2]: http://espeak.sourceforge.net/
[3]: http://espeak.sourceforge.net/voices.html
[4]: https://github.com/karlstav/cava
[5]: https://opensource.com/article/18/12/linux-toy-nudoku

View File

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

View File

@ -1,80 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Watch YouTube videos at the Linux terminal)
[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl)
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
Watch YouTube videos at the Linux terminal
======
Thought video content was just for your GUI? Think again.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a)
We're almost to the end of our 24-day-long Linux command-line toys advent calendar. Hopefully, you've been following along, but if not, start back at [the beginning][1] and work your way through. You'll find plenty of games, diversions, and oddities for your Linux terminal.
And while you may have seen some toys from our calendar before, we hope theres at least one new thing for everyone.
Today we're going to double-down on yesterday's toy, [MPlayer][2], and add in one more, [**youtube-dl**][3].
As its name would imply, **youtube-dl** is a command-line utility for downloading YouTube videos, but it can capture video from a number of other sites as well, and it's a really quite full-featured application with [thorough documentation][4] to make video acquisition easy. A note: please don't use **youtube-dl** in any context that would violate the copyright laws in your jurisdiction.
**youtube-dl** is licensed under a public domain dedication known as [the][5] [Unlicense][5] that's similar to Creative Common's [CC0][6]. There are some interesting [legal opinions][7] out there about where public domain dedication fits into the open source landscape, but it's generally considered compatible with existing open source licenses even by organizations who don't recommend its use.
In its simplest form, we're going to use **youtube-dl** to grab a video for playback in our terminal. First, [install][8] it using a method appropriate for your distribution. For me, in Fedora, it was packaged in my repositories, so installation was as simple as:
```
$ sudo dnf install youtube-dl
```
Then, let's grab a video. YouTube allows you to search by license, so today, we're going to take a look at a fireplace [video][9] from [Gemmy's Videos][10] available under a Creative Commons attribution license. For YouTube videos, you can download with the file ID alone, like this, and we'll specify an output file name as well. I intentionally picked a short video, since long videos can get quite large!
```
$ youtube-dl pec8P5K4s8c -o fireplace.mp4
```
If you didn't install [MPlayer][2] yesterday, go ahead and do that, and you may need to install **libcaca** for your system as well if you did not install it previously. If you just use MPlayer to launch the video from the command line as-is ( **$** **mplayer fireplace.webm** ), it will play, but in a window all of its own; not exactly what we were going for.
First, I set my **libcaca** settings to force it to use **ncurses** **** as the display driver, keeping the output in my terminal, with:
```
$ export CACA_DRIVER=ncurses
```
Then, I zoomed way out in my terminal (the more "pixels", the better), and played the file with the following (forcing the use of **libcaca** and silencing text output from MPlayer):
```
$ mplayer -really-quiet -vo caca fireplace.mp4
```
And, there you go!
![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif)
Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement.
Be sure to check out yesterday's toy, [Listen to the radio at the Linux terminal][2], and come back tomorrow for another!
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/linux-toy-youtube-dl
作者:[Jason Baker][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/jason-baker
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/12/linux-toy-boxes
[2]: https://opensource.com/article/18/12/linux-toy-mplayer
[3]: https://rg3.github.io/youtube-dl/
[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme
[5]: https://unlicense.org/
[6]: https://creativecommons.org/share-your-work/public-domain/cc0/
[7]: https://opensource.org/faq#public-domain
[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation
[9]: https://www.youtube.com/watch?v=pec8P5K4s8c
[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A

View File

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

View File

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

View File

@ -0,0 +1,312 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Asciinema Record And Share Your Terminal Sessions On The Fly)
[#]: via: (https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
Asciinema Record And Share Your Terminal Sessions On The Fly
======
This is known topic and we had already written so many article about this topic.
Even today also we are going to discuss about the same topic.
Other tools are works locally but Asciinema works in both way like local and web.
I mean we can share the recording on the web.
By default everyone prefer history command to review/recall the previously entered commands in terminal.
But unfortunately, that shows only the commands that we ran and doesnt shows the commands output which was performed previously.
There are many utilities available in Linux to record the terminal session activity.
Also, we had written about few utilities in the past and today also we are going to discuss about the same kind of topic.
If you would like to check other utilities to record your Linux terminal session activity then you can give a try to **[Script Command][1]** , **[Terminalizer Tool][2]** and **[Asciinema Tool][3]**.
But if you are looking for **[GIF Recorder][4]** then try **[Gifine][5]** , **[Kgif][6]** and **[Peek][7]** utilities.
### What is Asciinema
asciinema is a free and open source solution for recording terminal sessions and sharing them on the web.
When you run asciinema rec in your terminal the recording starts, capturing all output that is being printed to your terminal while youre issuing the shell commands.
When the recording finishes (by hitting `Ctrl-D` or typing `exit`) then the captured output is uploaded to asciinema.org website and prepared for playback on the web.
Asciinema project is built of several complementary pieces such as asciinema command line tool, API at asciinema.org and javascript player.
Asciinema was inspired by script and scriptreplay commands.
### How to Install Asciinema In Linux
It was written in Python and pip installation is a recommended method to install Asciinema on Linux.
Make sure you should have installed python-pip package on your system. If no, use the following command to install it.
For Debian/Ubuntu users, use **[Apt Command][8]** or **[Apt-Get Command][9]** to install pip package.
```
$ sudo apt install python-pip
```
For Archlinux users, use **[Pacman Command][10]** to install pip package.
```
$ sudo pacman -S python-pip
```
For Fedora users, use **[DNF Command][11]** to install pip package.
```
$ sudo dnf install python-pip
```
For CentOS/RHEL users, use **[YUM Command][12]** to install pip package.
```
$ sudo yum install python-pip
```
For openSUSE users, use **[Zypper Command][13]** to install pip package.
```
$ sudo zypper install python-pip
```
Finally run the following **[pip command][14]** to install Asciinema tool in Linux.
```
$ sudo pip3 install asciinema
```
### How to Record Your Terminal Session Using Asciinema
Once you successfully installed Asciinema. Just run the following command to start recording.
```
$ asciinema rec 2g-test
asciinema: recording asciicast to 2g-test
asciinema: press "ctrl-d" or type "exit" when you're done
```
For testing purpose run few commands and see whether its working fine or not.
```
$ free
total used free shared buff/cache available
Mem: 15867 2783 10537 1264 2546 11510
Swap: 17454 0 17454
$ hostnamectl
Static hostname: daygeek-Y700
Icon name: computer-laptop
Chassis: laptop
Machine ID: 31bdeb7b833547368d230a2025d475bc
Boot ID: c84f7e6f39394d1f8fdc4bcaa251aee2
Operating System: Manjaro Linux
Kernel: Linux 4.19.8-2-MANJARO
Architecture: x86-64
$ uname -a
Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Stepping: 3
CPU MHz: 800.047
CPU max MHz: 3500.0000
CPU min MHz: 800.0000
BogoMIPS: 5186.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d
```
Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in the same directory.
```
$ exit
exit
asciinema: recording finished
asciinema: asciicast saved to 2g-test
```
If you would like to save the output in the different directory then mention the path where you want to save the file.
```
$ asciinema rec /opt/session-record/2g-test1
```
We can play the recorded session using the following command.
```
$ asciinema play 2g-test
```
We can play the recorded session with double speed.
```
$ asciinema play -s 2 2g-test
```
Alternatively we can play the recorded session with normal speed with idle time limited to 2 seconds.
```
$ asciinema play -i 2 2g-test
```
### How To Share the Recorded Session on The Web
If you would like to share the recorded session with your friends, just run the following command which upload the recording to asciinema.org and provide you the unique link.
It will be automatically archived 7 days after upload.
```
$ asciinema upload 2g-test
View the recording at:
https://asciinema.org/a/jdJrxhDLboeyrhzZRHsve0x8i
This installation of asciinema recorder hasn't been linked to any asciinema.org
account. All unclaimed recordings (from unknown installations like this one)
are automatically archived 7 days after upload.
If you want to preserve all recordings made on this machine, connect this
installation with asciinema.org account by opening the following link:
https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8
```
![][16]
If you would like to share the recorded session on social media, just click the `Share` button in the bottom of the page.
If anyone wants to download this recording, just click the `Download` button in the bottom of the page to save on your system.
### How to Manage Recording on asciinema.org Site
If you want to preserve all recordings made on this machine, connect this installation with asciinema.org account by opening the following link and follow the instructions.
```
https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8
```
If you have already recorded an asciicast but you dont see it on your profile on asciinema.org website. Just run the `asciinema auth` command in your terminal to move those.
```
$ asciinema auth
Open the following URL in a web browser to link your install ID with your asciinema.org user account:
https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8
This will associate all recordings uploaded from this machine (past and future ones) to your account, and allow you to manage them (change title/theme, delete) at asciinema.org.
```
![][17]
Run the following command if you would like to upload the file directly to asciinema.org instead of locally saving.
```
$ asciinema rec
asciinema: recording asciicast to /tmp/tmp6kuh4247-ascii.cast
asciinema: press "ctrl-d" or type "exit" when you're done
```
Just run the following command to start recording.
```
$ asciinema rec 2g-test
asciinema: recording asciicast to 2g-test
asciinema: press "ctrl-d" or type "exit" when you're done
```
For testing purpose run few commands and see whether its working fine or not.
```
$ free
total used free shared buff/cache available
Mem: 15867 2783 10537 1264 2546 11510
Swap: 17454 0 17454
$ hostnamectl
Static hostname: daygeek-Y700
Icon name: computer-laptop
Chassis: laptop
Machine ID: 31bdeb7b833547368d230a2025d475bc
Boot ID: c84f7e6f39394d1f8fdc4bcaa251aee2
Operating System: Manjaro Linux
Kernel: Linux 4.19.8-2-MANJARO
Architecture: x86-64
$ uname -a
Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux
```
Once you have done, simple press `CTRL+D` or type `exit` to stop the recording then hit `Enter` button to upload the recording to asciinema.org website.
It will take few seconds to generate the unique url for your uploaded recording. Once its done you will be getting the results same as below.
```
$ exit
exit
asciinema: recording finished
asciinema: press "enter" to upload to asciinema.org, "ctrl-c" to save locally
View the recording at:
https://asciinema.org/a/b7bu5OhuCy2vUH7M8RRPjsSxg
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/
作者:[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/script-command-record-save-your-terminal-session-activity-linux/
[2]: https://www.2daygeek.com/terminalizer-a-tool-to-record-your-terminal-and-generate-animated-gif-images/
[3]: https://www.2daygeek.com/Asciinema-record-your-terminal-sessions-as-svg-animations-in-linux/
[4]: https://www.2daygeek.com/category/gif-recorder/
[5]: https://www.2daygeek.com/gifine-create-animated-gif-vedio-recorder-linux-mint-debian-ubuntu/
[6]: https://www.2daygeek.com/kgif-create-animated-gif-file-active-window-screen-recorder-capture-arch-linux-mint-fedora-ubuntu-debian-opensuse-centos/
[7]: https://www.2daygeek.com/peek-create-animated-gif-screen-recorder-capture-arch-linux-mint-fedora-ubuntu/
[8]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
[9]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
[10]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/
[11]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/
[12]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/
[13]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
[14]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/
[15]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[16]: https://www.2daygeek.com/wp-content/uploads/2018/12/linux-asciinema-record-your-terminal-sessions-share-web-1.png
[17]: https://www.2daygeek.com/wp-content/uploads/2018/12/linux-asciinema-record-your-terminal-sessions-share-web-3.png

View File

@ -0,0 +1,252 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Linux commands for measuring disk activity)
[#]: via: (https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
Linux commands for measuring disk activity
======
![](https://images.idgesg.net/images/article/2018/12/tape-measure-100782593-large.jpg)
Linux systems provide a handy suite of commands for helping you see how busy your disks are, not just how full. In this post, we examine five very useful commands for looking into disk activity. Two of the commands (iostat and ioping) may have to be added to your system, and these same two commands require you to use sudo privileges, but all five commands provide useful ways to view disk activity.
Probably one of the easiest and most obvious of these commands is **dstat**.
### dtstat
In spite of the fact that the **dstat** command begins with the letter "d", it provides stats on a lot more than just disk activity. If you want to view just disk activity, you can use the **-d** option. As shown below, youll get a continuous list of disk read/write measurements until you stop the display with a ^c. Note that after the first report, each subsequent row in the display will report disk activity in the following time interval, and the default is only one second.
```
$ dstat -d
-dsk/total-
read writ
949B 73k
65k 0 <== first second
0 24k <== second second
0 16k
0 0 ^C
```
Including a number after the -d option will set the interval to that number of seconds.
```
$ dstat -d 10
-dsk/total-
read writ
949B 73k
65k 81M <== first five seconds
0 21k <== second five second
0 9011B ^C
```
Notice that the reported data may be shown in a number of different units — e.g., M (megabytes), k (kilobytes), and B (bytes).
Without options, the dstat command is going to show you a lot of other information as well — indicating how the CPU is spending its time, displaying network and paging activity, and reporting on interrupts and context switches.
```
$ dstat
You did not select any stats, using -cdngy by default.
--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai stl| read writ| recv send| in out | int csw
0 0 100 0 0| 949B 73k| 0 0 | 0 3B| 38 65
0 0 100 0 0| 0 0 | 218B 932B| 0 0 | 53 68
0 1 99 0 0| 0 16k| 64B 468B| 0 0 | 64 81 ^C
```
The dstat command provides valuable insights into overall Linux system performance, pretty much replacing a collection of older tools, such as vmstat, netstat, iostat, and ifstat, with a flexible and powerful command that combines their features. For more insight into the other information that the dstat command can provide, refer to this post on the [dstat][1] command.
### iostat
The iostat command helps monitor system input/output device loading by observing the time the devices are active in relation to their average transfer rates. It's sometimes used to evaluate the balance of activity between disks.
```
$ iostat
Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.07 0.01 0.03 0.05 0.00 99.85
Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
loop0 0.00 0.00 0.00 1048 0
loop1 0.00 0.00 0.00 365 0
loop2 0.00 0.00 0.00 1056 0
loop3 0.00 0.01 0.00 16169 0
loop4 0.00 0.00 0.00 413 0
loop5 0.00 0.00 0.00 1184 0
loop6 0.00 0.00 0.00 1062 0
loop7 0.00 0.00 0.00 5261 0
sda 1.06 0.89 72.66 2837453 232735080
sdb 0.00 0.02 0.00 48669 40
loop8 0.00 0.00 0.00 1053 0
loop9 0.01 0.01 0.00 18949 0
loop10 0.00 0.00 0.00 56 0
loop11 0.00 0.00 0.00 7090 0
loop12 0.00 0.00 0.00 1160 0
loop13 0.00 0.00 0.00 108 0
loop14 0.00 0.00 0.00 3572 0
loop15 0.01 0.01 0.00 20026 0
loop16 0.00 0.00 0.00 24 0
```
Of course, all the stats provided on Linux loop devices can clutter the display when you want to focus solely on your disks. The command, however, does provide the **-p** option, which allows you to just look at your disks — as shown in the commands below.
```
$ iostat -p sda
Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.07 0.01 0.03 0.05 0.00 99.85
Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 1.06 0.89 72.54 2843737 232815784
sda1 1.04 0.88 72.54 2821733 232815784
```
Note that **tps** refers to transfers per second.
You can also get iostat to provide repeated reports. In the example below, we're getting measurements every five seconds by using the **-d** option.
```
$ iostat -p sda -d 5
Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU)
Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 1.06 0.89 72.51 2843749 232834048
sda1 1.04 0.88 72.51 2821745 232834048
Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 0.80 0.00 11.20 0 56
sda1 0.80 0.00 11.20 0 56
```
If you prefer to omit the first (stats since boot) report, add a **-y** to your command.
```
$ iostat -p sda -d 5 -y
Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU)
Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 0.80 0.00 11.20 0 56
sda1 0.80 0.00 11.20 0 56
```
Next, we look at our second disk drive.
```
$ iostat -p sdb
Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.07 0.01 0.03 0.05 0.00 99.85
Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sdb 0.00 0.02 0.00 48669 40
sdb2 0.00 0.00 0.00 4861 40
sdb1 0.00 0.01 0.00 35344 0
```
### iotop
The **iotop** command is top-like utility for looking at disk I/O. It gathers I/O usage information provided by the Linux kernel so that you can get an idea which processes are most demanding in terms in disk I/O. In the example below, the loop time has been set to 5 seconds. The display will update itself, overwriting the previous output.
```
$ sudo iotop -d 5
Total DISK READ: 0.00 B/s | Total DISK WRITE: 1585.31 B/s
Current DISK READ: 0.00 B/s | Current DISK WRITE: 12.39 K/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
32492 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.12 % [kworker/u8:1-ev~_power_efficient]
208 be/3 root 0.00 B/s 1585.31 B/s 0.00 % 0.11 % [jbd2/sda1-8]
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init splash
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd]
3 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_gp]
4 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_par_gp]
8 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [mm_percpu_wq]
```
### ioping
The **ioping** command is an altogether different type of tool, but it can report disk latency — how long it takes a disk to respond to requests — and can be helpful in diagnosing disk problems.
```
$ sudo ioping /dev/sda1
4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=1 time=960.2 us (warmup)
4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=2 time=841.5 us
4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=3 time=831.0 us
4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=4 time=1.17 ms
^C
--- /dev/sda1 (block device 111.8 GiB) ioping statistics ---
3 requests completed in 2.84 ms, 12 KiB read, 1.05 k iops, 4.12 MiB/s
generated 4 requests in 3.37 s, 16 KiB, 1 iops, 4.75 KiB/s
min/avg/max/mdev = 831.0 us / 947.9 us / 1.17 ms / 158.0 us
```
### atop
The **atop** command, like **top** provides a lot of information on system performance, including some stats on disk activity.
```
ATOP - butterfly 2018/12/26 17:24:19 37d3h13m------ 10ed
PRC | sys 0.03s | user 0.01s | #proc 179 | #zombie 0 | #exit 6 |
CPU | sys 1% | user 0% | irq 0% | idle 199% | wait 0% |
cpu | sys 1% | user 0% | irq 0% | idle 99% | cpu000 w 0% |
CPL | avg1 0.00 | avg5 0.00 | avg15 0.00 | csw 677 | intr 470 |
MEM | tot 5.8G | free 223.4M | cache 4.6G | buff 253.2M | slab 394.4M |
SWP | tot 2.0G | free 2.0G | | vmcom 1.9G | vmlim 4.9G |
DSK | sda | busy 0% | read 0 | write 7 | avio 1.14 ms |
NET | transport | tcpi 4 | tcpo stall 8 | udpi 1 | udpo 0swout 2255 |
NET | network | ipi 10 | ipo 7 | ipfrw 0 | deliv 60.67 ms |
NET | enp0s25 0% | pcki 10 | pcko 8 | si 1 Kbps | so 3 Kbp0.73 ms |
PID SYSCPU USRCPU VGROW RGROW ST EXC THR S CPUNR CPU CMD 1/1673e4 |
3357 0.01s 0.00s 672K 824K -- - 1 R 0 0% atop
3359 0.01s 0.00s 0K 0K NE 0 0 E - 0% <ps>
3361 0.00s 0.01s 0K 0K NE 0 0 E - 0% <ps>
3363 0.01s 0.00s 0K 0K NE 0 0 E - 0% <ps>
31357 0.00s 0.00s 0K 0K -- - 1 S 1 0% bash
3364 0.00s 0.00s 8032K 756K N- - 1 S 1 0% sleep
2931 0.00s 0.00s 0K 0K -- - 1 I 1 0% kworker/u8:2-e
3356 0.00s 0.00s 0K 0K -E 0 0 E - 0% <sleep>
3360 0.00s 0.00s 0K 0K NE 0 0 E - 0% <sleep>
3362 0.00s 0.00s 0K 0K NE 0 0 E - 0% <sleep>
```
If you want to look at _just_ the disk stats, you can easily manage that with a command like this:
```
$ atop | grep DSK
$ atop | grep DSK
DSK | sda | busy 0% | read 122901 | write 3318e3 | avio 0.67 ms |
DSK | sdb | busy 0% | read 1168 | write 103 | avio 0.73 ms |
DSK | sda | busy 2% | read 0 | write 92 | avio 2.39 ms |
DSK | sda | busy 2% | read 0 | write 94 | avio 2.47 ms |
DSK | sda | busy 2% | read 0 | write 99 | avio 2.26 ms |
DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms |
DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms |
DSK | sda | busy 2% | read 0 | write 92 | avio 2.43 ms |
^C
```
### Being in the know with disk I/O
Linux provides enough commands to give you good insights into how hard your disks are working and help you focus on potential problems or slowdowns. Hopefully, one of these commands will tell you just what you need to know when it's time to question disk performance. Occasional use of these commands will help ensure that especially busy or slow disks will be obvious when you need to check them.
Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972
[1]: https://www.networkworld.com/article/3291616/linux/examining-linux-system-performance-with-dstat.html
[2]: https://www.facebook.com/NetworkWorld/
[3]: https://www.linkedin.com/company/network-world

View File

@ -0,0 +1,259 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Easily Upload Text Snippets To Pastebin-like Services From Commandline)
[#]: via: (https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
Easily Upload Text Snippets To Pastebin-like Services From Commandline
======
![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-720x340.png)
Whenever there is need to share the code snippets online, the first one probably comes to our mind is Pastebin.com, the online text sharing site launched by **Paul Dixon** in 2002. Now, there are several alternative text sharing services available to upload and share text snippets, error logs, config files, a commands output or any sort of text files. If you happen to share your code often using various Pastebin-like services, I do have a good news for you. Say hello to **Wgetpaste** , a command line BASH utility to easily upload text snippets to pastebin-like services. Using Wgetpaste script, anyone can quickly share text snippets to their friends, colleagues, or whoever wants to see/use/review the code from command line in Unix-like systems.
### Installing Wgetpaste
Wgetpaste is available in Arch Linux [Community] repository. To install it on Arch Linux and its variants like Antergos and Manjaro Linux, just run the following command:
```
$ sudo pacman -S wgetpaste
```
For other distributions, grab the source code from [**Wgetpaste website**][1] and install it manually as described below.
First download the latest Wgetpaste tar file:
```
$ wget http://wgetpaste.zlin.dk/wgetpaste-2.28.tar.bz2
```
Extract it:
```
$ tar -xvjf wgetpaste-2.28.tar.bz2
```
It will extract the contents of the tar file in a folder named “wgetpaste-2.28”.
Go to that directory:
```
$ cd wgetpaste-2.28/
```
Copy the wgetpaste binary to your $PATH, for example **/usr/local/bin/**.
```
$ sudo cp wgetpaste /usr/local/bin/
```
Finally, make it executable using command:
```
$ sudo chmod +x /usr/local/bin/wgetpaste
```
### Upload Text Snippets To Pastebin-like Services
Uploading text snippets using Wgetpaste is trivial. Let me show you a few examples.
**1\. Upload text files**
To upload any text file using Wgetpaste, just run:
```
$ wgetpaste mytext.txt
```
This command will upload the contents of mytext.txt file.
Sample output:
```
Your paste can be seen here: https://paste.pound-python.org/show/eO0aQjTgExP0wT5uWyX7/
```
![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-1.png)
You can share the pastebin URL via any medium like mail, message, whatsapp or IRC etc. Whoever has this URL can visit it and view the contents of the text file in a web browser of their choice.
Here is the contents of mytext.txt file in web browser:
![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-2.png)
You can also use **tee** command to display what is being pasted, instead of uploading them blindly.
To do so, use **-t** option like below.
```
$ wgetpaste -t mytext.txt
```
![][3]
**2. Upload text snippets to different services
**
By default, Wgetpaste will upload the text snippets to **poundpython** (<https://paste.pound-python.org/>) service.
To view the list of supported services, run:
```
$ wgetpaste -S
```
Sample output:
```
Services supported: (case sensitive):
Name: | Url:
=============|=================
bpaste | https://bpaste.net/
codepad | http://codepad.org/
dpaste | http://dpaste.com/
gists | https://api.github.com/gists
*poundpython | https://paste.pound-python.org/
```
Here, ***** indicates the default service.
As you can see, Wgetpaste currently supports five text sharing services. I didnt try all of them, but I believe all services will work.
To upload the contents to other services, for example **bpaste.net** , use **-s** option like below.
```
$ wgetpaste -s bpaste mytext.txt
Your paste can be seen here: https://bpaste.net/show/5199e127e733
```
**3\. Read input from stdin**
Wgetpaste can also read the input from stdin.
```
$ uname -a | wgetpaste
```
This command will upload the output of uname -a command.
**4. Upload the COMMAND and the output of COMMAND together
**
Sometimes, you may need to paste a COMMAND and its output. To do so, specify the contents of the command within quotes like below.
```
$ wgetpaste -c 'ls -l'
```
This will upload the command ls -l along with its output to the pastebin service.
This can be useful when you wanted to let others to clearly know what was the exact command you just ran and its output.
![][4]
As you can see in the output, I ran ls -l command.
**5. Upload system log files, config files
**
Like I already said, we can upload any sort of text files, not just an ordinary text file, in your system such as log files, a specific commands output etc. Say for example, you just updated your Arch Linux box and ended up with a broken system. You ask your colleague how to fix it and s/he wants to read the pacman.log file. Here is the command to upload the contents of the pacman.log file:
```
$ wgetpaste /var/log/pacman.log
```
Share the pastebin URL with your Colleague, so s/he will review the pacman.log and may help you to fix the problem by reviewing the log file.
Usually, the contents of log files might be too long and you dont want to share them all. In such cases, just use **cat** command to read the output and use **tail** command with the **-n** switch to define the number of lines to share and finally pipe the output to Wgetpaste as shown below.
```
$ cat /var/log/pacman.log | tail -n 50 | wgetpaste
```
The above command will upload only the **last 50 lines** of pacman.log file.
**6\. Convert input url to tinyurl**
By default, Wgetpaste will display the full pastebin URL in the output. If you want to convert the input URL to a tinyurl, just use **-u** option.
```
$ wgetpaste -u mytext.txt
Your paste can be seen here: http://tinyurl.com/y85d8gtz
```
**7. Set language
**
By default, Wgetpaste will upload text snippets in **plain text**.
To list languages supported by the specified service, use **-L** option.
```
$ wgetpaste -L
```
This command will list all languages supported by default service i.e **poundpython** (<https://paste.pound-python.org/>).
We can change this using **-l** option.
```
$ wgetpaste -l Bash mytext.txt
```
**8\. Disable syntax highlighting or html in the output**
As I mentioned above, the text snippets will be displayed in a specific language format (plaintext, Bash etc.).
You can, however, change this behaviour to display the raw text snippets using **-r** option.
```
$ wgetpaste -r mytext.txt
Your raw paste can be seen here: https://paste.pound-python.org/raw/CUJhQ3jEmr2UvfmD2xCL/
```
![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-5.png)
As you can see in the above output, there is no syntax highlighting, no html formatting. Just a raw output.
**9\. Change Wgetpaste defaults**
All Defaults values (DEFAULT_{NICK,LANGUAGE,EXPIRATION}[_${SERVICE}] and DEFAULT_SERVICE) can be changed globally in **/etc/wgetpaste.conf** or per user in **~/.wgetpaste.conf** files. These files, however, are not available by default in my system. I guess we need to manually create them. The developer has given the sample contents for both files [**here**][5] and [**here**][6]. Just create these files manually with given sample contents and modify the parameters accordingly to change Wgetpaste defaults.
**10\. Getting help**
To display the help section, run:
```
$ wgetpaste -h
```
And, thats all for now. Hope this was useful. We will publish more useful content in the days to come. Stay tuned!
On behalf of **OSTechNix** , I wish you all a very **Happy New Year 2019**. I am grateful to all our readers, contributors, and mentors for supporting us from the beginning of our journey. We couldnt come this far without your support and guidance. Thank you everyone! Have a great year ahead!!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/
作者:[SK][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.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: http://wgetpaste.zlin.dk/
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-3.png
[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-4.png
[5]: http://wgetpaste.zlin.dk/zlin.conf
[6]: http://wgetpaste.zlin.dk/wgetpaste.example

View File

@ -0,0 +1,141 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Troubleshooting hardware problems in Linux)
[#]: via: (https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux)
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
Troubleshooting hardware problems in Linux
======
Learn what's causing your Linux hardware to malfunction so you can get it back up and running quickly.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0)
[Linux servers][1] run mission-critical business applications in many different types of infrastructures including physical machines, virtualization, private cloud, public cloud, and hybrid cloud. It's important for Linux sysadmins to understand how to manage Linux hardware infrastructure—including software-defined functionalities related to [networking][2], storage, Linux containers, and multiple tools on Linux servers.
It can take some time to troubleshoot and solve hardware-related issues on Linux. Even highly experienced sysadmins sometimes spend hours working to solve mysterious hardware and software discrepancies.
The following tips should make it quicker and easier to troubleshoot hardware in Linux. Many different things can cause problems with Linux hardware; before you start trying to diagnose them, it's smart to learn about the most common issues and where you're most likely to find them.
### Quick-diagnosing devices, modules, and drivers
The first step in troubleshooting usually is to display a list of the hardware installed on your Linux server. You can obtain detailed information on the hardware using **ls** commands such as **[lspci][3]** , **[lsblk][4]** , **[lscpu][5]** , and **[lsscsi][6]**. For example, here is output of the **lsblk** command:
```
# lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  50G  0 disk
├─xvda1 202:1    0   1M  0 part
└─xvda2 202:2    0  50G  0 part /
xvdb    202:16   0  20G  0 disk
└─xvdb1 202:17   0  20G  0 part
```
If the **ls** commands don't reveal any errors, use init processes (e.g., **systemd** ) to see how the Linux server is working. **systemd** is the most popular init process for bootstrapping user spaces and controlling multiple system processes. For example, here is output of the **systemctl status** command:
```
# systemctl status
● bastion.f347.internal
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Wed 2018-11-28 01:29:05 UTC; 2 days ago
   CGroup: /
           ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
           ├─kubepods.slice
           │ ├─kubepods-pod3881728a_f2af_11e8_af77_06af52f87498.slice
           │ │ ├─docker-88b27385f4bae77bba834fbd60a61d19026bae13d18eb147783ae27819c34967.scope
           │ │ │ └─23860 /opt/bridge/bin/bridge --public-dir=/opt/bridge/static --config=/var/console-config/console-c
           │ │ └─docker-a4433f0d523c7e5bc772ee4db1861e4fa56c4e63a2d48f6bc831458c2ce9fd2d.scope
           │ │   └─23639 /usr/bin/pod
....
```
### Digging into multiple loggings
**Dmesg** allows you to figure out errors and warnings in the kernel's latest messages. For example, here is output of the **dmesg | more** command:
```
# dmesg | more
....
[ 1539.027419] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 1539.042726] IPv6: ADDRCONF(NETDEV_UP): veth61f37018: link is not ready
[ 1539.048706] IPv6: ADDRCONF(NETDEV_CHANGE): veth61f37018: link becomes ready
[ 1539.055034] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 1539.098550] device veth61f37018 entered promiscuous mode
[ 1541.450207] device veth61f37018 left promiscuous mode
[ 1542.493266] SELinux: mount invalid.  Same superblock, different security settings for (dev mqueue, type mqueue)
[ 9965.292788] SELinux: mount invalid.  Same superblock, different security settings for (dev mqueue, type mqueue)
[ 9965.449401] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 9965.462738] IPv6: ADDRCONF(NETDEV_UP): vetheacc333c: link is not ready
[ 9965.468942] IPv6: ADDRCONF(NETDEV_CHANGE): vetheacc333c: link becomes ready
....
```
You can also look at all Linux system logs in the **/var/log/messages** file, which is where you'll find errors related to specific issues. It's worthwhile to monitor the messages via the **tail** command in real time when you make modifications to your hardware, such as mounting an extra disk or adding an Ethernet network interface. For example, here is output of the **tail -f /var/log/messages** command:
```
# tail -f /var/log/messages
Dec  1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa
Dec  1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local
Dec  1 13:21:03 bastion dnsmasq[30201]: setting upstream servers from DBus
Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53
Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa
Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local
Dec  1 13:21:33 bastion dnsmasq[30201]: setting upstream servers from DBus
Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53
Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa
Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local
```
### Analyzing networking functions
You may have hundreds of thousands of cloud-native applications to serve business services in a complex networking environment; these may include virtualization, multiple cloud, and hybrid cloud. This means you should analyze whether networking connectivity is working correctly as part of your troubleshooting. Useful commands to figure out networking functions in the Linux server include **ip addr** , **traceroute** , **nslookup** , **dig** , and **ping** , among others. For example, here is output of the **ip addr show** command:
```
# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc mq state UP group default qlen 1000
    link/ether 06:af:52:f8:74:98 brd ff:ff:ff:ff:ff:ff
    inet 192.199.0.169/24 brd 192.199.0.255 scope global noprefixroute dynamic eth0
       valid_lft 3096sec preferred_lft 3096sec
    inet6 fe80::4af:52ff:fef8:7498/64 scope link
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:67:fb:1a:a2 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:67ff:fefb:1aa2/64 scope link
       valid_lft forever preferred_lft forever
....
```
### In conclusion
Troubleshooting Linux hardware requires considerable knowledge, including how to use powerful command-line tools and figure out system loggings. You should also know how to diagnose the kernel space, which is where you can find the root cause of many hardware problems. Keep in mind that hardware issues in Linux may come from many different sources, including devices, modules, drivers, BIOS, networking, and even plain old hardware malfunctions.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux
作者:[Daniel Oh][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/daniel-oh
[b]: https://github.com/lujun9972
[1]: https://opensource.com/article/18/5/what-linux-server
[2]: https://opensource.com/article/18/11/intro-software-defined-networking
[3]: https://linux.die.net/man/8/lspci
[4]: https://linux.die.net/man/8/lsblk
[5]: https://linux.die.net/man/1/lscpu
[6]: https://linux.die.net/man/8/lsscsi

View File

@ -0,0 +1,186 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How To Display Thumbnail Images In Terminal)
[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/)
[#]: author: (SK https://www.ostechnix.com/author/sk/)
How To Display Thumbnail Images In Terminal
======
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png)
A while ago, we discussed about [**Fim**][1], a lightweight, CLI image viewer application used to display various type of images, such as bmp, gif, jpeg, and png etc., from command line. Today, I stumbled upon a similar utility named **lsix**. It is like ls command in Unix-like systems, but for images only. The lsix is a simple CLI utility designed to display thumbnail images in Terminal using **Sixel** graphics. For those wondering, Sixel, short for six pixels, is a type of bitmap graphics format. It uses **ImageMagick** , so almost all file formats supported by imagemagick will work fine.
### Features
Concerning the features of lsix, we can list the following:
* Automatically detects if your Terminal supports Sixel graphics or not. If your Terminal doesnt support Sixel, it will notify you to enable it.
* Automatically detects the terminal background color. It uses terminal escape sequences to try to figure out the foreground and background colors of your Terminal application and will display the thumbnails clearly.
* If there are more images in the directory, usually >21, lsix will display those images one row a a time, so you need not to wait for the entire montage to be created.
* Works well over SSH, so you can manipulate images stored on your remote web server without much hassle.
* It supports Non-bitmap graphics, such as.svg, .eps, .pdf, .xcf etc.
* Written in BASH, so works on almost all Linux distros.
### Installing lsix
Since lsix uses ImageMagick, make sure you have installed it. It is available in the default repositories of most Linux distributions. For example, on Arch Linux and its variants like Antergos, Manjaro Linux, ImageMagick can be installed using command:
```
$ sudo pacman -S imagemagick
```
On Debian, Ubuntu, Linux Mint:
```
$ sudo apt-get install imagemagick
```
lsix doesnt require any installation as it is just a BASH script. Just download it and move it to your $PATH. Its that simple.
Download the latest lsix version from projects github page. I am going to download the lsix archive file using command:
```
$ wget https://github.com/hackerb9/lsix/archive/master.zip
```
Extract the downloaded zip file:
```
$ unzip master.zip
```
This command will extract all contents into a folder named lsix-master. Copy the lsix binary from this directory to your $PATH, for example /usr/local/bin/.
```
$ sudo cp lsix-master/lsix /usr/local/bin/
```
Finally, make the lsbix binary executable:
```
$ sudo chmod +x /usr/local/bin/lsix
```
Thats it. Now is the time to display thumbnails in the terminal itself.
Before start using lsix, **make sure your Terminal supports Sixel graphics**.
The developer has developed lsix on an Xterm in **vt340 emulation mode**. However, the he claims that lsix should work on any Sixel compatible Terminal.
Xterm supports Sixel graphics, but it isnt enabled by default.
You can launch Xterm with Sixel mode enabled using command (from another Terminal):
```
$ xterm -ti vt340
```
Alternatively, you can make vt340 the default terminal type for Xterm as described below.
Edit **.Xresources** file (If it not available, just create it):
```
$ vi .Xresources
```
Add the following line:
```
xterm*decTerminalID : vt340
```
Press **ESC** and type **:wq** to save and close the file.
Finally, run the following command to apply the changes:
```
$ xrdb -merge .Xresources
```
Now Xterm will start with Sixel mode enabled at every launch by default.
### Display Thumbnail Images In Terminal
Launch Xterm (Dont forget to start it with vt340 mode). Here is how Xterm looks like in my system.
![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png)
Like I already stated, lsix is very simple utility. It doesnt have any command line flags or configuration files. All you have to do is just pass the path of your file as an argument like below.
```
$ lsix ostechnix/logo.png
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png)
If you run it without path, it will display the thumbnail images in your current working directory. I have few files in a directory named **ostechnix**.
To display the thumbnails in this directory, just run:
```
$ lsix
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png)
See? The thumbnails of all files are displayed in the terminal itself.
If you use ls command, you would just see the filenames only, not thumbnails.
![][3]
You can also display a specific image or group of images of a specific type using wildcards.
For example, to display a single image, just mention the full path of the image like below.
```
$ lsix girl.jpg
```
![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png)
To display all images of a specific type, say PNG, use the wildcard character like below.
```
$ lsix *.png
```
![][4]
For JPEG type images, the command would be:
```
$ lsix *jpg
```
The thumbnail image quality is surprisingly good. I thought lsix would just display blurry thumbnails. I was wrong. The thumbnails are clearly visible just like on the graphical image viewers.
And, thats all for now. As you can see, lsix is very similar to ls command, but it only for displaying thumbnails. If you deal with a lot of images at work, lsix might be quite handy. Give it a try and let us know your thoughts on this utility in the comment section below. If you know any similar tools, please suggest them as well. I will check and update this guide.
More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/
作者:[SK][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.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/
[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png
[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png

View File

@ -0,0 +1,265 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using Yarn on Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/install-yarn-ubuntu)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
Using Yarn on Ubuntu and Other Linux Distributions
======
**This quick tutorial shows you the official way of installing Yarn package manager on Ubuntu and Debian Linux. Youll also learn some basic Yarn commands and the steps to remove Yarn completely.**
[Yarn][1] is an open source JavaScript package manager developed by Facebook. It is an alternative or should I say improvement to the popular npm package manager. [Facebook developers team][2] created Yarn to overcome the shortcomings of [npm][3]. Facebook claims that Yarn is faster, reliable and more secure than npm.
Like npm, Yarn provides you a way to automate the process of installing, updating, configuring, and removing packages retrieved from a global registry.
The advantage of Yarn is that it is faster as it caches every package it downloads so it doesnt need to download it again. It also parallelizes operations to maximize resource utilization. Yarn also uses [checksums to verify the integrity][4] of every installed package before its code is executed. Yarn also guarantees that an install that worked on one system will work exactly the same way on any other system.
If you are [using nodejs on Ubuntu][5], probably you already have npm installed on your system. In that case, you can use npm to install Yarn globally in the following manner:
```
sudo npm install yarn -g
```
However, I would recommend using the official way to install Yarn on Ubuntu/Debian.
### Installing Yarn on Ubuntu and Debian [The Official Way]
![Yarn JS][6]
The instructions mentioned here should be applicable to all versions of Ubuntu such as Ubuntu 18.04, 16.04 etc. The same set of instructions are also valid for Debian and other Debian based distributions.
Since the tutorial uses Curl to add the GPG key of Yarn project, it would be a good idea to verify whether you have Curl installed already or not.
```
sudo apt install curl
```
The above command will install Curl if it wasnt installed already. Now that you have curl, you can use it to add the GPG key of Yarn project in the following fashion:
```
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
```
After that, add the repository to your sources list so that you can easily upgrade the Yarn package in future with the rest of the system updates:
```
sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list'
```
You are set to go now. [Update Ubuntu][7] or Debian system to refresh the list of available packages and then install yarn:
```
sudo apt update
sudo apt install yarn
```
This will install Yarn along with nodejs. Once the process completes, verify that Yarn has been installed successfully. You can do that by checking the Yarn version.
```
yarn --version
```
For me, it showed an output like this:
```
yarn --version
1.12.3
```
This means that I have Yarn version 1.12.3 installed on my system.
### Using Yarn
I presume that you have some basic understandings of JavaScript programming and how dependencies work. I am not going to go in details here. Ill show you some of the basic Yarn commands that will help you getting started with it.
#### Creating a new project with Yarn
Like npm, Yarn also works with a package.json file. This is where you add your dependencies. All the packages of the dependencies are cached in the node_modules directory in the root directory of your project.
In the root directory of your project, run the following command to generate a fresh package.json file:
It will ask you a number of questions. You can skip the questions r go with the defaults by pressing enter.
```
yarn init
yarn init v1.12.3
question name (test_yarn): test_yarn_proect
question version (1.0.0): 0.1
question description: Test Yarn
question entry point (index.js):
question repository url:
question author: abhishek
question license (MIT):
question private:
success Saved package.json
Done in 82.42s.
```
With this, you get a package.json file of this sort:
```
{
"name": "test_yarn_proect",
"version": "0.1",
"description": "Test Yarn",
"main": "index.js",
"author": "abhishek",
"license": "MIT"
}
```
Now that you have the package.json, you can either manually edit it to add or remove package dependencies or use Yarn commands (preferred).
#### Adding dependencies with Yarn
You can add a dependency on a certain package in the following fashion:
```
yarn add <package_name>
```
For example, if you want to use [Lodash][8] in your project, you can add it using Yarn like this:
```
yarn add lodash
yarn add v1.12.3
info No lockfile found.
[1/4] Resolving packages…
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Building fresh packages…
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
Done in 2.67s.
```
And you can see that this dependency has been added automatically in the package.json file:
```
{
"name": "test_yarn_proect",
"version": "0.1",
"description": "Test Yarn",
"main": "index.js",
"author": "abhishek",
"license": "MIT",
"dependencies": {
"lodash": "^4.17.11"
}
}
```
By default, Yarn will add the latest version of a package in the dependency. If you want to use a specific version, you may specify it while adding.
As always, you can also update the package.json file manually.
#### Upgrading dependencies with Yarn
You can upgrade a particular dependency to its latest version with the following command:
```
yarn upgrade <package_name>
```
It will see if the package in question has a newer version and will update it accordingly.
You can also change the version of an already added dependency in the following manner:
You can also upgrade all the dependencies of your project to their latest version with one single command:
```
yarn upgrade
```
It will check the versions of all the dependencies and will update them if there are any newer versions.
#### Removing dependencies with Yarn
You can remove a package from the dependencies of your project in this way:
```
yarn remove <package_name>
```
#### Install all project dependencies
If you made any changes to the project.json file, you should run either
```
yarn
```
or
```
yarn install
```
to install all the dependencies at once.
### How to remove Yarn from Ubuntu or Debian
Ill complete this tutorial by mentioning the steps to remove Yarn from your system if you used the above steps to install it. If you ever realized that you dont need Yarn anymore, you will be able to remove it.
Use the following command to remove Yarn and its dependencies.
```
sudo apt purge yarn
```
You should also remove the Yarn repository from the repository list:
```
sudo rm /etc/apt/sources.list.d/yarn.list
```
The optional next step is to remove the GPG key you had added to the trusted keys. But for that, you need to know the key. You can get that using the apt-key command:
Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging
Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02]
The key here is the last 8 characters of the GPG keys fingerprint in the line starting with pub.
So, in my case, the key is 86E50310 and Ill remove it using this command:
```
sudo apt-key del 86E50310
```
Youll see an OK in the output and the GPG key of Yarn package will be removed from the list of GPG keys your system trusts.
I hope this tutorial helped you to install Yarn on Ubuntu, Debian, Linux Mint, elementary OS etc. I provided some basic Yarn commands to get you started along with complete steps to remove Yarn from your system.
I hope you liked this tutorial and if you have any questions or suggestions, please feel free to leave a comment below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-yarn-ubuntu
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://yarnpkg.com/lang/en/
[2]: https://code.fb.com/
[3]: https://www.npmjs.com/
[4]: https://itsfoss.com/checksum-tools-guide-linux/
[5]: https://itsfoss.com/install-nodejs-ubuntu/
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/yarn-js-ubuntu-debian.jpeg?resize=800%2C450&ssl=1
[7]: https://itsfoss.com/update-ubuntu/
[8]: https://lodash.com/

View File

@ -0,0 +1,138 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to create presentations with Beamer)
[#]: via: (https://opensource.com/article/19/1/create-presentations-beamer)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
How to create presentations with Beamer
======
Beamer brings LaTeX's powerful typesetting features and ecosystem to creating slides.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b)
[Beamer][1] is a LaTeX package for generating presentation slide decks. One of its nicest features is that it can take advantage of LaTeX's powerful typesetting system and all the other packages in its ecosystem. For example, I often use LaTeX's [listings][2] package in Beamer presentations that include code.
### Starting a presentation
To begin a Beamer document, enter:
```
\documentclass{beamer}
```
As you would with any other LaTeX document, add any packages you want to use. For example, to use the **listings** package, enter:
```
\usepackage{listings}
```
Place all content inside the **document** environment:
```
\begin{document}
```
Beamer documents are usually a sequence of **frame** environments. Frames that contain code should be marked **fragile** :
```
\begin{frame}[fragile]
```
Begin your frames with a title:
```
\frametitle{Function to Do Stuff}
```
### Testing your code before you present it
One of the worst feelings in the world is giving a talk and realizing, as you walk through the code, that there is a glaring bug in it—maybe a misspelled keyword or an unclosed brace.
The solution is to test code that is presented. In most presentation environments, this means creating a separate file, writing tests, then copying and pasting.
However, with Beamer, there is a better way. Imagine you have a file named **do_stuff.py** that contains code. You can write tests for the **do_stuff.py** code in a second file, which you call **test_do_stuff.py** , and can exercise it with, say, [pytest][3]. However, most of the lines in **do_stuff.py** lack pedagogic value, like defining helper functions.
To simplify things for your audience, you can import just the lines you want to talk about into the frame in your presentation :
```
\lstinputlisting[
    language=Python,
    firstline=8,
    lastline=15
]{do_stuff.py}
```
Since you will be talking through those lines (from 8 to 15), you don't need any other content on the slide. Close the frame:
```
\end{frame}
```
On the next slide, you want to show a usage example for the **do_stuff()** function you just presented:
```
\begin{frame}[fragile]
\frametitle{Calling Function to Do Stuff}
\lstinputlisting[
    language=Python,
    firstline=17,
    lastline=19
]{do_stuff.py}
\end{frame}
```
You use the same file, but this time you show the lines that call the function. Finally, close the document:
```
\end{document}
```
Assuming you have an appropriate Python file in **do_stuff.py** , this will produce a short two-slide presentation.
Beamer also supports necessary features such as progressive revelation, showing only one bullet at a time to prevent the audience from being distracted by reading ahead.": **\pause** inside a list will divide bullets into pages:
```
\begin{frame}
Remember:
\begin{itemize}
\item This will show up on the first slide. \pause
\item This will show up on the
      second slide, as well as the preceding point. \pause
\item Finally, on the third slide,
       all three bullets will show up.
\end{frame}
```
### Creating handouts
My favorite feature in Beamer is that you can set it to ignore everything outside a frame with **\documentclass[ignorenonframetext]{beamer}**. When I prepare a presentation, I leave off the top (where the document class is declared) and auto-generate two versions of it: one with Beamer that ignores all text outside any frame, which I use for my presentation, and one with a header like:
```
\documentclass{article}
\usepackage{beamerarticle}
```
which generates a handout—a PDF that has all the frames and all the text between them.
When a conference organizer asks me to publish my slides, I include the original slide deck as a reference, but the main thing I like people to have is the handout, which has all the explanatory text that I don't want to include on the slide deck itself.
When creating presentation slides, people often wonder whether it's better to optimize their materials for the presentation or for people who want to read them afterward. Fortunately, Beamer provides the best of both worlds.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/create-presentations-beamer
作者:[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://www.overleaf.com/learn/latex/Beamer
[2]: https://www.overleaf.com/learn/latex/Code_listing
[3]: https://docs.pytest.org/en/latest/

View File

@ -0,0 +1,53 @@
[#]: collector: (lujun9972)
[#]: translator: (qhwdw)
[#]: reviewer: ()
[#]: publisher: ()
[#]: url: ()
[#]: subject: (Computer Laboratory Raspberry Pi: Lesson 0 Introduction)
[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html)
[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34)
计算机实验室 树莓派:课程 0简介
======
这个课程简介不包含实践内容,但它解释了一个操作系统的基本概念、汇编代码、和其它很重要的一些基本原理。如果你想直接进入实践环节,跳过本课程并不会有什么问题。
### 1、操作系统
一个操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话也需要操作系统它可能使用的操作系统是 Android、iOS 和 [Windows Phone][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1]
由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须有系统上硬件专有的内容。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。
操作系统有各种不同的设计方式,在本课程中,我们只触及操作系统设计的皮毛。本课程中,我们主要专注于操作系统与各种硬件的交互部分,因为这经常是比较棘手的部分,并且也是在网络上文档和帮助最少的部分。
### 2、汇编代码
```
一个处理器每秒可以执行上百万的指令,但是这些指令必须要简单。
```
本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 **RAM** 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。
常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic、等等来写代码然后一个叫编译器的程序将程序员写的代码转换成汇编代码然后进一步转换为[二进制代码][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2]。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。
![Compiler process][1]
和普通编程一样,也有很多不同的汇编代码编程语言,但与普通编程不一样的是,每个汇编编程语言是面对不同的处理器的,每种处理器设计为去理解不同的语言。因此,用一个针对某种机器设计的汇编语言所写的汇编代码,是不能在其它种类的机器上运行的。很多情况下,这都是一个大灾难,因此每个程序都必须在使用它的不同种类的机器上重写一遍,但对于操作系统,这不是个问题,因为在不同的硬件上它必须得重写。尽管如此,大多数操作系统都是用 C++ 或 C 来写的,这样它们就可以很容易地在不同种类的硬件上使用,只需要重写那些必须用汇编代码来实现的部分即可。
现在,你已经准备好进入第一节课了,它是 [课程 1OK01][2]
--------------------------------------------------------------------------------
via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html
作者:[Robert Mullins][a]
选题:[lujun9972][b]
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: http://www.cl.cam.ac.uk/~rdm34
[b]: https://github.com/lujun9972
[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/compiling.png
[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html

View File

@ -0,0 +1,97 @@
10 个供管理员快速使用的杀手工具
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT)
当工作负载累计时,管理网络和系统变得富有压力。没有人能真正意识到需要花费多长时间,每个人都希望在昨天能够完成他们的具体事务。
所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。
So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time.
因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。
### 服务器配置和脚本
让我们看一看!
**[NixCraft][1]**
用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。
**[Webmin][2]**
它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。
**[Windows 下的 Linux 子系统][3]**
现代工作场所的现实是大多数员工都运行着 Windows而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。
你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。
这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。
**[mRemoteNG][4]**
当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。
### 设置网络,这样你就无需再这样做了。
一个考虑不周的网络是厌恶加班管理员的死敌。
**[可拓展的 IP 寻址方案][5]**
IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。
没有人有时间做这件事!
到了某个时候IPv6 终将到来来拯救这世界。在那之前无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机这些一刀切的IP 寻址方案都应该让我们继续前行。
**[Linux Chmod 权限备忘录][6]**
一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。
**[VLSM 子网计算器][7]**
只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。
### 单一用途的 Linux 发行版
需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。
下面这些每一个都使得我的工作变得轻松了许多。
**[Porteus Kiosk][8]**
这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。
**[Parted Magic][9]**
这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。
**[IPFire][10]**
啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”译者注IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。
那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松?
我很高兴知道,请在评论中分享您的工具。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/tools-admin
作者:[Grant Hamono][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[bestony](https://github.com/bestony)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/grantdxm
[1]:https://www.cyberciti.biz/
[2]:http://www.webmin.com/
[3]:http://wsl-guide.org/en/latest/
[4]:https://mremoteng.org/
[5]:https://blog.dxmtechsupport.com.au/ip-addressing-for-a-small-business-that-might-grow/
[6]:https://isabelcastillo.com/linux-chmod-permissions-cheat-sheet
[7]:http://www.vlsm-calc.net/
[8]:http://porteus-kiosk.org/
[9]:https://partedmagic.com/
[10]:https://www.ipfire.org/

View File

@ -0,0 +1,93 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 cool new projects to try in COPR for December 2018)
[#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/)
[#]: author: (Dominik Turecek https://fedoramagazine.org)
2018 年 12 月值得尝试的 4个很酷的 COPR 新项目
======
![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg)
COPR 是个人软件仓库[集合][1],它不在 Fedora 中。某些软件不符合允许轻松打包的标准。或者它可能不符合其他 Fedora 标准尽管它是自由开源的。COPR 可在 Fedora套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或由项目自己签名。但是,这是尝试新的或实验性软件的一种很好的方法。
这是 COPR 中一组新的有趣项目。
### MindForger
[MindForger][2] 是 Markdown 编辑器和笔记本。除了你希望的 Markdown 编辑器的功能之外MindForger 还允许你将单个文件拆分为多个笔记。组织笔记并在文件之间移动、搜索它们都很容易。我已经使用 MindForger 一段时间来记录学习笔记了,现在可以在 COPR 中找到它啦。
![][3]
#### 安装说明
该仓库目前在 Fedora 29 和 Rawhide 中提供 MindForger。要安装 MindForger请使用以下命令
```
sudo dnf copr enable deadmozay/mindforger
sudo dnf install mindforger
```
### Clingo
[Clingo][4] 是使用[回答集编程][5] ASP 建模语言解决逻辑问题的程序。使用 ASP你可以将问题声明为一个 Clingo 逻辑程序然后解决。最后Clingo 以逻辑模型的形式产生问题的解决方案,称为回答集。
#### 安装说明
该仓库目前为 Fedora 28 和 29 提供 Clingo。要安装 Clingo请使用以下命令
```
sudo dnf copr enable timn/clingo
sudo dnf install clingo
```
### SGVrecord
[SGVrecord][6] 是一个用于录制屏幕的简单工具。它允许你捕获整个屏幕或仅选择其中的一部分。此外有没有声音都可以进行录制。Sgvrecord 以 WebM 格式生成文件。
![][7]
#### 安装说明
该仓库目前为 Fedora 28、29 和 Rawhide 提供 SGVrecord。要安装 SGVrecord请使用以下命令
```
sudo dnf copr enable youssefmsourani/sgvrecord
sudo dnf install sgvrecord
```
### Watchman
[Watchman][8] 是一个对文件更改进行监视和记录的服务。你可以为指定 Watchman 监视的目录树,以及定义指定文件发生更改时触发的操作。
#### 安装说明
该仓库目前为 Fedora 29 和 Rawhide 提供 Watchman。要安装 Watchman请使用以下命令
```
sudo dnf copr enable eklitzke/watchman
sudo dnf install watchman
```
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/4-try-copr-december-2018/
作者:[Dominik Turecek][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://fedoramagazine.org
[b]: https://github.com/lujun9972
[1]: https://copr.fedorainfracloud.org/
[2]: https://www.mindforger.com/
[3]: https://fedoramagazine.org/wp-content/uploads/2018/12/mindforger.png
[4]: https://potassco.org/clingo/
[5]: https://en.wikipedia.org/wiki/Answer_set_programming
[6]: https://github.com/yucefsourani/sgvrecord
[7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png
[8]: https://facebook.github.io/watchman/