UnixWorld ``New To Unix'' Column: August 1988: Listings

Listing 1. Sample output from some UNIX commands

A. The date command produces a formatted date/time string:

$ date
Sun Mar 20 08:15:48 MST 1988
$ []

B. Use the cal command to print a monthly calendar:

$ cal 12 1988
   December 1988
 S  M Tu  W Th  F  S
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
$ []

C. The uname command tells you about your system hardware and software:

$ uname -a
UNIX omni SYSTEMS 3.51 mc68k
$ []

Listing 2. The command prints a listing of a directory

A. The standard System V ls command produces a single-column directory listing:

$ ls
07start.mm
07start.prn
listing1
listing2
listing3
listing4
outline save
$ []

On Berkeley UNIX, ls produces a multi-column listing when output goes to the screen.

B. A long directory listing shows file and directory detail:

$  ls -l
total 55
-rw-r--r--  1 arh   omni     9693 Mar 21 15:19 07start.mm
-rw-r--r--  1 arh   omni    11026 Mar 21 21:26 07start.prn
-rw-r--r--  1 arh   omni      536 Mar 21 21:07 listing1
-rw-r--r--  1 arh   omni      417 Mar 21 21:08 listing2
-rw-r--r--  1 arh   omni      965 Mar 21 21:23 listing3
-rw-r--r--  1 arh   omni      761 Mar 21 21;10 listing4
-rw-r--r--  1 arh   omni     2470 Mar 17 21:52 outline
drwxr-xr-x  2 arh   omni       48 Mar 15 14:03 save
$[]

Listing 3. Basic editing with Ed

A. Create a text file by appending lines:

$ ed sample.txt
?sample.txt
a
This is a sample file.  It is being created with the 
help of the ed text editor.
.
w
81
[]

B. View the lines you entered using the Ed print (p) command:

l,$p
This is a sample file.  It is being created with the 
help of the ed text editor.
[]

C. Terminate editing by typing the Ed quit (q) command:

q
$ []

Copyright © 1995 The McGraw-Hill Companies, Inc. All Rights Reserved.
Edited by Becca Thomas / Online Editor / UnixWorld Online / editor@unixworld.com

[Go to Contents] [Search Editorial]

Text entry and HTML markup by Arlene Lee
Last Modified: Sunday, 10-Mar-96 11:18:12 PST