linux:zsh

Z shell(Zsh)

Z Shell 001

本家: Zsh - zsh.org
ソースコード: zsh / Code - sourceforge.net

Z shell (Zsh) は、対話型ログインシェルとして、またシェル スクリプトのコマンド インタープリタとして使用できる Unix シェルである。Zsh は、Bash、ksh、および tcsh のいくつかの機能を含む、多くの改良が施された拡張 Bourne シェルである。

Zsh は、プリンストン大学の学生だった 1990 年に Paul Falstad によって作成された。ksh と tcsh の両方の機能を組み合わせ、プログラム可能なコマンドライン補完、拡張ファイルグロビング、改善された変数/配列処理、テーマ対応プロンプトなどの機能を提供する。

Zsh は、 UnxUtils コレクションの一部として Microsoft Windows で利用でき、macOS および Kali Linux のデフォルト シェルとして採用されています。“Oh My Zsh” ユーザー コミュニティ Web サイトは、サードパーティのプラグインとテーマ用のプラットフォームを提供し、大規模で活発な寄稿者ベースを特徴としている。
Z shell - Wikiwand 翻訳 より

$ sudo dnf install zsh

メタデータの期限切れの最終確認: 0:01:08 時間前の 2023年05月22日 12時10分04秒 に実施しました。
依存関係が解決しました。
==============================================================================================================
 パッケージ            アーキテクチャー         バージョン                     リポジトリー             サイズ
==============================================================================================================
インストール:
 zsh                   x86_64                   5.9-5.fc38                     fedora                   3.3 M

トランザクションの概要
==============================================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 3.3 M
インストール後のサイズ: 8.0 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
zsh-5.9-5.fc38.x86_64.rpm                                                     242 kB/s | 3.3 MB     00:13    
--------------------------------------------------------------------------------------------------------------
合計                                                                          225 kB/s | 3.3 MB     00:14     
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                                      1/1 
  インストール中   : zsh-5.9-5.fc38.x86_64                                                                1/1 
  scriptletの実行中: zsh-5.9-5.fc38.x86_64                                                                1/1 
  検証             : zsh-5.9-5.fc38.x86_64                                                                1/1 

インストール済み:
  zsh-5.9-5.fc38.x86_64                                                                                       

完了しました!

$ zsh --version

zsh 5.9 (x86_64-redhat-linux-gnu)

Z Shell on DietPi

How to properly switch to zsh and be able to use dietpi commands - General Discussion - DietPi Community Forum 翻訳
DietPi では DietPi 固有のコマンド群が bash でしかサポートされていないが…🤔 無理やり…😅

$ sudo apt install zsh

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  zsh-common
Suggested packages:
  zsh-doc
The following NEW packages will be installed:
  zsh zsh-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,711 kB of archives.
After this operation, 17.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf zsh-common all 5.8-6+deb11u1 [3,941 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf zsh armhf 5.8-6+deb11u1 [770 kB]
Fetched 4,711 kB in 6s (782 kB/s)                                                                            
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package zsh-common.
(Reading database ... 106351 files and directories currently installed.)
Preparing to unpack .../zsh-common_5.8-6+deb11u1_all.deb ...
Unpacking zsh-common (5.8-6+deb11u1) ...
Selecting previously unselected package zsh.
Preparing to unpack .../zsh_5.8-6+deb11u1_armhf.deb ...
Unpacking zsh (5.8-6+deb11u1) ...
Setting up zsh-common (5.8-6+deb11u1) ...
Setting up zsh (5.8-6+deb11u1) ...
Processing triggers for man-db (2.9.4-2) ...

$ zsh --version

zsh 5.8 (arm-unknown-linux-gnueabihf)

~/.zsh_dietpi を作成する🤔

$ nano ~/.zsh_dietpi

# DietPi-Globals: dietpi-* aliases, G_* functions and variables
. /boot/dietpi/func/dietpi-globals || { echo -e '[\e[31mFAILED\e[0m] DietPi-Login | Failed to load DietPi-Globals. Skipping DietPi login scripts...'; return 1; }
 
# Aliases
# - sudo alias that allows running other aliases with "sudo": https://github.com/MichaIng/DietPi/issues/424
alias sudo='sudo '
# - DietPi programs
alias dietpi-letsencrypt='/boot/dietpi/dietpi-letsencrypt'
alias dietpi-autostart='/boot/dietpi/dietpi-autostart'
alias dietpi-cron='/boot/dietpi/dietpi-cron'
alias dietpi-launcher='/boot/dietpi/dietpi-launcher'
alias dietpi-cleaner='/boot/dietpi/dietpi-cleaner'
alias dietpi-morsecode='/boot/dietpi/dietpi-morsecode'
alias dietpi-sync='/boot/dietpi/dietpi-sync'
alias dietpi-backup='/boot/dietpi/dietpi-backup'
alias dietpi-bugreport='/boot/dietpi/dietpi-bugreport'
alias dietpi-services='/boot/dietpi/dietpi-services'
alias dietpi-config='/boot/dietpi/dietpi-config'
alias dietpi-software='/boot/dietpi/dietpi-software'
alias dietpi-update='/boot/dietpi/dietpi-update'
alias dietpi-drive_manager='/boot/dietpi/dietpi-drive_manager'
alias dietpi-logclear='/boot/dietpi/func/dietpi-logclear'
alias dietpi-survey='/boot/dietpi/dietpi-survey'
alias dietpi-explorer='/boot/dietpi/dietpi-explorer'
alias dietpi-banner='/boot/dietpi/func/dietpi-banner'
alias dietpi-justboom='/boot/dietpi/misc/dietpi-justboom'
alias dietpi-led_control='/boot/dietpi/dietpi-led_control'
alias dietpi-wifidb='/boot/dietpi/func/dietpi-wifidb'
alias dietpi-optimal_mtu='/boot/dietpi/func/dietpi-optimal_mtu'
alias dietpi-cloudshell='/boot/dietpi/dietpi-cloudshell'
alias dietpi-nordvpn='G_DIETPI-NOTIFY 1 "DietPi-NordVPN has been renamed to DietPi-VPN. Please use the \"dietpi-vpn\" command."'
alias dietpi-vpn='/boot/dietpi/dietpi-vpn'
alias dietpi-ddns='/boot/dietpi/dietpi-ddns'
alias cpu='/boot/dietpi/dietpi-cpuinfo'
# - Optional DietPi software aliases
[[ -d '/mnt/dietpi_userdata/sonarr' || -d '/mnt/dietpi_userdata/radarr' || -d '/mnt/dietpi_userdata/lidarr' ]] && alias dietpi-arr_to_RAM='/boot/dietpi/misc/dietpi-arr_to_RAM'
command -v kodi > /dev/null && alias startkodi='/boot/dietpi/misc/start_kodi'
[[ -f '/usr/games/opentyrian/run' ]] && alias opentyrian='/usr/games/opentyrian/run'
[[ -f '/mnt/dietpi_userdata/dxx-rebirth/run.sh' ]] && alias dxx-rebirth='/mnt/dietpi_userdata/dxx-rebirth/run.sh'
# - 1337 moments ;)
alias 1337='echo "Indeed, you are =)"'
 
# "G_DIETPI-NOFITY -2 message" starts a process animation. If scripts fail to kill the animation, e.g. cancelled by user, terminal bash prompt has to do it as last resort.
[[ $PROMPT_COMMAND == *'dietpi-process.pid'* ]] || PROMPT_COMMAND="[[ -w '/tmp/dietpi-process.pid' ]] && rm -f /tmp/dietpi-process.pid &> /dev/null && echo -ne '\r\e[J'; $PROMPT_COMMAND"
 
 
# DietPi-Login: First run setup, autostarts and login banner
# - Prevent call if $G_DIETPI_LOGIN has been set. E.g. when shell is called as subshell of G_EXEC or dietpi-login itself, we don't want autostart programs to be launched.
[[ $G_DIETPI_LOGIN ]] || /boot/dietpi/dietpi-login

~/.zshrc から ~/.zsh_dietpi を呼び出すように設定する🤔

$ nano ~/.zshrc

if [ -f ~/.commonshrc ]; then
    . ~/.commonshrc
fi
 
# Z shell DietPi Support
. ~/.zsh_dietpi

MichaIng/DietPi: Lightweight justice for your single-board computer!

+ 参考 そのままでは DietPi の機能でエラーが発生

$ . /etc/bashrc.d/dietpi.bash

/boot/dietpi/.version:6: G_LIVE_PATCH_STATUS: assignment to invalid subscript range
/etc/bashrc.d/dietpi.bash:76: closing brace expected

$ cat/etc/bashrc.d/dietpi.bash

#!/bin/bash
{
	#////////////////////////////////////
	# DietPi bash init script
	#
	#////////////////////////////////////
	# Created by MichaIng / micha@dietpi.com / dietpi.com
	#
	#////////////////////////////////////
	#
	# Info:
	# - Location: /etc/bashrc.d/dietpi.bash
	# - Sourced by all interactive bash shells from: /etc/bash.bashrc
	# - Prepares shell for DietPi and runs autostarts on /dev/tty1
	#////////////////////////////////////
 
	# Failsafe: Never load this script in non-interactive shells, e.g. SFTP, SCP or rsync
	[[ -t 0 && $- == *'i'* ]] || return 0
 
	# DietPi-Globals: dietpi-* aliases, G_* functions and variables
	. /boot/dietpi/func/dietpi-globals || { echo -e '[\e[31mFAILED\e[0m] DietPi-Login | Failed to load DietPi-Globals. Skipping DietPi login scripts...'; return 1; }
 
	# Aliases
	# - sudo alias that allows running other aliases with "sudo": https://github.com/MichaIng/DietPi/issues/424
	alias sudo='sudo '
	# - DietPi programs
	alias dietpi-letsencrypt='/boot/dietpi/dietpi-letsencrypt'
	alias dietpi-autostart='/boot/dietpi/dietpi-autostart'
	alias dietpi-cron='/boot/dietpi/dietpi-cron'
	alias dietpi-launcher='/boot/dietpi/dietpi-launcher'
	alias dietpi-cleaner='/boot/dietpi/dietpi-cleaner'
	alias dietpi-morsecode='/boot/dietpi/dietpi-morsecode'
	alias dietpi-sync='/boot/dietpi/dietpi-sync'
	alias dietpi-backup='/boot/dietpi/dietpi-backup'
	alias dietpi-bugreport='/boot/dietpi/dietpi-bugreport'
	alias dietpi-services='/boot/dietpi/dietpi-services'
	alias dietpi-config='/boot/dietpi/dietpi-config'
	alias dietpi-software='/boot/dietpi/dietpi-software'
	alias dietpi-update='/boot/dietpi/dietpi-update'
	alias dietpi-drive_manager='/boot/dietpi/dietpi-drive_manager'
	alias dietpi-logclear='/boot/dietpi/func/dietpi-logclear'
	alias dietpi-survey='/boot/dietpi/dietpi-survey'
	alias dietpi-explorer='/boot/dietpi/dietpi-explorer'
	alias dietpi-banner='/boot/dietpi/func/dietpi-banner'
	alias dietpi-justboom='/boot/dietpi/misc/dietpi-justboom'
	alias dietpi-led_control='/boot/dietpi/dietpi-led_control'
	alias dietpi-wifidb='/boot/dietpi/func/dietpi-wifidb'
	alias dietpi-optimal_mtu='/boot/dietpi/func/dietpi-optimal_mtu'
	alias dietpi-cloudshell='/boot/dietpi/dietpi-cloudshell'
	alias dietpi-nordvpn='G_DIETPI-NOTIFY 1 "DietPi-NordVPN has been renamed to DietPi-VPN. Please use the \"dietpi-vpn\" command."'
	alias dietpi-vpn='/boot/dietpi/dietpi-vpn'
	alias dietpi-ddns='/boot/dietpi/dietpi-ddns'
	alias cpu='/boot/dietpi/dietpi-cpuinfo'
	# - Optional DietPi software aliases
	[[ -d '/mnt/dietpi_userdata/sonarr' || -d '/mnt/dietpi_userdata/radarr' || -d '/mnt/dietpi_userdata/lidarr' ]] && alias dietpi-arr_to_RAM='/boot/dietpi/misc/dietpi-arr_to_RAM'
	command -v kodi > /dev/null && alias startkodi='/boot/dietpi/misc/start_kodi'
	[[ -f '/usr/games/opentyrian/run' ]] && alias opentyrian='/usr/games/opentyrian/run'
	[[ -f '/mnt/dietpi_userdata/dxx-rebirth/run.sh' ]] && alias dxx-rebirth='/mnt/dietpi_userdata/dxx-rebirth/run.sh'
	[[ -f '/var/www/owncloud/occ' ]] && alias occ='sudo -u www-data php /var/www/owncloud/occ'
	[[ -f '/var/www/nextcloud/occ' ]] && alias ncc='sudo -u www-data php /var/www/nextcloud/occ'
	# - 1337 moments ;)
	alias 1337='echo "Indeed, you are =)"'
 
	# "G_DIETPI-NOFITY -2 message" starts a process animation. If scripts fail to kill the animation, e.g. cancelled by user, terminal bash prompt has to do it as last resort.
	[[ $PROMPT_COMMAND == *'dietpi-process.pid'* ]] || PROMPT_COMMAND="[[ -w '/tmp/dietpi-process.pid' ]] && rm -f /tmp/dietpi-process.pid &> /dev/null && echo -ne '\r\e[J'; $PROMPT_COMMAND"
 
	# Workaround if SSH client overrides locale with "POSIX" fallback: https://github.com/MichaIng/DietPi/issues/1540#issuecomment-367066178
	if [[ ${LC_ALL:-${LANG:-POSIX}} == 'POSIX' ]]
	then
		current_locale=$(sed -n '/^[[:blank:]]*AUTO_SETUP_LOCALE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)
		export LC_ALL=${current_locale:=C.UTF-8} LANG=$current_locale
		unset -v current_locale
	fi
 
	# Workaround if SSH client sets an unsupported $TERM string: https://github.com/MichaIng/DietPi/issues/2034
	term="/${TERM::1}/$TERM"
	if [[ $SSH_TTY && ! -f /lib/terminfo$term && ! -f /usr/share/terminfo$term && ! -f ~/.terminfo$term && ! -f /etc/terminfo$term ]]
	then
		TERM_old=$TERM
		export TERM='xterm'
		[[ $TERM_old == *'256'* ]] && TERM+='-256color'
 
		G_WHIP_MENU_ARRAY=('0' 'Ignore for now, I will change the SSH clients terminal.')
		ncurses_term=
		if ! dpkg-query -s ncurses-term &> /dev/null
		then
			ncurses_term=' or install the "ncurses-term" APT package, which enables broader terminal support'
			G_WHIP_MENU_ARRAY+=('1' 'Install "ncurses-term" now to enable broader terminal support.')
			G_WHIP_DEFAULT_ITEM=1
		fi
 
		G_PROGRAM_NAME='Unsupported SSH client terminal' G_WHIP_MENU "[WARNING] Your SSH client passed an unsupported terminal: TERM=$TERM_old
\nAs a workaround, we fooled the server by setting TERM=$TERM. This is not the cleanest solution as commands may use control sequences which are not supported by the current terminal.
\nPlease change your SSH clients terminal, respectively the passed \$TERM string$ncurses_term." && (( $G_WHIP_RETURNED_VALUE )) && G_AGI ncurses-term
		unset -v TERM_old ncurses_term
	fi
	unset -v term
 
	# DietPi-Login: First run setup, autostarts and login banner
	# - Prevent call if $G_DIETPI_LOGIN has been set. E.g. when shell is called as subshell of G_EXEC or dietpi-login itself, we don't want autostart programs to be launched.
	[[ $G_DIETPI_LOGIN ]] || /boot/dietpi/dietpi-login
}

$ zsh --version

zsh 5.9 (x86_64-redhat-linux-gnu)

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Cloning Oh My Zsh...
remote: Enumerating objects: 1361, done.
remote: Counting objects: 100% (1361/1361), done.
remote: Compressing objects: 100% (1309/1309), done.
remote: Total 1361 (delta 33), reused 1132 (delta 28), pack-reused 0
Receiving objects: 100% (1361/1361), 2.00 MiB | 8.84 MiB/s, done.
Resolving deltas: 100% (33/33), done.
From https://github.com/ohmyzsh/ohmyzsh
 * [new branch]      master     -> origin/master
branch 'master' set up to track 'origin/master'.
Already on 'master'
/home/tomoyan

Looking for an existing zsh config...
Using the Oh My Zsh template file and adding it to /home/tomoyan/.zshrc.

I can't change your shell automatically because this system does not have chsh.
Please manually change your default shell to zsh
         __                                     __   
  ____  / /_     ____ ___  __  __   ____  _____/ /_  
 / __ \/ __ \   / __ `__ \/ / / /  /_  / / ___/ __ \ 
/ /_/ / / / /  / / / / / / /_/ /    / /_(__  ) / / / 
\____/_/ /_/  /_/ /_/ /_/\__, /    /___/____/_/ /_/  
                        /____/                       ....is now installed!


Before you scream Oh My Zsh! look over the `.zshrc` file to select plugins, themes, and options.

• Follow us on Twitter: https://twitter.com/ohmyzsh
• Join our Discord community: https://discord.gg/ohmyzsh
• Get stickers, t-shirts, coffee mugs and more: https://shop.planetargon.com/collections/oh-my-zsh

~

$ zsh


This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~).  This function can help you with a few settings that should
make your use of the shell easier.

You can:

(q)  Quit and do nothing.  The function will be run again next time.

(0)  Exit, creating the file ~/.zshrc containing just a comment.
     That will prevent this function being run again.

(1)  Continue to the main menu.

--- Type one of the keys in parentheses --- 1

これは新規ユーザー向けの Z Shell 設定機能です。
zsh-newuser-install。
zsh 起動ファイルがないため、このメッセージが表示されます。
(ディレクトリ内のファイル .zshenv、.zprofile、.zshrc、.zlogin
~)。この機能は、必要ないくつかの設定に役立ちます。
シェルをより簡単に使用できるようになります。

あなたはできる:

(q) やめて何もしないでください。この関数は次回も実行されます。

(0) コメントのみを含むファイル ~/.zshrc を作成して終了します。
     これにより、この関数は再度実行されなくなります。

(1) メインメニューに進みます。

--- 括弧内にいずれかのキーを入力します ---


Please pick one of the following options:

(1)  Configure settings for history, i.e. command lines remembered
     and saved by the shell.  (Recommended.)

(2)  Configure the new completion system.  (Recommended.)

(3)  Configure how keys behave when editing command lines.  (Recommended.)

(4)  Pick some of the more common shell options.  These are simple "on"
     or "off" switches controlling the shell's features.  

(0)  Exit, creating a blank ~/.zshrc file.

(a)  Abort all settings and start from scratch.  Note this will overwrite
     any settings from zsh-newuser-install already in the startup file.
     It will not alter any of your other settings, however.

(q)  Quit and do nothing else.  The function will be run again next time.
--- Type one of the keys in parentheses --- 0

次のオプションのいずれかを選択してください。

(1) 履歴の設定を構成します。つまり、コマンドラインを記憶します。
     そしてシェルによって保存されます。 (おすすめされた。)

(2) 新しい補完システムを構成します。 (おすすめされた。)

(3) コマンドライン編集時のキーの動作を設定します。 (おすすめされた。)

(4) より一般的なシェル オプションをいくつか選択します。これらは単純に「オン」です
     またはシェルの機能を制御する「オフ」スイッチ。

(0) 終了し、空の ~/.zshrc ファイルを作成します。

(a) すべての設定を中止し、最初からやり直します。これは上書きされることに注意してください
     zsh-newuser-install の設定はすでに起動ファイルに含まれています。
     ただし、他の設定は変更されません。

(q) 辞めて何もしません。この関数は次回も実行されます。
--- 括弧内にいずれかのキーを入力します ---

この設定を先にしておかないと、bash 環境で追加設定したものが zsh に切り替えた後に、使用できなくなっていることに気が付きます😅

~/.bashrc~/.zshrc に共通の構成ファイルを読み込むようにする🤔

~/.bashrc
if [ -f ~/.commonshrc ]; then
	. ~/.commonshrc
fi
~/.zshrc
if [ -f ~/.commonshrc ]; then
	. ~/.commonshrc
fi

共通の構成は ~/.commonshrc に書く✍ようにする🤔

~/.commonshrc
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE="/home/tomoyan/.local/bin/micromamba";
export MAMBA_ROOT_PREFIX="/home/tomoyan/micromamba";
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__mamba_setup"
else
    if [ -f "/home/tomoyan/micromamba/etc/profile.d/micromamba.sh" ]; then
        . "/home/tomoyan/micromamba/etc/profile.d/micromamba.sh"
    else
        export  PATH="/home/tomoyan/micromamba/bin:$PATH"  # extra space after export prevents interference from conda init
    fi
fi
unset __mamba_setup
# <<< mamba initialize <<<
 
# anyenv
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
 
# cargo
. "$HOME/.cargo/env"

デフォルトを zsh に変更する場合🤔

$ chsh -s $(which zsh)


デフォルトを bash に変更する場合🤔

$ chsh -s $(which bash)

tomoyan のシェルを変更します。
パスワード: ************
シェルを変更しました。

$ bash -l


chsh コマンドが見つからない場合🤔

$ chsh -s $(which zsh)

-bash: chsh: コマンドが見つかりません

util-linux-user パッケージをインストールする😉

$ dnf provides chsh

メタデータの期限切れの最終確認: 0:00:23 時間前の 2023年09月23日 01時23分36秒 に実施しました。
util-linux-user-2.38.1-1.fc37.x86_64 : util-linux utilities based on libuser
Repo        : fedora
一致:
ファイル名    : /usr/bin/chsh

$ sudo dnf install util-linux-user

メタデータの期限切れの最終確認: 1:36:50 時間前の 2023年09月22日 23時53分44秒 に実施しました。
依存関係が解決しました。
==============================================================================================================
 パッケージ                    アーキテクチャー     バージョン                     リポジトリー         サイズ
==============================================================================================================
インストール:
 util-linux-user               x86_64               2.38.1-1.fc37                  fedora                30 k

トランザクションの概要
==============================================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 30 k
インストール後のサイズ: 60 k
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
util-linux-user-2.38.1-1.fc37.x86_64.rpm                                      265 kB/s |  30 kB     00:00    
--------------------------------------------------------------------------------------------------------------
合計                                                                           71 kB/s |  30 kB     00:00     
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                                      1/1 
  インストール中   : util-linux-user-2.38.1-1.fc37.x86_64                                                 1/1 
  scriptletの実行中: util-linux-user-2.38.1-1.fc37.x86_64                                                 1/1 
  検証             : util-linux-user-2.38.1-1.fc37.x86_64                                                 1/1 

インストール済み:
  util-linux-user-2.38.1-1.fc37.x86_64                                                                        

完了しました!

Oh My Zsh テーマギャラリー
Themes · ohmyzsh/ohmyzsh Wiki 翻訳

alejandromume/ubunly-zsh-theme: The new Kali Linux console bringed to Ubuntu 翻訳

ubunly のテーマをクローンする🤔

$ mkdir ~/work && cd ~/work
$ git clone --depth 1 https://github.com/alejandromume/ubunly-zsh-theme.git

Cloning into 'ubunly-zsh-theme'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 2 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), 5.48 KiB | 5.48 MiB/s, done.

テーマをインストールする🤔

$ cd ubunly-zsh-theme
$ chmod +x INSTALL.sh 
$ ./INSTALL.sh

[-] Installing Theme... ╔══════════════════════════════════════════════════════════════════════════════╗ ║ Remeber to add zsh-autosuggestions and zsh-syntax-highlighting to your plugins ║ ╚══════════════════════════════════════════════════════════════════════════════╝ [sudo] tomoyan のパスワード: [✱] Ubunly ZSH Theme Installed successfully! ╔══════════════════════════════════════════╗ ║ Set ubunly as ZSH_THEME in your .zshrc ║ ╚══════════════════════════════════════════╝

~/.zshrc の設定でテーマを ubunlyに変更する🤔

$ nano ~/.zshrc

~/.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
 
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
 
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="ubunly"

zsh の設定を反映させる😊

$ . ~/.zshrc
┌──(tomoyan  WICKED-BEAT)-[~/work/ubunly-zsh-theme]
└─$ 

ubunly.zsh-theme をコピーして fedoly.zsh-theme に修正する…🤔

$ cp ~/.oh-my-zsh/custom/themes/ubunly.zsh-theme ~/.oh-my-zsh/custom/themes/fedoly.zsh-theme
$ nano ~/.oh-my-zsh/custom/themes/fedoly.zsh-theme
$ diff -u ~/.oh-my-zsh/custom/themes/ubunly.zsh-theme ~/.oh-my-zsh/custom/themes/fedoly.zsh-theme | bat --style changes -l diff

  --- /home/tomoyan/.oh-my-zsh/custom/themes/ubunly.zsh-theme 2023-07-05 04:40:11.485903200 +0900
  +++ /home/tomoyan/.oh-my-zsh/custom/themes/fedoly.zsh-theme 2024-04-21 16:36:59.088333447 +0900
  @@ -77,7 +77,7 @@
   fi
   
   if [ "$color_prompt" = yes ]; then
  -    PROMPT=$'%F{%(#.blue.214)}┌──${debian_chroot:+($debian_chroot)──}(%B%F{%(#.red.202)}%n%(#.💀.  )%m%b%F
  {%(#.orange.214)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.214)}]\n└─%B%(#.%F{red}#.%F{208}$)%b%F{rese
  t} '
  +    PROMPT=$'%F{%(#.057.051)}┌──${debian_chroot:+($debian_chroot)──}(%B%F{%(#.red.033)}%n%(#. 💀 .   )%m%b
  %F{%(#.057.051)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.057.051)}]\n└─%B%(#.%F{red}#.%F{033}⚡)%b%F{reset
  } '
       RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
   
       # enable syntax-highlighting

テーマを ZSH_THEME=“fedoly” に変更する🤔

$ nano ~/.zshrc

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="fedoly"

zsh の設定を反映させる😉

$ . ~/.zshrc

┌──(tomoyan   WICKED-BEAT)-[~]
└─

┌──(root 💀 WICKED-BEAT)-[~]
└─#

fedoly.zsh-theme

$ curl -L https://www.tomoyan.net/_media/linux/zsh/fedoly.zsh-theme -o ~/.oh-my-zsh/custom/fedoly.zsh-theme
$ nano ~/.zshrc
$ . ~/.zshrc

OS ロゴの検索

$ sudo dnf install -y gucharmap

gucharmap

Xterm 256color chart

参考

ubunly.zsh-theme をコピーして dietly.zsh-theme に修正する…🤔

$ cp ~/.oh-my-zsh/custom/themes/ubunly.zsh-theme ~/.oh-my-zsh/custom/themes/dietly.zsh-theme
$ nano ~/.oh-my-zsh/custom/themes/dietly.zsh-theme
$ diff -u ~/.oh-my-zsh/custom/themes/ubunly.zsh-theme ~/.oh-my-zsh/custom/themes/dietly.zsh-theme | bat --style changes -l diff

  --- /home/dietpi/.oh-my-zsh/custom/themes/ubunly.zsh-theme  2023-08-08 04:19:56.183862288 +0900
  +++ /home/dietpi/.oh-my-zsh/custom/themes/dietly.zsh-theme  2024-04-22 06:34:35.501186304 +0900
  @@ -77,7 +77,7 @@
   fi
   
   if [ "$color_prompt" = yes ]; then
  -    PROMPT=$'%F{%(#.blue.214)}┌──${debian_chroot:+($debian_chroot)──}(%B%F{%(#.red.202)}%n%(#.💀.  )%m%b%F
  {%(#.orange.214)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.214)}]\n└─%B%(#.%F{red}#.%F{208}$)%b%F{rese
  t} '
  +    PROMPT=$'%F{%(#.blue.156)}┌──${debian_chroot:+($debian_chroot)──}(%B%F{%(#.red.154)}%n%(#. 💀 .  )%m%b
  %F{%(#.orange.156)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.156)}]\n└─%B%(#.%F{red}#.%F{154}$)%b%F{re
  set} '
       RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
   
       # enable syntax-highlighting

テーマを ZSH_THEME=“dietly” に変更する🤔

$ nano ~/.zshrc

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="dietly"

zsh の設定を反映させる😉

$ . ~/.zshrc

┌──(dietpi  dietpi-001)-[~]
└─$

┌──(root 💀 dietpi-001)-[~]
└─#

  • linux/zsh.txt
  • 最終更新: 2024/04/24 12:11
  • by ともやん