Shell prompt names define how the prompt in the terminal appears when the user opens their shell. On Red Hat (and most other forms of Unix and Linux), prompt names are defined by the PS1 to PS4 environment variables. PS1 defines the main prompt, while PS2-4 define less common prompts, such as the prompt that appears when commands take up multiple lines. These can be changed at any time by assigning the environment variable a new value, but they must be made permanent by altering the "/etc/bashrc" file.
Open the file "/etc/bashrc" in your favorite text editor.
Alter the "PS1=" line to contain your desired prompt. Any text you put here will appear in all your prompts. There are dozens of special values that you can add to the prompt as well, such as "\u" for the name of the current user and "\t" for the current time. For the sake of example, change it to read:
PS1="\u@\w > "
This will make it so that, whenever the terminal is opened, the command prompt will read "username@working_directory > ". Any text you type will appear, and escape codes such as "\u" for username and "\w" for "working directory" can be used to display important information.
Save the file and open a new terminal. The new prompt will appear.
Tips & Warnings
- Environment variables can be defined on the fly by typing the command "export VARIABLE_NAME=VARIABLE_DATA." So, to test out a new prompt immediately, you would type 'export PS1="prompt".'
How to Configure a VNC Server With Red Hat
VNC (Virtual Network Computing) is a software used to remotely connect to computers using the network. The VNC server is installed on...
How to Open Shell Prompt in Linux
Linux is a free, open-source operating system and a powerful alternative to Windows and OS X. Unlike other operating systems, Linux is...
How to Change Colors on the Command Line
The Windows command prompt is one of the more useful tools available in the Windows operating system. With a huge number of...
How to Search for a File in Red Hat
Red Hat is one of Linux's many "distributions." Linux is an open-source operating system with many different versions all running on the...