在終端中每次執行
cd
後,想要檢視檔案還要執行
ls
,啰嗦。
那麼讓終端執行
cd
後自動執行
ls
豈不美滋滋。
vi
添加下面的語句到.bashrc中:
注意空格,空格不對就會報錯,建議直接複制下面的語句,而不是自己再敲一遍
cd() { builtin cd "$@" && ls; }
這時候打開終端試一下。

- https://superuser.com/questions/507697/how-do-i-cd-and-then-ls-automatically-in-linux