|
|
|
Lecture 3 — users, processes, emacs, scripting
|
|
|
|
|
Shell review
|
|
|
|
|
one line to remove all .log files in the current directory (rm *.log)
|
|
|
|
|
what if rm has been aliased to rm -i? (rm -f *.log)
|
|
|
|
|
copy the contents of a directory images to images_backup (cp -r images images_backup)
|
|
|
|
|
view a file many pages long (less)
|
|
|
|
|
move two directories up (cd ../..)
|
|
|
|
|
execute a program encode, have it use data.txt as stdin, and use use output.txt as stdout (./encode < data.txt > output.txt)
|
|
|
|
|
print a message on stderr (echo “ERROR” 1>&2)
|
|
|
|
|
create a directory called model_results (mkdir model_results)
|
|
|
|
|
suppress stdout while appending stderr (time ./some_program > /dev/null 2>> logfile)
|
|
|
|
|
Users
|
|
|
|
|
permissions
|
|
|
|
|
chmod
|
|
|
|
|
superuser
|
|
|
|
|
~
|
|
|
|
|
Processes
|
|
|
|
|
instance of a running program
|
|
|
|
|
contains code, resources, state
|
|
|
|
|
ps, top, kill
|
|
|
|
|
Emacs
|
|
|
|
|
files & buffers
|
|
|
|
|
cutting & pasting
|
|
|
|
|
scrolling & windows
|
|
|
|
|
Scripting
|
|
|
|
|
variables
|
|
|
|
|
name=value
|
|
|
|
|
$name
|
|
|
|
|
control flow
|
|
|
|
|
for
|
|
|
|
|
for var in list, for (( expr1; expr2; expr3 ))
|
|
|
|
|
if, while
|
|
|
|
|
test commands
|
|
|
|
|
arithmetic expansion
|
|
|
|
|
$(( expr ))
|
|
|
|
|
command substitution
|
|
|
|
|
$( command )
|
|
|
|
|
#!/bin/bash, chmod +x
|
|
|