---
title: "ターミナルがダサいとモテない。xxfetch 編 | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/terminal-xxfetch"
description: "いろいろな fetch を使ってオシャレログイン Photo by Markus Spiske on Unsplash 恵比寿で IT 企業をやっているとモテると聞いて創業しましたが早いことありがたいことに 10 年目に突入した長谷川です。 まだモテる成果は出ていません、、、これからです！（もうめんどくさいのでカウン…"
---

# ターミナルがダサいとモテない。xxfetch 編

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2025年3月12日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#シリーズ: ターミナル環境](/tags/シリーズ-ターミナル環境/)

![ターミナルがダサいとモテない。xxfetch 編](/_astro/ogp.DRqgmDaJ_Z5XIUP.webp)

いろいろな fetch を使ってオシャレログイン

![ターミナルがダサいとモテない。xxfetch 編](/_astro/01-0-YYLfJEGjUEYyfqEB-96005e75.BYmnfy8J_AfSWq.webp)

Photo by [Markus Spiske](https://unsplash.com/@markusspiske?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)

恵比寿で IT 企業をやっているとモテると聞いて創業しましたが早いことありがたいことに 10 年目に突入した長谷川です。

まだモテる成果は出ていません、、、これからです！（もうめんどくさいのでカウントやめましたw）

## xxfetch とは？

Command-Line で OS 情報や Kernel 情報、CPU や GPU、メモリなどの System Infomation が表示できるツールです。

![macOSのターミナルにOSやCPUなどのシステム情報を表示したfastfetch](/_astro/02-1-oQvsHiN3afgyXh2XaVSV2Q-23a84ed1.CV2OCjji_18XmaM.webp)

fastfetch on macOS

もともとが [neofetch](https://github.com/dylanaraps/neofetch) なのかわからないけど、最近は [Awesome Fetch](https://github.com/beucismis/awesome-fetch) なんてあって笑ってしまったw

[GitHub - beucismis/awesome-fetch: Command-line fetch tools for system/other information](https://github.com/beucismis/awesome-fetch?source=post_page-----53d06babc296---------------------------------------)

こちらを見るといろいろな実装があります。

自分は [neofetch](https://github.com/dylanaraps/neofetch) を利用していましたが、現在は [fastfetch](https://github.com/fastfetch-cli/fastfetch) を利用しています。  
また git の Directory を fetch してくれる [onefetch](https://github.com/o2sh/onefetch) も利用しています。

ここでは [fastfetch](#fastfetch) と [onefetch](#onefetch) を紹介していきます。

## fastfetch

先ほども screenshot を貼り付けましたが、このような表示をしてくれるツールです。

![fastfetchの画面](/_astro/02-1-oQvsHiN3afgyXh2XaVSV2Q-23a84ed1.CV2OCjji_18XmaM.webp)

fastfetch on macOS

### Install

[homebrew](https://brew.sh/) で Install できます。

Plain textcontent\_copy

```
brew install fastfetch
```

### gen-config

fastfetch には gen-config option があります。

これで設定ファイルを生成することができます。

Plain textcontent\_copy

```
fastfetch --gen-config
```

config path は XDG\_CONFIG\_DIR の下になります。  
もしすでにある場合は強制上書きしますが、gen-config-force option もあります。

Plain textcontent\_copy

```
fastfetch --gen-config-force
```

実際の config は json になっています。

Plain textcontent\_copy

```
cat ${HOME}/.config/fastfetch/config.jsonc
{
  "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
  "modules": [
    "title",
    "separator",
    "os",
    "host",
    "kernel",
    "uptime",
    "packages",
    "shell",
    "display",
    "de",
    "wm",
    "wmtheme",
    "theme",
    "icons",
    "font",
    "cursor",
    "terminal",
    "terminalfont",
    "cpu",
    "gpu",
    "memory",
    "swap",
    "disk",
    "localip",
    "battery",
    "poweradapter",
    "locale",
    "break",
    "colors"
  ]
}
```

### logo

また logo は画像を表示することもできます。  
例えば自分は [WezTerm](https://wezfurlong.org/wezterm/index.html) を利用しているので、logo type は iterm を使えば画像を表示することもできます。

Plain textcontent\_copy

```
fastfetch --iterm [image file]
```

![logoの画面](/_astro/03-1--6_D7DhU9SoK548G1cAGuQ-c2a6086b.DxJtdzLY_ZLRhbb.webp)

画像の指定もここに sample の方法がありました。[](https://github.com/fastfetch-cli/fastfetch/blob/dev/presets/examples/2.jsonc?source=post_page-----53d06babc296---------------------------------------#L6-L8)

[fastfetch/presets/examples/2.jsonc at dev · fastfetch-cli/fastfetch](https://github.com/fastfetch-cli/fastfetch/blob/dev/presets/examples/2.jsonc?source=post_page-----53d06babc296---------------------------------------#L6-L8)

Plain textcontent\_copy

```
{
    "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
    "logo": {
        "type": "iterm",
        "source": "~/Desktop/apple1.png",
```

### Setup

.bashrc などの最後あたりに以下のような記述をして組み込んでいます。SHLVL を指定してる理由は [tmux](https://github.com/tmux/tmux) や [neovim](https://neovim.io/) から Terminal を開いた場合にちょっと邪魔で表示しないようにしてる  
今のところこれで特に問題ないかな・・・

Plain textcontent\_copy

```
#################################################
### fastfetch
if command -v fastfetch &> /dev/null; then
  if [ ${SHLVL} -eq 1 ]; then
    fastfetch
  fi
fi
```

## onefetch

git の directory の git infomation を表示するツールです。

自分は cd した時に git なのかを確認するのに使っています。[](https://github.com/o2sh/onefetch?source=post_page-----53d06babc296---------------------------------------)

[GitHub - o2sh/onefetch: Command-line Git information tool](https://github.com/o2sh/onefetch?source=post_page-----53d06babc296---------------------------------------)

### Install

普通に [homebrew](https://brew.sh/) にあります。

Plain textcontent\_copy

```
brew install onefetch
```

あとは git の directory で普通に onefetch を叩くだけです。

自分がよく使ってる [mustache](https://mustache.github.io/) の bash版を git clone してみましょう。[](https://github.com/tests-always-included/mo?source=post_page-----53d06babc296---------------------------------------)

[GitHub - tests-always-included/mo: Mustache templates in pure bash](https://github.com/tests-always-included/mo?source=post_page-----53d06babc296---------------------------------------)

Plain textcontent\_copy

```
test ! -d work && mkdir work
git clone --depth 1 https://github.com/tests-always-included/mo.git work/mo
cd work/mo
```

![Installの画面](/_astro/04-1-GE_8uR69m50ol4BgE3rvUg-03c0cf41.BfAjMTka_f02F2.webp)

こんな感じで表示してくれます。  
bash が 83.2%

cd した directory が git だったら自動的に onefetch を実行するようにします。

getting-started の ”By @quazr-omega” のサンプルが参考になります。

Plain textcontent\_copy

```
# git repository greeter
last_repository=
check_directory_for_new_repository() {
 current_repository=$(git rev-parse --show-toplevel 2> /dev/null)

 if [ "$current_repository" ] && \
    [ "$current_repository" != "$last_repository" ]; then
  onefetch
 fi
 last_repository=$current_repository
}
cd() {
 builtin cd "$@"
 check_directory_for_new_repository
}

# optional, greet also when opening shell directly in repository directory
# adds time to startup
check_directory_for_new_repository
```

自分は cd を [zoxide](https://github.com/ajeetdsouza/zoxide) で bash を使っているので以下のようにしています。

.bashrc などに

Plain textcontent\_copy

```
# onefetch
if command -v onefetch &> /dev/null; then
  declare -x LAST_REPOSITORY=""
  _check_directory_for_new_repository() {
    CURRENT_REPOSITORY=$(git rev-parse --show-toplevel 2> /dev/null)
    if [ "${CURRENT_REPOSITORY}" ] && [ "${CURRENT_REPOSITORY}" != "${LAST_REPOSITORY}" ]; then
      onefetch
    fi
    LAST_REPOSITORY=${CURRENT_REPOSITORY}
  }

  _check_directory_for_new_repository
fi

# zoxide
if command -v zoxide &> /dev/null; then
  eval "$(zoxide init --hook pwd $(basename ${SHELL}))"
  function cd(){
    z "$@"

    # onefetch
    if [ -d .git ]; then
      _check_directory_for_new_repository
    fi
  }
fi
```

これで git の directory に移動すると onefetch が表示されるようになります。

xxfetch はいろいろあるのでちょっと楽しいです。[](https://github.com/beucismis/awesome-fetch?source=post_page-----53d06babc296---------------------------------------)

[GitHub - beucismis/awesome-fetch: Command-line fetch tools for system/other information](https://github.com/beucismis/awesome-fetch?source=post_page-----53d06babc296---------------------------------------)

たまに表示がうるさいけどね・・・

お客さんのサーバに入れるわけにはいかないけど、社内のインスタンスなどにはこれらを仕込んで間違えないようにしています。

ターミナル環境について他の記事も書いているので、よろしければこちらもご覧ください！  
[『ターミナルがダサいとモテない』シリーズ一覧](https://blog.grasys.io/tags/series-terminal-update)

転載：[ターミナルがダサいとモテない。xxfetch 編](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-xxfetch%E7%B7%A8-53d06babc296)

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [X](https://x.com/yusukeh "X")
-   [GitHub](https://github.com/yusukeh "GitHub")
-   [Medium](https://medium.com/@yusukeh "Medium")
-   [Facebook](https://www.facebook.com/yusuke.exzm "Facebook")
-   [Instagram](https://www.instagram.com/yusukehasegawa/ "Instagram")
-   [LinkedIn](https://www.linkedin.com/in/hasegawa-yusuke-091b4164/ "LinkedIn")

[プロフィールと記事一覧](/authors/yusukeh/)