The Login Process
The following step-by-step description shows what happens each time a user logs in to a UNIX computer system.
- Users enters their username.
- User enters their password.
- The operating system confirms your name and password.
- A "shell" is created for you based on your entry in the "/etc/passwd" file (in small businesses, this is usually a Bourne Shell).
- You are "placed" in your "home"directory.
- Startup information is read from the file named "/etc/profile". This file is known as the system login file. When every user logs in, they read the information in this file.
- Additional information is read from the file named ".profile" that is located in your "home" directory. This file is known as your personal login file. (This is the file that usually contains the "menu" program.)
/etc/profile和/etc/bashrc傻傻分不清楚?
profile
profile 是某个用户惟一的用来设置环境变量的中央, 因为用户能够有多个 shell 比方 bash, sh, zsh 之类的, 但像环境变量这种其实只须要在对立的一个中央初始化就能够了, 而这就是 profile.
bashrc rc--RunCom
是专门用来给 bash 做初始化的比方用来初始化 bash 的设置, bash 的代码补全, bash 的别名, bash 的色彩. 以此类推也就还会有 shrc, zshrc 这样的文件存在了, 只是 bash 太罕用了而已.
tips:
source命令简介
在以后Shell环境中从指定文件读取和执行命令。
摘要
source filename [arguments]
参数
filename:要执行的文件
arguments(可选):传递给文件的参数
返回值
source返回文件最初一个命令的返回值,如果文件不能读取则会失败
参考资料
https://alvinalexander.com/un...
https://www.linuxprobe.com/di...