Merge pull request #13 from LCTT/master

更新
This commit is contained in:
zEpoch 2021-06-28 12:07:48 +08:00 committed by GitHub
commit f566482a4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 891 additions and 486 deletions

View File

@ -0,0 +1,189 @@
[#]: collector: "lujun9972"
[#]: translator: "BoosterY"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13529-1.html"
[#]: subject: "7 Git tricks that changed my life"
[#]: via: "https://opensource.com/article/20/10/advanced-git-tips"
[#]: author: "Rajeev Bera https://opensource.com/users/acompiler"
七个改变我生活的 Git 小技巧
======
> 这些有用的小技巧将改变你在当前最流行的版本控制系统下的工作方式。
![](https://img.linux.net.cn/data/attachment/album/202106/28/110029d64pblurlh5a4a50.jpg)
Git 是当前最流行最普遍的版本控制系统之一,它被应用于私有系统和公开网站上各种各样的开发工作。不论我变得对 Git 有多熟悉,似乎总有些功能等待着被发掘。下面分享下和 Git 相关的改变我工作方式的一些小技巧。
### 1、Git 中的自动纠错
我们每个人都不时在输入时犯拼写错误,但是如果你使能了 Git 的自动纠错功能,你就能让 Git 自动纠正一些输入错误的子命令。
假如你想用命令 `git status` 来检查状态,但是你恰巧错误地输入了 `git stats`。通常情况下Git 会告诉你 stats 不是个有效的命令:
```
$ git stats
git: stats is not a git command. See git --help.
The most similar command is
status
```
为了避免类似情形,只需要在你的 Git 配置中使能自动纠错功能。
```
$ git config --global help.autocorrect 1
```
如果你只想对当前的仓库生效,就省略掉选项 `--global`
这个命令会使能自动纠错功能。在相应的 [Git 官方文档][2] 中可以看到这个命令的详细说明,但是试着敲一下上面的错误命令会使你对这个设置干了什么有个直观的了解:
```
$ git stats
git: stats is not a git command. See git --help.
On branch master
Your branch is up to date with origin/master.
nothing to commit, working tree clean
```
在上面的例子中Git 直接运行了它建议命令的第一个,也就是 `git status`,而不是给你展示它所建议的子命令。
### 2、对提交进行计数
需要对提交进行计数的原因有很多。例如,一些开发人员利用提交计数来判断什么时候递增工程构建序号,也有一些开发人员用提交计数来对项目进展取得一个整体上的感观。
对提交进行计数相当简单而且直接,下面就是相应的 Git 命令:
```
$ git rev-list --count branch-name
```
在上述命令中,参数 `branch-name` 必须是一个你当前仓库里的有效分支名。
```
$ git rev-list count master
32
$ git rev-list count dev
34
```
### 3、仓库优化
你的代码仓库不仅对你来说很宝贵,对你所在的组织也一样。通过少数几个惯例你就能使自己的仓库整洁并且保持最新。[使用 .gitignore 文件][3] 就是这些最好的惯例之一。通过使用这个文件你可以告诉 Git 不要保存一些不需要记录的文件,如二进制文件、临时文件等等。
当然,你还可以使用 Git 的垃圾回收来进一步优化你的仓库。
```
$ git gc --prune=now --aggressive
```
这个命令在你和你的团队经常使用 `pull` 或者 `push` 操作的时候很有帮助。
它是一个内部工具,能清理掉你的仓库里没法访问或者说“空悬”的 Git 对象。
### 4、给未追踪的文件来个备份
大多数时候,删除所有未追踪的文件是安全的。但很多时候也有这么一种场景,你想删掉这些未追踪的文件同时也想做个备份防止以后需要用到。
Git 组合一些 Bash 命令和管道操作,可以让你可以很容易地给那些未追踪的文件创建 zip 压缩包。
```
$ git ls-files --others --exclude-standard -z |\
xargs -0 tar rvf ~/backup-untracked.zip
```
上面的命令就生成了一个名字为 `backup-untracked.zip` 的压缩包文件(当然,在 `.gitignore` 里面忽略了的文件不会包含在内)。
### 5、了解你的 .git 文件夹
每个仓库都有一个 `.git` 文件夹,它是一个特殊的隐藏文件夹。
```
$ ls -a
. … .git
```
Git 主要通过两个东西来工作:
1. 当前工作树(你当前检出的文件状态)
2. 你的 Git 仓库的文件夹(准确地说,包含版本信息的 `.git` 文件夹的位置)
这个文件夹存储了所有参考信息和一些其他的如配置、仓库数据、HEAD 状态、日志等更多诸如此类的重要细节。
一旦你删除了这个文件夹,尽管你的源码没被删,但是类似你的工程历史记录等远程信息就没有了。删除这个文件夹意味着你的工程(至少本地的复制)不再在版本控制的范畴之内了。这也就意味着你没法追踪你的修改;你没法从远程仓拉取或推送到远程仓了。
通常而言,你需要或者应当对你的 `.git` 文件夹的操作并不多。它是被 Git 管理的,而且大多数时候是一个禁区。然而,在这个文件夹内还是有一些有趣的工件,比如说当前的 HEAD 状态在内的就在其中。
```
$ cat .git/HEAD
ref: refs/heads/master
```
它也隐含着对你仓库地描述:
```
$ cat .git/description
```
这是一个未命名的仓库;通过编辑文件 description 可以给这个仓库命名。
Git 钩子文件夹连同一些钩子文件例子也在这里。参考这些例子你就能知道 Git 钩子能干什么了。当然,你也可以 [参考这个 Seth Kenlon 写的 Git 钩子介绍][4]。
### 6、浏览另一个分支的文件
有时,你会想要浏览另一个分支下某个文件的内容。这其实用一个简单的 Git 命令就可以实现,甚至都不用切换分支。
设想你有一个命名为 [README.md][5] 的文件,并且它在 `main` 分支上。当前你正工作在一个名为 `dev` 的分支。
用下面的 Git 命令,在终端上就行。
```
$ git show main:README.md
```
一旦你执行这个命令,你就能在你的终端上看到 `main` 分支上该文件的内容。
### 7、Git 中的搜索
用一个简单的命令你就能在 Git 中像专业人士一样搜索了。更有甚者,尽管你不确定你的修改在哪次提交或者哪个分支上,你依然能搜索。
```
$ git rev-list --all | xargs git grep -F ''
```
例如,假设你想在你的仓库中搜索字符串 `“font-size: 52 px;"`
```
$ git rev-list all | xargs git grep -F font-size: 52 px;
F3022…9e12:HtmlTemplate/style.css: font-size: 52 px;
E9211…8244:RR.Web/Content/style/style.css: font-size: 52 px;
```
### 试试这些小技巧
我希望这些小技巧对你是有用的,或者增加你的生产力或者节省你的大量时间。
你也有一些喜欢的 [Git 技巧][6] 吗?在评论区分享吧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/10/advanced-git-tips
作者:[Rajeev Bera][a]
选题:[lujun9972][b]
译者:[BoosterY](https://github.com/BoosterY)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/acompiler
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open)
[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_code_help_autocorrect_code
[3]: https://opensource.com/article/20/8/dont-ignore-gitignore
[4]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6
[5]: http://README.md
[6]: https://acompiler.com/git-tips/

View File

@ -3,18 +3,20 @@
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13530-1.html)
KTorrentKDE 的一个非常有用的 BitTorrent 应用
KTorrentKDE 的一个非常有用的 BitTorrent 应用
======
Linux 中有各种各样的 BitTorrent 应用。但是,找到一个好的、提供许多功能的应用应该可以为你节省一些时间。
![](https://img.linux.net.cn/data/attachment/album/202106/28/120031cml79jimcs99ybpy.jpg)
Linux 中有各种各样的 BitTorrent 应用。但是,找到一个好的、提供许多功能的应用将可以为你节省一些时间。
KDE 的 KTorrent 就是这样一个为 Linux 打造的 BitTorrent 应用。
虽然 [Linux 有几个 torrent 客户端][1],但我最近发现 KTorrent 对我而言很有趣
虽然 [Linux 有几个 torrent 客户端][1],但我最近发现 KTorrent 对我而言很合适
### KTorrent: 适用于 Linux 的开源 BitTorrent 客户端
@ -22,7 +24,7 @@ KDE 的 KTorrent 就是这样一个为 Linux 打造的 BitTorrent 应用。
KTorrent 是一个成熟的 torrent 客户端,主要为 KDE 桌面定制。无论你使用什么桌面环境,它都能很好地工作。
当然使用KDE桌面你可以得到一个无缝的用户体验。
当然,使用 KDE 桌面,你可以得到一个无缝的用户体验。
让我们来看看它的所有功能。
@ -35,45 +37,43 @@ KTorrent 是一个成熟的 torrent 客户端,主要为 KDE 桌面定制。无
* 在一个队列中添加 torrent 下载
* 能够控制每次下载(或整体)的速度限制
* 视频和音频文件预览选项
* 支持导入下载文件(部分/全部)
* 支持导入下载文件(部分/全部)
* 在下载多个文件时,能够对 torrent 下载进行优先排序
* 为多文件 torrent 选择要下载的特定文件
* IP 过滤器,可选择踢走/禁止 peer
* IP 过滤器,可选择踢走/禁止对端
* 支持 UDP 跟踪器
* 支持 µTorrent peer
* 支持 µTorrent 对端
* 支持协议加密
* 能够创建无 tracker 的 torrent
* 能够创建无跟踪器的 torrent
* 脚本支持
* 系统托盘集成
* 通过代理连接
* 增加了插件支持
* 支持 IPv6
KTorrent 听起来很有用,作为一个 torrent 客户端,你可以日常控制它在一个地方管理所有的 torrent 下载。
KTorrent 看起来可以作为一个日常使用的 torrent 客户端,在一个地方管理所有的 torrent 下载。
![][4]
除了上面提到的功能外,它还对客户端的行为提供了很大的控制。例如,调整指示下载/暂停/tracker 服务器的颜色。
除了上面提到的功能外,它还对客户端的行为提供了很大的控制。例如,调整下载/暂停/跟踪器的指示颜色。
如果你想禁用完成 torrent 下载的声音或得到活动通知,你还可以设置通知。
如果你想禁用完成 torrent 下载的声音或得到活动通知,你还可以设置通知。
![][5]
虽然像协议加密支持这样的功能可能无法取代一些[最好的 VPN][6] 服务,但它对桌面客户端来说是一个重要的补充。
虽然像协议加密支持这样的功能可能无法取代一些 [最好的私有专用网络][6] 服务,但它对桌面客户端来说是一个重要的补充。
### 在 Linux 中安装 KTorrent
KTorrent 应该可以通过包管理器(如 [Synaptic][7])或默认的仓库获得。你也可以在你的软件中心找到它并轻松安装。
除此之外,它还在 [Flathub][9] 上提供了一个适用于任何 Linux 发行版的 [Flatpak][8] 官方包。如果你需要帮助,我们有一个 [Flatpak 指南][10]供参考。
除此之外,它还在 [Flathub][9] 上提供了一个适用于任何 Linux 发行版的 [Flatpak][8] 官方包。如果你需要帮助,我们有一个 [Flatpak 指南][10] 供参考。
如果你喜欢的话,你也可以尝试可用的 [snap包][11]。
要探索更多关于它和源码的信息,请前往它的[官方 KDE 应用页面][12]。
要探索更多关于它和源码的信息,请前往它的 [官方 KDE 应用页面][12]。
[KTorrent][12]
- [KTorrent][12]
### 结束语
@ -90,7 +90,7 @@ via: https://itsfoss.com/ktorrent/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,126 @@
[#]: subject: (Using Git Version Control as a Writer)
[#]: via: (https://news.itsfoss.com/version-control-writers/)
[#]: author: (Theena https://news.itsfoss.com/author/theena/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Using Git Version Control as a Writer
======
I believe modern writers should begin thinking about their processes, or workflows.
In a highly distracted world, it is imperative to take ownership over the chain of tasks we perform every day as writers. Traditionally, writers would put their writing to the hours where the distraction is less, and the focus high. Unfortunately advice from Hemingway, Atwood, et al., isnt really applicable to us any more. The world we live in is far more connected, and thus have far more pitfalls for writers. Part of that is being disciplined enough to not let social media or cute videos of puppies and kittens distract us at the times we are writing.
But disconnecting from the internet isnt really an option if part of your writing requires quick fact-checks, spellings of uncommon and technical words, etc., this is very true for me when I am writing. The other issue is the distractions that are within the writing app itself; as a life long MS Word user, I found it getting prettier, but slower and more distracting. I spoke about this at length as being among the [primary reasons for transitioning into Vim][1] in the first place, so I am not going to speak extensively on this. The point being that writing in the modern world, on modern devices can be far from ideal.
Since Ive already gone into detail on the [why I switched to Vim][2] and open source version control, I would like to use this article to talk about the **how**, specifically how to use open source version control technology such as git (and GitHub).
### What is Version Control, again?
![Source: https://git-scm.com/][3]
The diagram above is a illustration of how we perform traditional version control. This
diagram assumes that you have one device and that you write only in that device. In my case, I write on a number of machines, including my Android phone and a selection of laptops of varying ages that I use for specific and in specific places. The one common task that I carry out between all these devices is writing it is imperative, therefore, that my devices capture changes and version controls my files in sane manner. No more `file1V1_device1_date.doc` as I would name my files.
The diagram above also doesnt take into account the tools that we use to write.A word processor such as LibreOffice Write works across Linux, Mac, and Windows machines, but using a word processor on the phone is an unpleasant experience. Some of us writers also use other text tools, including Gmail or our email clients, to write little sketches for our writing. Keeping track of all of these files and emails in a logical order is exhausting I wrote a book using such a process, and trust me: the time I spent figuring out file names, version changes, comments, notes to self, and emails with additional notes, was enough to drive me to distraction.
Some of you reading this might rightly point out that cloud-based backup technology
exists. While the benefits of cloud-based storage are immense, and I continue using them, version control barely exists, or isnt powerful.
### A better workflow
Like the rest of the planet, the start of the pandemic led to some anxiety and some soul
searching. I spent the time teaching myself web development on [The Odin Project][4] (highly recommended for those who are thinking of learning html, CSS, JavaScript/Ruby).
Among the first modules was an introduction to Git: what version control was, and what problems it sought to address. Reading this chapter was a revelation. I knew immediately that this _git_ was exactly what I was looking for as a writer.
The better way, then, isnt localized version control but _distributed_ version control. Distributed describes the distribution of the _devices_ that I will be accessing a file from, and editing/changing thereafter. The diagram below is a visual illustration of distributed version control.
![Source: https://git-scm.com/][5]
### My way
My goals in building a version control system for writing were as follows:
* Make my manuscript repository accessible from anywhere, from any device
* Ease of use
* Reduce or remove the friction that comes about from shifting context between writing, study and coding workflows as much as possible, we will use the same tool (i.e. Vim)
* Scalable
* Easy to maintain
Based on the above needs, the diagram below is my distributed version control system for my writing.
![][6]
As you can see, my version control system is a simplistic adaptation of distributed version control. By adding git version control to a folder on cloud storage ([pCloud][7]) in my case, I can now draw the benefits of both technologies. Thus my workflow can be visualized as follows:
![][8]
#### Advantages
1. I have one writing (and coding) tool
2. I have version control of my manuscripts, no matter what device I access the file from
3. Its [super easy, barely an inconvenience][9]
4. Easy to maintain.
#### Drawbacks
The writers among you must wonder what drawbacks exist in the system. Here are a few that I anticipate as I continue using and refining this workflow.
* Comments on drafts: one of the more useful features of word processors is the ability to comment. I often leave comments for myself when I want to come back to a certain portion of the text. I still havent figured out a workaround for this.
* Collaboration: Word processors allow for collaboration between writers. During my advertising days, I would use Google Docs to write copy and share the link with my designers to extract the copy for ads and websites. Right now, my workaround for this writing the copy in markdown, and exporting the markdown file to a .doc file via Pandoc. More critically, when my manuscripts are completed, Id need to still send the files in .doc format for my editors. Once my editor makes
those changes and sends it back, it makes little sense for me to try opening it again in Vim. At this point, the systems limitations will become more obvious.
In no way am I saying this is the best method, but this is the best method for _me_ at this
point in my career. I imagine I will be refining this further as I get more familiar and comfortable with my new [open source tools for writing][10] and version control.
I hope this serves as a good introduction to writers wanting to use Git for their document version control. This is by no means an extensive article, but I will share some useful links to make the journey easier for you.
1. [Git Basics from The Odin Project:][11]
2. [Getting started with Git][12]
3. GitHubs Basics of Git Tutorial
As a bonus, heres a screen recording of me using Vim on my Android device to work on a poem, pushing the changes to Git.
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/version-control-writers/
作者:[Theena][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/theena/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/how-i-started-loving-vim/
[2]: https://news.itsfoss.com/configuring-vim-writing/
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjY2NiIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[4]: https://www.theodinproject.com/
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjgwMCIgd2lkdGg9IjY2OCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjYwNSIgd2lkdGg9IjYxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[7]: https://itsfoss.com/recommends/pcloud/
[8]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9Ijc1MSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[9]: https://www.youtube.com/watch?v=NtH-HhaLw-Q
[10]: https://itsfoss.com/open-source-tools-writers/
[11]: https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/introduction-to-git
[12]: https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control

View File

@ -1,109 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (stevenzdg988)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Music composition with Python and Linux)
[#]: via: (https://opensource.com/article/20/2/linux-open-source-music)
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss)
Music composition with Python and Linux
======
A chat with Mr. MAGFest—Brendan Becker.
![Wires plugged into a network switch][1]
I met Brendan Becker working in a computer store in 1999. We both enjoyed building custom computers and installing Linux on them. Brendan was always involved in several technology projects at once, ranging from game coding to music composition. Fast-forwarding a few years from the days of computer stores, he went on to write [pyDance][2], an open source implementation of multiple dancing games, and then became the CEO of music and gaming event [MAGFest][3]. Sometimes referred to as "Mr. MAGFest" because he was at the helm of the event, Brendan now uses the music pseudonym "[Inverse Phase][4]" as a composer of chiptunes—music predominantly made on 8-bit computers and game consoles.
I thought it would be interesting to interview him and ask some specifics about how he has benefited from Linux and open source software throughout his career.
![Inverse Phase performance photo][5]
Copyright Nickeledge, CC BY-SA 2.0.
### Alan Formy-Duval: How did you get started in computers and software?
Brendan Becker: There's been a computer in my household almost as far back as I can remember. My dad has fervently followed technology; he brought home a Compaq Portable when they first hit the market, and when he wasn't doing work on it, I would have access to it. Since I began reading at age two, using a computer became second nature to me—just read what it said on the disk, follow the instructions, and I could play games! Some of the time I would be playing with learning and education software, and we had a few disks full of games that I could play other times. I remember a single disk with a handful of free clones of popular titles. Eventually, my dad showed me that we could call other computers (BBS'ing at age 5!), and I saw where some of the games came from. One of the games I liked to play was written in BASIC, and all bets were off when I realized that I could simply modify the game by just reading a few things and re-typing them to make my game easier.
### Formy-Duval: This was the 1980s?
Becker: The Compaq Portable dropped in 1983 to give you a frame of reference. My dad had one of the first of that model.
### Formy-Duval: How did you get into Linux and open source software?
Becker: I was heavy into MODs and demoscene stuff in the early 90s, and I noticed that Walnut Creek ([cdrom.com][6]; now defunct) ran shop on FreeBSD. I was super curious about Unix and other operating systems in general, but didn't have much firsthand exposure, and thought it might be time to finally try something. DOOM had just released, and someone told me I might even be able to get it to run. Between that and being able to run cool internet servers, I started going down the rabbit hole. Someone saw me reading about FreeBSD and suggested I check out Linux, this new OS that was written from the ground up for x86, unlike BSD, which (they said) had some issues with compatibility. So, I joined #linuxhelp on undernet IRC and asked how to get started with Linux, pointing out that I had done a modicum of research (asking "what's the difference between Red Hat and Slackware?") and probing mainly about what would be easiest to use. The only person talking in the channel said that he was 13 years old and he could figure out Slackware, so I should not have an issue. A math teacher in my school gave me a hard disk, I downloaded the "A" disk sets and a boot disk, wrote it out, installed it, and didn't spend much time looking back.
### Formy-Duval: How'd you become known as Mr. MAGFest?
Becker: Well, this one is pretty easy. I became the acting head of MAGFest almost immediately after the first event. The former chairpeople were all going their separate ways, and I demanded the event not be canceled to the guy in charge. The solution was to run it myself, and that nickname became mine as I slowly molded the event into my own.
### Formy-Duval: I remember attending in those early days. How large did MAGFest eventually become?
Becker: The first MAGFest was 265 people. It is now a scary huge 20,000+ unique attendees.
### Formy-Duval: That is huge! Can you briefly describe the MAGFest convention?
Becker: One of my buddies, Hex, described it really well. He said, "It's like this video-game themed birthday party with all of your friends, but there happen to be a few thousand people there, and all of them can be your friends if you want, and then there are rock concerts." This was quickly adopted and shortened to "It's a four-day video game party with multiple video game rock concerts." Often the phrase "music and gaming festival" is all people need to get the idea.
### Formy-Duval: How did you make use of open source software in running MAGFest?
Becker: At the time I became the head of MAGFest, I had already written a game in Python, so I felt most comfortable also writing our registration system in Python. It was a pretty easy decision since there were no costs involved, and I already had the experience. Later on, our online registration system and rideshare interfaces were written in PHP/MySQL, and we used Kboard for our forums. Eventually, this evolved to us rolling our own registration system from scratch in Python, which we also use at the event, and running Drupal on the main website. At one point, I also wrote a system to manage the video room and challenge stations in Python. Oh, and we had a few game music listening stations that you could flip through tracks and liner notes of iconic game OSTs (Original Sound Tracks) and bands who played MAGFest.
### Formy-Duval: I understand that a few years ago you reduced your responsibilities at MAGFest to pursue new projects. What was your next endeavor?
Becker: I was always rather heavily into the game music scene and tried to bring as much of it to MAGFest as possible. As I became a part of those communities more and more, I wanted to participate. I wrote some medleys, covers, and arrangements of video game tunes using free, open source versions of the DOS and Windows demoscene tools that I had used before, which were also free but not necessarily open source. I released a few tracks in the first few years of running MAGFest, and then after some tough love and counseling from Jake Kaufman (also known as virt; Shovel Knight and Shantae are on his resume, among others), I switched gears to something I was much better at—chiptunes. Even though I had written PC speaker beeps and boops as a kid with my Compaq Portable and MOD files in the demoscene throughout the 90s, I released the first NES-spec track that I was truly proud to call my own in 2006. Several pop tributes and albums followed.
In 2010, I was approached by multiple individuals for game soundtrack work. Even though the soundtrack work didn't affect it much, I began to scale back some of my responsibilities with MAGFest more seriously, and in 2011, I decided to take a much larger step into the background. I would stay on the board as a consultant and help people learn what they needed to run their departments, but I was no longer at the helm. At the same time, my part-time job, which was paying the bills, laid off all of their workers, and I suddenly found myself with a lot of spare time. I began writing Pretty Eight Machine, a Nine Inch Nails tribute, which I spent over a year on, and between that and the game soundtrack work, I proved to myself that I could put food on the table (if only barely) with music, and this is what I wanted to do next.
###
![Inverse Phase CTM Tracker][7]
Copyright Inverse Phase, Used with permission.
### Formy-Duval: What is your workspace like in terms of hardware and software?
Becker: In my DOS/Windows days, I used mostly FastTracker 2. In Linux, I replaced that with SoundTracker (not Karsten Obarski's original, but a GTK rewrite; see [soundtracker.org][8]). These days, SoundTracker is in a state of flux—although I still need to try the new GTK3 version—but [MilkyTracker][9] is a good replacement when I can't use SoundTracker. Good old FastTracker 2 also runs in DOSBox, if I really need the original. This was when I started using Linux, however, so this is stuff I figured out 20-25 years ago.
Within the last ten years, I've gravitated away from sample-based music and towards chiptunes—music synthesized by old sound chips from 8- and 16-bit game systems and computers. There is a very good cross-platform tool called [Deflemask][10] to write music for a lot of these systems. A few of the systems I want to write music for aren't supported, though, and Deflemask is closed source, so I've begun building my own music composition environment from scratch with Python and [Pygame][11]. I maintain my code tree using Git and will control hardware synthesizer boards using open source [KiCad][12].
### Formy-Duval: What projects are you currently focused on?
Becker: I work on game soundtracks and music commissions off and on. While that's going on, I've also been working on starting an electronic entertainment museum called [Bloop][13]. We're doing a lot of cool things with archival and inventory, but perhaps the most exciting thing is that we've been building exhibits with Raspberry Pis. They're so versatile, and it's weird to think that, if I had tried to do this even ten years ago, I wouldn't have had small single-board computers to drive my exhibits; I probably would have bolted a laptop to the back of a flat-panel!
### Formy-Duval: There are a lot more game platforms coming to Linux now, such as Steam, Lutris, and Play-on-Linux. Do you think this trend will continue, and these are here to stay?
Becker: As someone who's been gaming on Linux for 25 years—in fact, I was brought to Linux _because_ of games—I think I find this question harder than most people would. I've been running Linux-native games for decades, and I've even had to eat my "either a Linux solution exists or can be written" words back in the day, but eventually, I did, and wrote a Linux game.
Real talk: Android's been out since 2008. If you've played a game on Android, you've played a game on Linux. Steam's been available for Linux for eight years. The Steambox/SteamOS was announced only a year after Steam. I don't hear a whole lot about Lutris or Play-on-Linux, but I know they exist and hope they succeed. I do see a pretty big following for GOG, and I think that's pretty neat. I see a lot of quality game ports coming out of people like Ryan Gordon (icculus) and Ethan Lee (flibitijibibo), and some companies even port in-house. Game engines like Unity and Unreal already support Linux. Valve has incorporated Proton into the Linux version of Steam for something like two years now, so now Linux users don't even have to search for Linux-native versions of their games.
I can say that I think most gamers expect and will continue to expect the level of support they're already receiving from the retail game market. Personally, I hope that level goes up and not down!
_Learn more about Brendan's work as [Inverse Phase][14]._
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/2/linux-open-source-music
作者:[Alan Formy-Duval][a]
选题:[lujun9972][b]
译者:[stevenzdg988](https://github.com/stevenzdg988)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/alanfdoss
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other21x_cc.png?itok=JJJ5z6aB (Wires plugged into a network switch)
[2]: http://icculus.org/pyddr/
[3]: http://magfest.org/
[4]: http://www.inversephase.com/
[5]: https://opensource.com/sites/default/files/uploads/inverse_phase_performance_bw.png (Inverse Phase performance photo)
[6]: https://en.wikipedia.org/wiki/Walnut_Creek_CDROM
[7]: https://opensource.com/sites/default/files/uploads/inversephase_ctm_tracker_screenshot.png (Inverse Phase CTM Tracker)
[8]: http://soundtracker.org
[9]: http://www.milkytracker.org
[10]: http://www.deflemask.com
[11]: http://www.pygame.org
[12]: http://www.kicad-pcb.org
[13]: http://bloopmuseum.com
[14]: https://www.inversephase.com

View File

@ -1,203 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (BoosterY)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 Git tricks that changed my life)
[#]: via: (https://opensource.com/article/20/10/advanced-git-tips)
[#]: author: (Rajeev Bera https://opensource.com/users/acompiler)
7 Git tricks that changed my life
======
These helpful tips will change the way you work with the popular version
control system.
![Computer screen with files or windows open][1]
Git is one of the most common version control systems available, and it's used on private systems and publicly hosted websites for all kinds of development work. Regardless of how proficient with Git I become, it seems there are always features left to discover. Here are seven tricks that have changed the way I work with Git.
### 1\. Autocorrection in Git
We all make typos sometimes, but if you have Git's auto-correct feature enabled, you can let Git automatically fix a mistyped subcommand.
Suppose you want to check the status with `git status` but you type `git stats` by accident. Under normal circumstances, Git tells you that 'stats' is not a valid command:
```
$ git stats
git: stats is not a git command. See git --help.
The most similar command is
status
```
To avoid similar scenarios, enable Git autocorrection in your Git configuration:
```
`$ git config --global help.autocorrect 1`
```
If you want this to apply only to your current repository, omit the `--global` option.
This command enables the autocorrection feature. An in-depth tutorial is available at [Git Docs][2], but trying the same errant command as above gives you a good idea of what this configuration does:
```
$ git stats
git: stats is not a git command. See git --help.
On branch master
Your branch is up to date with origin/master.
nothing to commit, working tree clean
```
Instead of suggesting an alternative subcommand, Git now just runs the top suggestion, which in this case was **git status**.
### 2\. Count your commits
There are many reasons you might need to count your commits. Many developers count the number of commits to judge when to increment the build number, for instance, or just to get a feel for how the project is progressing.
To count your commits is really easy and straightforward; here is the Git command:
```
`$ git rev-list --count`
```
In the above command, the **branch-name** should be a valid branch name in your current repository.
```
$ git rev-list count master
32
$ git rev-list count dev
34
```
### 3\. Optimize your repo
Your code repository is valuable not only for you but also for your organization. You can keep your repository clean and up to date with a few simple practices. One of the best practices is to [use the .gitignore file][3]. By using this file, you are telling Git not to store many unwanted files like binaries, temporary files, and so on.
To optimize your repository further, you can use Git garbage collection.
```
`$ git gc --prune=now --aggressive`
```
This command helps when you or your team heavily uses **pull** or **push** commands.
This command is an internal utility that cleans up unreachable or "orphaned" Git objects in your repository.
### 4\. Take a backup of untracked files
Most of the time, it's safe to delete all the untracked files. But many times, there is a situation wherein you want to delete, but also to create a backup of your untracked files just in case you need them later.
Git, along with some Bash command piping, makes it easy to create a zip archive for your untracked files.
```
$ git ls-files --others --exclude-standard -z |\
xargs -0 tar rvf ~/backup-untracked.zip
```
The above command makes an archive (and excludes files listed in .gitignore) with the name backup-untracked.zip
### 5\. Know your .git folder
Every repository has a .git folder. It is a special hidden folder.
```
$ ls -a
. … .git
```
Git mainly works with two things:
1. The working tree (the state of files in your current checkout)
2. The path of your Git repository (specifically, the location of the .git folder, which contains the versioning information)
This folder stores all references and other important details like configurations, repository data, the state of HEAD, logs, and much more.
If you delete this folder, the current state of your source code is not deleted, but your remote information, such as your project history, is. Deleting this folder means your project (at least, the local copy) isn't under version control anymore. It means you cannot track your changes; you cannot pull or push from a remote.
Generally, there's not much you need to do, or should do, in your .git folder. It's managed by Git and is considered mostly off-limits. However, there are some interesting artifacts in this directory, including the current state of HEAD:
```
$ cat .git/HEAD
ref: refs/heads/master
```
It also contains, potentially, a description of your repository:
```
`$ cat .git/description`
```
This is an unnamed repository; edit this file 'description' to name the repository.
The Git hooks folder is also here, complete with example hook files. You can read these samples to get an idea of what's possible through Git hooks, and you can also [read this Git hook introduction by Seth Kenlon][4].
### 6\. View a file of another branch
Sometimes you want to view the content of the file from another branch. It's possible with a simple Git command, and without actually switching your branch.
Suppose you have a file called [README.md][5], and it's in the **main** branch. You're working on a branch called **dev**.
With the following Git command, you can do it from the terminal.
```
`$ git show main:README.md`
```
Once you execute this command, you can view the content of the file in your terminal.
### 7\. Search in Git
You can search in Git like a pro with one simple command. Better still, you can search in Git even if you aren't sure which commit—or even branch—you made your changes.
```
`$ git rev-list --all | xargs git grep -F `
```
For example, suppose you want to search for the string "font-size: 52 px;" in your repository:
```
$ git rev-list all | xargs git grep -F font-size: 52 px;
F3022…9e12:HtmlTemplate/style.css: font-size: 52 px;
E9211…8244:RR.Web/Content/style/style.css: font-size: 52 px;
```
### Try these tips
I hope these advanced tips are useful and boost your productivity, saving you lots of time.
Do you have [Git tips][6] you love? Share them in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/10/advanced-git-tips
作者:[Rajeev Bera][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/acompiler
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open)
[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_code_help_autocorrect_code
[3]: https://opensource.com/article/20/8/dont-ignore-gitignore
[4]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6
[5]: http://README.md
[6]: https://acompiler.com/git-tips/

View File

@ -1,152 +0,0 @@
[#]: subject: (Replace du with dust on Linux)
[#]: via: (https://opensource.com/article/21/6/dust-linux)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Replace du with dust on Linux
======
The dust command is a more intuitive implementation of the du command
written in Rust.
![Sand dunes][1]
If you work on the Linux command line, you will be familiar with the `du` command. Knowing commands like `du`, which returns information about disk usage quickly, is one of the ways the command line makes programmers more productive. Yet if you're looking for a way to save even more time and make your life even easier, take a look at [dust][2], which is `du` rewritten in Rust with more intuitiveness.
In short, `dust` is a tool that provides a file's type and metadata. If you trigger `dust` in a directory, it will report that directory's disk utilization in a couple of ways. It provides a very informative graph that tells you which folder is using the most disk space. If there is a nested folder, you can see the percentage of space used by each folder.
### Install dust
You can install `dust` using Rust's Cargo package manager:
```
`$ cargo install du-dust`
```
Alternately, you might find it in your software repository on Linux, and on macOS, use [MacPorts][3] or [Homebrew][4].
### Explore dust
Issuing the `dust` command on a directory returns a graph that shows its contents and what percentage each item holds in a tree format.
```
$ dust
 5.7M   ┌── exa                                                                                                         ██ │   2%
 5.9M   ├── tokei                                                                                                       ██ │   2%
 6.1M   ├── dust                                                          │                                                ██ │   2%
 6.2M   ├── tldr                                                          │                                                ██ │   2%
 9.4M   ├── fd                                                            │                                                ██ │   4%
 2.9M   │ ┌── exa                                                                                                     ░░░█ │   1%
  15M   │ ├── rustdoc                                                                                                 ░███ │   6%
  18M   ├─┴ bin                                                                                                       ████ │   7%
  27M   ├── rg                                                            │                                            ██████ │  11%
 1.3M      ┌── libz-sys-1.1.3.crate                                    │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   0%
 1.4M      ├── libgit2-sys-0.12.19+1.1.0.crate                                      ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   1%
 4.5M    ┌─┴ github.com-1ecc6299db9ec823                                            ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   2%
 4.5M   │ ┌─┴ cache                                                                    ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │   2%
 1.0M   │ │   ┌── git2-0.13.18                                            │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   0%
 1.4M   │ │   ├── exa-0.10.1                                              │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 1.5M   │ │   │ ┌── src                                                                ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 2.2M   │ │   ├─┴ idna-0.2.3                                              │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 1.2M   │ │        ┌── linux                                                        ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   0%
 1.6M   │ │      ┌─┴ linux_like                                        │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 2.6M   │ │    ┌─┴ unix                                                │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 3.1M   │ │   │ ┌─┴ src                                                                ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 3.1M   │ │   ├─┴ libc-0.2.94                                                          ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 1.2M   │ │      ┌── test                                              │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   0%
 2.6M   │ │    ┌─┴ zlib-ng                                                          ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 904K   │ │     ┌── vstudio                                                      ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   0%
 2.0M   │ │    │ ┌─┴ contrib                                                        ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 3.4M   │ │    ├─┴ zlib                                                │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 6.1M   │ │   │ ┌─┴ src                                                                ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │   2%
 6.1M   │ │   ├─┴ libz-sys-1.1.3                                          │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │   2%
 1.6M   │ │      ┌── pcre                                              │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 2.5M   │ │    ┌─┴ deps                                                │               ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 3.8M   │ │    ├── src                                                              ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │   1%
 7.4M   │ │   │ ┌─┴ libgit2                                                            ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │   3%
 7.6M   │ │   ├─┴ libgit2-sys-0.12.19+1.1.0                                            ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │   3%
  26M   │ │ ┌─┴ github.com-1ecc6299db9ec823                                            ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████ │  10%
  26M   │ ├─┴ src                                                                      ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████ │  10%
 932K   │ │   ┌── .cache                                                  │               ░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█ │   0%
  11M   │ │      ┌── pack-c3e3a51a17096a3078196f3f014e02e5da6285aa.idx │               ░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███ │   4%
 135M   │ │      ├── pack-c3e3a51a17096a3078196f3f014e02e5da6285aa.pack│               ░░░░░░▓▓███████████████████████████ │  53%
 147M   │ │    ┌─┴ pack                                                │               ░░░░░░█████████████████████████████ │  57%
 147M   │ │   │ ┌─┴ objects                                                            ░░░░░░█████████████████████████████ │  57%
 147M   │ │   ├─┴ .git                                                    │               ░░░░░░█████████████████████████████ │  57%
 147M   │ │ ┌─┴ github.com-1ecc6299db9ec823                                            ░░░░░░█████████████████████████████ │  57%
 147M   │ ├─┴ index                                                                    ░░░░░░█████████████████████████████ │  57%
 178M   ├─┴ registry                                                      │               ███████████████████████████████████ │  69%
 257M ┌─┴ .                                                               │██████████████████████████████████████████████████ │ 100%
$
```
To apply `dust` to a specific directory:
```
`$ dust ~/Work/`
```
![Dust output from a specific directory][5]
(Sudeshna Sur, [CC BY-SA 4.0][6])
The `-r` option shows the output in reverse order, with root at the bottom:
```
`$ dust -r ~/Work/`
```
Using `dust -d 3` returns three levels of subdirectories and their disk utilization:
```
`$ dust -d 3 ~/Work/wildfly/jaxrs/target/classes`[/code] [code]
$ dust -d 3 ~/Work/wildfly/jaxrs/target/classes
 4.0K     ┌── jaxrs.xml                                                                                                  █ │   1%
 4.0K   ┌─┴ subsystem-templates                                                                                          █ │   1%
 4.0K    ┌── org.jboss.as.controller.transform.ExtensionTransformerRegistration│                                         █ │   1%
 4.0K    ├── org.jboss.as.controller.Extension                                                                        █ │   1%
 8.0K   │ ┌─┴ services                                                            │                                         █ │   2%
 8.0K   ├─┴ META-INF                                                              │                                         █ │   2%
 4.0K   │ ┌── jboss-as-jaxrs_1_0.xsd                                              │                                        ░█ │   1%
 8.0K   │ ├── jboss-as-jaxrs_2_0.xsd                                              │                                        ░█ │   2%
  12K   ├─┴ schema                                                                │                                        ██ │   3%
 408K    ┌── as                                                                │  ████████████████████████████████████████ │  94%
 408K   │ ┌─┴ jboss                                                               │  ████████████████████████████████████████ │  94%
 408K   ├─┴ org                                                                   │  ████████████████████████████████████████ │  94%
 432K ┌─┴ classes                                                                 │██████████████████████████████████████████ │ 100%
$
```
### Conclusion
The beauty of `dust` lies in being a small, simple, and easy-to-understand command. It uses a color scheme to denote the largest subdirectories, making it easy to visualize your directory. It's a popular project, and contributions are welcome.
Have you used or considered using `dust`? If so, please let us know your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/6/dust-linux
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/sudeshna-sur
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sand_dunes_desert_hills_landscape_nature.jpg?itok=wUByylBb
[2]: https://github.com/bootandy/dust
[3]: https://opensource.com/article/20/11/macports
[4]: https://opensource.com/article/20/6/homebrew-mac
[5]: https://opensource.com/sites/default/files/uploads/dust-work.png (Dust output from a specific directory)
[6]: https://creativecommons.org/licenses/by-sa/4.0/

View File

@ -2,7 +2,7 @@
[#]: via: (https://opensource.com/article/21/6/copy-files-linux-freedos)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,154 @@
[#]: subject: (Try Chatwoot, an open source customer relationship platform)
[#]: via: (https://opensource.com/article/21/6/chatwoot)
[#]: author: (Nitish Tiwari https://opensource.com/users/tiwarinitish86)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Try Chatwoot, an open source customer relationship platform
======
Chatwoot is an open source alternative to Intercom, Zendesk, Salesforce
Service Cloud, and other proprietary communications platforms.
![Digital images of a computer desktop][1]
Chatwoot is an open source customer relationship platform built with Ruby and Vue.js. It was written from scratch to allow customer-relations teams to build end-to-end platforms for ticket management and support.
This article looks at Chatwoot's architecture, installation, and key features.
### Chatwoot's architecture
Chatwoot requires the following components to function properly:
* Chatwoot web servers
* Chatwoot workers
* PostgreSQL database
* Redis
* Email service (e.g., SMTP, SendGrid, Mailgun)
* Object storage (e.g., AWS S3, Azure, Google Cloud Storage, MinIO)
The Chatwoot server and workers are the core components that integrate with everything else. PostgreSQL and Redis are specific, required components.
![Chatwoot architecture][2]
(Nitish Tiwari, [CC BY-SA 4.0][3])
The other components, like the email server and object storage, are loosely coupled, so you can use any compatible system. Therefore, you could choose any SMTP server, self-hosted or SaaS, as your email service. Similarly, for object storage, you can use public cloud platforms like AWS S3, Azure Blob Store, GCS, or private cloud platforms like MinIO.
### Install Chatwoot
Chatwoot is available on common platforms, including Linux virtual machines, Docker, and as a single-click install application on [Heroku][4] and [CapRover][5]. This how-to looks at the Docker installation process; for other platforms, refer to Chatwoot's [documentation][6].
To begin, ensure Docker Compose is installed on your machine. Then, download the `env` and `docker-compose` files from [Chatwoot's GitHub repo][7]:
```
# Download the env file template
wget -O .env <https://raw.githubusercontent.com/chatwoot/chatwoot/develop/.env.example>
# Download the Docker compose template
wget -O docker-compose.yml <https://raw.githubusercontent.com/chatwoot/chatwoot/develop/docker-compose.production.yaml>
```
Open the `env` file and fill in the env variables `REDIS_PASSWORD` and `POSTGRES_PASSWORD`; these will be the passwords for Redis and PostgreSQL, respectively. Then update the same PostgreSQL password in the `docker-compose.yaml` file. 
Now, prepare PostgreSQL:
```
`docker-compose run --rm rails bundle exec rails db:chatwoot_prepare`
```
Deploy Chatwoot:
```
`docker-compose up -d`
```
You should now be able to access Chatwoot at `http://localhost:3000`.
![Chatwoot welcome screen][8]
(Nitish Tiwari, [CC BY-SA 4.0][3])
### Chatwoot features
Fill in the details on the welcome page to create the admin user. After that, you should land on the Conversations page.
![Chatwoot conversations screen][9]
(Nitish Tiwari, [CC BY-SA 4.0][3])
The following are Chatwoot's key features:
#### Channels
Chatwoot supports a wide range of platforms as messaging Channels (including website widgets, Facebook, Twitter, WhatsApp, email, and others). To create an integration, click on the **Inboxes** button on the left-hand sidebar. Then select the platform you want to integrate with.
![Chatwoot channels screen][10]
(Nitish Tiwari, [CC BY-SA 4.0][3])
Each platform has its own set of human agents, teams, labels, and canned responses. This way, Chatwoot allows a unified interface for talking to customers, but each channel is as customizable as it can be in the background.
#### Reporting
Organizations take customer response service-level agreements (SLAs) very seriously—and rightly so. Chatwoot has an integrated dashboard that gives a birds-eye view of the most important metrics, like total messages, response times, resolution times, etc. Administrators can also download reports for specific agents.
![Chatwoot reports screen][11]
(Nitish Tiwari, [CC BY-SA 4.0][3])
#### Contacts
Chatwoot also captures contact details from each incoming message and neatly arranges this information on a separate page called Contacts. This ensures all contact details are available for further follow-up or even syncing with an external, full-fledged customer relationship management (CRM) platform.
![Chatwoot Contacts][12]
(Nitish Tiwari, [CC BY-SA 4.0][3])
#### Integrations
Channels enable integrations with external messaging systems so that Chatwoot can communicate using these systems. However, what if you want a team to be notified on Slack if there is a new chat message on Chatwoot?
This is where Integration Webhooks come into the picture. This feature allows you to integrate Chatwoot into external systems so that it can send out relevant information.
![Chatwoot Integrations][13]
(Nitish Tiwari, [CC BY-SA 4.0][3])
### Learn more
Chatwoot provides many of the key communications features customer relations teams want. To learn more about Chatwoot, take a look at its [GitHub repository][14] and [documentation][15].
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/6/chatwoot
作者:[Nitish Tiwari][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/tiwarinitish86
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop)
[2]: https://opensource.com/sites/default/files/uploads/chatwoot_servicecalls.png (Chatwoot architecture)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://www.heroku.com/
[5]: https://caprover.com/docs/get-started.html
[6]: https://www.chatwoot.com/docs/self-hosted/deployment/architecture#available-deployment-options
[7]: https://github.com/chatwoot/chatwoot
[8]: https://opensource.com/sites/default/files/uploads/chatwoot_welcome.png (Chatwoot welcome screen)
[9]: https://opensource.com/sites/default/files/uploads/chatwoot_conversations.png (Chatwoot conversations screen)
[10]: https://opensource.com/sites/default/files/uploads/chatwoot_channels.png (Chatwoot channels screen)
[11]: https://opensource.com/sites/default/files/uploads/chatwoot_reports.png (Chatwoot reports screen)
[12]: https://opensource.com/sites/default/files/uploads/chatwoot_contacts.png (Chatwoot Contacts)
[13]: https://opensource.com/sites/default/files/uploads/chatwoot_integrations.png (Chatwoot Integrations)
[14]: http://github.com/chatwoot/chatwoot
[15]: https://www.chatwoot.com/help-center

View File

@ -0,0 +1,139 @@
[#]: subject: (Forgot Linux Password on WSL? Heres How to Reset it Easily)
[#]: via: (https://itsfoss.com/reset-linux-password-wsl/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Forgot Linux Password on WSL? Heres How to Reset it Easily
======
WSL (Windows Subsystem for Linux) is a handy tool for people who want to enjoy the power of Linux command line from the comfort of Windows.
When you [install Linux using WSL on Windows][1], you are asked to create a username and password. This user is automatically logged on when you start Linux on WSL.
Now, the problem is that if you havent used it for some time, you may forget the account password of WSL. And this will become a problem if you have to use a command with sudo because here youll need to enter the password.
![][2]
Dont worry. You can easily reset it.
### Reset forgotten password for Ubuntu or any other Linux distribution on WSL
To reset the Linux password in WSL, you have to:
* Switch the default user to root
* Reset the password for the normal user
* Switch back the default user to the normal user
Let me show you the steps in detail and with screenshots.
#### Step 1: Switch to root as default user
It will be wise to note down your accounts normal/regular username. As you can see, my regular accounts username is abhishek.
![Note down the account username][3]
The root user in WSL is unlocked and doesnt have a password set. This means that you can switch to the root user and then use the power of root to reset the password.
Since you dont remember the account password, switching to the root user is done by changing the configuration of your Linux WSL application and make it use root user by default.
This is done through Windows Command Prompt and youll need to know which command you need to run for your Linux distribution.
This information is usually provided in the description of the distribution app in the [Windows Store][4]. This is from where you had downloaded your distribution in the first place.
![Know the command to run for your distribution app][5]
From the Windows menu, start the command prompt:
![Start Command Prompt][6]
In here, use your distributions command in this fashion. If you were using the Ubuntu app from Windows store, the command would be:
```
ubuntu config --default-user root
```
In the screenshot, I am using Ubuntu 20.04 app from the Windows store. So, I have used ubuntu2004 command.
![Set root as default user in Linux apps configuration][7]
To save you the trouble, I am listing some distributions and their respective commands in this table:
Distribution App | Windows Command
---|---
Ubuntu | ubuntu config default-user root
Ubuntu 20.04 | ubuntu2004 config default-user root
Ubuntu 18.04 | ubuntu1804 config default-user root
Debian | debian config default-user root
Kali Linux | kali config default-user root
#### Step 2: Reset the password for the account
Now, if you start the Linux distribution app, you should be logged in as root. You can reset the password for the normal user account.
Do you remember the username in WSL? If not, you can always check the contents of the /home directory. When you have the username, use this command:
```
passwd username
```
It will ask you to enter a new password. **When you type here, nothing will be displayed on the screen. Thats normal. Just type the new password and hit enter.** Youll have to retype the new password to confirm and once again, nothing will be displayed on the screen while you type the password.
![Reset the password for the regular user][8]
Congratulations. The password for the user account has been reset. But you are done just yet. The default user is still root. You should change it back to your regular account user, otherwise it will keep on logging in as root user.
#### Step 3: Set regular user as default again
Youll need the regular account username that you used with the [passwd command][9] in the previous step.
Start the Windows command prompt once again. **Use your distributions command** in the similar manner you did in the step 1. However, this time, replace root with the regular user.
```
ubuntu config --default-user username
```
![Set regular user as default user][10]
Now when you start your Linux distribution app in WSL, youll be logged in as the regular user. You have reset the password fresh and can use it to run commands with sudo.
If you forgot the password again in the future, you know the steps to reset it.
### If resetting WSL password is this easy, is this not a security risk?
Not really. You need to have physical access to the computer along with access to the Windows account. If someone already has this much access, she/he can do a lot more than just changing the Linux password in WSL.
### Were you able to reset WSL password?
I gave you the commands and explained the steps. I hope this was helpful to you and you were able to reset the password of your Linux distribution in WSL.
If you are still facing issues or if you have a question on this topic, please feel free to ask in the comment section.
--------------------------------------------------------------------------------
via: https://itsfoss.com/reset-linux-password-wsl/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/install-bash-on-windows/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/reset-wsl-password.png?resize=800%2C450&ssl=1
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/username-wsl.png?resize=800%2C296&ssl=1
[4]: https://www.microsoft.com/en-us/store/apps/windows
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/wsl-distro-command.png?resize=800%2C602&ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/start-cmd-windows.jpg?resize=800%2C500&ssl=1
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/wsl-set-root-as-default.png?resize=800%2C288&ssl=1
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/resetting-wsl-password.png?resize=800%2C366&ssl=1
[9]: https://linuxhandbook.com/passwd-command/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/set-regular-user-as-default-wsl.png?resize=800%2C288&ssl=1

View File

@ -0,0 +1,110 @@
[#]: collector: (lujun9972)
[#]: translator: (stevenzdg988)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Music composition with Python and Linux)
[#]: via: (https://opensource.com/article/20/2/linux-open-source-music)
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss)
Music composition with Python and Linux
用 Python 和 Linux 进行音乐创作
======
与 MAGFest 先生的聊天——Brendan Becker。
![接入网络交换机的网络线缆][1]
1999 年,我遇到了在一家计算机商店工作的 Brendan Becker。我们都喜欢构建定制计算机并在其上安装 Linux。 Brendan 总是同时参与多个技术项目,从游戏编程到音乐创作。从电脑商店的日子快进几年,他继续编写[pyDance][2],一个多跳舞游戏的开源实现,然后成为音乐和游戏项目[MAGFest][3]的 CEO。有时被称为 “Mr. MAGFest”因为他是项目的负责人Brendan 现在使用音乐笔名 “[Inverse Phase][4]” 作为 `chiptunes`(电子和音)的作曲家——主要在8位计算机和游戏控制台上制作音乐。
我认为采访他并询问他在整个职业生涯中如何从 Linux 和开源软件中受益的一些细节会很有趣。
![Inverse Phase 表演照片][5]
版权所有 Nickeledge, CC BY-SA 2.0.
### Alan Formy-Duval: 您是如何开始使用计算机和软件的?
Brendan Becker从我记事起我家就有一台电脑。我父亲热衷于技术当 Compaq Portable 第一次大量上市时他带了一台回家当他不用它工作时我可以使用它。自从我两岁开始阅读来使用电脑就成了我的第二天性——只要阅读磁盘上的内容按照说明进行操作我就可以玩游戏了有时我会玩学习和教育软件我们有几张装满游戏的磁盘我可以在其他时间玩。我记得有一个磁盘里面有一些流行主题的免费克隆。最终我父亲向我展示了我们可以调用其他计算机5 岁时在 BBS 上!),我看到了一些游戏的来源。我喜欢玩的一款游戏是用 BASIC 编写的,当我意识到我可以简单地修改游戏时,只需阅读一些内容并重新输入它们以使我的游戏更容易,所有的赌注都被取消了。
### Formy-Duval: 这是 80 年代?
Becker Compaq Portable 康柏便携式电脑于 1983 年推出,为您提供了一个参考框架。我爸爸有第一个那个模型。
### Formy-Duval: 您是如何进入 Linux 和开源软件的?
Becker在 90 年代初我酷爱 MOD 和演示场景的东西,我注意到 Walnut Creek[cdrom.com][6];现已解散)在 FreeBSD 上运行商店。总的来说,我对 Unix 和其他操作系统非常好奇但没有太多的第一手资料认为是时候尝试一些东西了。DOOM 刚刚发布,有人告诉我甚至可以让它运行。在这与能够运行很酷的互联网服务器之间,我开始陷入困境。有人看到我在阅读有关 FreeBSD 的文章,并建议我检查 Linux这是一个重新为 x86 编写的新操作系统,与 BSD 不同,后者(他们说)存在一些兼容性问题。因此,我加入了在线交谈网络 IRC 上的 `#linuxhelp` 并询问如何开始使用 Linux指出我已经做了一些研究询问 “Red Hat 和 Slackware 之间有什么区别?”)并主要探讨什么是最简单的使用。频道里唯一说话的人说他已经 13 岁了,他可以弄清楚 Slackware所以我应该没有问题。学校的一个数学老师给了我一个硬盘我下载了 “A” 盘组和一个启动盘,写了出来,安装了它,回头看并没有花太多时间。
### Formy-Duval: 你是如何被称为 MAGFest 先生的?
Becker这个很简单。在第一个项目后我几乎立即成为了 MAGFest 的代理负责人。前任主席都各奔东西,我向负责人要求不要取消项目。解决方案是自己运行它,当我慢慢地将项目塑造成我自己的时,这个昵称就成了我的。
### Formy-Duval: 我记得在那些早期参加过。 MAGFest 到底有多大?
Becker第一届 MAGFest 是 265 人。现在是一个可怕的庞大的罕见的 20,000+ 出席者。
### Formy-Duval: 太棒了!您能简要描述一下 MAGFest 大会吗?
Becker我的一个朋友 Hex 描述得非常好。他说:“就像是和你所有的朋友一起举办这个以电子游戏为主题的生日派对,但那里恰好有几千人,如果你愿意,他们都可以成为你的朋友,然后还有摇滚音乐会。” 这很快被采用并缩短为 “这是一个为期四天的视频游戏派对,有多个视频游戏摇滚音乐会”。通常 “音乐和游戏节” 这个措词是人们所需要的。
### Formy-Duval: 您是如何利用开源软件来运行 MAGFest 的?
Becker当我成为 MAGFest 的负责人时,我已经用 Python 编写了一个游戏,所以我觉得用 Python 编写我们的注册系统最舒服。这是一个非常容易的决定,因为不涉及任何成本,而且我已经有了经验。后来,我们的在线注册系统和拼车界面都是用 PHP/MySQL 编写的,我们的论坛使用了 Kboard。最终从无到有逐渐形成在 Python 中滚动我们自己的注册系统,我们也在项目中使用它,并在主网站上运行 Drupal。有一次我还用 Python 编写了一个系统来管理视频室和邀请比赛站。哦,我们有一些游戏音乐收听站,你可以翻阅曲目,标志性游戏的班轮笔记 OST原始音轨和演奏 MAGFest 的乐队。
### Formy-Duval: 我知道几年前你减少了你在 MAGFest 的职责,去追求新的项目。你接下来的努力是什么?
Becker我一直非常投入游戏音乐领域并试图将尽可能多的音乐带到 MAGFest 中。随着我越来越多地成为这些社区的一部分,我想参与其中。我使用我以前使用过的免费开源版本的 DOS 和 Windows 演示场景工具编写了一些视频游戏曲调的混合曲、封面和编曲,这些工具也是免费的,但不一定是开源的。我在运行 MAGFest 的最初几年发布了一些曲目,然后在 Jake Kaufman也被称为 `virt`;其中包括 Shovel Knight 和 Shantae 等人在他的简历上)的一些严厉的爱和建议之后,我改变主题到我更擅长的—— `chiptunes`(电子和音)。尽管我在 90 年代的演示场景中用我的 Compaq Portable 和 MOD 文件编写了 PC 扬声器的哔哔声和嘘声,但我还是在 2006 年发布了第一首 NES-spec 曲目,我真的很自豪地称之为我自己的曲目。专辑紧随其后。
2010 年,有很多人找我做游戏配乐工作。尽管配乐工作对它没有太大影响,但我开始更认真地缩减我在 MAGFest 的一些职责,并且在 2011 年,我决定在后台采取更大的步骤。我会留在董事会担任顾问,帮助人们了解他们需要什么来管理他们的部门,但我不再掌舵了。与此同时,我的兼职工作,即支付账单,解雇了他们所有的工人,我突然发现自己有很多空闲时间。我开始写 Pretty Eight Machine Nine Inch Nails 致敬,我花了一年多,在那和游戏配乐工作之间,我向自己证明了我可以用音乐把食物放在桌子上(如果只是勉强),这就是我接下来想做的。
###
![Inverse Phase CTM 跟踪器][7]
版权所有 Inverse Phase,经许可使用。
### Formy-Duval: 就硬件和软件而言,您的工作空间是什么样的?
Becker在我的 DOS/Windows 时代,我主要使用 FastTracker 2。在 Linux 中,我将其替换为 SoundTracker不是 Karsten Obarski 的原始版本,而是 GTK 重写;参见 [soundtracker.org][8]。这些天SoundTracker 处于不断变化的状态——虽然我仍然需要尝试新的 GTK3 版本——但是当我无法使用 SoundTracker 时,[MilkyTracker][9] 是一个很好的替代品。如果我真的需要原版,那么好老的 FastTracker 2 也可以在 DOSBox 中运行。然而,那是我开始使用 Linux 的时候,所以这是我在 20-25 年前发现的东西。
在过去的十年里,我已经从基于样本的音乐转向了`chiptunes`(电子和音)——由来自 8 位和 16 位游戏系统和计算机的旧声音芯片合成的音乐。有一个非常好的跨平台工具 [Deflemask][10] 可以为许多这些系统编写音乐。不过,我想为其创作音乐的一些系统不受支持,而且 Deflemask 是闭源的,因此我已经开始使用 Python 和 [Pygame][11] 从头开始构建自己的音乐创作环境。我使用 Git 维护我的代码树,并将使用开源 [KiCad][12] 控制硬件合成器板。
### Formy-Duval: 您目前专注于哪些项目?
Becker我断断续续地制作游戏配乐和音乐委员会。在此期间我还一直致力于创办一个名为 [Bloop][13] 的电子娱乐博物馆。我们在档案和详细目录方面做了很多很酷的事情,但也许最令人兴奋的是我们一直在用 Raspberry Pi 构建展览。它们是如此多才多艺,而且很奇怪,如果我在十年前尝试这样做,我就不会拥有小型单板计算机来驱动我的展品;我可能会用螺栓将笔记本电脑固定在平板的背面!
### Formy-Duval: 现在有更多游戏平台进入 Linux例如 Steam、Lutris 和 Play-on-Linux。您认为这种趋势会持续下去吗这些会一直存在吗
Becker作为一个在 Linux 上玩了 25 年游戏的人——事实上,我被带到 Linux _是因为_ 游戏——我想我认为这个问题比大多数人更难。几十年来,我一直在运行 Linux 原生游戏,我甚至不得不对“存在 Linux 解决方案或可以编写”的话表示食言,但最终,我做到了,编写了一个 Linux 游戏。
真心话Android 于 2008 年问世。如果您在 Android 上玩过游戏,那么您就在 Linux 上玩过游戏。Steam 已可用于 Linux 八年。Steambox/SteamOS 仅在 Steam 发布一年后发布。我没有听到很多关于 Lutris 或 Play-on-Linux 的消息,但我知道它们存在并希望它们成功。我确实看到 GOG 的追随者非常多,我认为这非常好。我看到很多高质量的游戏端口来自 Ryan Gordon (icculus) 和 Ethan Lee (flibitijibibo) 等人甚至有些公司在内部移植。Unity 和 Unreal 等游戏引擎已经支持 Linux。Valve 已经将 Proton 纳入 Linux 版本的 Steam 已有两年左右的时间了,所以现在 Linux 用户甚至不必搜索他们游戏的 Linux 原生版本。
我可以说,我认为大多数游戏玩家期待并将继续期待他们已经从零售游戏市场获得的支持水平。就我个人而言,我希望这个水平增长而不是下降!
_详细了解 Brendan 担任 [Inverse Phase][14] 的工作。_
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/2/linux-open-source-music
作者:[Alan Formy-Duval][a]
选题:[lujun9972][b]
译者:[stevenzdg988](https://github.com/stevenzdg988)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/alanfdoss
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other21x_cc.png?itok=JJJ5z6aB (Wires plugged into a network switch)
[2]: http://icculus.org/pyddr/
[3]: http://magfest.org/
[4]: http://www.inversephase.com/
[5]: https://opensource.com/sites/default/files/uploads/inverse_phase_performance_bw.png (Inverse Phase performance photo)
[6]: https://en.wikipedia.org/wiki/Walnut_Creek_CDROM
[7]: https://opensource.com/sites/default/files/uploads/inversephase_ctm_tracker_screenshot.png (Inverse Phase CTM Tracker)
[8]: http://soundtracker.org
[9]: http://www.milkytracker.org
[10]: http://www.deflemask.com
[11]: http://www.pygame.org
[12]: http://www.kicad-pcb.org
[13]: http://bloopmuseum.com
[14]: https://www.inversephase.com

View File

@ -0,0 +1,151 @@
[#]: subject: (Replace du with dust on Linux)
[#]: via: (https://opensource.com/article/21/6/dust-linux)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
在 Linux 上用 dust 代替 du
======
dust 命令是用 Rust 编写的对 du 命令的一个更直观实现。
![Sand dunes][1]
如果你在 Linux 命令行上工作,你会熟悉 `du` 命令。了解像 `du` 这样的可以快速返回磁盘使用情况命令,是命令行使程序员更有效率的方法之一。然而,如果你正在寻找一种方法来节省更多的时间,使你的生活更加容易,看看 [dust][2],它是用 Rust 重写的 `du`,具有更多的直观性。
简而言之,`dust` 是一个提供文件类型和元数据的工具。如果你在一个目录中触发了 `dust`,它将以几种方式报告该目录的磁盘利用率。它提供了一个信息量很大的图表,告诉你哪个文件夹使用的磁盘空间最大。如果有一个嵌套的文件夹,你可以看到每个文件夹使用的空间百分比。
### 安装 dust
你可以使用 Rust 的 Cargo 包管理器安装 `dust`
```
`$ cargo install du-dust`
```
另外,你可以在 Linux 上的软件库中找到它,在 macOS 上,使用 [MacPorts][3] 或 [Homebrew][4]。
### 探索 dust
在一个目录中执行 `dust` 命令,会返回一个图表,以树状格式显示其内容和每个项目所占的百分比。
```
$ dust
5.7M ┌── exa │ ██ │ 2%
5.9M ├── tokei │ ██ │ 2%
6.1M ├── dust │ ██ │ 2%
6.2M ├── tldr │ ██ │ 2%
9.4M ├── fd │ ██ │ 4%
2.9M │ ┌── exa │ ░░░█ │ 1%
15M │ ├── rustdoc │ ░███ │ 6%
18M ├─┴ bin │ ████ │ 7%
27M ├── rg │ ██████ │ 11%
1.3M │ ┌── libz-sys-1.1.3.crate │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │ 0%
1.4M │ ├── libgit2-sys-0.12.19+1.1.0.crate │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │ 1%
4.5M │ ┌─┴ github.com-1ecc6299db9ec823 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │ 2%
4.5M │ ┌─┴ cache │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ │ 2%
1.0M │ │ ┌── git2-0.13.18 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 0%
1.4M │ │ ├── exa-0.10.1 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
1.5M │ │ │ ┌── src │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
2.2M │ │ ├─┴ idna-0.2.3 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
1.2M │ │ │ ┌── linux │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 0%
1.6M │ │ │ ┌─┴ linux_like │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
2.6M │ │ │ ┌─┴ unix │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
3.1M │ │ │ ┌─┴ src │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
3.1M │ │ ├─┴ libc-0.2.94 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
1.2M │ │ │ ┌── test │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 0%
2.6M │ │ │ ┌─┴ zlib-ng │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
904K │ │ │ │ ┌── vstudio │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 0%
2.0M │ │ │ │ ┌─┴ contrib │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
3.4M │ │ │ ├─┴ zlib │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
6.1M │ │ │ ┌─┴ src │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │ 2%
6.1M │ │ ├─┴ libz-sys-1.1.3 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │ 2%
1.6M │ │ │ ┌── pcre │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
2.5M │ │ │ ┌─┴ deps │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
3.8M │ │ │ ├── src │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓█ │ 1%
7.4M │ │ │ ┌─┴ libgit2 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │ 3%
7.6M │ │ ├─┴ libgit2-sys-0.12.19+1.1.0 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓██ │ 3%
26M │ │ ┌─┴ github.com-1ecc6299db9ec823 │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████ │ 10%
26M │ ├─┴ src │ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████ │ 10%
932K │ │ ┌── .cache │ ░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█ │ 0%
11M │ │ │ ┌── pack-c3e3a51a17096a3078196f3f014e02e5da6285aa.idx │ ░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███ │ 4%
135M │ │ │ ├── pack-c3e3a51a17096a3078196f3f014e02e5da6285aa.pack│ ░░░░░░▓▓███████████████████████████ │ 53%
147M │ │ │ ┌─┴ pack │ ░░░░░░█████████████████████████████ │ 57%
147M │ │ │ ┌─┴ objects │ ░░░░░░█████████████████████████████ │ 57%
147M │ │ ├─┴ .git │ ░░░░░░█████████████████████████████ │ 57%
147M │ │ ┌─┴ github.com-1ecc6299db9ec823 │ ░░░░░░█████████████████████████████ │ 57%
147M │ ├─┴ index │ ░░░░░░█████████████████████████████ │ 57%
178M ├─┴ registry │ ███████████████████████████████████ │ 69%
257M ┌─┴ . │██████████████████████████████████████████████████ │ 100%
$
```
`dust` 应用于一个特定的目录:
```
`$ dust ~/Work/`
```
![Dust output from a specific directory][5]
Sudeshna Sur, [CC BY-SA 4.0][6]
`-r` 选项以相反的顺序显示输出root 在底部:
```
`$ dust -r ~/Work/`
```
使用 `dust -d 3` 会返回三层的子目录和它们的磁盘利用率:
```
`$ dust -d 3 ~/Work/wildfly/jaxrs/target/classes`[/code] [code]
$ dust -d 3 ~/Work/wildfly/jaxrs/target/classes
4.0K ┌── jaxrs.xml │ █ │ 1%
4.0K ┌─┴ subsystem-templates │ █ │ 1%
4.0K │ ┌── org.jboss.as.controller.transform.ExtensionTransformerRegistration│ █ │ 1%
4.0K │ ├── org.jboss.as.controller.Extension │ █ │ 1%
8.0K │ ┌─┴ services │ █ │ 2%
8.0K ├─┴ META-INF │ █ │ 2%
4.0K │ ┌── jboss-as-jaxrs_1_0.xsd │ ░█ │ 1%
8.0K │ ├── jboss-as-jaxrs_2_0.xsd │ ░█ │ 2%
12K ├─┴ schema │ ██ │ 3%
408K │ ┌── as │ ████████████████████████████████████████ │ 94%
408K │ ┌─┴ jboss │ ████████████████████████████████████████ │ 94%
408K ├─┴ org │ ████████████████████████████████████████ │ 94%
432K ┌─┴ classes │██████████████████████████████████████████ │ 100%
$
```
### 总结
`dust` 的魅力在于它是一个小的、简单的、易于理解的命令。它使用一种颜色方案来表示最大的子目录,使你的目录易于可视化。这是一个受欢迎的项目,欢迎大家来贡献。
你是否使用或考虑使用 `dust`?如果是,请在下面的评论中告诉我们你的想法。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/6/dust-linux
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/sudeshna-sur
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sand_dunes_desert_hills_landscape_nature.jpg?itok=wUByylBb
[2]: https://github.com/bootandy/dust
[3]: https://opensource.com/article/20/11/macports
[4]: https://opensource.com/article/20/6/homebrew-mac
[5]: https://opensource.com/sites/default/files/uploads/dust-work.png (Dust output from a specific directory)
[6]: https://creativecommons.org/licenses/by-sa/4.0/