Key Concepts

Review core concepts you need to learn to master this subject

Command line environment

The environment of the command line refers to the settings and preferences of the current user. It enables users to set greetings, alias commands, variables, and much more.

Source Bash Profile

All the commands in ~/.bash_profile are executed with the shell command source ~/.bash_profile. So when changes are made to ~/.bash_profile, run this command to activate the changes in the current session.


The shell command alias is used to assign commonly used commands to shortcuts (or aliases). The assigned commonly used command should be wrapped in double quotes.

history command in Unix Systems

The history shell command is used to get a history of commands (also known as “events”) that were executed in the current session. The command also allows us to perform operations on this list of commands that have been executed, such as selecting or manipulating a command in the history.

Environment Variables

Variables that can be used across terminal commands are called environment variables. They also hold information about the shell’s environment.

Export command

The export command makes a given variable available to all child sessions initiated from the current session.

HOME Environment Variable in Unix Systems

HOME is an environment variable present in command line environments. It is used to get the path to the current user’s home directory. This makes it easy for programs to access the home directory when needed.

Shell Command env

For Unix-based systems like Mac OS and Linux (not Windows), the shell command env returns a list of environment variables for the current user.

Lesson 1 of 1
  1. 1
    Each time we launch the terminal application, it creates a new session. The session immediately loads settings and preferences that make up the command line environment. We can configure the env…
  2. 2
    Nice. You just edited a file in the nano text editor. How does it work? $ nano hello.txt nano is a command line text editor. It works just like a desktop text editor like TextEdit or Notepad, …
  3. 3
    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 setting…
  4. 4
    What happens when you store this alias in ~/.bash_profile? alias pd=”pwd” The alias command allows you to create keyboard shortcuts, or aliases, for commonly used commands. 1. Here alias p…
  5. 5
    What happens when you store the following aliases in ~/.bash_profile? alias hy=”history” hy is set as alias for the history command in the bash profile. The alias is then made available in …
  6. 6
    What happens when you store this in ~/.bash_profile? export USER=”Jane Doe” environment variables are variables that can be used across commands and programs and hold information about th…
  7. 7
    What happens when this is stored in ~/.bash_profile? export PS1=”>> “ PS1 is a variable that defines the makeup and style of the command prompt. 1. export PS1=”>> “ sets the command prompt …
  8. 8
    What happens when you type this command? $ echo $HOME The HOME variable is an environment variable that displays the path of the home directory. Here by typing echo $HOME, the terminal displays…
  9. 9
    What happens when you type this command? $ echo $PATH /home/ccuser/.gem/ruby/2.0.0/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin PATH is an environment variable that stores a…
  10. 10
    What happens when you type this command? env The env command stands for “environment”, and returns a list of the environment variables for the current user. Here, the env command returns a numbe…
  11. 11
    Congratulations! You learned to use the bash profile to configure the environment. What can we generalize so far? * The environment refers to the preferences and settings of the current user. *…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo