PS1 is an environment variable that defines the makeup and style of the command prompt.

What happens when this is stored in ~/.bash_profile?

export PS1=">> "
  1. export PS1=">> " sets the command prompt variable and exports the variable. Here we change the default command prompt from $ to >>.
  2. After using the source command, the command line displays the new command prompt.

Let’s try it out!



Open ~/.bash_profile in nano.


On a new line, beneath the last entry, set the PS1 variable equal to ">> " (make sure there is one space following >>).

Save the file and exit nano, and press Enter into a new line in the terminal.


Use source to make the changes in ~/.bash_profile available. The command prompt should now look like >>


Let’s try out the new command prompt. In the terminal, type:

echo "hello"

Now type:

ls -alt

In the past two commands, did you notice that the command prompt has changed and is no longer $?

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?