AIX: Korn Shell: How to set tab auto completion and hostname, present working directory path in the terminal(PS1 Variable) ?

Today in this article, we will look how to set TAB auto-completion and,

How to set PS1 variable to see hostname and current working directory on IBM AIX server.

1. Setting auto TAB Completion.
By default, in AIX, or old Korn shell don’t have feature for auto TAB Completion.
To get this feature, we can try to set vi editor, however it really does not work as desired.

Hence the best way to achieve this is to set new ksh93 session.

/usr/bin/ksh93 ;

 

2. Setting PS1 variable to see hostname and current working directory.

HOSTNAME2=`hostname`; 
PS1="${HOSTNAME2}:\${PWD##*/} \$ "

 

3. Example: On the terminal

ngelinux125--> /usr/bin/ksh93 ;
ngelinux125-->
ngelinux125--> PS1="${HOSTNAME2}:\${PWD##*/} \$ "
ngelinux125: $
ngelinux125: $ cd /tmp
ngelinux125:tmp $ vi vx
 1) vxcadm_llt_tmp                    14) vxfentab_temp.3735600
 2) vxfentab_temp.2097794             15) vxfentab_temp.7143436
 3) vxfentab_temp.2490720             16) vxfentab_temp.7274528
 4) vxfentab_temp.2621566             17) vxfentab_temp.7405586
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments