システムの基本情報をおしゃれに表示するneofetchを使ってみる

はじめに

ターミナルを開いた瞬間、自分のマシンのスペックやOSのロゴがかっこよく表示されたら、少しだけ気分が上がるのではないだろうか。 neofetchは、システム情報とOSのロゴをアスキーアートで表示してくれるコマンドラインツールである。

今回はこのneofetchコマンドについて紹介する。

環境

WSL2 Ubuntu 24.04 LTS
neofetch 7.1.0

neofetchのインストール

neofetchは多くのLinuxディストリビューションの公式リポジトリに含まれている。 Ubuntuの場合は、以下のコマンドでインストールを行う。

sudo apt update
sudo apt install neofetch
ログ
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  crack-common gyp libcares2 libgl1-amber-dri libglapi-mesa libjs-async libjs-events libjs-inherits
  libjs-is-typedarray libjs-prettify libjs-regenerate libjs-source-map libjs-sprintf-js
  libjs-typedarray-to-buffer libllvm17t64 liblttng-ust-common1t64 liblttng-ust-ctl5t64 liblttng-ust1t64
  libnotify-bin libqt5x11extras5 libre2-10 libssl-dev libuv1-dev libxcb-damage0 mesa-utils-bin node-abbrev
  node-ampproject-remapping node-ansi-regex node-ansi-styles node-aproba node-are-we-there-yet node-arrify
  node-async node-async-each node-auto-bind node-babel-plugin-add-module-exports node-babel7-runtime
  node-balanced-match node-base64-js node-binary-extensions node-brace-expansion node-busboy
  node-camelcase node-caniuse-lite node-chownr node-chrome-trace-event node-ci-info node-cjs-module-lexer
  node-cli-boxes node-cli-cursor node-clone node-collection-visit node-color-convert node-color-name
  node-colors node-commander node-commondir node-concat-stream node-console-control-strings
  node-convert-source-map node-core-js node-core-js-pure node-core-util-is node-data-uri-to-buffer
  node-decompress-response node-deep-is node-defaults node-define-property node-delegates node-depd
  node-diff node-electron-to-chromium node-encoding node-end-of-stream node-err-code node-error-ex
  node-es-module-lexer node-escape-string-regexp node-eslint-utils node-eslint-visitor-keys node-esquery
  node-estraverse node-esutils node-events node-fancy-log node-fast-deep-equal node-fast-levenshtein
  node-fetch node-find-up node-flatted node-foreground-child node-fs-readdir-recursive
  node-fs-write-stream-atomic node-fs.realpath node-function-bind node-get-caller-file node-get-stream
  node-get-value node-glob node-globals node-got node-graceful-fs node-growl node-has-flag
  node-has-unicode node-has-value node-has-values node-hosted-git-info node-iconv-lite node-ieee754
  node-iferr node-imurmurhash node-indent-string node-inflight node-inherits node-ini node-interpret
  node-ip node-ip-regex node-is-arrayish node-is-binary-path node-is-buffer node-is-descriptor
  node-is-extglob node-is-path-cwd node-is-plain-obj node-is-plain-object node-is-stream
  node-is-typedarray node-is-windows node-isarray node-isexe node-isobject node-js-tokens node-json-buffer
  node-json-parse-better-errors node-json-schema node-json-schema-traverse node-json-stable-stringify
  node-jsonify node-jsonparse node-kind-of node-levn node-loader-runner node-locate-path
  node-lodash-packages node-lowercase-keys node-lru-cache node-map-visit node-memfs node-merge-stream
  node-mimic-response node-minimatch node-minimist node-minipass node-mute-stream node-n3 node-negotiator
  node-npm-run-path node-object-inspect node-object-visit node-once node-optimist node-optionator
  node-osenv node-p-cancelable node-p-limit node-p-locate node-p-map node-pascalcase node-path-dirname
  node-path-exists node-path-is-absolute node-path-is-inside node-path-type node-pify node-pkg-dir
  node-postcss-value-parser node-prelude-ls node-process-nextick-args node-promise-inflight
  node-promise-retry node-promzard node-prr node-pump node-punycode node-quick-lru node-randombytes
  node-read node-readable-stream node-rechoir node-regenerator-runtime node-regenerator-transform
  node-regexpp node-regjsgen node-repeat-string node-require-directory node-require-from-string
  node-resolve node-resolve-cwd node-resolve-from node-restore-cursor node-resumer node-retry
  node-run-queue node-safe-buffer node-serialize-javascript node-set-blocking node-set-immediate-shim
  node-shebang-command node-shebang-regex node-shell-quote node-signal-exit node-slash node-slice-ansi
  node-source-list-map node-source-map node-spdx-correct node-spdx-exceptions node-spdx-expression-parse
  node-spdx-license-ids node-sprintf-js node-ssri node-stack-utils node-string-decoder node-strip-bom
  node-supports-color node-tapable node-terser node-text-table node-through node-time-stamp
  node-to-fast-properties node-tslib node-type-check node-typedarray node-typedarray-to-buffer node-undici
  node-unicode-canonical-property-names-ecmascript node-unicode-match-property-value-ecmascript
  node-unicode-property-aliases-ecmascript node-unset-value node-uri-js node-util-deprecate node-uuid
  node-v8flags node-validate-npm-package-license node-wcwidth.js node-webpack-sources node-wordwrap
  node-wrappy node-write-file-atomic node-xtend node-y18n node-yallist node-yaml nodejs-doc xbitmaps
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  caca-utils libid3tag0 libimlib2t64 libsixel-bin toilet toilet-fonts w3m w3m-img
Suggested packages:
  brotli cmigemo compface dict dict-wn dictd mailcap w3m-el xsel
The following NEW packages will be installed:
  caca-utils libid3tag0 libimlib2t64 libsixel-bin neofetch toilet toilet-fonts w3m w3m-img
0 upgraded, 9 newly installed, 0 to remove and 71 not upgraded.
Need to get 2265 kB of archives.
After this operation, 5489 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu noble/universe amd64 libid3tag0 amd64 0.15.1b-14build1 [33.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu noble/universe amd64 libimlib2t64 amd64 1.12.1-1.1build2 [208 kB]
Get:3 http://archive.ubuntu.com/ubuntu noble/universe amd64 caca-utils amd64 0.99.beta20-4build2 [57.0 kB]
Get:4 http://archive.ubuntu.com/ubuntu noble/universe amd64 neofetch all 7.1.0-4 [83.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu noble/universe amd64 toilet-fonts all 0.3-1.4build1 [713 kB]
Get:6 http://archive.ubuntu.com/ubuntu noble/universe amd64 toilet amd64 0.3-1.4build1 [12.3 kB]
Get:7 http://archive.ubuntu.com/ubuntu noble/main amd64 w3m amd64 0.5.3+git20230121-2ubuntu5 [1117 kB]
Get:8 http://archive.ubuntu.com/ubuntu noble/universe amd64 w3m-img amd64 0.5.3+git20230121-2ubuntu5 [22.8 kB]
Get:9 http://archive.ubuntu.com/ubuntu noble/universe amd64 libsixel-bin amd64 1.10.3-3build1 [18.2 kB]
Fetched 2265 kB in 3s (792 kB/s)
Selecting previously unselected package libid3tag0:amd64.
(Reading database ... 118656 files and directories currently installed.)
Preparing to unpack .../0-libid3tag0_0.15.1b-14build1_amd64.deb ...
Unpacking libid3tag0:amd64 (0.15.1b-14build1) ...
Selecting previously unselected package libimlib2t64:amd64.
Preparing to unpack .../1-libimlib2t64_1.12.1-1.1build2_amd64.deb ...
Unpacking libimlib2t64:amd64 (1.12.1-1.1build2) ...
Selecting previously unselected package caca-utils.
Preparing to unpack .../2-caca-utils_0.99.beta20-4build2_amd64.deb ...
Unpacking caca-utils (0.99.beta20-4build2) ...
Selecting previously unselected package neofetch.
Preparing to unpack .../3-neofetch_7.1.0-4_all.deb ...
Unpacking neofetch (7.1.0-4) ...
Selecting previously unselected package toilet-fonts.
Preparing to unpack .../4-toilet-fonts_0.3-1.4build1_all.deb ...
Unpacking toilet-fonts (0.3-1.4build1) ...
Selecting previously unselected package toilet.
Preparing to unpack .../5-toilet_0.3-1.4build1_amd64.deb ...
Unpacking toilet (0.3-1.4build1) ...
Selecting previously unselected package w3m.
Preparing to unpack .../6-w3m_0.5.3+git20230121-2ubuntu5_amd64.deb ...
Unpacking w3m (0.5.3+git20230121-2ubuntu5) ...
Selecting previously unselected package w3m-img.
Preparing to unpack .../7-w3m-img_0.5.3+git20230121-2ubuntu5_amd64.deb ...
Unpacking w3m-img (0.5.3+git20230121-2ubuntu5) ...
Selecting previously unselected package libsixel-bin.
Preparing to unpack .../8-libsixel-bin_1.10.3-3build1_amd64.deb ...
Unpacking libsixel-bin (1.10.3-3build1) ...
Setting up toilet-fonts (0.3-1.4build1) ...
Setting up toilet (0.3-1.4build1) ...
Setting up libsixel-bin (1.10.3-3build1) ...
Setting up neofetch (7.1.0-4) ...
Setting up libid3tag0:amd64 (0.15.1b-14build1) ...
Setting up w3m (0.5.3+git20230121-2ubuntu5) ...
Setting up libimlib2t64:amd64 (1.12.1-1.1build2) ...
Setting up caca-utils (0.99.beta20-4build2) ...
Setting up w3m-img (0.5.3+git20230121-2ubuntu5) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.6) ...

インストール後、バージョンを確認する。

neofetch --version
Neofetch 7.1.0

neofetchを使う

基本的な使い方

ターミナルで以下のコマンドを入力する。

neofetch

実行すると、左側にOSのロゴ、右側にシステム情報が表示される。

実際に使ってみる

実際に実行してみると、以下のような出力が得られる。 OSの種類、カーネルのバージョン、CPU、メモリ使用量などが一目でわかるようになっている。

            .-/+oossssoo+/-.               kbushi@kbushi
        `:+ssssssssssssssssss+:`           -------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 24.04.3 LTS on Windows 10 x86_64
    .ossssssssssssssssssdMMMNysssso.       Kernel: 5.15.153.1-microsoft-standard-WSL2
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Uptime: 54 mins
  +ssssssssshmydMMMMMMMNddddyssssssss+     Packages: 1885 (dpkg), 53 (nix-default), 4 (snap)
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Shell: zsh 5.9
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Adwaita [GTK3]
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Icons: Adwaita [GTK3]
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Terminal: Windows Terminal
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: AMD Ryzen 9 7900X3D (24) @ 4.391GHz
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   GPU: 2de9:00:00.0 Microsoft Corporation Basic Render Driver
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Memory: 4064MiB / 31701MiB
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.

Windows 11 だけど、Windows 10 x86_64 と表示されている…。
GPUMicrosoft Corporation Basic Render Driver と表示されているが、WSL2環境なので仕方ないかもしれない。
Memory64GiBあるのだけど、31701MiBと表示されている。
恐らく、WSL2のメモリ割り当てが32GiBに制限されているためか…?

カスタマイズについて

neofetchは表示内容を細かくカスタマイズできる。
設定ファイルは初回実行時に ~/.config/neofetch/config.conf に生成される。

vi ~/.config/neofetch/config.conf

このファイル内の print_info() 関数を編集することで、表示項目の追加や削除が可能である。
例えば、IPアドレスを表示したい場合は info "Local IP" local_ip のコメントアウトを外すだけでよい。

また、アスキーアートの代わりに画像を表示することも可能だが、対応したターミナルエミュレータが必要となる。

参考

おわりに

neofetchは、システム確認ツールでありながら、おしゃれに表示する側面も持っている。

neofetchの開発は2024年に終了(アーカイブ)しているが、現在でも問題なく利用できる。
もし、より高速で活発に開発されているツールを探している場合は、C言語で書かれた後継の fastfetchというものもあるのでこちらを試してみるのもよさそう。

ターミナルを開くたびに表示されるシステム情報を見て、少しでも気分が上がれば良いのではないだろうか。

Hugo で構築されています。
テーマ StackJimmy によって設計されています。