HOME  |    TRAINING  |   FREE TUTORIALS   |   JOBS
Find out more about our new RSS feed.
FREE Tutorial
THE UNIX COMMAND LINE

CATEGORY
SEARCH OUR OTHER TUTORIALS

DESCRIPTION

In this tutorial the UNIX Command Line is explained.


TUTORIAL TAKEN FROM COURSE : UNIX FUNDAMENTALS

FULL COURSE DETAILS

This course covers the competencies and skills identified as key to intending UNIX users and developers. The course aims are to give readers a good understanding of the UNIX operating system sufficient to meet the needs of application developers. Providing hands-on experience, on completion of the course the reader will be able to; understand the concepts underlying UNIX; use a variety of commands, tools and utilities; program the command interpreter (shell); understand the file system; and carry out basic text manipulation.

TO ACCESS THE FULL COURSE AND HUNDREDS OF OTHERS, CLICK HERE.


Command Line Syntax

The syntax for the use any single utility in UNIX is:

command [options] [expression] [filenames]

command
The name of the utility to be used.

Example:
pwd Prints the name of the working directory

option
Many UNIX utilities have a number of options that may be stated on the command line. They are used to qualify the usage of the utility. Option flags are preceded by either a hyphen ( - ) or a plus ( + ) symbol. They may be stated separately or grouped together (if they are preceded with a hyphen and not suffixed by a qualifier).

Example:
ls -la Long listing of the names of all files in the working directory

expression
Some UNIX utilities require an expression on which to operate. For example, searching files for lines that contain a stated expression.

Example:
grep "UNIX utilities" unix_fund.notes

Find all lines in the file unix_fund.notes that contain the expression UNIX utilities

filename
Many UNIX utilities require a file, or list of files, on which to operate.

Example:
ls -la /usr/bin Long listing of the names of all files in the directory /usr/bin

If a utility is stated wrongly on the command line, most utilities will print an error message, stating the correct syntax of use.

Example: ls -%

This will result in the following being displayed on the screen:

ls: illegal option -- %
usage: -1ACFRabcdfgilmnopqrstux [files]

Multi-Processing

Most UNIX utilities are separate from the UNIX operating system. That is, they are separate programs (many compiled from C source files) and, so, act separately from the operating system. As such, when the utility is used on the command line, the shell program that is being used makes a copy of itself and hands that copy over to the utility to be run. In other words, every time a utility is used:

a. The user has at least two processes in operation: the original shell and the utility.
b. The original shell remains unaffected by any changes the utility makes to its own shell.

The original shell is called the Parent Process. The copy is called the Child Process or Sub-shell.

Tip:
There are several commands that are built into the operating system - such as cd (change directory). When executed, they do not use a sub-shell, but are run in the present shell. This is because they need to affect the present shell's environment - such as updating the Working Directory, in the case of the cd command.

Certain utilities - and application software - may produce a number of child processes when used. At all times, there is communication between a parent and a child. In most cases, a parent process will go into the Background while a child process is running, so that there is no more than one process requesting information from the keyboard at any time. However, a slow-running child process may be forced into the background, allowing the user to continue to do other things (see Section 8.12 for more details).

As there will be a number of processes running at the same time - created by the operating system as well as all users on the system - each has to have a unique method of identification. The method used is that each process is issued with a unique Process Identification Number (pid) on execution. Both this and its parent pid is stored with each process.

Continued...


NEXT PAGE



10 RELATED COURSES AVAILABLE
UNIX USER INTRODUCTION
This course covers the competencies and skills identified as key to intending UNIX users. The course aims are t....
UNIX FUNDAMENTALS
This course covers the competencies and skills identified as key to intending UNIX users and developers. The cour....
UNIX ADVANCED USER
This course covers the competencies and skills identified as key to power Unix users and developers. The course a....
LINUX FUNDAMENTALS
This course covers the competencies and skills identified as key to intending Linux users and developers. The cou....
LINUX USER INTRODUCTION
This course covers the competencies and skills identified as key to intending Linux users. The course aims are to....
 
1 RELATED JOBS AVAILABLE
UNIX, LINUX (HIGH AVAILABILITY CLUSTERS) & QNX SYSTEMS ADMIN N/WEST
Computer Futures Solutions are seeking an experienced Linux/Unix/QNX Systems Administrator with a knowledge of Ne....
CONTACT US
Wednesday 3rd December 2008  © COPYRIGHT 2008 - VISUALSOFT