Open an xterm window for this lesson.
For each of the commands, try typing them yourself in the
demonstration window. Remember that you must click with the mouse to
direct keyboard input to that window.
Reports the time and date.
Prints a calendar of the current month.
cal 2 2000
prints a calendar for February, 2000, a leap year. Do not abbreviate
the year, as in "92", since it will give you the year 92 AD, instead
of the year 1992 AD.
Lists who is currently logged on to the computer.
Clears the window.
Replace "<name>" with the name of any user. It can be a user name,
first name, or last name. Prints information about that user, or
user(s) in case of more than one match. In particular this is the way
to find out a user name. Try
For this command you substitute any file name for "<filename>". Try
Counts lines, words, and characters in
the file. In Unix words are separated by "white space" characters,
meaning spaces, tabs or an end-of-line.
Lists the top few lines of the file. Try
Lists the last few lines of the file. Try
Prints all lines in the file <filename> that have the string of
characters <string> in them. Example:
grep the no_use
searches the file called "no_use" for all lines containing the string
"the". In this case the match is case-sensitive, so it would fail on
a line containing only "The". To make it case-insensitive, use
grep -i the no_use
Many Unix commands take a variety of options, and the standard way to
specify options is with a dash "-" followed by one or more characters.
For example the -v option inverts the process. So to exclude
lines that contain the string ``the'' and get everything else, do
grep -v the no_use
Sorts the lines in a file <filename>, according to the first "word".
There are many options. Some common ones are:
||Treat the first "word" on each line as a number and
||sort in numeric order. Thus .12 comes before 0.05
||in an ordinary alphabetic sort, but after in a
||Sort in reverse order.
||Sort in reverse numeric order.
||Sort on column n with the above attributes.
Example: The command to sort numerically on the fifth value on each
line of the file no_use is
sort -n -k5 no_use