How to customize and change color of the bash login prompt in Linux
10 examples to customize or change the login prompt using PS1 variable of bash shell in Linux
so now in this article I will share some examples which can be used to customise login prompt for 'ksh shell'
By default in Red Hat Linux we only get a "$" prompt for ksh shell
First let us create a user with default shell as 'ksh'
As you see we only get a dollar ($) prompt for ksh shell based user
Last login: Thu Feb 15 09:27:42 IST 2018 on pts/0
$
$
Display only hostname
[Ban17-adm01-a-br]$
Display username and hostname
[deepak@Ban17-adm01-a-br]$
Display hostname with current working directory
[Ban17-adm01-a-br:/home/deepak]$
Display user, hostname and current working directory
[deepak@Ban17-adm01-a-br:/home/deepak]$
To make the changes permanent, place your PS1 variable to .kshrc in the user home folder
# Source global definitions
if [ -f /etc/kshrc ]; then
. /etc/kshrc
fi
# use emacs editing mode by default
set -o emacs
# User specific aliases and functions
export PS1='${USER}@${HOSTNAME}:${PWD}> '
I hope the article was useful.