以下command在cshell中生效

在.cshrc中加入下面的语句:

alias cd 'cd \!* ; ll'

注意*后面的空格,以及ll之前的空格

进一步,可以同时打印出cd之后的path

alias cd 'cd \!* ; ll; pwd'

如果执行cd之后命令行显示的目录(用户名后面紧跟着的)没有变化的,可以试着再加入source

alias cd 'cd \!* ; ll; pwd; so'

 

如果是在bash的环境,在.bashrc中加入:

alias cd="cd $1; ll "

Note the leading space (" ") in the bash version, it prevents the result to be alias expanded again. So it prevents loops.

bash另一种方法,在.bashrc中加入:

  1. cdls() {  
  2.     cd "${1}";  
  3.     ls;  
  4. }  
  5. alias cd='cdls'  

相关文章:

  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2022-03-05
  • 2022-12-23
猜你喜欢
  • 2021-07-27
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案