This module covers basic information about how shell scripts are executed on a UNIX system. Subsequent modules in this course will focus on the programming aspects of the shell. Before we begin those modules, we will look at the difference between using the shell as an interactive command interpreter and using it as a programming language. We will also examine techniques available for running a shell script and go over what processes are started when you run the shell using the various techniques.
The most current version of Ubuntu Linux is Ubuntu 22.04.2 LTS (Jammy Jellyfish). It was released on April 21, 2022, and will receive security updates and support until April 2025. Ubuntu 22.04.2 LTS is a Long-Term Support (LTS) release, which means it is designed to be used for a longer period of time than the regular releases. LTS releases are supported for five years for both desktop and server versions.
Here are some of the new features in Ubuntu 22.04.2 LTS:
- GNOME 42 desktop environment
- Linux kernel 5.15
- New hardware support, including the latest Intel and AMD processors
- Improved performance and security
To determine the login shell in Ubuntu 22.04, you need to utilize specific commands in the terminal. Follow the instructions below to identify the current user's login shell:
- Open Terminal: You can open the terminal by pressing Ctrl + Alt + T or by typing terminal into the search bar and clicking on the Terminal application.
- Execute the following command:
The echo $SHELL command prints the value of the SHELL environment variable. The SHELL variable typically holds the path of the default login shell.
The output of the command will likely be something similar to
, /bin/sh, /bin/zsh, or /usr/bin/fish, depending on your default shell. To determine the login shell for a specific user, you can use the following command:
getent passwd <username>
Replace <username> with the name of the user whose login shell you want to determine. The getent command displays entries from databases supported by the Name Service Switch libraries, which are configured in /etc/nsswitch.conf. The passwd database contains user account information.
The output will be a colon-separated line with seven fields. The seventh field is the user's login shell. For example, an output might look like this:
In this case, /bin/bash is the login shell for the user named "john".
Please note that you need to have the appropriate permissions to execute these commands, especially when trying to access other user information.
If you are having trouble, consider prefacing the commands with sudo to execute them with superuser permissions, like so: sudo getent passwd <username>.
An executing instance of a program is called a process.
Some operating systems use the term task to refer to a program that is being executed. The UNIX System guarantees that every process has a unique numeric identifier called the process ID. The process ID is always a non-negative integer.
The program in the figure below prints its process ID.