Mac系统中终端“图形化”查系统信息neofetch

在这里插入图片描述
在黑苹果论坛中经常能看到类似上图的内容,感觉挺酷的。

安装

安装neofetch,执行以下命令。

brew install neofetch

如果执行这个命令报错,可能是你还没有安装Homebrew。
安装方法可以参考:
《macOS 下安装 Homebrew》https://blog.csdn.net/lxyoucan/article/details/111520623
配置环境变量:

echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

运行

neofetch

使用就运行这一行就可以了。

自定义信息

自定义项目+汉化

为什么我这个显示出来的全是英文呢?如果让项目名称显示中文呢?我百度搜索了一下没有找到。
后来到官方文档看了一下,发现很多内容都可以自定义的。
https://github.com/dylanaraps/neofetch/wiki/Customizing-Info

自定义前:
在这里插入图片描述
全英文的,咋汉化呢?毕竟中文是最漂亮的文字。
配置文件:

~/.config/neofetch/config.conf

用户目录中对应上面的路径,我这里是:/Users/itkey/.config/neofetch/config.conf
其实itkey换成你的用户名就好了。

修改print_info()相关配置

我的配置如下,我翻译的不一定准确,仅供参考。

print_info() {
    
    
    info title
    info underline
	#OS
    info "操作系统" distro
    #Host
    info "型  号" model
    #Kernel
    info "内核版本" kernel
    #Uptime
    info "开机时间" uptime

    prin "当前时间" "$(date +%Y年%m月%d""%H时%M分%S秒)"
    #Packages
    #info "Packages" packages
    info "S h e ll" shell
    #Resolution
    info "分  辨  率" resolution
    #info "DE" de
    #info "WM" wm
    #WM Theme
    info "主  题" wm_theme
    info "Theme" theme
    info "Icons" icons
    #Terminal
    info "终  端" term
    #Terminal Font
    info "终端字体" term_font
    #CPU
    info "处  理  器" cpu
    #GPU
    info "显卡设备" gpu
    #Memory
    info "内  存" memory
    #info "GPU Driver" gpu_driver  # Linux/macOS only
    # CPU Usage
    info "CPU 已用" cpu_usage
    #info "Disk" disk
    #Battery
    info "剩余电量" battery
    # info "Font" font
    # info "Song" song
    # [[ "$player" ]] && prin "Music Player" "$player"
    # 本地IP
    info "内  网  IP" local_ip
    #Public IP
    info "公  网  IP" public_ip
    #Users
    #info "用户" users
    #Locale
    info "语  言" locale  # This only works on glibc systems.
    #info cols
}

我只保留了个人感觉有用的信息,并进行了汉化。
现在显示如下:
在这里插入图片描述

参考文档:

《Neofetch:在终端中显示 Linux 系统信息》

https://github.com/dylanaraps/neofetch/wiki/Customizing-Info

猜你喜欢

转载自blog.csdn.net/lxyoucan/article/details/112983693