|
![collapse V](Expanded.png) |
|
Lecture 2 — more shell, streams, and poetry quest
|
|
|
![collapse V](Expanded.png) |
|
Announcements
|
|
|
![collapse V](Expanded.png) |
|
hw0 due tonight
|
|
|
![*](LeafRowHandle.png) |
|
for hw0, cd Desktop only makes sense on a Linux VM
|
|
|
![*](LeafRowHandle.png) |
|
office hours on webpage
|
|
|
![collapse V](Expanded.png) |
|
I/O streams
|
|
|
![collapse V](Expanded.png) |
|
every process has 3 standard streams
|
|
|
![collapse V](Expanded.png) |
|
input (stdin), file descriptor 0
|
|
|
![*](LeafRowHandle.png) |
|
the keyboard by default
|
|
|
![collapse V](Expanded.png) |
|
output (stdout), file descriptor 1
|
|
|
![*](LeafRowHandle.png) |
|
the screen by default
|
|
|
![collapse V](Expanded.png) |
|
error (stderr), file descriptor 2
|
|
|
![*](LeafRowHandle.png) |
|
the screen by default
|
|
|
![collapse V](Expanded.png) |
|
redirect to files
|
|
|
![*](LeafRowHandle.png) |
|
>, >>, 2>, 2>>, &>
|
|
|
![*](LeafRowHandle.png) |
|
> — save output
|
|
|
![*](LeafRowHandle.png) |
|
>> — generate a file line by line (e.g., as part of a loop)
|
|
|
![*](LeafRowHandle.png) |
|
2>, 2>>, &> — save errors, other info output to stderr (like time)
|
|
|
![collapse V](Expanded.png) |
|
redirect from files
|
|
|
![*](LeafRowHandle.png) |
|
<, <<<
|
|
|
![collapse V](Expanded.png) |
|
redirect to other streams
|
|
|
![*](LeafRowHandle.png) |
|
2>&1
|
|
|
![*](LeafRowHandle.png) |
|
command > 2>&1 file vs command 2>&1 > file
|
|
|
![collapse V](Expanded.png) |
|
redirect to other commands
|
|
|
![*](LeafRowHandle.png) |
|
pipe: |
|
|
|
![*](LeafRowHandle.png) |
|
ls /usr/bin | less
|
|
|
![*](LeafRowHandle.png) |
|
du | sort -nr
|
|
|
![collapse V](Expanded.png) |
|
shell
|
|
|
![*](LeafRowHandle.png) |
|
general form: command [options] [args]
|
|
|
![collapse V](Expanded.png) |
|
alias
|
|
|
![*](LeafRowHandle.png) |
|
alias rm=rm -i
|
|
|
![*](LeafRowHandle.png) |
|
.bashrc
|
|
|
![collapse V](Expanded.png) |
|
history search
|
|
|
![*](LeafRowHandle.png) |
|
ctrl-r, grep ~/.bash_history
|
|
|
![*](LeafRowHandle.png) |
|
*.png -> all png files
|
|
|
![*](LeafRowHandle.png) |
|
[abc]* -> all files whose names start with a, b, or c
|
|
|
![*](LeafRowHandle.png) |
|
ls -l
|
|
|
![collapse V](Expanded.png) |
|
poetry quest
|
|
|
![*](LeafRowHandle.png) |
|
wget http://courses.cs.washington.edu/courses/cse374/16wi/poetry_quest.tar
|
|
|
![*](LeafRowHandle.png) |
|
tar -xf poetry_quest.tar
|
|
|
![*](LeafRowHandle.png) |
|
readme file has instructions
|
|
|