|
UNIX Fundamentals
MODULE 1 - Introduction
You will cover
* Basic concepts of a UNIX system
* Logging onto and logging off from a UNIX system
þ Basic structure of a UNIX system
þ Using UNIX on-line manuals for information
þ Using basic UNIX commands
MODULE 1 - CONTENTS
1.1 OVERVIEW OF UNIX 4
Operating System 4
System V/Posix 4
Data Structure 4
Input 4
Commands 4
Command Checking 4
Accessing Devices 4
Logging On/Off 5
System Numbering 5
Terminal Handling 5
1.1.1 Operating Sequence 6
1.1.2 Command Location 7
1.1.3 Command Syntax 7
1.2 BASIC UNIX COMMANDS 7
1.3 USING UNIX MANUALS 8
1.1 Overview of UNIX
Operating System
UNIX is a modular, general-purpose system. The central part of the operating system is relatively small and written in the ‘C' programming language, making UNIX portable across many different hardware platforms.
System V/Posix
There are many variants of UNIX, but all of those that conform to System V or Posix definitions are very similar in structure.
Data Structure
Data on a UNIX system is stored in files. Groups of files are contained in directories, which are combined into an inverted tree structure.
Input
Input to a UNIX system is predominately typed in lowercase, although there are some exceptions to this. UNIX is case sensitive, so it would be possible to have three different files named, for example, ‘pop', ‘POP' and ‘pOp'.
Commands
UNIX commands tend to be shortened words or mnemonics.
Some simple examples are:
ls list file names in current directory
who display list of current users
cat file display contents of file on screen
Command Checking
By default, most UNIX commands do NOT prompt for approval before carrying out an action. For example, the ‘rm' command will remove files, without prompting ‘Are you sure', before carrying out the action!
Accessing Devices
On a UNIX system, all physical devices, such as terminals, printers etc. are referenced by a file interface. These files are accessed in a directory called ‘/dev'.
Logging On/Off
To log on to a UNIX system, you enter a valid user name and password at the appropriate system prompts.
To log off, type either exit or enter .
System Numbering
On UNIX systems, most things are identified by numbers. Files have an ‘inode' number. Users are referred to by a ‘user identity' number and all processes running on the system have a ‘process id' number.
Terminal Handling
Some UNIX utilities, such as screen editors, use specific screen handling techniques and work best if the terminal used is in ‘ANSI 7 bit' emulation mode.
1.1.1 Operating Sequence
1. When you log on there is a program running, which presents you with a prompt on the screen and interprets any command that you type in. In UNIX, this is called a SHELL. There are different types of shell available, the commonest being the Bourne, Korn and ‘C' shells
2. The interpreted command causes something from the second level to be invoked. This could be a ‘shell built in', a ‘shell script', which is a simple batch control language, or a ‘C' program which uses more complex, compiled language, or a combination of these.
3. The ‘C' program run at level 2 makes a system call to the central part of the operating system, which on a UNIX system is called the ‘kernel'.
4. The kernel interfaces directly with the system hardware.
1.1.2 Command Location
When a command is typed in, the system first checks to see if it is a ‘shell built in'. If not, it then consults an environment variable called ‘PATH', which tells it in which directories, in which order, to search for a command program. Note that, on a UNIX system, it is not normally the default to search in a user's own directory for a command program!
1.1.3 Command Syntax
Most UNIX commands can be entered on their own, or an extended action can be invoked by the addition of ‘options'. Options are normally preceded by a ‘-‘ sign.
ls gives a list of files in current directory
ls –l gives a ‘long' listing, i.e. more information
1.2 Basic UNIX Commands
Below are a set of basic UNIX commands and their function on the system.
id shows your current user and group identity
pwd shows your current working directory (location on the tree)
tty shows your current terminal device file
ls lists files in your current directory
ls –a as above, plus shows files starting with ‘.' (hidden files)
who lists users currently logged on to the system
who –u as above, plus shows inactivity time and login process
ps lists any processes that you are currently running
ps –ef lists ALL processes currently running on the system (Sys V only. Options with ‘ps' vary with different versions of UNIX )
date shows system time and date
uname shows system information
1.3 Using UNIX Manuals
Most UNIX systems have ‘on-line' manuals, that can be accessed to find out information about commands etc. The manuals are split into numbered sections, with section 1 containing information about commands, section 4 containing information about files and so on.
The manuals can be accessed in various ways, as follows:
man passwd shows pages from section 1 about the ‘passwd' command.
man 4 passwd shows pages from section 4 about the ‘passwd' file and it's contents.
man –k user searches all sections of the manuals and any pages that contain the string ‘user' in their page headings.
By using the above utility, you can find out what commands are available, (normally shown as section 1 e.g. whoami (1)), and then look up detailed information on the command and it's options.
|
|