Topics: AIX, System Admin
PS1
The following piece of code fits nicely in the /etc/profile file. It makes sure the PS1, the prompt is set in such a way, that you can see who is logged in at what system and what the current path is. At the same time it also sets the window title the same way.
Note: to type the special characters, such as ^], you have to type first CRTL-V, and then CTRL-]. Likewise for ^G: type it as CTRL-V and then CTRL-G.H=`uname -n` if [ $(whoami) = "root" ] ; then PS1='^[]2;${USER}@(${H}) ${PWD##/*/}^G^M${USER}@(${H}) ${PWD##/*/} # ' else PS1='^[]2;${USER}@(${H}) ${PWD##/*/}^G^M${USER}@(${H}) ${PWD##/*/} $ ' fi
Second note: the escape characters only work properly when setting the window title using PuTTY. If you or any of your users use Reflection to access the servers, the escape codes don't work. In that case, shorten it to:
if [ $(whoami) = "root" ] ; then PS1='${USER}@(${H}) ${PWD##/*/} # ' else PS1='${USER}@(${H}) ${PWD##/*/} $ ' fi
If you found this useful, here's more on the same topic(s) in our blog:
- Howto setup AIX 'boot debugger'
- Copying a logical volume
- Creating an LPP source and SPOT in NIM
- Creating an image_data resource without preserving mirrors for use with NIM
- Using the Command-Line Interface for LPM
UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.
Interested in learning more?
Interested in learning more?