Customizing AIX Prompt

本文介绍如何为AIX系统的不同用户设置个性化的命令行提示符。通过修改特定文件中的PS1环境变量,可以清晰地显示当前用户的名称、所在主机及工作目录,有助于减少操作错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值