Session: Bash Configuration and Usage (Extended Session)
The Bash shell is the default shell for almost every Linux distribution. As the Lazy SysAdmin, understanding and using the available tools to configure the Bash shell can enhance and simplify our command line experience.
In this session, which is largely based on Chapter 17 of my book, Using and Administering Linux: Volume 1 – Zero to SysAdmin: Getting Started, you will explore the several Bash configuration files for both global configuration and for users’ local configuration. You will perform simple experiments to determine the sequence in which the Bash configuration files are executed when the shell is launched.
You will explore environment variables and shell variables such as $PATH, $?, $EDITOR, and more and how they contribute to the behavior of the shell itself and the programs that run in a shell.
In this session you will learn:
- The difference between a login shell and a non-login shell. In the interest of clearing up any confusion we will also learn about the nologin shell.
- How the Bash shell is configured
- How to modify the configuration of the Bash shell
- Which Bash configuration scripts are run when it is launched as a login shell and as a non-login shell
- The names and locations of the files used to configure Linux shells at both global and user levels
- Which shell configuration files should not be changed
- How to set shell options
- How to set environment variables from the command line
- How to set environment variables using shell configuration files
- The function of aliases and how to set them
- How to have some fun on the Bash command line