

We can see immediately the change on our console. It will help to switch back to our original prompt easier in case we make a mistake or without having to log out and back in again.Įxample 1: Display only the username and the hostname with the separation character “-”: export PS1="\u - \h$ " We will do some examples but before manipulating the value of theses variables, we need to save the file which contains all. \] This sequence should appear after a sequence of non-printing characters. This allows bash to calculate word wrapping correctly. \[ This sequence should appear before a sequence of characters that don’t move the cursor (like color escape sequences). \xxx Inserts an ASCII character based on three-digit number xxx (replace unused digits with zeros, such as “\007″) \$ If you are not root, inserts a “$” if you are root, you get a “#” \# Command number (this will count up at each prompt, as long as you type something) \! Current command’s position in the history buffer \W The “basename” of the current working directory (such as “koithara”) \w Current working directory (such as “/home/koithara”) \T Time in 12-hour format (such as Time in 12-hour format with am/pm


\s The name of the shell executable (such as “bash”) \l The name of the shell’s terminal device (such as “ttyp4″) \j The number of processes you’ve suspended in this shell by hitting ^Z \h First part of hostname (such as “mybox”) \e ASCII escape character (you can also type \033) \a The ASCII bell character (you can also type \007) Look below to have a complete idea for the rest of the prompt: # echo parts that include debian_chroot indicate that if you are operating in a change root environment, the prompt will be modified to remind you. Let’s take a look at the PS1 prompt default value on the terminal There are some other values that we will see later. These are just examples of different values it can take. For the most news Linux systems, the defaults values have which show the username, hostname, the current working directory and the user privilege. PS1 is the default prompt we see every time when we log in the console. Note that in this article, we will use echo command to see the value of the different prompt in our console. PS4: environment variable which contains the value of the prompt used to show script lines during the execution of a bash script in debug mode.PS3: environment variable which contains the value of the prompt for the select operator inside the shell script.You see it when you write a long command in many lines. PS2: environment variable which contains the value the prompt used for a command continuation interpretation.It changes the shell command prompt appearance and environment.

PS1: environment variable which contains the value of the default prompt.
#Ps3 mac address change how to#
Related Read: How to Change Bash Shell Prompt Colorful in Linux Presentation of the different shell variable I am going to show some examples of changing the Linux environment using variable PS1. You can even run shell scripts inside PS1 variable, where PS stands for the prompt statement. Using variables you can change the command prompt color, display, date time, user name, etc. By default, the shell prompt display hostname and working directory. You can see the real beauty of Linux when you use shell commands.
