您的位置:首页 > 大数据 > 人工智能

Customizing AIX Prompt

2015-09-08 11:26 405 查看
Proper prompt make users easy to know who they are, what privilege they have, where they are, so that to reduce the change of making unnecessary mistakes. 

The following is a little tip on setting up PS1 environment variable. 

To modify the following two files to make it different for root and ordinary users. 

For root, modify /.profile as below. (File permission should be, chmod 640 /.profile) 

PS1="$(whoami)@$(hostname)(\$PWD)# " 
export PS1 

the prompt appears as 
root@server01(/)# 

For ordinary users, modify the default /etc/security/.profile as below. 

PS1="$(whoami)@$(hostname)(\$PWD)$ " 
export PS1 

the prompt appears as 
hankcen@server01(/home/hankcen)$ 

To change for an existing user, modify file /$HOME/.profile (after the change, chmod 540 /$HOME/.profile) 

PS1="$(whoami)@$(hostname)(\$PWD)$ " 
export PS1 

I suggest that not to set PS1 in file /etc/profile file, but you can. This will apply the change to all users if they do not have PS1 environment variable set, and the change will be override
by the user's .profile. (After the modification, set file permission as, chmod 555 /etc/profile) 

PS1="$(whoami)@$(hostname)(\$PWD)# " 
export PS1 

Disclaimer: All the information presented in this document is provided on the basis of as is and is meant for reference purpose only without any expressed or implied warranty. Use of the information
and its application in any form is sole discretion and responsibility of the user. The AUTHOR of this document is not responsible for any damage or loss arising out of use of information presented in this document. 

原文地址:http://it.toolbox.com/blogs/my-two-cents/customizing-aix-prompt-32801
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  AIX