Merge pull request #14169 from geekpi/new

translated
This commit is contained in:
geekpi 2019-06-19 08:42:08 +08:00 committed by GitHub
commit 671fcc11ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 230 additions and 229 deletions

View File

@ -1,229 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Neofetch Display Linux system Information In Terminal)
[#]: via: (https://www.ostechnix.com/neofetch-display-linux-systems-information/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Neofetch Display Linux system Information In Terminal
======
![Display Linux system information using Neofetch][1]
**Neofetch** is a simple, yet useful command line system information utility written in **Bash**. It gathers information about your systems software and hardware and displays the result in the Terminal. By default, the system information will be displayed alongside your operating systems logo. However, you can further customize it to use an **ascii image** or any image of your choice instead of the OS logo. You can also configure Neofetch to display which information, where and when that information should be displayed. Neofetch is mainly developed to be used in screenshots of your system information. It supports Linux, BSD, Mac OS X, iOS, and Windows operating systems. In this brief tutorial, let us see how to display Linux system information using Neofetch.
### Install Neofetch
Neofetch is available in the default repositories of most Linux distributions.
On Arch Linux and its variants, install it using command:
```
$ sudo pacman -S netofetch
```
On Debian (Stretch / Sid):
```
$ sudo apt-get install neofetch
```
On Fedora 27:
```
$ sudo dnf install neofetch
```
On RHEL, CentOS:
Enable EPEL Repository:
```
# yum install epel-relase
```
Fetch the neofetch repository:
```
# curl -o /etc/yum.repos.d/konimex-neofetch-epel-7.repo
https://copr.fedorainfracloud.org/coprs/konimex/neofetch/repo/epel-7/konimex-neofetch-epel-7.repo
```
Then, install Neofetch:
```
# yum install neofetch
```
On Ubuntu 17.10 and newer versions:
```
$ sudo apt-get install neofetch
```
On Ubuntu 16.10 and lower versions:
```
$ sudo add-apt-repository ppa:dawidd0811/neofetch
$ sudo apt update
$ sudo apt install neofetch
```
On NixOS:
```
$ nix-env -i neofetch
```
### Display Linux system Information Using Neofetch
Neofetch is pretty easy and straightforward. Let us see some examples.
Open up your Terminal, and run the following command:
```
$ neofetch
```
**Sample output:**
![][2]
Display Linux system Information Using Neofetch
As you can see in the above output, Neofetch is displaying the following details of my Arch Linux system:
* Name of the installed operating system,
* Laptop model,
* Kernel details,
* System uptime,
* Number of installed packages by default and other package managers,
* Default Shell,
* Screen resolution,
* Desktop environment,
* Window manager,
* Window managers theme,
* System theme,
* System Icons,
* Default Terminal,
* CPU type,
* GPU type,
* Installed memory.
Neofetch has plenty of other options too. We will see some of them.
##### How to use custom imagess in Neofetch output?
By default, Neofetch will display your OS logo along with the system information. You can, of course, change the image as you wish.
In order to display images, your Linux system should have the following dependencies installed:
1. **w3m-img** (It is required to display images. w3m-img is sometimes bundled together with **w3m** package),
2. **Imagemagick** (required for thumbnail creation),
3. A terminal that supports **\033[14t** or **xdotool** or **xwininfo + xprop** or **xwininfo + xdpyinfo**.
W3m-img and ImageMagick packages are available in the default repositories of most Linux distributions. So you can install them using your distributions default package manager.
For instance, run the following command to install w3m-img and ImageMagick on Debian, Ubuntu, Linux Mint:
```
$ sudo apt install w3m-img imagemagick
```
Here is the list of Terminal Emulators with **w3m-img** support:
1. Gnome-terminal,
2. Konsole,
3. st,
4. Terminator,
5. Termite,
6. URxvt,
7. Xfce4-Terminal,
8. Xterm
If you have **kitty** , **Terminology** and **iTerm** terminal emulators on your system, you dont need to install w3m-img.
Now, run the following command to display your systems information with a custom image:
```
$ neofetch --w3m /home/sk/Pictures/image.png
```
Or,
```
$ neofetch --w3m --source /home/sk/Pictures/image.png
```
Sample output:
![][3]
Neofetch output with custom logo
Replace the image path in the above command with your own.
Alternatively, you can point a directory that contains the images like below.
```
$ neofetch --w3m <path-to-directory>
```
##### Configure Neofetch
When we run the Neofetch for the first time, It will create a per-user configuration file at **$HOME/.config/neofetch/config.conf** by default. It also creates a system-wide neofetch config file at **$HOME/.config/neofetch/config**. You can tweak this file to tell Neofetch which details should be displayed, removed and/or modified.
You can also keep this configuration file between versions. Meaning just customize it once as per your liking and use the same settings after upgrading to newer version. You can even share this file to your friends and colleagues to have the same settings as yours.
To view Neofetch help section, run:
```
$ neofetch --help
```
As far as I tested Neofetch, It worked perfectly in my Arch Linux system as expected. It is a nice handy tool to easily and quickly print the details of your system in the Terminal.
* * *
**Related read:**
* [**How to find Linux System details using inxi**][4]
* * *
**Resource:**
* [**Neofetch on GitHub**][5]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/neofetch-display-linux-systems-information/
作者:[sk][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2016/06/neofetch-1-720x340.png
[2]: http://www.ostechnix.com/wp-content/uploads/2016/06/Neofetch-1.png
[3]: http://www.ostechnix.com/wp-content/uploads/2016/06/Neofetch-with-custom-logo.png
[4]: https://www.ostechnix.com/how-to-find-your-system-details-using-inxi/
[5]: https://github.com/dylanaraps/neofetch

View File

@ -0,0 +1,230 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Neofetch Display Linux system Information In Terminal)
[#]: via: (https://www.ostechnix.com/neofetch-display-linux-systems-information/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Neofetch - 在终端中显示 Linux 系统信息
======
![Display Linux system information using Neofetch][1]
**Neofetch** 是一个简单但有用的命令行系统信息工具,它用 **Bash** 编写。它会收集有关系统软件和硬件的信息,并在终端中显示结果。默认情况下,系统信息将与操作系统的 logo 一起显示。但是,你可以进一步地使用 **ascii 图像**或其他任何图片来自定义。你还可以配置 Neofetch 显示的信息信息的显示位置和时间。Neofetch 主要用于系统信息的截图。它支持 Linux、BSD、Mac OS X、iOS 和 Windows 操作系统。在这个简短的教程中,让我们看看如何使用 Neofetch 显示 Linux 系统信息。
### 安装 Neofetch
Neofetch 可在大多数 Linux 发行版的默认仓库中找到。
在 Arch Linux 及其衍生版上,使用这个命令安装它:
```
$ sudo pacman -S netofetch
```
在 DebianStretch / Sid
```
$ sudo apt-get install neofetch
```
在 Fedora 27 上:
```
$ sudo dnf install neofetch
```
在 RHEL、CentOS 上:
启用 EPEL 仓库:
```
# yum install epel-relase
```
获取 neofetch 仓库:
```
# curl -o /etc/yum.repos.d/konimex-neofetch-epel-7.repo
https://copr.fedorainfracloud.org/coprs/konimex/neofetch/repo/epel-7/konimex-neofetch-epel-7.repo
```
然后,安装 Neofetch
```
# yum install neofetch
```
在 Ubuntu 17.10 和更新版本上:
```
$ sudo apt-get install neofetch
```
在 Ubuntu 16.10 和更低版本上:
```
$ sudo add-apt-repository ppa:dawidd0811/neofetch
$ sudo apt update
$ sudo apt install neofetch
```
在 NixOS 上:
```
$ nix-env -i neofetch
```
### 使用 Neofetch 显示 Linux 系统信息
Neofetch 非常简单直接。让我们看一些例子。
打开终端,然后运行以下命令:
```
$ neofetch
```
**示例输出:**
![][2]
使用 Neofetch 显示 Linux 系统信息
正如你在上面的输出中所看到的Neofetch 显示了我的 Arch Linux 系统的以下详细信息:
* 已安装操作系统的名称,
  * 笔记本型号,
  * 内核详细信息,
  * 系统运行时间,
  * 默认和其他软件包管理器安装的软件数量
  * 默认 shell
  * 屏幕分辨率,
  * 桌面环境,
  * 窗口管理器,
  * 窗口管理器的主题,
  * 系统主题,
  * 系统图标,
  * 默认终端,
  * CPU 类型,
  * GPU 类型,
  * 已安装的内存。
Neofetch 还有很多其他选择。我们会看到其中一些。
##### 如何在 Neofetch 输出中使用自定义图像?
默认情况下Neofetch 将显示你的操作系统 logo 以及系统信息。当然,你可以根据需要更改图像。
要显示图像Linux 系统应该安装以下依赖项:
1. **w3m-img**用于显示图像。w3m-img 有时与 **w3m** 包捆绑在一起),
  2. **Imagemagick**(用于创建缩略图),
  3. 支持 **\033[14t** 或者 **xdotool** 或者 **xwininfo + xprop** 或者 **xwininfo + xdpyinfo** 的终端。
大多数 Linux 发行版的默认仓库中都提供了 W3m-img 和 ImageMagick 包。因此,你可以使用你的发行版的默认包管理器来安装它们。
例如,运行以下命令在 Debian、Ubuntu、Linux Mint 上安装 w3m-img 和 ImageMagick
```
$ sudo apt install w3m-img imagemagick
```
以下是带 **w3m-img** 支持的终端列表:
1. Gnome-terminal
2. Konsole
3. st
4. Terminator
5. Termite
6. URxvt
7. Xfce4-Terminal
8. Xterm
如果你的系统上已经有了 **kitty**、**Terminology** 和 **iTerm**,那么就无需安装 w3m-img。
现在,运行以下命令以使用自定义图像显示系统信息:
```
$ neofetch --w3m /home/sk/Pictures/image.png
```
或者
```
$ neofetch --w3m --source /home/sk/Pictures/image.png
```
示例输出:
![][3]
使用自定义 logo 的 Neofetch 输出
使用你自己的图片替换上面图片的路径。
或者,你可以指向包含以下图像的目录。
```
$ neofetch --w3m <path-to-directory>
```
##### 配置 Neofetch
当我们第一次运行 Neofetch 时,它默认会为每个用户在 **$HOME/.config/neofetch/config.conf** 中创建一个配置文件。它还会在 **$HOME/.config/neofetch/config** 中创建一个全局的 neofetch 配置文件。你可以调整此文件来告诉 neofetch 该显示、删除和/或修改哪些详细信息。
还可以在不同版本中保留此配置文件。这意味着你只需根据自己的喜好自定义一次,并在升级到更新版本后使用相同的设置。你甚至可以将此文件共享给你的朋友和同事,使他拥有与你相同的设置。
要查看Neofetch帮助部分请运行
```
$ neofetch --help
```
就我测试的 Neofetch 而言,它在我的 Arch Linux 系统中完美地工作。它是一个非常方便的工具,可以在终端中轻松快速地打印系统的详细信息。
* * *
**相关阅读:**
* [**如何使用 inxi 查看 Linux 系统详细信息**][4]
* * *
**资源:**
* [**Neofetch 的 GitHub 页面**][5]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/neofetch-display-linux-systems-information/
作者:[sk][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://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2016/06/neofetch-1-720x340.png
[2]: http://www.ostechnix.com/wp-content/uploads/2016/06/Neofetch-1.png
[3]: http://www.ostechnix.com/wp-content/uploads/2016/06/Neofetch-with-custom-logo.png
[4]: https://www.ostechnix.com/how-to-find-your-system-details-using-inxi/
[5]: https://github.com/dylanaraps/neofetch