System startup files
System startup files
When you log in, the shell defines your user environment after reading the initialization files that you have set up. The characteristics of your user environment are defined by the values given to your environment variables. You maintain this environment until you log out of the system.
The shell uses two types of profile files when you log in to the operating system. It evaluates the commands contained in the files and then executes the commands to set up your system environment. The files have similar functions, except that the /etc/profile file controls profile variables for all users on a system, whereas the .profile file allows you to customize your own environment.
The shell first runs the commands to set up your system environment in the /etc/environment file and then evaluates the commands contained in the /etc/profile file. After these files are run, the system then checks to see if you have a .profile file in your home directory. If the .profilefile exists, the system runs this file. The .profile file will specify if an environment file also exists. If an environment file exists (usually named .env), the system then runs this file and sets up your environment variables.
The /etc/environment, /etc/profile, and .profile files are run once at login time. The .env file, on the other hand, is run every time you open a new shell or a window.
- /etc/environment file
The first file that the operating system uses at login time is the /etc/environment file. The /etc/environment file contains variables specifying the basic environment for all processes. - /etc/profile file
The second file that the operating system uses at login time is the /etc/profile file. - .profile file
The .profile file is present in your home ($HOME) directory and lets you customize your individual working environment. - .env file
A fourth file that the operating system uses at login time is the .env file, if your .profile contains the following line: export ENV=$HOME/.env
/etc/environment file
The first file that the operating system uses at login time is the /etc/environment file. The /etc/environment file contains variables specifying the basic environment for all processes.
When a new process begins, the exec subroutine makes an array of strings available that have the form Name=Value. This array of strings is called the environment. Each name defined by one of the strings is called an environment variable or shell variable. The exec subroutine allows the entire environment to be set at one time.
When you log in, the system sets environment variables from the /etc/environment file before reading your login profile, named .profile. The following variables make up the basic environment:
| HOME | The full path name of the user's login or HOME directory. The login program sets this to the name specified in the /etc/passwd file. |
| LANG | The locale name currently in effect. The LANG variable is initially set in the /etc/profile file at installation time. |
| NLSPATH | The full path name for message catalogs. |
| LOCPATH | The full path name of the location of National Language Support tables. |
| PATH | The sequence of directories that commands, such as sh, time, nice and nohup, search when looking for a command whose path name is incomplete. |
| TZ | The time zone information. The TZ environment variable is initially set by the /etc/profile file, the system login profile. |
For detailed information about the /etc/environment file, see the AIX 5L™ Version 5.3 Files Reference.
/etc/profile file
The second file that the operating system uses at login time is the /etc/profile file.
The /etc/profile file controls system-wide default variables, such as:
- Export variables
- File creation mask (umask)
- Terminal types
- Mail messages to indicate when new mail has arrived
The system administrator configures the /etc/profile file for all users on the system. Only the system administrator can change this file.
The following example is a typical /etc/profile file:
#Set file creation mask
unmask 022
#Tell me when new mail arrives
MAIL=/usr/mail/$LOGNAME
#Add my /bin directory to the shell search sequence
PATH=/usr/bin:/usr/sbin:/etc::
#Set terminal type
TERM=lft
#Make some environment variables global
export MAIL PATH TERM
For detailed information about the /etc/profile file, see the AIX 5L™ Version 5.3 Files Reference .
.profile file
The .profile file is present in your home ($HOME) directory and lets you customize your individual working environment.
Because the .profile file is hidden, use the ls -a command to list it.
After the login program adds the LOGNAME (login name) and HOME (login directory) variables to the environment, the commands in the$HOME/.profile file are executed if the file is present. The .profile file contains your individual profile that overrides the variables set in the/etc/profile file. The .profile file is often used to set exported environment variables and terminal modes. You can customize your environment by modifying the .profile file. Use the .profile file to control the following defaults:
- Shells to open
- Prompt appearance
- Keyboard sound
PATH=/usr/bin:/etc:/home/bin1:/usr/lpp/tps4.0/user::
epath=/home/gsc/e3:
export PATH epath
csh
This example has defined two path variables (PATH and epath), exported them, and opened a C shell (csh).
You can also use the .profile file (or if it is not present, the /etc/profile file) to determine login shell variables. You can also customize other shell environments. For example, use the .cshrc file and .kshrc file to customize a C shell and a Korn shell, respectively, when each type of shell is started.
.env file
A fourth file that the operating system uses at login time is the .env file, if your .profile contains the following line: export ENV=$HOME/.env
The .env file lets you customize your individual working environment variables. Because the .env file is hidden, use the ls -a command to list it. For more information about the ls command, see ls. The .env file contains the individual user environment variables that override the variables set in the/etc/environment file. You can customize your environment variables as desired by modifying your .env file.
The following example is a typical .env file:
export myid=`id | sed -n -e 's/).*$//' -e 's/^.*(//p'`
#set prompt: login & system name & path
if [ $myid = root ]
then typeset -x PSCH='#:\${PWD}> '
PS1="#:\${PWD}> "
else typeset -x PSCH='>'
PS1="$LOGNAME@$UNAME:\${PWD}> "
PS2=">"
PS3="#?"
fi
export PS1 PS2 PS3
#setup my command aliases
alias ls="/bin/ls -CF" \
d="/bin/ls -Fal | pg" \
rm="/bin/rm -i" \
up="cd .."
System startup files的更多相关文章
- Update startup files更新安装文件
The service request did not complete because access to the service configuration manager was not gra ...
- Linux后门入侵检测工具,附bash漏洞解决方法[转载]
转自:http://blog.jobbole.com/77663/ 官网 ClamAV杀毒软件介绍 ClamAV是一个在命令行下查毒软件,因为它不将杀毒作为主要功能,默认只能查出您计算机内的病毒,但是 ...
- C语言中没有main函数生成可执行程序的几种方法
1.define预处理指令 这种方式很简单,只是简单地将main字符串用宏来代替,或者使用##拼接字符串.示例程序如下: #include <stdio.h> #define begin ...
- Linux后门入侵检测工具
一.rootkit简介 rootkit是Linux平台下最常见的一种木马后门工具,它主要通过替换系统文件来达到入侵和和隐蔽的目的,这种木马比普通木马后门更加危险和隐蔽,普通的检测工具和检查手段很难发现 ...
- 没有main函数的helloworld
差点儿全部程序猿的第一堂课都是学习helloworld程序,以下我们先来重温一下经典的C语言helloworl /* hello.c */ #include <stdio.h> int m ...
- module使用和设置
Modules environmentDescription This is a system that allows you to easily change between different v ...
- Linux后门入侵检测工具,附bash漏洞解决方法
一.rootkit简介 rootkit是Linux平台下最常见的一种木马后门工具,它主要通过替换系统文件来达到入侵和和隐蔽的目的,这种木马比普通木马后门更加危险和隐蔽,普通的检测工具和检查手段很难发现 ...
- gcc, ld
GCC gcc除了具备基本的c文件编译功能外,还把其它工具的功能也集成了进来,比如as的汇编功能,ld的链接功能. 因此,gcc也可以通过-Wa, option,将option传给汇编器as:也可以通 ...
- Common Linux log files name and usage--reference
reference:http://www.coolcoder.in/2013/12/common-linux-log-files-name-and-usage.html if you spend lo ...
随机推荐
- 【数据结构】【平衡树】无旋转treap
最近在研究平衡树,看起来这种东西又丧水又很深,感觉很难搞清楚.在Ditoly学长的建议下,我先学习了正常的treap,个人感觉这应该是平衡树当中比较好懂的而且比较好写的一种. 然而,发现带旋treap ...
- 【BZOJ1036】【ZJOI2008】数的统计
接着找树剖的题...传送门(点我) 题意:给你一棵无根树,有三种操作:查询树上2点路径的点权和/最大点权:更改某点的点权. 解题思路:树链剖分裸题,我采用了常数较小的zkw线段树维护剖下来的树(毕竟线 ...
- ZOJ 3228 Searching the String(AC自动机)
Searching the String Time Limit: 7 Seconds Memory Limit: 129872 KB Little jay really hates to d ...
- [hdu2167]Pebbles
来自FallDream的博客,未经允许,请勿转载,谢谢. 给定一个方阵,你要取出一些数字,满足没有两个格子八联通相邻的前提下和最大,求这个和 n<=15 插头dp,保存轮廓线以及目前转移点左上方 ...
- 遗传算法:N皇后
N皇后问题描述 N皇后问题是一个经典的问题,在一个N*N的棋盘上放置N个皇后,每行一个并使其不能互相攻击(同一行.同一列.同一斜线上的皇后都会自动攻击). 遗传算法 遗传算法是局部束搜索的变形: 与自 ...
- C语言程序设计第一次作业1
(一)实验总结 1. 圆面积问题 1:求圆面积和周长 (1)输入圆的半径,计算圆的周长和面积. (2) (3) 2:判断闰年 (1)输入一个四位年份,判断其是否是闰年.闰年的判别条件是该年年份能被4整 ...
- 开源小工具 - swagger API访问代码生成器(js/typescript)
现在流行前后端分离,后端通常会使用swagger生成api文档,提供给前端的同事来调用,一般前端是查看这个文档,根据文档说明编写调用代码.其实,swagger已经提供了足够多的描述信息,我们可以基于s ...
- 关于一些基础的Java问题的解答(一)
学习一门语言基础是非常重要的,因此本文总结了一些常见的Java基础问题的解答,希望可以帮到大家. 1. 九种基本数据类型的大小,以及他们的封装类. 9种基本数据类型 基本类型 包装类型 大小 bool ...
- 详解Tomcat配置JVM参数步骤
这里向大家描述一下如何使用Tomcat配置JVM参数,Tomcat本身不能直接在计算机上运行,需要依赖于硬件基础之上的操作系统和一个Java虚拟机.您可以选择自己的需要选择不同的操作系统和对应的JDK ...
- webpack require.ensure 按需加载
使用 vue-cli构建的项目,在 默认情况下 ,会将所有的js代码打包为一个整体比如index.js.当使用存在多个路由代码的时候,index.js可能会超大,影响加载速度. 这个每个路由页面除了i ...