Engineering H192 - Computer Programming
Introduction to UNIX
Lecture 4
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 1
Engineering H192 - Computer Programming
Computing Environment
• PC vs. UNIX
– Many PCs use a version of the Microsoft
Windows operating system (perhaps 98/ME or
more likely 2000/XP).
– This year, the C How To Program book has a
CD with Visual C++ Version 6.0 – More later
– UNIX is an operating system used primarily on
workstations. There are versions for Personal
Computers. LINUX is a version of UNIX. Each
UNIX has its versions of C and C++ languages.
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 2
Engineering H192 - Computer Programming
UNIX
• Originally written by programmers for
programmers at Bell Labs.
• Often is the operating system of choice for highperformance engineering workstations.
• Original (and still common) user interface is the
"UNIX command line", although graphic user
interfaces (GUIs) are available.
• Names of UNIX commands tend to be a little
cryptic or strange.
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 3
Engineering H192 - Computer Programming
UNIX Command Line Interface
• We will use the "UNIX command line" user
interface for much of the work in this class.
• The availability of some limited graphic user
interface capabilities is provided by special
terminal emulation software.
• The emulator runs on the PC and makes the PC
system act like an "X-Windows" terminal and is
called XWin32 (OSU site licensed).
• Simple Secure-Shell terminal emulation can also
be used (also site licensed).
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 4
Engineering H192 - Computer Programming
Some Simple UNIX Commands
S im p le C o m m a n d
U N IX
M S /D O S
L is t file s in d ire c to ry
ls
d ir
rm file
d e l file
c a t file
ty p e file
D e le te a file
D is p la y c o n te n ts o f
file o n s c re e n
D is p la y c o n te n ts o f
file o n s c re e n
P rin t w o rk in g
d ire c to ry
C h a n g e d ire c to ry
Winter Quarter
m o re file
m o re < file
pwd
pwd
c d /p a th /n e w c d \p a th \n e w
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 5
Engineering H192 - Computer Programming
Your Computer Accounts
• Each student actually has two separate computer
system accounts for ENG H192:
– One for the personal computers
– One for the UNIX system (Linux)
• Each account is established only for the duration
of the current quarter (i.e., the files stored under
your Au Quarter's H191 account(s) may be gone)
• Each account has a separate, distinct password
for logon. Changing the password on one
system (PC) does NOT change on it the other
system (UNIX).
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 6
Engineering H192 - Computer Programming
Your User ID and Default Password
• The User ID for both of your computer accounts
is simply your OSU email ID (name.#)
• The default password for both accounts is:
– The first letter of your last name
– The first three digits of your SSN in reversed
order
– Your entire first name
• Written as one "word" in all lowercase
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 7
Engineering H192 - Computer Programming
Figuring out Your ID & Default Password
• So, as an example of a User ID and a default
password, let's suppose:
– Your name is "Woody Hayes"
– Your SSN is 987-65-4321
– Your OSU email address is [email protected]
• Then, Wayne Woodrow "Woody" Hayes would
logon as:
– User ID:
hayes.1
– Password: h789wayne
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 8
Engineering H192 - Computer Programming
Logging On to a PC in HI 324
Windows XP Logon
• Press “Ctrl - Alt - Del”, if so instructed
• Fill in the logon window with
– Your User ID
– Your Password (watch case of text)
– The Domain (ENGR1)
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 9
Engineering H192 - Computer Programming
Logging On to the PC
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 10
Engineering H192 - Computer Programming
Changing Your Password on the PC
(Press Ctrl -- Alt -- Del)
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 11
Engineering H192 - Computer Programming
Changing Your Password on the PC
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 12
Engineering H192 - Computer Programming
Logging On to the Linux (UNIX) System
• After logging onto the PC:
– Click on “Start”,
• Then Point “All Programs” menu,
– Then point to “X-Win32” and Click
» Then when prompted, enter your User
ID and your UNIX system password
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 13
Engineering H192 - Computer Programming
Enter Your User ID & UNIX Password
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 14
Engineering H192 - Computer Programming
Red Hat Linux desk top
Click on the
Red Hat to
display menu
Select ‘System Tools’ – Then select ‘Terminal’
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 15
Engineering H192 - Computer Programming
Linux desk top with two Terminal Windows
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 16
Engineering H192 - Computer Programming
Accessing the LINUX System
From Outside the Classroom
• There are three convenient ways to access the
Linux system from outside this classroom:
– Use the computers in the open computer lab,
Hitchcock Hall 324
– Download and install the X-Win32 X Windows
terminal emulator on your machine
– Download and install the Secure Shell (SSH)
Client terminal emulator (a more “secure”
TELNET-like kind of connection)
• Any OSU site-licensed software package can be
downloaded from: http://osusls.osu.edu
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 17
Engineering H192 - Computer Programming
Logging On to the UNIX System with SSH
• With the Secure Shell Client installed on a PC:
– Click on “Start”, then point to “All Programs”
menu,
– Then point to “Secure Shell Client” and click
– When SSH window appears, click on “Quick
Connect” in upper left part of window
– Enter “Host Name” as:
r1rhl.eng.ohio-state.edu
– Enter your “User Name” and click
– Enter your “Password” when prompted
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 18
Engineering H192 - Computer Programming
Connecting with the SSH Client
First, click on
“Quick Connect”
Then, type in “Host Name”
& “User Name”
r1rhl.eng.ohio-state.edu
Winter Quarter
Finally, “Connect”
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 19
Engineering H192 - Computer Programming
Using SSH
• When logging on for the first time, you may be
prompted to save a “host public key”.
• With the SSH Client:
– You can have more than one command line
“window” to the UNIX system
– You will not be able to use any UNIX programs
which require the “X Windows” environment
without losing capability. This would include
full screen editors like “emacs”.
– vi is the recommended editor for Secure Shell
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 20
Engineering H192 - Computer Programming
Today's Assignment – G03
• In assignment G03, you are asked to logon on to the UNIX
system and try a few commands.
• In Part A, write down the command you typed for each of
the seven steps.
• In Part B, choose an editor program and type in the given
computer program.
• UNIX editor choices include:
– vi (either SSH or X Win32)
– emacs (X Win32 only)
• We will be using the C++ compiler so the file extension
must be .cpp
• To compile the program use g++ -o g03.out g03.cpp
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 21
Engineering H192 - Computer Programming
Dual Boot Computers
• The computers in the classrooms are dual boot.
• This means that they can run Microsoft Windows
XP or Red Hat Linux OSU V1.0
• The default operating system is Windows XP
• To run Red Hat Linux the machine needs to be
restarted or turned off and started again.
• When it is booting, there will be a point where you
can select Linux rather than XP.
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 22
Engineering H192 - Computer Programming
Dual Boot Computers
You will see two lines printed as follows:
Microsoft Windows XP
Red Hat Linux OSU V 1.0
Use the down arrow to highlight Red Hat
Microsoft Windows XP
Red Hat Linux OSU V 1.0
Then press Enter
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 23
Engineering H192 - Computer Programming
Dual Boot Computers
The login information is similar to the previous slides.
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 24
Engineering H192 - Computer Programming
Dual Boot Computers
You will see this image after the login as the computer
continues to boot.
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 25
Engineering H192 - Computer Programming
Dual Boot Computers
To log out, click on the Red Hat and then Logout
Winter Quarter
The Ohio State University
Gateway Engineering Education Coalition
Lect 4
P. 26
Descargar

PC and UNIX Login - Electrical and Computer Engineering