Merge branch 'LCTT:master' into master

This commit is contained in:
alex 2021-06-25 13:26:33 +08:00 committed by GitHub
commit 83bda83da1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 813 additions and 133 deletions

View File

@ -0,0 +1,128 @@
[#]: subject: "Heres Why Switching to Linux Makes Sense in 2021"
[#]: via: "https://news.itsfoss.com/switch-to-linux-in-2021/"
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
[#]: collector: "lujun9972"
[#]: translator: "zepoch"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13519-1.html"
为什么在 2021 年我仍然推荐你使用 Linux
======
![](https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/05/linux-2021.png?w=1200&ssl=1)
在某些领域Linux 确实要比 Windows 和 macOS 更加优秀。人们正在意识到这一点,而且 Linux 也在桌面操作系统市场上变得愈发流行。
当然,目前大多数桌面操作系统用户仍然对 Windows 或者 macOS 推崇备至,但是也有着越来越多的用户开始尝试新的 Linux 发行版,看看他们是否可以从原来的系统切换到 Linux 系统。
他们可能已经听过 [用 Linux 作为桌面操作系统](https://news.itsfoss.com/linux-foundation-linux-desktop/) 的一些优秀案例,又或者是仅仅想要去尝试一些与原先不同的事物,谁知道呢?
在这里,我将为你解释为什么在 2021 年我仍然推荐你使用 Linux。
### Linux 真棒,但是究竟是什么让其在 2021 年值得推荐呢?
如果已经知道了 [使用 Linux 的优点](https://itsfoss.com/reasons-switch-linux-windows-xp/),你可能就知道接下来我会说些什么。
#### 1、你不需要购买许可证
![][3]
你必须付费才能获得 Windows 10 许可证。
虽然有更便宜的选择,如获得 OEM 密钥。但是,如果你不愿意通过一些地下网站,而是从官方网站获得许可证,那么仅授权使用 1 台 PC 的**家庭版**就至少需要花费 **140 美元**
当然macOS 是一个完全不同的模式(你需要购买先进的硬件才能使用 macOS——所以我们才会一直使用微软的 Windows。
关键是,在失业的浪潮中,配置一台新电脑是一个挑战。此外,你还需要花钱购买操作系统的许可证,但是你却可以在多台计算机上免费使用 Linux。
是的,你不需要为 Linux 获取许可证密钥。你可以轻松下载 [Linux 发行版][4],并根据需要将其安装在尽可能多的设备上。
不要担心,如果你不了解 Linux 发行版,你可以看看我们的 [最好的 Linux 发行版](https://itsfoss.com/best-linux-distributions/) 列表。
#### 2、重新唤醒你的 PC 并节省资金
[全球芯片短缺](https://www.cnbc.com/2021/05/12/the-global-chip-shortage-could-last-until-2023-.html) 已经严重影响了电脑组件的价格,特别是**显卡**。并不是简单的价格上升,而是你不得不支付 **2 到 5 倍**的零售价来购得显卡。
当然,如果你没有电脑,现在配置一个新的电脑可能是难以置信的挑战,但如果你有一个旧电脑的话,选择在上面运行 Windows 10 将会是十分卡顿的。
如果你不想要 Windows 系统,那 macOS 呢?入门级 Mac 系统将会花费至少 **1100** 美金,甚至更多,这取决于你住在哪里。对许多人来说,这会是一笔昂贵的开销。
你肯定需要升级你的系统 —— 但是如果我说 Linux 可以让你的旧电脑重新派上用场,能为你省钱呢?
你将能够在你认为无法运行最新版本的微软 Windows 的电脑上运行 Linux。是的就是这样的。
Linux 是一个资源高效型的操作系统,可在各种较旧的系统配置上运行。
所有你需要做的只是参考我们的列表 [轻量级 Linux 发行版][7],并选择一个你喜欢的。
#### 3、通过再次利用系统来减少电子浪费
![][8]
考虑到电子废物正在全球不断产生,尤其是由加密矿工产生的,我们可以尽量减少浪费。除非你真正需要新的硬件,否则最好将现有硬件设备重新用于新任务。
而且,多亏了 Linux你可以将旧电脑或单片机转变成媒体服务器或个人 [Nextcloud][9] 服务器。
你可以在现有硬件上使用 Linux 做更多工作。
因此,这将显著降低对新硬件的需求,并让你高效地重复使用现有的设备。
#### 4、远离病毒和恶意软件
![][10]
在远程工作无处不在的时代,病毒和恶意软件显著增加。因此,即使你想平静地工作,你最终也可能受到恶意软件的影响。
Windows 和 macOS 比以往任何时候都更容易受到恶意软件的影响。但是,对于 Linux这是不太可能的。
Linux 发行版会定期修补,以确保最佳安全性。
此外,正因为用户群体小,攻击者就不会花太多时间制作欺骗 Linux 用户的病毒或软件。因此,在使用 Linux 时遇到某种形式的恶意软件的机会较小。
#### 5、没有强制更新
![][11]
在一个人们压力倍增的时代,强制更新然后发现计算机无法启动可能是一大烦恼。
至少Windows 用户的情况就是这样。
但是,使用 Linux你可以继续使用你的系统而无需在后台强制下载任何更新。
你的操作系统只有你能决定。
当你想要更新你的 Linux 发行版本时,你可以选择更新,也可以不更新,它可以一直保持不更新的状态并且不会打扰你,除非你有很长一段时间没有更新。
### 总结
这些只是我能想到的几个原因之一Linux 作为操作系统的选择在 2021 年比以往任何时候都更值得被推荐。
当然,这也取决于你的要求,这些好处可能不会体现在在你的用例中。但是,如果你确实不了解 Linux至少现在你可以评估你的需求重新作出选择。
除了上述几点之外,你还能想到什么?请在下面的评论中告诉我。
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/switch-to-linux-in-2021/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[zepoch](https://github.com/zepoch)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/linux-foundation-linux-desktop/
[2]: https://itsfoss.com/reasons-switch-linux-windows-xp/
[3]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/06/license-agreement.jpg?w=1000&ssl=1
[4]: https://itsfoss.com/what-is-linux-distribution/
[5]: https://itsfoss.com/best-linux-distributions/
[6]: https://www.cnbc.com/2021/05/12/the-global-chip-shortage-could-last-until-2023-.html
[7]: https://itsfoss.com/lightweight-linux-beginners/
[8]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/05/e-waste-illustration.jpg?w=800&ssl=1
[9]: https://itsfoss.com/nextcloud/
[10]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/05/system-malware.jpg?w=800&ssl=1
[11]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/05/linux-system-update.jpg?w=800&ssl=1

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (stevenzdg988)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
@ -86,7 +86,7 @@ via: https://opensource.com/article/20/2/linux-open-source-music
作者:[Alan Formy-Duval][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[stevenzdg988](https://github.com/stevenzdg988)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,129 @@
[#]: subject: (Copy files between Linux and FreeDOS)
[#]: via: (https://opensource.com/article/21/6/copy-files-linux-freedos)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Copy files between Linux and FreeDOS
======
Here's how I transfer files between my FreeDOS virtual machine and my
Linux desktop system.
![Files in a folder][1]
I run Linux as my primary operating system, and I boot FreeDOS in a virtual machine. Most of the time, I use QEMU as my PC emulator, but sometimes I'll run other experiments with GNOME Boxes (which uses QEMU as a back-end virtual machine) or with VirtualBox.
I like to play classic DOS games, and sometimes I'll bring up a favorite DOS application. I teach a Management Information Systems (MIS) class where I talk about the history of computing, and I'll sometimes record a demonstration using FreeDOS and a legacy DOS application, such as As-Easy-As (my favorite DOS spreadsheet—once released as "shareware" but now available [for free from TRIUS, Inc][2]).
But using FreeDOS this way means I need to transfer files between my FreeDOS virtual machine and my Linux desktop system. Let me show you how I do that.
### Accessing the image with guestmount
I used to access my virtual disk image by calculating the offset to the first DOS partition, then calling the Linux `mount` command with the right mix of options to match that offset. This was always error-prone and not very flexible. Fortunately, there's an easier way to do it. The `guestmount` program from the [libguestfs-tools][3] package lets you access or _mount_ the virtual disk image from Linux. You can install `libguestfs-tools` using this command on Fedora:
```
`$ yum install libguestfs-tools libguestfs`
```
Using `guestmount` is not as easy as double-clicking the file from the GNOME file manager, but the command line isn't too difficult to use. The basic usage of `guestmount` is:
```
`$ guestmount -a image -m device mountpoint`
```
In this usage, _image_ is the virtual disk image to use. On my system, I created my QEMU virtual disk image with the `qemu-img` command. The g`uestmount` program can read this disk image format, as well as the QCOW2 image format used by GNOME Boxes, or the VDI image format used in VirtualBox.
The _device_ option indicates the partition on the virtual disk. Imagine using this virtual disk as a real hard drive. You would access the first partition as `/dev/sda1`, the second partition as `/dev/sda2`, and so on. That's the syntax for `guestmount`. By default, FreeDOS 1.3 RC4 creates one partition on an empty drive, so access that partition as `/dev/sda1`.
And _mountpoint_ is the location to "mount" the DOS filesystem on your local Linux system. I'll usually create a temporary directory to work with. You only need the mount point while you're accessing the virtual disk.
Putting that all together, I use this set of commands to access my FreeDOS virtual disk image from Linux:
```
$ mkdir /tmp/freedos
$ guestmount -a freedos.img -m /dev/sda1 /tmp/freedos
```
After that, I can access my FreeDOS files via the `/tmp/freedos` directory, using normal tools on Linux. I might use `ls /tmp/freedos` at the command line, or open the `/tmp/freedos` mount point using the desktop file manager.
```
$ ls -l /tmp/freedos
total 216
drwxr-xr-x.  5 root root  8192 May 10 15:53 APPS
-rwxr-xr-x.  1 root root 85048 Apr 30 07:54 COMMAND.COM
-rwxr-xr-x.  1 root root   103 May 13 15:48 CONFIG.SYS
drwxr-xr-x.  5 root root  8192 May 15 16:52 DEVEL
drwxr-xr-x.  2 root root  8192 May 15 13:36 EDLIN
-rwxr-xr-x.  1 root root  1821 May 10 15:57 FDAUTO.BAT
-rwxr-xr-x.  1 root root   740 May 13 15:47 FDCONFIG.SYS
drwxr-xr-x. 10 root root  8192 May 10 15:49 FDOS
-rwxr-xr-x.  1 root root 46685 Apr 30 07:54 KERNEL.SYS
drwxr-xr-x.  2 root root  8192 May 10 15:57 SRC
-rwxr-xr-x.  1 root root  3190 May 16 08:34 SRC.ZIP
drwxr-xr-x.  3 root root  8192 May 11 18:33 TEMP
```
![GNOME file manager][4]
Using GNOME file manager to access the virtual disk
(Jim Hall, [CC-BY SA 4.0][5])
For example, to copy several C source files from my Linux `projects` directory into `C:\SRC` on the virtual disk image, so I can use the files under FreeDOS later, I can use the Linux `cp` command:
```
`$ cp /home/jhall/projects/*.c /tmp/freedos/SRC`
```
The files and directories on the virtual drive are technically _case insensitive_, so you can refer to them using uppercase or lowercase letters. However, I find it more natural to type DOS files and directories using all uppercase.
```
$ ls /tmp/freedos
APPS         CONFIG.SYS  EDLIN       FDCONFIG.SYS  KERNEL.SYS  SRC.ZIP
COMMAND.COM  DEVEL       FDAUTO.BAT  FDOS          SRC         TEMP
$ ls /tmp/freedos/EDLIN
EDLIN.EXE  MAKEFILE.OW
$ ls /tmp/freedos/edlin
EDLIN.EXE  MAKEFILE.OW
```
### Unmounting with guestmount
You should always _unmount_ the virtual disk image before you use it again in your virtual machine. If you leave the image mounted while you run QEMU or VirtualBox, you risk messing up your files.
The companion command to `guestmount` is `guestunmount`, to unmount the disk image. Just give the mount point that you wish to unmount:
```
`$ guestunmount /tmp/freedos`
```
Note that this command is spelled slightly differently from the Linux `umount` system command.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/6/copy-files-linux-freedos
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder)
[2]: http://www.triusinc.com/forums/viewtopic.php?t=10
[3]: https://libguestfs.org/
[4]: https://opensource.com/sites/default/files/uploads/gnome-file-manager.png (Using GNOME file manager to access the virtual disk)
[5]: https://creativecommons.org/licenses/by-sa/4.0/

View File

@ -0,0 +1,192 @@
[#]: subject: (Linux package management with apt)
[#]: via: (https://opensource.com/article/21/6/apt-linux)
[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Linux package management with apt
======
Learn how to install packages on Debian-based Linux distros with the apt
command, then download our cheat sheet to keep the right command at your
fingertips.
![bash logo on green background][1]
On Linux, [package managers][2] help you handle updates, uninstalls, troubleshooting, and more for the software on your computer. Seth Kenlon [wrote about `dnf`][3], the command-line package management tool for installing software in RHEL, CentOS, Fedora, Mageia, OpenMandriva, and other Linux distros.
Debian and Debian-based distros such as MX Linux, Deepin, Ubuntu—and distros based on Ubuntu, such as Linux Mint and Pop!_OS—have `apt`, a "similar but different" tool. In this article, I'll follow Seth's examples—but with `apt`—to show you how to use it.
Before I start, I want to mention four `apt`-related tools for installing software:
* [Synaptic][4] is a GTK+ based graphical user interface (GUI) front end for `apt`.
* [Aptitude][5] is an Ncurses-based full-screen command-line front end for `apt`.
* There are `apt-get`, `apt-cache`, and other predecessors of `apt`.
* [Dpkg][6] is the "behind the scenes" package manager `apt` uses to do the heavy lifting.
There are other packaging systems, such as [Flatpak][7] and [Snap][8], that you might run into on Debian and Debian-based systems, but I'm not going to discuss them here. There are also application "stores," such as [GNOME Software][9], that overlap with `apt` and other packaging technologies; again, I'm not going to discuss them here. Finally, there are other Linux distros such as [Arch][10] and [Gentoo][11] that use neither `dnf` nor `apt`, and I'm not going to discuss those here either!
With all the things I'm not going to discuss here, you may be wondering what tiny subset of software `apt` handles. Well, on my Ubuntu 20.04, `apt` gives me access to 69,371 packages, from the `0ad` real-time strategy game of ancient warfare to the `zzuf` transparent application fuzzer. Not bad at all.
### Finding software with apt
The first step in using a package manager such as `apt` is finding a software package of interest. Seth's `dnf` article used the [Cockpit][12] server management application as an example, so I will, too:
```
$ apt search cockpit
Sorting... Done
Full Text Search... Done
389-ds/hirsute,hirsute 1.4.4.11-1 all
  389 Directory Server suite - metapackage
cockpit/hirsute,hirsute 238-1 all
  Web Console for Linux servers
...
$
```
The second package above is the one you're after (it's the line beginning with `cockpit/hirsute`). If you decide you want to install it, enter:
```
`$ sudo apt install cockpit`
```
`apt` will take care of installing Cockpit and all the bits and pieces, or _dependencies_, needed to make it work. Sometimes that's all that's needed; sometimes it's not. It's possible that having a bit more information could be useful in deciding whether you really want to install this application.
### Package metadata
To find out more about a package, use the `apt show` command:
```
$ apt show cockpit
Package: cockpit
Version: 238-1
Priority: optional
Section: universe/admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <[ubuntu-devel-discuss@lists.ubuntu.com][13]>
Original-Maintainer: Utopia Maintenance Team <[pkg-utopia-maintainers@lists.alioth.debian.org][14]>
Bugs: <https://bugs.launchpad.net/ubuntu/+filebug>
Installed-Size: 88.1 kB
Depends: cockpit-bridge (&gt;= 238-1), cockpit-ws (&gt;= 238-1), cockpit-system (&gt;= 238-1)
Recommends: cockpit-storaged (&gt;= 238-1), cockpit-networkmanager (&gt;= 238-1), cockpit-packagekit (&gt;= 238-1)
Suggests: cockpit-doc (&gt;= 238-1), cockpit-pcp (&gt;= 238-1), cockpit-machines (&gt;= 238-1), xdg-utils
Homepage: <https://cockpit-project.org/>
Download-Size: 21.3 kB
APT-Sources: <http://ca.archive.ubuntu.com/ubuntu> hirsute/universe amd64 Packages
Description: Web Console for Linux servers
 The Cockpit Web Console enables users to administer GNU/Linux servers using a
 web browser.
 .
 It offers network configuration, log inspection, diagnostic reports, SELinux
 troubleshooting, interactive command-line sessions, and more.
$
```
In particular, notice the `Description` field, which tells you more about the application. The `Depends` field says what else must be installed, and `Recommends` shows what other—if any—cooperating components are suggested alongside it. The `Homepage` field offers a URL in case you need more info.
### What package provides a file?
Sometimes you don't know the package name, but you know a file that must be in a package. Seth offers as an example the `qmake-qt5` utility. Using `apt search` doesn't find it:
```
$ apt search qmake-qt5
Sorting... Done
Full Text Search... Done
$
```
However, a related command, `apt-file` will explore inside packages:
```
$ apt-file search qmake-qt5
qt5-qmake-bin: /usr/share/man/man1/qmake-qt5.1.gz
$
```
This turns up a man page for `qmake-qt5` that is part of a package called `qt5-qmake-bin`. Note that this package name reverses the `qmake` and `qt5` parts.
### What files are included in a package?
That handy `apt-file` command also tells which files are included in a given package. For example:
```
$ apt-file list cockpit
cockpit: /usr/share/doc/cockpit/TODO.Debian
cockpit: /usr/share/doc/cockpit/changelog.Debian.gz
cockpit: /usr/share/doc/cockpit/copyright
cockpit: /usr/share/man/man1/cockpit.1.gz
cockpit: /usr/share/metainfo/cockpit.appdata.xml
cockpit: /usr/share/pixmaps/cockpit.png
$
```
Note that this is distinct from the info provided by the `apt show` command, which lists the package's dependencies (other packages that must be installed).
### Removing an application
You can also remove packages with `apt`. For example, to remove the `apt-file` application:
```
`$ sudo apt purge apt-file`
```
Note that a superuser must run `apt` to install or remove applications.
Removing a package doesn't automatically remove all the dependencies that `apt` installs along the way. However, it's easy to carry out that little bit of tidying:
```
`$ sudo apt autoremove`
```
### Getting to know apt
As Seth wrote, "the more you know about how your package manager works, the easier it is for you to install and query applications when necessary."
Even if you're not a regular `apt` user, knowing it can be useful when you need to work at the command line while installing or removing packages (for example, on a remote server or when following a how-to published by some helpful soul). You may also need to know a bit about Dkpg (mentioned above); for example, some software creators provide a bare `.pkg` file.
I find the Synaptic package manager to be a really useful tool on my desktop, but I also use `apt` on a handful of servers that I maintain for various purposes.
**[Download our `apt` cheat sheet][15]** to get used to the command and try some new tricks with it. Once you do, you might find it hard to use anything else.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/6/apt-linux
作者:[Chris Hermansen][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/clhermansen
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background)
[2]: https://opensource.com/article/21/2/linux-package-management
[3]: https://opensource.com/article/21/5/dnf
[4]: https://www.nongnu.org/synaptic/
[5]: https://wiki.debian.org/Aptitude
[6]: https://wiki.debian.org/Teams/Dpkg
[7]: https://flatpak.org/
[8]: https://snapcraft.io/
[9]: https://wiki.gnome.org/Apps/Software
[10]: https://archlinux.org/
[11]: https://www.gentoo.org/
[12]: https://opensource.com/article/20/11/cockpit-server-management
[13]: mailto:ubuntu-devel-discuss@lists.ubuntu.com
[14]: mailto:pkg-utopia-maintainers@lists.alioth.debian.org
[15]: https://opensource.com/downloads/apt-cheat-sheet

View File

@ -0,0 +1,201 @@
[#]: subject: (View statistics about your code with Tokei)
[#]: via: (https://opensource.com/article/21/6/tokei)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
View statistics about your code with Tokei
======
Learn details about projects' programming languages and more.
![A screen of code.][1]
Recently, GitHub added a small indicator that shows details about projects, including what programming languages a project uses. Before this, it was hard for new contributors to know this type of information about the projects they were interested in.
This addition is helpful, but what if you want to know the same information about projects in your local repository? That's where [Tokei][2] comes in handy. It's a tool that tells you code statistics about a project, which is especially useful when you want to build a project with people who are proficient in different languages.
### Exploring Tokei
According to its [README][3], "Tokei is a program that displays statistics about your code. Tokei will show the number of files, total lines within those files and code, comments, and blanks grouped by language." The introduction to its v.12.1.0 release [elaborates][4], "Tokei is a fast and accurate code analysis CLI tool and library, allowing you to easily and quickly see how many blank lines, comments, and lines of code are in your codebase." It can identify over 150 programming languages.
```
$ ./tokei ~/exa/src ~/Work/wildfly/jaxrs
==================
Language   Files Lines Code Comments Blank
Java        46    6135  4324  945     632
XML         23    5211  4839  473     224
\---------------------------------
Rust
Markdown
\-----------------------------------
Total
```
### Install Tokei
To install Tokei in Fedora:
```
`$ sudo dnf install tokei`
```
To install it with Rust's Cargo package manager:
```
`$ cargo install tokei`
```
### Use Tokei
To list code statistics for the current directory:
```
$ tokei
===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Ada                    10         2840         1681          560          599
 Assembly                4         2508         1509          458          541
 GNU Style Assembly      4         2751         1528          748          475
 Autoconf               16         2294         1153          756          385
 Automake                1           45           34            0           11
 BASH                    4         1895         1602          133          160
 Batch                   2            4            4            0            0
 C                     330       206433       150241        23402        32790
 C Header              342        60941        24682        29143         7116
 CMake                  48         4572         3459          548          565
 C#                      9         1615          879          506          230
 C++                     5          907          599          136          172
 Dockerfile              2           16           10            0            6
 Fish                    1           87           77            5            5
 HTML                    1          545          544            1            0
 JSON                    5         8995         8995            0            0
 Makefile               10          504          293           72          139
 Module-Definition      12         1183         1046           65           72
 MSBuild                 1          141          140            0            1
 Pascal                  4         1443         1016          216          211
 Perl                    2          189          137           16           36
 Python                  4         1257          949          112          196
 Ruby                    1           23           18            1            4
 Shell                  15         1860         1411          222          227
 Plain Text             35        29425            0        26369         3056
 TOML                   64         3180         2302          453          425
 Visual Studio Pro|     30        14597        14597            0            0
 Visual Studio Sol|      6          655          650            0            5
 XML                     1          116           95           17            4
 YAML                    2           81           56           12           13
 Zsh                     1           59           48            8            3
\-------------------------------------------------------------------------------
 Markdown               55         4677            0         3214         1463
 |- C                    1            2            2            0            0
 |- Rust                19          336          268           20           48
 |- TOML                23           61           60            0            1
 (Total)                           5076          330         3234         1512
\-------------------------------------------------------------------------------
 Rust                  496       210966       188958         5348        16660
 |- Markdown           249        17676         1551        12502         3623
 (Total)                         228642       190509        17850        20283
===============================================================================
 Total                1523       566804       408713        92521        65570
===============================================================================
$
```
The following command prints out the supported languages and extensions:
```
$ tokei -l
ABNF
ABAP
ActionScript
Ada
Agda
Alex
Alloy
Arduino C++
AsciiDoc
ASN.1
ASP
ASP.NET
Assembly
GNU Style Assembly
```
If you run `tokei` on two files and specify their location as an argument, it prints the stats for individual files in a last-in-first-out format:
![Running Tokei on two files][5]
(Sudeshna Sur, [CC BY-SA 4.0][6])
By default, `tokei` outputs only data about the languages used, but using the `--files` flag provides individual file statistics:
```
$ tokei ~/exa/src --files
===========================================================================================
 Language                              Files      Lines      Code             Comments     Blanks
===========================================================================================
 Rust                                   54          9339        7070             400       1869
 |- Markdown                            33          1306           0            1165        141
 (Total)                                           10645        7070        1565       2010
\-------------------------------------------------------------------------------------------
 /home/ssur/exa/src/theme/default_theme.rs           130         107           0         23
 /home/ssur/exa/src/output/render/times.rs            30          24           0          6
 /home/ssur/exa/src/output/render/users.rs            98          76           0         22
 /home/ssur/exa/src/output/render/size.rs            182         141           3         38
 /home/ssur/exa/src/output/render/octal.rs           116          88           0         28
 /home/ssur/exa/src/output/render/mod.rs              33          20           3         10
 /home/ssur/exa/src/output/render/inode.rs            28          20           0          8
 /home/ssur/exa/src/output/render/links.rs            87          65           0         22
 /home/ssur/exa/src/output/render/groups.rs          123          93           0         30
 |ome/ssur/exa/src/output/render/filetype.rs          31          26           0          5
 /home/ssur/exa/src/output/render/blocks.rs           57          40           0         17
 /home/ssur/exa/src/output/render/git.rs             108          87           0         21
 |/ssur/exa/src/output/render/permissions.rs         204         160           3         41
 /home/ssur/exa/src/output/grid.rs                    67          51           3         13
 /home/ssur/exa/src/output/escape.rs                  26          18           4          4
 /home/ssur/exa/src/theme/lsc.rs                     235         158          39         38
 /home/ssur/exa/src/options/theme.rs                 159         124           6         29
 /home/ssur/exa/src/options/file_name.rs              46          39           0          7
 /home/ssur/exa/src/options/flags.rs                  84          63           6         15
 /home/ssur/exa/src/fs/mod.rs                         10           8           0          2
 /home/ssur/exa/src/fs/feature/mod.rs                 33          25           0          8
\-- /home/ssur/exa/src/output/time.rs ---------------------------------------------------------------
 |- Rust                                             215          170          5         40
 |- Markdown                                          28            0         25          3
```
### Conclusion
I found it very easy to use `tokei` to learn more about my code statistics. Another good thing about `tokei` is that it can be used as a library, which makes it easy to integrate into other projects. Visit Tokei's [Crate.io page][7] and [Docs.rs][8] to learn more about its usage. If you would like to get involved, you can also contribute to Tokei through its [GitHub repository][2].
Do you find Tokei useful? Let us know in the comments section below.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/6/tokei
作者:[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/code_development_programming_screen.png?itok=BgcSm5Pl (A screen of code.)
[2]: https://github.com/XAMPPRocky/tokei
[3]: https://github.com/XAMPPRocky/tokei/blob/master/README.md
[4]: https://github.com/XAMPPRocky/tokei/releases/tag/v12.1.0
[5]: https://opensource.com/sites/default/files/uploads/tokei-two-files_0.png (Running Tokei on two files)
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://crates.io/crates/tokei
[8]: https://docs.rs/tokei/12.1.2/tokei/

View File

@ -0,0 +1,161 @@
[#]: subject: (9 Features in Brave Search That Make it a Great Google Search Alternative)
[#]: via: (https://itsfoss.com/brave-search-features/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
9 Features in Brave Search That Make it a Great Google Search Alternative
======
Brave Search is an ambitious initiative by Brave Software based on the open-source project [Tailcat][1], which tries to take on the big tech by introducing the ability to search anonymously. Brave Search itself is [not open source at the moment][2].
Of course, there are various other [private search engines][3] available out there trying to offer a privacy-focused experience. Even though not every service proves to be better than Google (regarding features), Brave Search seems to be a compelling choice when considering Brave Browser as a successful open-source replacement to Google Chrome.
Here, let me highlight a few features in Brave Search that makes it an interesting alternative to Google Search.
### Top 9 Brave Search Features
Brave Search does a few things better than Google and those are worth highlighting as unique feature offerings that sets it apart.
Brave Search is in beta at the time of writing this article. If you notice something different with your experience, there are chances that they may have made an improvement/change. Let me know in the comments below if thats the case.
#### 1\. Anonymous Search
![][4]
Google tracks your search queries, keeps a log of your history (unless you manually delete it or disable recording your activity). Not just the basics, but your IP address and the website you visit from the search result is also recorded in the process.
In contrast, Brave Search does not track the IP, or the search queries made using their search portal.
You stay completely anonymous, along with your search history being private only to yourself.
This could eliminate the need of using a [secure VPN service][5] to keep your Internet search activity private.
#### 2\. Ad-Free Version (Coming Soon)
![][6]
All the private search engines include advertisements to make money (which is fair). The advertisements used by Google Search include trackers when you click on it, which is not the case with privacy-focused search engines.
But Brave Search tries to go a little further by offering a choice to the users.
It is a feature that has been planned for addition, but it is worth mentioning. If you want to get rid of the ads, you can opt for the paid version of the search engine where you can explore the web ad-free.
I think thats a win-win for both Brave and you as a user. They do not lose on making revenue and you get to experience a truly ad-free search engine.
#### 3\. Community Curated Search Rankings (Coming Soon)
Users can help spot the quality of a web resource better than an algorithm often.
So, Brave Search aims to work on a community-curated search ranking system, which will be open to all when it is available.
This should improve the collaborative approach of exploring the web, which should be an impressive feature of Brave Search.
#### 4\. Independent Index with No Search Algorithm
![][7]
With most of the other search engines, theres an algorithm in place to make sure that only the high-quality web pages rank above the rest. Brave Search does not have any special algorithm controlling the search rankings.
And yes, that is a feature in a world where everything depends on algorithms.
Sometimes that algorithm ends up being biased by ranking plagiarism content first, low-quality web pages, along with a few other issues.
Without any special search algorithm, Brave search uses its own Index to fetch results as per your queries.
#### 5\. Private Local and Global Search Results
![][8]
No matter what region you choose for the search results, you get an additional option to filter your results based on your locality (IP address).
Brave explains that the IP address is stored locally on your device and is used to serve you the local feed of results which sounds useful.
![][9]
#### 6\. Transparency in Search Results
![][10]
The web is a vast network. Therefore, to keep the search result quality resourceful, Brave Search fetches some search results anonymously from Google and Bing (which is often less than 10% in my tests).
For the rest of the results, Brave Search relies on its independent index. Brave Search also displays the percent of its independent search index used for your search.
The more users start using Brave Search, the more independent the search results will become. So thats a good thing.
Considering not all search engines reveal a lot about their search results, Transparency, as a principle, can be a feature to compare with when choosing a search engine.
![][11]
#### [Brave: Open Source Web Browser That Blocks Ads and Tracking By Default][12]
An open source web browser that blocks ads and tracking. A good choice if you are looking for a privacy focused web browser. Heres how to install Brave on Linux.
#### 7\. A Refreshing User Interface
While every other Google search alternative tries to offer a familiar experience, Brave Search is actually refreshing to look at (in my opinion).
![][13]
The user interface looks well-thought and offers a modern, clean experience. Dont you think?
I like how DuckDuckGo simplifies things, but Brave certainly makes it up for a better user experience that looks unique and clean.
#### 8\. No Anti-Competitive Nature
Unlike some other search engines (especially, Google) do not suggest anything else explicitly, except their own products and services in their search results.
Thats fair but potentially also anti-competitive, being the most popular search engine. They do have their reasons which we dont have to talk about here, but giving a shout-out to your competitors is something new businesses/services are adopting.
![][14]
And Brave Search does an excellent jobat that. While you scroll through the search results, you will find a choice to use other search engines for your search query.
#### 9\. Dark Mode &amp; Tweaks
Yes, the dark mode is an important feature (sigh).
![][15]
And from the settings available in Brave Search, you can **turn on the dark mode**, **set links to open in a new tab,** and **control the language** (soon).
![][16]
### Wrapping Up
Brave Search is an interesting private search engine that aims to tackle the Big Tech by offering something new. It should be seamless user experience when [using Brave Browser][12] along with it, but you can use it on any browser without any limitations.
I like what I see here, what do you think? Let me know your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/brave-search-features/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://www.tailcat.com
[2]: https://www.reddit.com/r/brave_browser/comments/o5qknc/announcement_brave_search_beta_now_available_in/h2p3q22?utm_source=share&utm_medium=web2x&context=3
[3]: https://itsfoss.com/privacy-search-engines/
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-search-anonymous.png?resize=800%2C530&ssl=1
[5]: https://itsfoss.com/best-vpn-linux/
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/paid-no-ads-brave.png?resize=800%2C450&ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-search-sample.png?resize=800%2C586&ssl=1
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-local-global-search.png?resize=800%2C228&ssl=1
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-anonymous-local-results.png?resize=800%2C589&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-search-transparency.png?resize=800%2C654&ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/09/brave-browser-1-e1573731875389.jpeg?resize=150%2C150&ssl=1
[12]: https://itsfoss.com/brave-web-browser/
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-search-ui.png?resize=800%2C590&ssl=1
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-search-competitors.png?resize=800%2C502&ssl=1
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-search-dark-mode.png?resize=800%2C573&ssl=1
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/06/brave-search-settings.png?resize=483%2C389&ssl=1

View File

@ -1,131 +0,0 @@
[#]: subject: "Heres Why Switching to Linux Makes Sense in 2021"
[#]: via: "https://news.itsfoss.com/switch-to-linux-in-2021/"
[#]: author: "Ankush Das https://news.itsfoss.com/author/ankush/"
[#]: collector: "lujun9972"
[#]: translator: "zepoch"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
为什么在2021年我仍然推荐你使用Linux
======
在某些领域Linux确实要比Windows和macOS要更加优秀。人们也开始意识到这一点而且Linux也在桌面操作系统应用市场中也在变得愈发流行。
当然,目前大多数桌面操作系统用户仍然使用的是 Windows 或者 macOS 但是也有着越来越多的用户开始尝试新的 Linux 发行版本,看看他们是否可以从原来的系统切换到 Linux 系统。
他们可能已经听过[用 Linux 作为桌面操作系统](https://news.itsfoss.com/linux-foundation-linux-desktop/)的一些优秀案例,又或者是仅仅想要去尝试一些与原先不同的事物,谁知道呢?
在这里我将为你解释为什么在2021年我仍然推荐你使用Linux。
### Linux 是伟大的,但是究竟是什么让其在 2021 年更被推荐呢?
如果已经知道了[使用 Linux 的优点](https://itsfoss.com/reasons-switch-linux-windows-xp/),你可能就知道接下来我会说些什么。
#### 1\. 你不需要购买一个许可证
![][3]
你必须支付购买才能获得 Windows 10 许可证。
虽然有更便宜的选择如获得OEM密钥。但是如果您不愿意通过一些特别的网站而是从官方网站获得许可证那么仅授权使用 1 台 PC 的**家庭版**就至少需要花费 **140 美元**.
当然macOS是一个完全不同的模式你需要购买高级硬件才能使用macOS——所以我们才会一直使用微软的 Windows。
关键是——在失业的浪潮中,组件一台新电脑是一个挑战。此外,您还需要花钱购买操作系统的许可证,但是你却可以在多台计算机上免费使用 Linux。
是的,您不需要为 Linux 获取许可证密钥。您可以轻松下载 [Linux 发行版][4],并根据需要将其安装在尽可能多的设备上。
不要担心, 如果你不知道 Linux 发行, 你可以看看我们的[最好的 Linux 发行版](https://itsfoss.com/best-linux-distributions/)的列表。
#### 2\. 恢复现有的PC并节省资金
[全球芯片短缺](https://www.cnbc.com/2021/05/12/the-global-chip-shortage-could-last-until-2023-.html)已经严重影响了电脑组件的价格,特别是**显卡**。并不是简单的价格上升,而是你不得不支付 **2 到 5 倍**的零售价来购得显卡。
当然,如果你没有电脑,现在组建一个新的电脑可能是难以置信的挑战,但如果你有一个旧电脑的话,选择在上面运行 Windows 10 将会是十分卡顿的。
如果你不想要一个 Windows 的系统,那 macOS 呢?入门级 Mac 系统将会花费至少 **1100** 美金,这取决于你住在哪里。对许多人来说,这会是一笔昂贵的开销。
你肯定需要升级你的系统——但是如果我说 Linux 可以让你的旧电脑重新派上用场,也能为你省钱呢?
您将能够在您认为无法运行最新版本的 Microsoft Windows 的电脑上运行 Linux。是的这是正确的。
Linux 是一个资源高效型的操作系统,可在各种较旧的系统配置上运行。
所有你需要做的只是参考我们的列表 [轻量级 Linux 分布][7] 并选择一个你喜欢的。
#### 3\. 通过恢复系统减少电子浪费
![][8]
考虑到电子废物正在全球不断产生,尤其是矿工,我们可以尽量减少浪费。除非您真正需要新的硬件,否则最好将现有硬件设备重新用于新任务。
而且,多亏了 Linux您可以将旧电脑或单片机转到媒体服务器或个人[Nextcloud][9] 服务器。
您可以在现有硬件上使用 Linux 做更多工作。
因此,这将显著降低对新硬件的需求,并让您高效地重复使用现有的设备。
#### 4\. 远离病毒和恶意软件
![][10]
在远程工作无处不在的时代,病毒和恶意软件显著增加。因此,即使您想和平地工作,您最终也可能受到恶意软件的影响。
Windows 和 macOS 都比以往任何时候都更容易受到恶意软件的影响。但是对于Linux这是极不可能的。
Linux 发行版被定期修补,以确保最佳安全性。
此外,因为用户群很小,攻击者就不会花太多时间制作欺骗 Linux 用户的病毒或软件。因此,在使用 Linux 时遇到某种形式的恶意软件的机会较小。
#### 5\. 没有强制更新
![][8]
在一个人们压力倍增的时代,强制更新和发现计算机无法启动可能是一大烦恼。
至少Windows 用户的情况就是这样。
但是,使用 Linux您可以继续使用您的系统而无需在后台强制下载任何更新。
你的操作系统只有你能决定。
当你想要更新你的 Linux 发行版本时,你可以选择更新,也可以不更新,它可以一直保持不更新的状态并且不会打扰你,除非你有很长一段时间没有更新。
### 总结
这些只是我能想到的几个原因之一, Linux 作为操作系统的选择在 2021 年比以往任何时候都更值得被推荐。
当然,这也取决于您的要求,这些好处可能不会体现在在您的用例中。但是,如果你确实不了解 Linux至少现在你可以评估你的需求重新作出选择。
除了上述要点之外,您还能想到什么?请在下面的评论中告诉我。
### 大型科技网站获得数百万收入It's FOSS 为您服务!
如果您喜欢我们在 It's FOSS 所做的工作,请考虑捐款以支持我们的独立出版物。 您的支持将帮助我们继续发布专注于桌面 Linux 和开源软件的内容。
感谢各位。
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/switch-to-linux-in-2021/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[zepoch](https://github.com/zepoch)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/linux-foundation-linux-desktop/
[2]: https://itsfoss.com/reasons-switch-linux-windows-xp/
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUyMCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[4]: https://itsfoss.com/what-is-linux-distribution/
[5]: https://itsfoss.com/best-linux-distributions/
[6]: https://www.cnbc.com/2021/05/12/the-global-chip-shortage-could-last-until-2023-.html
[7]: https://itsfoss.com/lightweight-linux-beginners/
[8]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ5OSIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
[9]: https://itsfoss.com/nextcloud/
[10]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjUxNCIgd2lkdGg9Ijc4MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=