在终端中每次执行
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