A Quick Introduction to Unix/Components< A Quick Introduction to Unix
Unix is made up of three components
- the kernel;
- the shell; and
The kernel of Unix is the heart of the operating system. It allocates time and memory to programs and handles the file structure and communication between the different parts of the computer system such as the keyboard and the screen. It performs two main operations namely resource management and program ....
The shell is an interface between the user and the Unix kernel. It resembles the ‘dos box’ that Windows displays if you run the command cmd. When a user logs in, Unix checks their username and password and then starts a program called the shell. The shell interprets the commands the user types and transmits them to the kernel to be executed. These commands are programs.
There are a variety of shells available for the various Unix systems. The expert user can customise their own shell and users can use different shells on the same machine.
The shell and kernel work together like this:
- a user types cat somefile to display a file;
- the shell finds the program cat;
- the shell instructs the kernel to run the program cat on somefile;
- When the program finishes the kernel passes control back to the shell and displays the Unix prompt.
There are a number of different shells for Unix. People can become very attached to the shell they prefer. Popular shells include
- sh - the bourne shell
- bash - the bourne again shell
- csh - the c shell
- ksh - the Korn shell (strangely, not named for the band)
- zsh - the z shell
You can invoke any shell installed on your system with one of the above commands at the prompt. (Notice that this means you start a new shell within a shell!). We won't cover the distinctions about different shells at this time. When you begin to write Unix Shell Scripts you will probably want to choose a shell and stick with it if you can. Each shell has its advocates. The Bourne again shell is popular with many script writers. Some in the Unix community have expressed doubts about the suitability of the c shell for scripting, but this is something you can address when you know more about Unix (see Csh Programming Considered Harmful).
You can start a shell of a particular kind by typing the shell name at the command line prompt.
Programs are not part of the operating system as such, but they are logical sequences of commands, developed for implementing specific tasks. They usually include application software running at the user end.
- Shells and subshells
- Directory Structure
- Changing Directories
- Listing Files and Directories
- Files and Processes
- Exercises 1
- Creating Directories
- Creating Files
- Special Directories
- Exercises 2
- Copying Files
- Moving Files
- Deleting Files
- Exercises 3
- Searching Text Files
- More grep examples
- Permissions on Files and Directories
- Editing Text
- Exercises 4
- My First Shell Script
- Job Control
- Environment Variables