Change Command Prompt
Command Prompt is a non-graphical interface that allows you to interact with your operating system. This article deals with changing command Prompt in openSUSE 12.2 , GNOME 3.4.2. The command prompt in Unix is the famous '$'.The default command prompt in openSUSE looks like the following screenshot.
The openSUSE command prompt contains information about the current user (mantis), Host Name (linux-u7wa), Current working directory (~) which is the home directory indicator. Since the command prompt is dynamic in nature, when one changes directory the prompt also changes. Fox example if you navigate to Desktop directory then the command prompt will also change accordingly as shown below.
In Linux the command prompt is defined in a variable called "PS1". When we run the echo against variable PS1 it will display its value. The contents of PS1 will look something like $(ppwd \l)\u@\h:\w>
We can change the command prompt by changing the value in variable PS1. To change prompt to '$' we can use the command (PS1=$) as shown below.
But setting the variable value in terminal is not permanent in nature. The command prompt will revert back to default value after the terminal is closed. To change the prompt to '$' every time you open the terminal, you need to locate the file ".bashrc" in home folder and add a line (PS1=$) at the end of the file as shown below.
If you want to retain the dynamic prompt with minor changes then you need to add the line (PS1="$(ppwd \l)\u@\h:\w$") in the file ".bashrc". Here the '>' at the end is replaced by a '$' in the default prompt.
Also check out:- Changing Root Command Prompt