Skip to content

linux bashrc vs profile

2012 edited this page Jul 20, 2020 · 2 revisions

bashrc vs profile

作用

环境变量即可设置本地设置,也可全局设置;文件名都很类似,bashrc/profile

本地环境变量设置

# ~/.bashrc: executed by bash for non-login shells.

# ~/.profile: executed by Bourne-compatible login shells.

全局环境变量设置

# /etc/bashrc

# /etc/profile
  • bashrc 是在系统启动后执行
  • profile 是在用户登录后执行
  • source .bashrc用于更新修改后的 bashrc 文件,bash .profile用于更新修改后的 profile 文件

都是设置环境变量的目的,为啥会存在两个文件呢?

login shell / non-login shell不同点

区分两个文件存在的目的,要明白login shellnon-login shell, 字面意思已经很明确,是否需要在登录信息的命令下执行。如何判断当前 shell 是登录还是未登录,如下:

~$ echo $0
-bash # "-" is the first character. Therefore, this is a login shell.

~$ echo $0
bash # "-" is NOT the first character. This is NOT a login shell.

参考资料

JS

  1. 作用域
  2. 闭包
  3. 原型(链)
  4. 模块
  5. 位操作符
  6. 事件循环
  7. eval

CSS

  1. float
  2. BFC
  3. position
  4. flex
  5. grid

DOM

  1. DOM
  2. how browser works

Node.js

  1. Stream
  2. Timers
  3. Child Processes
  4. HTTP
  5. File System

react

  1. 生命周期
  2. setState
  3. hook

git

  1. git 基础命令
  2. git rebase 理解
  3. git bisect
  4. git commit
  5. git hook

设计模式

  1. 策略模式
  2. ...

TCP/IP 协议

  1. HTTP/1.x
  2. HTTP/2
  3. SSL/TLS
  4. TCP
  5. DNS
  6. HTTP Cache
  7. CORS
  8. http status code

linux(shell)知识点

  1. bashrc vs profile
  2. vim
  3. shell基本语法
  4. shell 知识误区
  5. shell命令
  6. 鸟哥的Linux私房菜:基础学习篇
  7. sudo vs su
Clone this wiki locally