RedHatやCentOSを利用すると初期シェルはbashなので、個人的にあると便利な設定。
使用アカウントのルートにある.bashrc
とかに下記を追加。
.bashrc
# cdでcdls関数を利用する
alias cd='cdls'
# 前方&後方一致検索
bind "\C-p":history-search-backward
bind "\C-n":history-search-forward
# cdコマンドの後自動でlsコマンドを実行する関数を定義
cdls () {
\cd "$@" && ls
}
# Prompt画面の編集(色付き現在地表示付き)
PS1="\[\e[32m\][\u@\h \w]\\$\[\e[0m\] "
その後に設定ファイルを下のコマンドで読み込む。
$ . .bashrc
もしくは下記コマンド。(もちろん再起動でもOK)
$ source .bashrc
※追記
2019/06/06 プロンプト表示の設定を追加しました