歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> SHELL編程 >> Linux 用戶登錄shell及登錄時讀取的配置文件

Linux 用戶登錄shell及登錄時讀取的配置文件

日期:2017/2/28 14:22:55   编辑:SHELL編程

站在用戶登錄的角度來說,SHELL的類型:
登錄式shell:
正常通過某終端登錄
su - USERNAME
su -l USERNAME
非登錄式shell:
su USERNAME(使用su切換用戶,不帶任何參數)
GUI下打開命令窗口
自動執行的shell腳本
bash的配置文件:
全局配置
/etc/profile,/etc/profile.d/*.sh,/etc/bashrc
個人配置
~/.bash_profile,~/.bashrc
profile類的文件:
設定環境變量
運行命令或腳本
bashrc類的文件:
設定本地變量
定義命令別名
登錄式shell如何讀取配置文件:
/etc/profile -->/etc/profile.d/*.sh -->~/.bash_profile -->~/.bashrc -->/etc/bashrc
非登錄式shell如何讀取配置文件:
~/.bashrc -->/etc/bashrc -->/etc/profile.d/*.sh

Copyright © Linux教程網 All Rights Reserved