linux自启动脚本汇总

/etc/rc.local 开机自启动 不要运行阻塞的程序, 该文件中不能加入用户shell下的脚本,例如加入 alias ll=“ls -l” 无效,因为该文件的执行环境是在系统shell下,系统尚未进入用户shell环境。

/etc/profile 第一个用户shell登录时 只执行一次, 可以放全局的环境变量修改

~/.bash_profile对应每个人的profile,也只执行一次,只有shell登录执行

  • 读取/.bash_profile,若它不存在,则读取/.bash_login,若前两者不存在,读取~/.profile。

~/.bashrc 对应每个人的profile,非shell登录时执行

  1. 图形模式登录时,顺序读取:/etc/profile和~/.profile
  2. 文本模式登录时,顺序读取:/etc/bash.bashrc,/etc/profile和~/.bash_profile

猜你喜欢

转载自blog.csdn.net/langouster/article/details/89919487