Changing your ksh prompt

Like bash, ksh also has two prompts you can edit:

  • The main prompt that you usually think of as the shell prompt. This prompt is 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.12), then modify it in your editor.

To change your ksh prompt:

1.
grep PS1 /etc/profile ~/. profile
→ ~/.kshrc
To begin, search through the configuration files located in your home directory and in the /etc directory for your prompt statement. It'll look something like PS1="$ " or PS1="$PWD ...

Get Unix: 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.