lecture 2: tools & conceptsintro to unix pipes & filters file system university of...
TRANSCRIPT
1
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Lecture 2: Tools & Concepts
CMPSCI120
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Editors
WINNotePad++
MacTextwrangler
2
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Secure Login
WINSecureCRT,PUTTYWinSCP
MacTerminal
Go
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
SFTP
WINWinSCP
MacFugu
3
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Intro to unix
pipes & filters
file system
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Intro to unix commands
some commands will not work dependingon the system ls
lists your files ls -l
lists your files in 'long format', which contains lots of useful information, e.g. theexact size of the file, who owns the file and who has the right to look at it, and whenit was last modified.
ls -a lists all files, including the ones whose filenames begin in a dot, which you do not
always want to see. mkdir dirname
make a new directory cd dirname
change directory. You basically 'go' to another directory, and you will see the files inthat directory when you do 'ls'. You always start out in your 'home directory', andyou can get back there by typing 'cd' without arguments. 'cd ..' will get you one levelup from your current position. You don't have to walk along step by step - you canmake big leaps or avoid walking around by specifying pathnames.
pwd tells you where you currently are.
see http://mally.stanford.edu/~sr/computing/basic-unix.htmluse wildcards with caution
4
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Reading,creating & deleting files cat filename
prints the file to your terminal window more filename
shows the first part of a file, just as much as will fit on one screen.Just hit the space bar to see more or q to quit. You can use /patternto search for a pattern.
mv filename1 filename2moves a file (i.e. gives it a different name, or moves it into adifferent directory (see below)
cp filename1 filename2 copies a file
rm filename removes a file. It is wise to use the option rm -i, which will ask you forconfirmation before actually deleting anything. You can make this yourdefault by making an alias in your .cshrc file.
diff filename1 filename2 compares files, and shows where they differ
wc filename tells you how many lines, words, and characters there are in a file
chmod options filename
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
More - history, processes, logout
pslists running processes
historylists your most recent commands
whotells you who's logged on, andwhere they're coming from.
logging offexitlogout
5
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
A short demo
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Basic html
<tag> … </tag>Document
Root<html>
Text:My header
Element<head>
Element<title>
Element<body>
Element<a>
Element<h1>
Text:My title
Text:My title
Attributehref
6
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
Basic html
<html>
<head>
<title> CMPSCI 120 Home Page</title>
</head>
<body>
<h1>CMPSCI 120: Introduction toProblem Solving with the Internet</h1>
<p>The Internet is a goldmine … to theInternet such as copyright laws, FirstAmendment issues, and public keycryptography. </p>
<h2>Prerequisites:</h2>
…
</body>
</html>
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
DOCTYPE declarations HTML 4.01 Strict -- This DTD contains all HTML elements and attributes, but does not
include presentational or deprecated elements (like font). Framesets are not allowed.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional -- This DTD contains all HTML elements and attributes, includingpresentational and deprecated elements (like font). Framesets are not allowed.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset -- This DTD is equal to HTML 4.01 Transitional, but allows the useof frameset content.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN""http://www.w3.org/TR/html4/frameset.dtd">
XHTML 1.0 Strict -- This DTD contains all HTML elements and attributes, but does notinclude presentational or deprecated elements (like font). Framesets are not allowed. Themarkup must also be written as well-formed XML.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional -- This DTD contains all HTML elements and attributes, includingpresentational and deprecated elements (like font). Framesets are not allowed. Themarkup must also be written as well-formed XML.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7
UNIVERSITY OF MASSACHUSETTS AMHERST •• CMPSCI 120 Fall 2010
A short demo