Neofetch-显示带有ASCII分发徽标的Linux系统信息

Neofetch - Shows Linux System Information With ASCII Distribution Logo

Neofetch是一个跨平台且易于使用的命令行(CLI)脚本,可收集您的Linux系统信息并将其显示在终端上图像旁边,该图像是您的发行徽标或您选择的任何ascii艺术。

Neofetch是通过命令行标志或用户配置文件快速,高度可定制的系统信息脚本。 有超过50种配置选项可供选择。 此外,它还允许您添加自己的自定义信息。

它目前支持Linux,MacOS,iOS,BSD,Solaris,Android,Haiku,GNU Hurd,MINIX,AIX,IRIX和Windows。

建议阅读:ScreenFetch –在带有分发ASCII艺术徽标的终端上获取Linux系统信息

它类似于Screenfetch,但高度可定制,并提供一些额外的功能。 记下neofetch可在任何具有BASH 3.2+的操作系统上使用

默认情况下,Neofetch可以显示以下信息。

  • 型号:系统型号

  • 操作系统:正在运行的操作系统名称

  • 内核:加载的内核版本

  • 正常运行时间:系统正常运行时间[DD:HH:MM]

  • 软件包:系统上已安装的软件包数

  • Shell:Bash Shell版本

  • 分辨率:显示器分辨率

  • DE:运行桌面环境名称

  • WM:运行窗口管理器名称

  • WM主题:窗口管理器主题名称

  • 主题:主题名称

  • 图标:图标设置名称

  • Termain:终端详细信息

  • CPU:CPU信息

  • GPU:GPU信息

  • 内存:内存利用率信息

  • 如何在Linux中安装Neofetch

    Neofetch在大多数主要发行版官方存储库中不可用,因此我们需要从第三方存储库进行安装。

    对于基于Arch Linux的系统,Neofetch在AUR存储库中可用,因此请使用Yaourt或Packer进行安装。

    1
    2
    3
    4
    5
    6
    7
    8
    $ yaourt -S neofetch
    or
    $ yaourt -S neofetch-git

    or
    $ packer -S neofetch
    or
    $ packer -S neofetch-git

    对于Fedora使用,启用COPR存储库以安装Neofetch。 对于RHEL/CentOS用户,将dnf更改为yum。

    1
    2
    3
    $ sudo dnf install dnf-plugins-core
    $ sudo dnf copr enable konimex/neofetch
    $ sudo dnf install neofetch

    对于CentOS/RHEL系统,启用EPEL存储库以安装Neofetch(替代方法)

    对于CentOS / RHEL 6。

    1
    2
    $ sudo curl -o /etc/yum.repos.d/konimex-neofetch-epel-6.repo https://copr.fedorainfracloud.org/coprs/konimex/neofetch/repo/epel-6/konimex-neofetch-epel-6.repo
    $ sudo yum install neofetch

    对于CentOS / RHEL 7。

    1
    2
    $ sudo 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
    $ sudo yum install neofetch

    对于Debian 9 (Stretch),用户可以使用APT命令从发行版正式存储库中安装,但是该存储库仅包含2.0.2版,请使用第三方存储库将其更新为。

    1
    $ sudo apt-get install neofetch

    对于Debian旧系统,请使用第三方存储库安装Neofetch

    1
    2
    3
    4
    $ echo"deb http://dl.bintray.com/dawidd6/neofetch jessie main" | sudo tee -a /etc/apt/sources.list
    $ curl -L"https://bintray.com/user/downloadSubjectPublicKey?username=bintray" -o Release-neofetch.key && sudo apt-key add Release-neofetch.key && rm Release-neofetch.key
    $ sudo apt-get update
    $ sudo apt-get install neofetch

    对于Ubuntu/LinuxMint 16.10及以下版本,您可以添加官方的Neofetch PPA来安装Neofetch。

    1
    2
    3
    $ sudo add-apt-repository ppa:dawidd0811/neofetch
    $ sudo apt update
    $ sudo apt install neofetch

    对于Ubuntu/LinuxMint 17.04及更高版本,请使用发行版官方软件包通过Apt-Get命令安装Neofetch。

    1
    $ sudo apt install neofetch

    如何使用Neofetch

    只需触发不带任何参数的neofetch命令。

    1
    $ neofetch

     width=

    要打印其他分发徽标,请使用--ascii_distro标志,后跟分发名称。

    1
    $ neofetch --ascii_distro gentoo

     width=

    首次运行后,Neofetch将在$HOME/.config/neofetch/config处创建一个配置文件。 它包含脚本的所有选项/设置。 通过在该行的前面添加#启用/禁用任何功能。 配置文件允许您添加自己的自定义项。 您可以根据需要在print_info()函数中重新排列行,以获得所需的输出。

    这是从我的系统中获取的示例配置文件。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    $ vi ~/.config/neofetch/config

    #!/usr/bin/env bash
    #
    # Neofetch config file
    # https://github.com/dylanaraps/neofetch

    # See this wiki page for more info:
    # https://github.com/dylanaraps/neofetch/wiki/Customizing-Info
    print_info() {
        info title
        info underline

        info"OS" distro
        info"Model" model
        info"Kernel" kernel
        info"Uptime" uptime
        info"Packages" packages
        info"Shell" shell
        info"Resolution" resolution
        info"DE" de
        info"WM" wm
        info"WM Theme" wm_theme
        info"Theme" theme
        info"Icons" icons
        info"Terminal" term
        info"Terminal Font" term_font
        info"CPU" cpu
        info"GPU" gpu
        info"Memory" memory

        # info"CPU Usage" cpu_usage
        # info"Disk" disk
        # info"Battery" battery
        # info"Font" font
        # info"Song" song
        # info"Local IP" local_ip
        # info"Public IP" public_ip
        # info"Users" users
        # info"Install Date" install_date
        # info"Locale" locale # This only works on glibc systems.

        info line_break
        info cols
        info line_break
    }

    导航到帮助部分,以了解有关Neofetch的更多信息。

    1
    $ neofetch --help