LoginSignup
3
4

More than 3 years have passed since last update.

個人的にあると作業効率が上がる最低限のbash設定

Last updated at Posted at 2017-03-26

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 プロンプト表示の設定を追加しました

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4