The shell-Basic facilities offered

Shell -the command interpreter.
There are many basic facilities offered by the shell.They include

1)Using shorthands for files(use of the asterisk ‘*’)
For example the command
pr temp*
would print the contents of all files beginning with ‘temp’
Similarly the echo command
echo *
will list all the files in the current directory

2)Input-Output redirection
Consider the case where we want to list the files of the directory but not in the terminal
So we redirect it to a file using the ‘>’ operator
ls > filename
If the file ‘filename ‘ is not already created it will be so,or else it will be overwritten.
Counting the number of lines in a particular directory is done as
ls >filename
wc -l<tfilename

3)Inorder to avoid the creation of a temporary file,PIPES are used for the input-output redirection
The vertical bar ‘|’ is the pipe.
Instead of using
wc -l<filename
we use
ls|wc -l
for the redirection to be possible.

4)Tailoring the environment
As a user of UNIX,we could customize it in the way comfortable to us.
The ‘stty’ command helps us do that
for eg:
stty erase ‘^h’
enables the user to use ctrl-h for erasing a particluar character.
By storing it in the file .profile (present in the home directory),we need not type it each time we login
One of the most important tailoring comes during the setting up of paths
Again this could be made changed in the ‘.profile’ file.
The current path would enable searches in the directories /usr/bin and /bin.
If we did want to augment another directory to the search path we do it as follows:
PATH=export $PATH:/usr/games
where usr/games would be the newly added search directory.
The augmented path would be obtained using the ‘echo’ command
echo $PATH

All these changes could be saved into the file named ‘.profile’


One response to this post.

  1. Posted by Pramode on July 31, 2010 at 1:49 am

    Good to see that you have started writing!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s