IT244: Introduction to Linux/UNIX – Fall 2010 Final Exam Review

advertisement
IT244: Introduction to Linux/UNIX – Fall 2010
Final Exam Review
For exam held Monday, 12/20/2010, 6:30-9:30pm (Room: M/1/612)
Instructions
The topics listed below are given at a high level. It is your responsibility
to delve into each of these topics at the depth at which we dealt with
them in class. The topics here are the only ones from which questions
might appear on the exam. There is no need to spend any time on a
topic that does not fit under this list. Study hard.
Note: This review sheet covers the second half of the semester. You will
need to use the Midterm review sheet to study material from the first
half of the semester. The exam will cover approximately 1/3 material
from the first half and 2/3 material from the second half of the
semester.
Topics
First half of semester:
1) Know the characters that are acceptable on the command line
without having to quote a string. Know how to quote a string
containing special characters. Know the difference between
quoting with single quotes, double quotes, and the backslash
character. Which special characters expand within single quotes?
2) Command information using man vs. apropos (what does each do
and how are they different). Remember man –k is the same as
apropos.
3) User privileges and file permissions. Basically, tell me what the
difference is between read/write/execute on a file versus a
directory, and tell whether files inside a directory can be
read/written/executed depending on the directory’s permissions.
4) Processes (a process is a running command taking up memory
and CPU time and having a process id (PID) that can be used to get
information about it (ps).
1
5) Tar for archiving – how do you create a tar file, how do you
display the list of archived files in a tar file, how do you extract a
tar file.
6) Piping and redirection defined and the difference between them;
how to pipe standard error to standard out and why you would
want to do that.
7) Text file commands – cat, grep, head, tail, sort, uniq, file, which
8) hierarchical filesystem: filename expansion by the shell before
starting a command process using *, ?, [].
9) Home/working directory - ~, $HOME, ., .., root (/).
10) Filesystem commands: pwd, mkdir, rmdir, cd (includes -, ~), cp,
mv
11) PATH environment variable and how which uses that, as well as
how the shell uses that to find the executable file for a given
command. What happens if you unset the PATH variable? How
do you easily recover from unsetting it?
Second half of semester:
12) Chapter 8: Bourne Again Shell
a. Differences between a startup (login) script and an
executable (non-login) script.
b. Redirecting standard error
c. Directory stack
d. User-created variables and variable attributes
e. Parameter variables ($#, $@, $*, $1-$n, shift, set)
i. For these, also see chapter 10, p. 441
f. Keyword variables (HOME, PATH, PS1, PS2, IFS, CDPATH
g. All special characters on p. 304-5
h. History (the history command, and all Event designators
given in table 8-8, p. 314)
i. Aliases (how to create them and their use, single vs double
quotes)
j. Functions (how to create them and their use, passing
parameters, ability to create functions in a login script)
k. Command line expansions (tilde expansion, variable
expansion, arithmetic expansion, command substitution,
pathname expansion)
2
13) Chapter 10: Programming the Bourne Again Shell
a. Debugging a script (echo, bash –x, set –x, set +x)
b. Control structures (if..then..elif..else..fi, for <loop-index>,
for…in, while, until, break, continue
c. Special parameters ($$, $?)
d. Arithmetic and Logical Evaluation ( let, (()), [[]] )
14) Chapter 12: Awk
a. Syntax
b. Options (-f, -F, -v)
c. Two parts of the language:
i. Pattern
1. Matches cause the action to be taken
2. Patterns can be:
a. string pattern matching within the line of
text
b. line number matching
c. relational comparisons using table 12-1,
p. 534-5.
d. BEGIN – matches the start of the script,
before any lines are read
e. END – matches the end of the script, after
all lines have been read
f. Comma (,) – matches a range between
two patterns
ii. Action
1. Any block of code starting with { and ending
with }.
2. Variables used in an action ($0, $1-$n, FS, NF,
NR)
3. Arithmetic operators – all operators shown in
table 12-4, p. 537
4. Associative arrays – just remember that one
variable (an array) can take many keys and
associate these with their own values.
15) Chapter 13: Sed
a. Syntax
b. Options (-f, -n)
3
c. Line syntax for each command
i. [address[, address]] instruction [argument-list]
d. Addresses
i. Line number
ii. String matches
iii. Comma (,) operator – matches a range
e. Instructions (a, c, d, I, N, n, p)
f. Control structures (!)
g. Hold space versus Pattern space
4
Download