Utilities

Understand and try all of those in chapter 3 which we do not cover in class, they will be tested on as well as the more complicated ones presented in this lecture.

date displays the current date and time
cal displays a calendar
0 arguments current month and year
1 argument assumed to be a year
2 arguments allow you to specify month and year
man the manual display command
more details
the manual is not only to tell you how to use the different shell commands
% man  passwd
and to tell you which shell commands correspond to a given keyword
as in
 
% man -k password or
% apropos  password
 
or a short summary
 
% man -f passwd
% whatis  passwd
 

notice the "See Also" section at the end of a manual listing

see the sections of the manual with % man intro.

whereis and which help you find locations of files corresponding to commands commands are just names of executable files search path shell variable named $path or $PATH
echo allows you to see the contents of a shell variable % echo $path

search path tells it to look in each of the places listed, in the order listed to find the directions for what to do on the command named.

ONLY COMMANDS will not search for filenames given as arguments !!!

grep "global regular expression print"
format:
% grep string filelist,
% grep man this.file
% grep man *

regular expression means there is a different set of "wildcards"
^   beginning of line
$   end of line
\< and \>   beginning and ending of a word - not on OSF
.   replaced by any 1 character
[ ]  choose one from the class of characters listed (just like the shell level wildcard)
*   multiplies the character before it to 0 or more times
" "   quotes a string

% grep Jan friend.list
% grep \<Jan\> friend.list
% grep [abc].1 this.list
   a.1 b.1 c.1 ax1 b31 etc.
% grep [abc]*.1 this.list
   a.1 b.1 c.1 aa.1 ab.1 ba.1 abx1 abb31 etc.

tar "tape archive"
allows you to collect a group of named files into one file so that the group is named one thing for doing things like transferring to another machine as a group or storing.

% tar -cvf all.file file1 file2 file3 file4
-c stands for create
-f stands for file (and must be the last option on some systems)
-v stands for verbose

% tar -xvf all.file
-x stands for extract

who am i to find the login id and machine name of the current login session
whoami to find the login id of the current login session
hostname tells just the name of the machine and its address
From text:
cat, head, tail display contents of a text file
compress, uncompress, zcat deal with compressing, uncompressing and seeing contents of compressed files
file guesses at the type of the file named
sed non-interactive editor
diff compares two files
sort orders the lines of a file
uniq removes sequential duplicate lines from a file

Copyright: Jandelyn Plane - Fall, 1996

 

l_hand.gif (965 bytes) main.gif (403 bytes) RightArrow.gif (115 bytes)