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.

Alias

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.

Shell History

Use the history shell command to get a list of past commands used in the current session of the terminal. This applies to Unix-based systems, like Mac OS and Linux, but not Windows.

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 a command-line environment in a Unix-based system, like Mac OS and Linux (not Windows), the environment variable HOME stores the path of the home directory.

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.

Environment
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 is a command line text editor. It works just like a desktop text editor like TextEdit or Notepad, except tha…

  3. 3

    You created a file in nano called ~/.bash_profile and added a greeting. How does this work? […] ~/.bash_profile is the name of file used to store environment settings. It is commonly…

  4. 4

    What happens when you store this alias in ~/.bash_profile? […] The […] command allows you to create keyboard shortcuts, or aliases, for commonly used commands. 1. Here […] creat…

  5. 5

    What happens when you store the following aliases in ~/.bash_profile? […] […] is set as alias for the […] command in the bash profile. The alias is then made available in the curr…

  6. 6

    What happens when you store this in ~/.bash_profile? […] environment variables are variables that can be used across commands and programs and hold information about the environment. 1…

  7. 7

    What happens when this is stored in ~/.bash_profile? […] […] is a variable that defines the makeup and style of the command prompt. 1. […] sets the command prompt variable and ex…

  8. 8

    What happens when you type this command? […] The […] variable is an environment variable that displays the path of the home directory. Here by typing […] , the terminal displays the pa…

  9. 9

    What happens when you type this command? […] […] is an environment variable that stores a list of directories separated by a colon. Looking carefully, […] lists the following director…

  10. 10

    What happens when you type this command? […] The […] command stands for “environment”, and returns a list of the environment variables for the current user. Here, the […] command retu…

  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