Chapter 4 - Introduction to Unix

Character representation

ASCII
American Standard Code for Information Interchange

This code defines the following characters:

ASCII uses 8 bits to represent characters. Actually, only 7 bits are used to uniquely define the character, and the 8th bit (called the parity bit) is used for error detection. When used, the value of the parity bit depends upon the number of 1's in bits 0-7. For odd parity, bit 8 is set to make the total number of 1's in the byte an odd number, such as 1 or 7. For even parity, bit 8 is set to make the total number of 1's in the byte an even number, such as 0, 2, or 8.

Some useful ASCII character codes:


Logic operators

OR - designated as A + B. If A or B is 1, then A + B = 1; else, A + B = 0.

AND - designated as AB. If A and B are 1, then AB = 1; else, AB = 0.

XOR - designated as A B. Used to differentiate which bits are the same and which bits are different between two binary numbers.

NOT - designated as ~A. If A is 1, then ~A = 0; if A is 0, then ~A = 1.

Logic functions can be combined.

Note that the last two columns are the same.

DeMorgan's theorems:

Basically, these theorems say that we can generate all logic functions with combinations of OR and NOT.


Example login:


Boldfaced elements are comments, not part of the login.

telnet dopey   NEVER connect to snowhite!
Translating "DOPEY"...domain server (129.22.4.3) [OK]
Trying DOPEY.EEAP.CWRU.EDU (129.22.56.21)... Open

HP-UX dopey 7.0 B 9000/330

login: <your name>          You enter this
Password: <your password>   You enter this

(c)Copyright 1983, 1984, 1985, 1986, 1987, 1988, 1989 Hewlett-Packard Co.
(c)Copyright 1979, The Regents of the University of Colorado, a body corporate.
(c)Copyright 1979, 1980, 1983, 1985-1988 The Regents of the Univ. of California
(c)Copyright 1980, 1984, 1986 AT&T Technologies.  All Rights Reserved.
(c)Copyright 1986, 1987, 1988 Sun Microsystems, Inc.
(c)Copyright 1985, 1986 Massachusetts Institute of Technology
(c)Copyright 1986 Digital Equipment Corp.

                       RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the Government is subject to restrictions
as set forth in subdivision (b) (3) (ii) of the Rights in Technical Data and
Computer Software clause at 52.227-7013.

                       HEWLETT-PACKARD COMPANY
                          3000 Hanover St.
                        Palo Alto, CA  94303

Welcome to HP-UX 7.0 on the HP 9000 Series.

##################################################################
#                                                                #
# Consoles are the BIG screens in the Kern lab. Therefore, when  #
# you first login to a console type % setenv TERM 300h <CR>      #
#                                                                #
##################################################################

You can check your terminal type by typing env<CR>.  You should be
vt100 if you are using CWRUnet and 300h if you are working in the
Kern Lab.  You can set your login session to the proper terminal
type using the following commands:

setenv TERM 300h
setenv TERM vt100

Note that you should only use one of these commands.

The following are system messages and general computer news.

emacs is available on snowhite: type <emacs>

USENET access is available on snowhite: type <rn>

The CWRU Ethics Primer is available in /usr/pub.  Please read this.

A new version of /usr/bin/finger has been installed.  Please read
        /usr/pub/new.finger for details.

Other system updates are in /usr/pub/

Please send any system problems that you are having to user "help"

TERM = (hp) vt100   You enter this, either vt100 or 300h, as above.


You have mail.   This is a message that you have received e-mail.

news: vi_guide   This is a message that you have unread news.

$logout

[Connection to DOPEY closed by foreign host]

If you want to see who is on the system, you can try either of
the following commands:
users
who -c


Unix

Logging in

login: <username>
password: <combination of letters and numbers>

invalid login - Typically a typing error

Your password has expired. Choose a new one.

Setting your password

If you are not prompted by the system you can reset your password at any time using the yppasswd command.

$yppasswd
Changing password for <user_name>
Old password: <type in your old password>
New password: <type in your new password>
Re-enter your new password: <type in your new password again>

Logging out

$exit

You can also use $logout or Ctrl-D, but this may not work on all UNIX systems.

Useful commands

$whoami
Displays your username.

$date
Displays the current date and time.

$calendar
Calendar for current month.

$cal 9 1752
Will display the calendar for September 1752.

Displaying files

$cat filename
Lists filename on the computer screen without stopping.

$more filename
Lists filename on the computer screen, and if the listing is longer than one screen, the listing stops and prompts you for MORE?

Printing files

$lp filename
This is currently monitored to prevent listings of huge files by automatically de-activating your account.

Filenames

Filenames can be up to 255 characters long and can contain upper and lower case characters, numbers, and special characters.

Examples:

The above are all unique and valid filenames. Note that UNIX is very case sensitive.

Wildcards

* matches any string.
? matches any character.

$lp *.c
Prints all files with the extension .c

$lp ?.c
Prints all files with one-character names and the extension .c

$lp *8051*.c
Prints all files which contain 8051 in their names and have the extension .c

Other commands

$mv oldname newname
Changes a file's name from oldname to newname.

$cp file1 file2
Copies file1 to file2.

$rm filename
Removes (deletes) filename.
This command is potentially dangerous, especially if wildcards are misused.

$rm -i filename
Asks if you really want to delete filename. A safer way to remove files.


Next Section: Chapter 5 - Unix Files
Previous Section: Chapter 3 - Number Systems
EEAP 282 Class Notes Table of Contents


-- aurora@po.cwru.edu -- About this server -- Copyright 1992, F. Merat