Module 07 of 12

Shell Environment & Config

Lessons

About This Module

Every time you open a terminal, Bash quietly sets up an environment: a collection of variables, settings and shortcuts that decides where it looks for programs, what your prompt looks like, and which commands you can type. Understanding that environment explains why a program installs fine but then says "command not found", or why a setting you changed disappears when you open a new window.

This module starts with shell and environment variables: how to view them with printenv and echo, and how export passes them on to the programs you run. Next is the most important variable of all, PATH, and how to add your own folders to it. Then comes the difference between .bashrc and .bash_profile, so you know which file to edit to make a change stick. The module finishes with aliases, which let you turn long commands you type every day into short ones of your own.

Back up your ~/.bashrc before editing it, then watch the lessons in order and continue on to Bash Scripting Fundamentals.

Lessons

4 videos
01

What Are Linux Environment Variables?

An introduction to the Linux environment: the difference between shell variables and environment variables, and how to view and set them with printenv, set, export and echo.

02

The Power of $PATH in Your Hands

Gardiner Bryant explains what PATH is, how to display its contents, how to add any directory to it, and how to make the change permanent.

03

bash_profile, bashrc and bash_logout Explained

What each of Bash's startup files does and when it runs: .bashrc for every new shell, .bash_profile at login, and .bash_logout when you leave. Also covers where the default copies come from.

04

Make Your Own Commands with Bash Alias

What an alias is, how to create one with the alias command, how to make aliases persist across sessions, useful examples, and when a small inline Bash function is the better choice.