linux

在一般的 linux 或者 unix 系统中, 都可以通过编辑 bashrc 和 profile 来设置用户的工作环境.

首先我们来看系统中的这些文件, 一般的系统可能会有

1 /etc/profile
2 /etc/bashrc
3 
4 ~/.profile
5 ~/.bashrc

如果是使用的ubuntu || debian 就没有上面1.&&2.文件

shell 

ps

可以显示你的shell 的种类(bash csh sh )

profile

其实看名字就能了解大概了, profile 是某个用户唯一的用来设置环境变量的地方, 因为用户可以有多个 shell 比如 bash, sh, zsh 之类的, 但像环境变量这种其实只需要在统一的一个地方初始化就可以了, 而这就是 profile.

bashrc

bashrc 也是看名字就知道, 是专门用来给 bash 做初始化的比如用来初始化 bash 的设置, bash 的代码补全, bash 的别名, bash 的颜色. 以此类推也就还会有 shrc, zshrc 这样的文件存在了, 只是 bash 太常用了而已.

原文地址:https://www.cnblogs.com/zhengtaodoit/p/4922668.html