
Z Shell(ズィーシェル、以後、zshと略す)は、Bashをベースに開発されたコマンドラインシェルです。
zshには下記の特徴があります。
強力なオートコンプリート
コマンドやファイル名を途中まで入力すると、残りの部分を自動的に補完してくれます。
これにより、誤字脱字を防ぎ、コマンド入力の時間を大幅に短縮できます。
豊富なカスタマイズ性
自分の好みに合わせて、見た目を変えたり、新しい機能を追加したりすることができます。
テーマやプラグインを利用することで、さらに便利にすることも可能です。
プログラミングのような操作性
プログラミング言語のような構文を持つため、複雑な処理も記述できます。
zshをインストールします。
ターミナルを開き、
$ sudo apt update $ sudo apt install zsh $ zsh --version
zsh 5.9 (aarch64-unknown-linux-gnu)
のような出力があれば、インストールは終了です。
続いて、ターミナルで使用するシェルをBashからZshに変更します。
$ which zsh
でZshのパスを調べます。
/usr/bin/zsh
出力されたパスを元にchshを実行します。
$ sudo chsh -s /usr/bin/zsh ${USER}
$ sudo shutdown -r now
# クロームブックの場合は、PCの再起動
再起動後にターミナルを起動すると、
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.
(2) Populate your ~/.zshrc with the configuration recommended
by the system administrator and exit (you will need to edit
the file by hand, if so desired).
--- Type one of the keys in parentheses ---
0〜2のどれかのキーを押して、Zshを起動します。
※ 自身で行いたい設定がなければ、2を選択することをおすすめします。
プロンプトが
raspberrypi%
※ 上記のプロンプトは0を押した場合の表示
になれば、設定は終了です。
下記コマンドを実行して、使用中のログインシェルのパスを確認しておきましょう。
% echo $SHELL
※ Zshの標準設定ではプロンプトの最初は % になります。
/usr/bin/zsh