Вы находитесь на странице: 1из 3

Normally the output is /bin/bash which

gives us the bash shell. There are ways


by which we can activate different shells.
Those will be covered in an advanced
tutorial.
Commands are actually files containing programs,
often written in C.
These files are contained in directories. To find out
where a command is stored, we can use
the type command.
Type at the command prompt type space ps and
Type at the command prompt type ps
enter.
This shows that ps is actually a file stored in
the /bin directory.
When we key in a command at the command prompt,
the shell searches for a file matching the command
name in a list of directories.
If it is found, then the program corresponding to that
file is executed, else a command not found error is
given.
The list of directories searched is specified by the
PATH variable, as we will see later.
For now, if we want to see this list, just type the
Type at the command prompt echo
command echo space dollar PATH in capital and
$PATH
press enter
Talking of commands, there is one important thing that
Display slide 6
we need to know.
Linux commands are of two types: External commands
and internal commands.
Now external commands are those which exist as
separate files/programs.
Most commands in Linux are of this nature. But there
are some commands whose implementation is written
within the shell and they do not exist as separate files.
These are internal commands.
The echo command, which we will see later, is in fact
an internal command.
Go to the terminal and type at the Go to the terminal and type at the command, type
command prompt type echo space echo and press enter.
The output shows echo as a shell bulletin. So instead
of giving a file name it shows that the echo command's
implementation is internal to the shell. So it is called
internal command.
Display slide
Another important thing which we need to understand
is the structure of commands.

Commands can be of one word or multiple words,


separated by white spaces.
In the second case the first word is the actual name of
the command while the other words are called
arguments.
Arguments can be options or expressions or file
names.
A command can perform different tasks depending on
the option specified. They are generally preceded by a
single or double minus sign(-), called short and long
option, respectively.
Go to the terminal window and type the commands and
Type at the command prompt
see their outputs.
Type clear to clear the terminal window
ls Then type ls and press enter
Again, type clear and press enter
ls -a Type ls space minus a and press enter.
Type clear to clear the terminal window
ls --all Now type ls space minus minus all and press enter.
Again, type clear to clear the terminal .Now type ls
ls -d
space minus d and press enter.
At this point it is enough to understand how the
command's behavior changes with change of options
In Linux we have a larger number of commands, each
Display slide 8
of which have many different options.
Commands can also be combined together as we will
see later. So how do we keep so much in mind? In
reality you don't have to. This is because of the
excellent online help facility available in Linux.
The man command provides documentation on just
about every available command on the system.
Type at the command prompt For instance, to know about say, the ls command, all
you have to do is to go to the terminal and
man ls type man command with ls as argument that is
type man space ls and press enter

press q Press q to come out.


Display Slide 8 man is the system’s manual pager. Each argument
given to man is normally the name of a program, utility
or function.
The manual page associated with each of these
arguments is then found and displayed. A section, if
provided, will direct man to look only in that section of
the manual.
The default is to search in all of the available sections,
following a pre-defined order and to show only the first
page found, even if page exists in several sections.
You can use man command to know more about the
command man itself.
Type at the command prompt
Go to the terminal and type man space man and
man man press enter.

Press q Press q to come out of it.


Display Slide 8 man command has many options.
Here let me tell the most useful ones. Sometimes we
know what we want to do but do not know the exact
command. Then what can we do? man provides the -
k option which takes a keyword and return a list of
commands and their brief purpose.

Вам также может понравиться