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

CATEGORY
SEARCH OUR OTHER TUTORIALS

DESCRIPTION

The command that is used in the Linux System is explained in this tutorial.
Click here to be kept informed of our new Tutorials.


TUTORIAL TAKEN FROM COURSE : LINUX USER INTRODUCTION

FULL COURSE DETAILS

This course covers the competencies and skills identified as key to intending Linux users. The course aims are to give readers sufficient skills to allow them to run applications in a Linux environment and the associated procedures this requires, such as organising, copying, moving and deleting files. Providing hands-on experience, on completion of the course the reader will be able to: understand the concepts underlying Linux and the benefits offered; be able to log on and off the system and run their chosen applications; be able to manage their files; and be able to use a variety of commands, tools and utilities.

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


Command Line Syntax

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

command [options] [expression] [filenames]

command
The name of the utility to be used.

Example:   pwd

{Print the name of the working directory}.

option
Many Linux 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 Linux utilities require an expression on which to operate. For example, searching files for lines that contain a stated expression.

Example:   grep "Linux utilities" unix.notes

{Find all lines in the file unix.notes that contain the expression Linux utilities}.

filename
Many Linux 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 Linux utilities are separate from the Linux 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.

Note: 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.

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.

passwd

This utility allows the user to create and update the login password on the account. The syntax of the command is:

passwd

The presentation of the prompts for this utility will vary, depending on the version of Linux. However, the prompts will be of the following format:

Changing password for jon
Old password: old_password
.
.
.
New password: new_password
Re-enter new password: new_password

Which ever version of Linux is being used the format is always:

Prompt for the old password - unless this is the first time a password is being entered.

Prompt for the new password, twice.

Notes

1. As shown in the SCO Linux example, the user may be asked whether or not the system should choose the password. Never use this option! Not only are the results bizarre at times, but it is easier for you to remember a password that you created.

2. There are varying restrictions on the structure of a password. Generally, the rules are:

a. A minimum of 4 or 5 characters.
b. A maximum of 8 characters.
c. Use letters (a-z and A-Z) and numbers only.
d. There may be restrictions to the minimum number of letters (usually 3) and numbers (usually 1) used in the structure of the password.

Consult the User Guide for your version of Linux.

man - online manual

man is an online manual utility. The syntax of the utility is:

man utility

This utility is not available on all Linux systems. On some systems it is an added extra, to be installed separately. On others, it is part of the basic system.

man pages the information, a screen at a time. This is because the on-line manual utility has been combined with the Linux command more.

The following options are available:

  • To display next page: Press the Spacebar
  • To quit the manual: Press the Q key

See section on The more Utility - Paginate Files for more details.

Many versions of the man utility allow the user to list other Linux utilities by specifying a keyword, or set of keywords, associated with them. The syntax is:

man -k "keyword(s)"

For example, the following will list all utilities that are associated with copying:

man -k copy




10 RELATED COURSES AVAILABLE
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....
LINUX OVERVIEW
To provide technical users new to Linux with a sound appreciation of the operating system. The course provides re....
UNIX NETWORKING ADMINISTRATION INTRODUCTION
Following the UNIX International Courseware Accreditation standards, this course covers the competencies and the ....
UNIX SYSTEM ADMINISTRATION SVR3
This course covers the competencies and skills identified as key to Unix System administrators. The course intro....
 
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
Monday 8th September 2008  © COPYRIGHT 2008 - VISUALSOFT