Tutorial: Unix - Introduction
Dr.
Thomas E. Hicks
Computer Science
Department
Trinity University
byte - 8 bits - enough memory to store one character.
file - a collection of digital information (0's and 1's).
directory or folder - a special file used as a container in which to hold other files and/or directories. Directoies/Folders make it possible to manage and organize the thousands of files that reside on a computer system.
text file - ASCII file - a file of text information. Text files contain text in a traditional language such as English, Spanish, etc. Text files do not have the normal word processing features such as margin control, font selection, underscore, bold, etc. FORTRAN programs, C programs, and Pascal programs are examples of text files.
ASCII - American Standard Institute for Information Interchange - collating sequence to associate a seven bit character string with the more commonly used characters. A = 1000001 B = 1000010 C = 1000011
hardware - physical components of the computer and devices attached to the computer.
software - programs that make the machine complete some task. Word processors, spreadsheets, games, operating systems, and paint programs are examples of software applications.
operating system - a software program which controls the resources and processing of a computer. Common examples of operating systems are UNIX, DOS, Windows 3.1, Windows 95, Windows NT, and Macintosh Finder.
graphical user interface (GUI) - a graphical user interface is one which contains icons, pictures, and buttons to facilitate processing. Windows 95, Macintosh, Windows 3.1, and NT have an operating system with a graphical user interface. Some versions of UNIX also have a graphical user interface.
command line interface - terminal connections to UNIX systems run with a command line interface. The user enters strings of information on a line in order to direct processing and feed data. Mouse interactions such as drag & drop or copy & paste are not available on a command line interface.
editor - a software program used to create, display, and/or edit text files. Editors do not permit the normal word processing features such as margin control, font selection, underscore, bold, etc. vi is an example of one of the editors available on all UNIX platforms. Edit is an example of an editor available on all IBM DOS platforms. Simple Text is an example of an editor available on all Macintosh platforms.
word processor - a software program used to create, display, and/or edit document files. Today's powerful word processors enable the user to create documents which contain (1) margin choices, (2) font choices, (3) style choices [bold, underline, etc.], (3) color choices, (4) graphic insertion, etc. Dominant players in today's word processing market are Microsoft Word and Word Perfect.
computer program - a series of instructions that tell the computer hardware what to do. These instructions are generally written in a high level programming language such as C, C++, Pascal, FORTRAN, BASIC, PL/1, COBOL, Modula 2, Scheme, Lisp, APL, Java, Javascript, etc.
high level programming language - a formal language (often English-like) used by computer scientists to create instructions for the computer hardware. Examples of high level programming languages are C, C++, Pascal, FORTRAN, BASIC, PL/1, COBOL, Modula 2, Scheme, Lisp, APL, Java, Javascript, etc. The code below represents an ultra simple FORTRAN program, called Hello.f, which would print "Hello World" on the console display.
compiler - a computer program which converts high level instructions into binary machine language. Most UNIX systems have FORTRAN, C, and C++ compilers available.
Once Telnet is running, you will have to provide the name of the central computer you wish to access. Each Telnet application is slightly different!
For Example: students at Trinity University have accounts on 15 UNIX platforms. They may opt to use any of the following MachineNames [janus01.cs.trinity.edu, janus02.cs.trinity.edu, ... janus15.cs.trinity.edu]
For Example: Students at the University of Texas at San Antonio have an account on the MachineNamed runner.utexas.edu
In order to logon to a central computer with Telnet, you will generally have to provide both your username and your password. You should never tell others your password!
UserName = Generally
constructed from the first letter of first name + up to seven letters of
the last name
Thomas Hicks = thicks (all lower case)
Arthur Anderson = aanderso
Sally Smith = ssmith
clear
<--
to clear the console window.
logout
-
to logoff the computer
exit
UNIX passwords are case sensitive! If the password is [DogSled], then [dogsled] will not work!
Although UNIX systems have some flexibility in password requirements, passwords must generally be at least six characters {A,B,C,...,Y,Z,a,b,c,...y,z,0,1,2,...,8,9, special characters (, . : ; + - etc.)}. If you use more than eight characters, only the first eight are significant. Some password systems require that you have at least one special character!
Hint! Pick a password that you can remember. Pick one that others will not be able to guess. With the exception of your faculty and systems administrators, do not ever tell anyone else your password!
To change the password on most UNIX systems:
passwd <Return>
Enter Old Password :
XXXXXX
Enter New Password :
YYYYYYYY
Re-enter New Password :
YYYYYYYY
To change the password on UNIX systems with multiple systems that maintain a single password, you might have to use yppasswd. See Below!
yppasswd
<Return>
Enter Old Password :
XXXXXX
Enter New Password :
YYYYYYYY
Re-enter New Password :
YYYYYYYY
Students should immediately change their password to something
they can remember! Should you forget your password, you will have to contact
the systems people; it will generally take a couple of days to get your
password problem resolved!
UNIX users will often select the names for their directories and files. Valid UNIX file/directory names may consist of one to seventeen characters from the set {A,B,C,...,Y,Z,a,b,c,...,y,z,0,1,2,...,8,9, Underscore(_),period(.)}
The following would be valid directory/file names:
123
Hello.f
GoodStuff.c
Mail.BillHicks
Correspondance
FORTRAN
C
The following would be invalid directory/file names:
Bill Hicks
<-- Blank
ABCDEFGHIJKLMNOPQRSTUVWXYZ
<-- Too long
ONE/TWO
<-- Invalid Character
Filenames that begin with a period (.) are considered to
be hidden file names. UNIX systems often include special hidden files such
as .profile, .login, .cshrc to assist in the user's setup. Do not erase
any of your hidden files until you know what you are doing!
ls-
Display File/Directory Listing
ls - to get a brief file display non-hidden files and directories)
ls -a
-to
get a brief file display of all files and directories
ls -l
-
to get a long file display of all non-hidden files and directories
ls -la
-
to get a long file display of all files and directories
ls He*
-
to get a brief file display of all non-hidden files and directories
that begin with He . The
*
is a wild card that says "I don't care what the end of the file name may
be".
ls *.f
-
to get a brief file display of all non-hidden files and directories
that end with .f . The
*
is a wild card that says "I don't care what the beginning of the file name
may be"
ls T*.f
-
to get a brief file display of all non-hidden files and directories
that begin with T and end
with .f . The
*
is a wild card that says "I don't care what the middle of the file name
may be".
ls -la T*.f
-
to get a b long display of all files and directories that begin
with T and end with
.f
. The * is a wild card that
says "I don't care what the middle of the file name may be".
ls Prog??.c -
to
get a brief file display of all non-hidden
files and directories that begin with
Prog
and end with .cand
may have any characters for characters 4 and 6. The
?
is a wild card that says "I don't care what this character of the file
name may be". This would be a great way to list all thirteen of the C programs
when you have a collection of programs called Prog01.c, Prog02.c,
Prog03.c, Prog04.c, Prog05.c, .., Prog012.c, Prog013.c.
vi Hello.f - to launch the vi editor with file Hello.f. If file Hello.f exists, the editor opens the file. If file Hello.f does not exit, the vi editor opens an empty file in preparation for that which you are about to enter. If you make a mistake on a line and have not hit the Return Key, you can use the backspace key to correct the mistake. If you make a mistake and hit the return key, don't try to correct it for the moment. Just keep typing!
Try creating the Fortran program above by following
the following directions:
vi Hello.f
<Return>
<-- launch the editor
i
<-- enter the input mode
Program Hello <Return> <-- type the program header line
<Tab> Print*, 'Hello World'
<Return> <-- type the program
code
End
<Return>
<-- type the last line; don't forget the Return!
<ESC>:wq
<-- exit the input mode, write the program
to disk, and exit the editor
cat Hello.f
<--
to display the contents of the ASCII text file
Hello.f in
the console window.
cat .login
<--
to display the contents of the ASCII text file
.login in
the console window.
cat Hello.f .login
<--
to display the contents of file Hello.f
followed by the
contents of file .login
cat *.f
<--
to display the contents of the ASCII text files that end in
.f
cp Hello.f NewHello.f
<--
to duplicate file Hello.f. The new copy will be called
NewHello.f
cp a.out Hello
<--
to duplicate the binary file a.out. The new copy will be
called Hello
mv Hello.f NewHello.f
<--
to change the name of file Hello.f to be NewHello.f
mv a.out Hello
<--
to change the name of file a.out to be Hello
rm Hello.f
<--
to erase file Hello.f
rm a.out
<--
to erase file a.out
rm a.out Hello.f
<--
to erase file Hello.f
and file a.out