EmbLogic's Blog

How to change default prompt in BASH shell

To change default prompt :-
========================
- We can change default prompt by assigning the character to it.
- Each character have a specific meaning.

BASH Shell Prompt Characters :-
Character Description
\a Bell Character
\d Date in format “Day Month Date”
\e ASCII escape character
\h Local hostname
\H Fully qualified domain hostname
\j Number of jobs currently managed by the shell
\l Basename of the shell’s terminal device name
\n ASCII newline character
\r ASCII carriage return
\s Name of the shell
\t Current time in 24-hour HH:MM:SS format
\T Current time in 12-hour HH:MM:SS format
\@ Current time in 12-hour am/pm format
\u Username of current user
\v Version of BASH shell
\V Release level of bash shell
\w Current working directory
\W Basename of current working directory
\# Command number of this command
\$ A dollar sign if normal user, #(Pound) for root user
/nnn Character corresponding to value nnn
\\ Backslash
\[ Begins a control code sequence
/] Ends a control code sequence

eg.
[ankur@(none) ~]$ PS1 = “[\t][\u]$”
[15:20:30][ankur]$

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>