Bash Profile

You created a file in nano called ~/.bash_profile and added a greeting. How does this work?

$ nano ~/.bash_profile

~/.bash_profile is the name of file used to store environment settings. It is commonly called the "bash profile". When a session starts, it will load the contents of the bash profile before executing commands.

  • The ~ represents the user's home directory.
  • The . indicates a hidden file.
  • The name ~/.bash_profile is important, since this is how the command line recognizes the bash profile.
  1. The command nano ~/.bash_profile opens up ~/.bash_profile in nano.
  2. The text echo "Welcome, Jane Doe" creates a greeting in the bash profile, which is saved. It tells the command line to echo the string "Welcome, Jane Doe" when a terminal session begins.
  3. The command source ~/.bash_profile activates the changes in ~/.bash_profile for the current session. Instead of closing the terminal and needing to start a new session, source makes the changes available right away in the session we are in.
Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.