Professional Documents
Culture Documents
In The Today's Session We'll Read
In The Today's Session We'll Read
What is command
• Option
• Arguments
• File Arguments
Internal and External commands
The Basic commands of UNIX
• date
• clear and tput
• banner
• who
• cal
• ls
• cat Conti….
Conti….
• wc
• Feeding output of one command to another
• type
• path
• man
• uname
• tty
• passwd
• lock
• echo
• cup
• smso and rmso
• bc Conti….
Conti….
• calendar
• spell
• script
• time
What is a Command
The UNIX system is heavily command-based i.e. you have to
type in a few characters to frame a command and then press the
enter key for it to work.
Options :-
• Modify the way that a command works.
• Usually consist of a hyphen (-) followed by a single letter.
• Some commands accept multiple options which can usually
be grouped together after a single hyphen
Arguments :-
• Most commands are used together with one or more
arguments.
$ type echo
o/p : echo is a shell built-in.
Cont….
echo is not a external command in the sense that, when you
type echo the system won’t look in its PATH to locate it.
• For Ex. You can print only the month, using the
format +%m
$ date +%m
$ date +%h
Conti….
Conti….
For Ex.
$ tput clear
Conti….
$ who –Hu
Conti….
Conti….
cal :- cal is a handy tool that you can invoke any time to see
the calendar of any specific month or a complete year.
$ cal dec
For Ex.
$ cal 1998 | more
ls :- This command is used to list out the names of the files
available in current directory.
$ ls
$ ls chap*
Conti….
For ex.
$ ls –l chap*
$ cat list
For Ex.
$ wc list
will give you above result.
Conti….
For Ex.
$ ls | wc
type :- The best and fastest way to know the location of any
command in the UNIX inbuilt file system is type.
For Ex.
$ type ls
Path :- The sequence of directories that the system will search to
look for a command is specified in its own PATH variable. To
find a directory list separated by colons we’ll write :
$ echo $PATH
$ man wc
Conti…
Conti….
For Ex. :
$ man -k inode
$ uname -r
$ uname -n
Conti….
$ tty
/dev/tty01
smso :- This command is used for bold face your text by using
the smso and rmso.
For Ex.
$ tput smso
$ echo “Come to the Web”
$ tput rmso
For Ex. :
$ spell linux.txt Conti…
Conti….
$ spell -b
$ script
Script started, file is typescript
$_
For viewing contents of this file you have to exit from script
then type cat and typescript command on shell prompt.
time (Timing Processes) :- When faced with several versions
of a program, it becomes necessary to find out drainage that the
command makes on the system resources. The time command
does this work.
• For ex. You can find out the time taken to perform a sorting
Conti….
$ time sort -o a1
• The real time shown is the clock elapsed time from the
invocation of the command till its termination. The time can
differ on multi-user systems where several programs may be
running concurrently.
• The sys time indicates the time used by the UNIX system in
doing work on behalf of the user.
The sum of user time and system time actually represents the
CPU time and its not necessary that this time be equal to the
real time or clock elapsed time (as you see in present case).
Since some time is consumed in doing other work in the
system. The more heavily loaded a system is the greater is the
difference.
End of Chapter 1