Learn

Please Note: In this exercise, we will work on .bash_profile in the starting directory, not the home directory. This exercise’s starting directory is ps1-variable.

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!

Instructions

1.

Open .bash_profile in nano.

2.

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 click the Check Work button.

3.

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

Hit Enter with or without typing in commands to see that the prompt is now changed to >>. Click the Check Work button when done.

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?