Changing Your ksh Prompt

Like bash, ksh has two prompts you can edit:

  • The main prompt that you usually think of as the shell prompt, called PS1.

  • A secondary prompt that you see when the system requires additional information to complete a command. Logically, this prompt is called PS2.

You can change either of these prompts using the following steps (we’ll modify PS1 in the example). You start by finding your prompt statement (Code Listing 8.17), then modifying it in your editor.

Code Listing 8.17. List your zsh configuration files and look for a prompt statement.
$ grep PS1 /etc/profile ~/.profile ~/
→ .kshrc
/home/users/e/ejray/.profile:PS1="$ "
/home/users/e/ejray/.profile:export PS1
$

To change your ksh prompt:

1.
grep PS1 /etc/profile ...

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.