编辑 .bashrc 文件
sudo gedit ~/.bashrc
在最后一行加入
cdAndList() { cd "${1}"; ls; } alias cd=cdAndList
保存后退出,在终端输入
source ~/.bashrc
之后cd任意目录,都会自动执行ls了