Macの初期状態だと、~/.bash_profile や ~/.bashrcは存在しないため、作成する必要がある
環境
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.5
BuildVersion: 18F132
作成
## ファイル作成
touch ~/.bash_profile
touch ~/.bashrc編集
## .bash_profile編集
vi ~/.bash_profile
## 追加
if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi
## .bashrc編集
vi ~/.bashrc
## 追加
alias ls='ls -la'反映
source ~/.bashrc
source ~/.bash_profile実行
lsを実行するとls -laとして実行されるようになる
.bash_profile
ログイン時に実行される。
.bashrc
bash起動時に都度実行される
簡単な色付けをしてみる
## 編集
vi ~/.bashrc
## 追加
PS1='\e[1;32m\W \t \e[1;31m\u \e[1;32m$ \e[0m'
alias ls='ls -FG'
alias ll='ls -alFG'
-
前の記事
mysql8でユーザーに権限を付与 2019.09.28
-
次の記事
MacにAnacondaをインストール 2019.09.30
コメントを書く