Common shell programs

1.1. Common shell programs

1.1.1. General shell functions

The UNIX shell program interprets user commands, which are either directly entered by the user, or which can be read from a file called the shell script or shell program. Shell scripts are interpreted, not compiled. The shell reads commands from the script line per line and searches for those commands on the system (see Section 1.2), while a compiler converts a program into machine readable form, an executable file - which may then be used in a shell script.

Apart from passing commands to the kernel, the main task of a shell is providing a user environment, which can be configured individually using shell resource configuration files.

1.1.2. Shell types

Just like people know different languages and dialects, your UNIX system will usually offer a variety of shell types:

The file /etc/shells gives an overview of known shells on a Linux system:


mia:~> cat /etc/shells
/bin/bash
/bin/sh
/bin/tcsh
/bin/csh

Your default shell is set in the /etc/passwd file, like this line for user mia:


mia:L2NOfqdlPrHwE:504:504:Mia Maya:/home/mia:/bin/bash

To switch from one shell to another, just enter the name of the new shell in the active terminal. The system finds the directory where the name occurs using the PATH settings, and since a shell is an executable file (program), the current shell activates it and it gets executed. A new prompt is usually shown, because each shell has its typical appearance:


mia:~> tcsh
[mia@post21 ~]$

192 visits (2 today, 12 this week, 31 this month, 192 this year)
Uptime: 07:57:17 up 3 days, 13:40, 3 users, load average: 0.00, 0.00, 0.00
3.14.247.239 GET from server z.lamurakami.com

Saturday, December 21, 2024 @ 7:57:17 AM
z.ServerAdmin@lam1.us