The shell is probably the most important tool you will use in GNU/Linux. Besides using it to enter simple commands, the shell will allow you to take “shortcuts” when entering commands and filenames.
The shells allows you to redirect the output of commands into files and other programs, to set up your user environment, and to write simple to complex programs. The shell is an application program that is part of the operating system. The default shell is bash and resides in the /bin directory. The shell is started when the user successfully logs into Linux and continues to run until the user logs off.
The major functions of the shell are as follows:
- Command Line Interpretation
The shell reads lines from the keyboard, parses and interprets them, and passes the information to the kernel for command execution.
- Establishes User Environment
When a user logs in, the shell establishes a “personal” working environment based on various parameters that the user has specified. These parameters are contained in a user login file, and can be customized on an individual, or system-wide basis.
- Filename Generation
The shell can accept certain metacharacters, which it expands into filenames. For example, the “*” means “match everything.” This assists the user by reducing typing errors and allowing selection of multiple files.
- Input/Output Redirection
The shell allows the user to redirect data to and from files, in lieu of the terminal.
- Pipe Connections
The output of one program can be sent directly to the input of another program through the pipe mechanism. This reduces the need for intermediate or temporary files.
- Job Control
Commands can be executed in the foreground or background mode. Executing commands in the background allows us to continue work, while the command is running.
- Programming Language
The shell is an interpretive programming language. We can build simple to complex shell programs for use in day-to-day operations.