Shell
A shell is both a command language and a programming language (interpreted) that provides an interface to any UNIX based operating system UBO.
The most popular shell by far is bash which is provided by the GNU team. There are several other popular shells, depending on your requirements and skillset:
- csh
- tcsh
- sh
- ash
- zsh
to see what shell you are using:
$ echo $SHELL
which is one of the variables that can be found in your environment. You can get a list of all of your environment variables:
$ env
as you can see, there is where you will change items such as your PATH
Scripting
If you want to learn shell scripting, we recommend you start with sed, awk and grep. All three are very powerful and each will take years to master. An example of each:
This will substitute any line with the word root in it in /etc/passwd with an empty space in place of "root":
$ sed s/root//g /etc/passwd
This will show you the fifth field in /etc/passwd if you seperate each field with a colon:
$ awk -F: '{print $5}' /etc/passwd
Finally, this will show you every line in /etc/passwd with the word "root" in it
$ grep root /etc/passwd