Unix Lecture 1

Download Report

Transcript Unix Lecture 1

UNIX Lecture 1
Hana Filip
January 16, 2007
Spring 2007
1
What is UNIX
• a computer operating system
– an operating system is the software that provides the
interface between the hardware of a computer system
and the applications programs running on it
January 16, 2007
Spring 2007
2
What is UNIX
• UNIX provides a range of tools that can be
combined and manipulated to perform such a wide
variety of jobs that users of the system can very
often carry out sophisticated tasks without writing
programs in a programming language
–
–
–
–
Text preparation and printing
Document storage and manipulation
Programming
E-mail
January 16, 2007
Spring 2007
3
What is Unix
• originally developed for multi-user systems
• now is also run on 'stand-alone' machines
January 16, 2007
Spring 2007
4
What is UNIX
• can be found on a wide variety of computer
systems:
– global computer networks like the World Wide Web
– PCs often have Linux (a UNIX-type operating system)
or a variety of BSD installed (BSD = Berkeley
Software Distribution, or Berkeley UNIX, one of the
branches of UNIX)
– OS X Apple Macintoshes all run a form of UNIX
– a host of free open software systems like FreeBSD,
NetBSD or GNU/Linux all are varieties of a UNIX-type
operating system
January 16, 2007
Spring 2007
5
Date: Thu, 11 Jan 2007 15:17:37
From: Michael LaStella < [email protected] >
Subject: English & Computational Linguistics, Language Description, Text/Corpus Linguistics: Knowledge
Engineer (KE), KNOVA Software, Inc.
Organization: KNOVA Software, Inc.
Department: Engineering
Web Address: http://www.knova.com
Specialty Areas: Computational Linguistics; Language Description; Text/Corpus
Linguistics
Required Language(s): English (eng)
Description:
Knowledge Engineer (KE)
Summary:
Want to work with cutting-edge technology in one of the ten fastest growing
software companies as selected by Baseline Magazine? KNOVA's
(http://www.knova.com/) suite of applications are built on an adaptive search
and knowledge management platform which has been lauded as 'visionary' and
'innovative' by technology research firms like Gartner, professional
associations like SSPA, and customers alike. KNOVA's applications help leading
companies like AOL, Ford, H&R Block, HP, McAfee, and Novell increase revenues,
reduce service costs and improve customer satisfaction.
January 16, 2007
Spring 2007
6
As a member of the KNOVA team, the Knowledge Engineer (KE) is responsible
for the discovery, development, and maintenance of terminology and synonyms
used to help drive the intelligence of KNOVA's search engine. This is a
contract-to-hire position.
Duties and Responsibilities:
- Discover, develop, and maintain terminology and synonyms used to help drive
the intelligence of KNOVA's search engine
- Set up and configure enterprise software and development environments
- Analyze and import structured and unstructured data using scripting languages
such as PERL and Python
- Participate in the effort of constantly improving methodology and tools
- Facilitate knowledge transfer from Subject Matter Experts (SMEs)
- Provide SME training
- Follow methodology to complete work within established time frames
Knowledge, Skills and Abilities:
- Skilled at using search engines
- Working knowledge of XML, HTML, PERL, UNIX, and regular expressions
- Ability to communicate effectively
- Working knowledge of data structures, data creation and manipulation,
taxonomies, and ontologies
- Understanding of search technology a plus
January 16, 2007
Spring 2007
7
Qualifications:
Bachelor's Degree in Library Science, Computer/Information Science, Linguistics,
or extensive coursework in knowledge engineering topics
-orTwo or more years of experience in knowledge engineering
Contact Information:
Please email resumes to: [email protected]
Or fax resumes to: (408) 863-5810
To find out more information about KNOVA, please visit us on the web at
http://www.knova.com.
Application Deadline: 30-Jun-2007
----------------------------------------------------------LINGUIST List: Vol-18-95
January 16, 2007
Spring 2007
8
History of UNIX
• UNIX was first developed in the early 1970s at Bell
Laboratories in the USA (in collaboration with GE and
MIT).
• AT&T (the owners of Bell Laboratories) made UNIX
available at nominal cost to academic users, allowing
researchers at universities to modify and extend UNIX.
• UC Berkeley was the first university to get interested in the
UNIX system in 1973, a PDP-11 installed in 1974, and the
computer science department used it for extensive research
thereafter
• Columbia (1974), Santa Cruz (1979), MIT (1983 - Athena
networked workstations)
January 16, 2007
Spring 2007
9
Different UNIX Systems
• System V (distributed by the original developers, AT&T)
• AIX (IBM)
• Berkeley BSD (from the University of California,
Berkeley)
• SunOS, now known as Solaris (from the makers of Sun
workstations)
• Xenix (a PC version of UNIX).
January 16, 2007
Spring 2007
10
UNIX Features
• written in the high level level language C
– easy to install on new computing systems
• the UNIX operating system consists of
– the kernel
• Performs basic operating system functions such as accessing
files, allocating memory, etc.
– the shell
• Provides the user interface to the kernel
• C shell (csh) is the original default shell for interactive work
January 16, 2007
Spring 2007
11
UNIX Features
• tcsh
– is a UNIX shell based on and compatible with the C
shell (csh)
– ‘t’ in tcsh comes from the T in TENEX, an operating
system inspired Ken Greer, the author of tcsh, with its
command-completion feature
– early versions of Mac OS X shipped with tcsh as the
default shell, the most recent versions now have bash
January 16, 2007
Spring 2007
12
Shell Commands
% shell prompt
– you are in the shell mode, the main command
center of the UNIX system
– alternative shell prompts are
$
#
>
January 16, 2007
Spring 2007
13
Shell Commands
% date
[RETURN]
– the command is typed and then
– the RETURN key is pressed
this causes the computer to execute that command
date
– displays current date and time
– is a two-way command: after executing the command,
the computer returns you to the Shell Mode (your
originating mode)
January 16, 2007
Spring 2007
14
Shell Commands
How do you spell … ?
UNIX maintains an on-line spelling dictionary
% look egg
% look psych
January 16, 2007
[RETURN]
[RETURN]
Spring 2007
15
Shell Commands
telnet command allows you to communicate
with a remote computer that is using the
Telnet protocol
% telnet [host] [RETURN]
opens a telnet session to the domain [host]
% telnet grove.ufl.edu [RETURN]
January 16, 2007
Spring 2007
16
Shell Commands
login
Trying 128.227.8.12...
Connected to grove.ufl.edu.
Escape character is '^]'.
Compaq Tru64 UNIX V5.1A (Rev. 1885) (dogwood) (pts/12)
login: hfilip
Password:
Compaq Tru64 UNIX V5.1A (Rev. 1885); Tue Oct 22
07:01:45 EDT 2002
>
January 16, 2007
Spring 2007
17
Shell Commands
% who [RETURN]
current users on the system
% whoami [RETURN] current user of the account
% cd .. [RETURN]
change directory move one tier up in the directory
% ls [RETURN]
list the files in the current directory
% cd ~ [RETURN]
move back to your home directory
January 16, 2007
Spring 2007
18
Shell Commands
% logout [RETURN]
Connection closed by foreign host.
January 16, 2007
Spring 2007
19
Your First File
• OBJECTIVES
–
–
–
–
Create a file for visual editing
Append text to the file
Escape from Text Append Mode
Quit working on a file, save the changes made
in the file and return to the Shell
– Display a list of files in your account
– Email your file
January 16, 2007
Spring 2007
20
Your First File
Starting Your First File
1.
2.
3.
4.
Logon to your UNIX account
% vi[SPACE]first
vi indicates that you wish to use the UNIX visual
text editor
first is the name of the file to be worked on
Press the [RETURN] key
The screen will clear and a note will appear at the
bottom of the screen
"first" [New File]
Tildes (~) will parade in a column down the left, the cursor will
appear at the top left of the screen
January 16, 2007
Spring 2007
21
Your First File
Appending Text
• You are now in the
Visual Editor Command Mode
• Press this key a SINGLE time (and do NOT
press the RETURN key):
a
• What happened?
January 16, 2007
Spring 2007
22
Your First File
Appending Text
• Nothing.
• In the Visual Editor Command Mode,
pressing the a key (once) tells vi that you
want to add or append text to the file
• After pressing the a key (once) the visual
editor will add anything you type to the file
and at the same time display it on the
screen.
• You are now in the Append Mode.
January 16, 2007
Spring 2007
23
Your First File
Appending Text
• Type in the following sentence
I anticipate a long and harmonious
relationship with UNIX.
January 16, 2007
Spring 2007
24
Your First File
Leaving the Append Mode
• Press the ESC key
• Nothing appears to happen, but you are now
out of Append Mode and back in the Visual
Editor Command Mode.
• To be certain press the ESC key again.
• If a beep sounds, vi is telling you that you
are in Command Mode.
January 16, 2007
Spring 2007
25
Your First File
Leaving the Append Mode
• From the Command Mode type
duty
• What happened? The terminal should have
beeped at you - several times.
January 16, 2007
Spring 2007
26
Your First File
Leaving the Append Mode
• From the Command Mode type
aduty
• What happened? The word duty appears on
the screen?
January 16, 2007
Spring 2007
27
Your First File
Leaving the Append Mode
SUMMARY
• The a command permits you to start
entering text
• The ESC key stops the append process and
returns you to the Command Mode
January 16, 2007
Spring 2007
28
Your First File
Returning to the Shell
“I am finished - save this text in a file for another
time and bring me back to the Shell.”
• Type
- ESC key
- ZZ (Upper Case)
hold down the SHIFT key and press the Z key
twice
January 16, 2007
Spring 2007
29
Your First File
Listing Files
% ls [RETURN]
The filename first should appear
% first
January 16, 2007
Spring 2007
30
Your First File
Mail - Sending a File
% mail [LOGIN@SYSTEM] < [FILENAME] [RETURN]
leave one space between mail and [LOGIN]
Example:
% mail [email protected] < first
If the person you wish to send an email message is
on the same system, you need not include in the
address:
% mail tigger < tritesayings
January 16, 2007
Spring 2007
31
Your First File
Mail - Sending a Message
% mail [LOGIN@SYSTEM]
[RETURN]
[TYPE YOUR MESSAGE]
CTRL-D
January 16, 2007
Spring 2007
32
Your First File
Transcript
% script
[RETURN]
Script started, file is typescript
% mail [email protected]
hello
% [CTRL-D]
%exit
Script done, file is typescript
%
January 16, 2007
Spring 2007
33
Your First File
Copying Files
%
%
%
%
cp
ls
[RETURN]
typescript
cp typescript [NEW.FILENAME]
ls typescript [NEW.FILENAME]
[RETURN]
copy
January 16, 2007
Spring 2007
34
Your First File
Renaming Files
%
%
%
%
ls
[RETURN]
file1
mv file1 file2
ls file2
mv
[RETURN]
moves file1 into file2
January 16, 2007
Spring 2007
35
Your First File
Cursor Moving Commands
Depending on the terminal type:
• arrow keys
• h, j, k, l keys
• or both
January 16, 2007
Spring 2007
36
Your First File
Cursor Moving Commands
Slash-search command:
• Command mode (Press [ESCAPE])
• /[word] e.g., /duck
/a
• Press [RETURN]
• Pressing the n key will send the cursor to
the next identical word or letter in your file
January 16, 2007
Spring 2007
37
Your First File
Deleting lines
• Command mode (Press [ESCAPE])
• Position the cursor on any character on a
line you want to delete
• Type dd
• Pressing the u key will undo the effect of
the most recent text changing command
–u
January 16, 2007
the undo or ‘I goofed’ command
Spring 2007
38
Your First File
Deleting Lines
• Command mode (Press [ESCAPE])
• Position the cursor on any character on a
line you want to delete
• Type 3dd
• What happened?
January 16, 2007
Spring 2007
39
Your First File
Deleting Words
• dw
– delete word
– move the cursor to the first letter of any word
– deletes the whole word and the cursor ‘lands’ on the
first character of the next word
– place the cursor in the middle of a word and try the dw
command - what happens?
• 3dw
January 16, 2007
Spring 2007
40
Your First File
Deleting Specific Characters
•x
– Move the cursor to a letter or a space
– Press x
– ‘Delete one character at a time’ under x
• 6x
January 16, 2007
Spring 2007
41
Your First File
Replacing a Single Character
•r
– replaces the one character located under the cursor
with the very next character that you type
– If the cursor is located at the w in two, typing r
followed by o will give you too
January 16, 2007
Spring 2007
42
Your First File
Breaking Up a Long Line
•r
[RETURN]
• Move the cursor to the space between two
words
• Type the replace r command and then press
the [RETURN] key
January 16, 2007
Spring 2007
43
Your First File
Substituting for a Single
Character
•s
– substituting for a single character
one-way text changing command - moves you
into the Append Mode
– r is a two-way text-changing command for a
replacement of a single character - leaves you
in the Command Mode
January 16, 2007
Spring 2007
44
Your First File
Substituting for a Word
• cw
– change word
– Move the cursor on the first letter in a word
– Type cw
– Deletes that word
– Lets you append as much text as you wish
– One-way text changing command - moves you
into the Append Mode
January 16, 2007
Spring 2007
45
Your First File
Substituting for Lines
• cc
– Substitutes text for a whole line
– Move the cursor to some place in a given line
– Type cc
– Deletes that line
– Lets you append as much text as you wish
– One-way text changing command - moves you into the
Append Mode
January 16, 2007
Spring 2007
46
Your First File
Summary
Commands that substitute or change
characters, words and lines
One-way Text Changing Commands: s, cw, cc
Two-way Text Changing Commands: x, dw dd
January 16, 2007
Spring 2007
47
Your First File
Inserting Text
•i
– Select a place to which you want to add some
text
– Type the i(nsert) command
– The text will be entered to the left of the cursor
– i moves you into the Append Mode
January 16, 2007
Spring 2007
48
Your First File
Opening a Line Below
•o
– Opens a new line below the cursor line
– o moves you into the Append Mode
January 16, 2007
Spring 2007
49
Your First File
Opening a Line Above
• O (capital)
– Opens a new line above the cursor line
– O moves you into the Append Mode
January 16, 2007
Spring 2007
50
Your First File
Summary of Append Commands
O
i
a
o
i
O Opens the line above
inserts text to the left
a appends to the right
January 16, 2007
o opens the line below
Spring 2007
51