210 likes | 293 Views
Lecture 1: Introduction, Basic UNIX. Advanced Programming Techniques. Why are we here?. What’s a computer Why do we run programs? What is needed to create a program?. Applications. Shell . Kernel (OS). Hardware. Structure of a typical OS. There are many standard applications:
E N D
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques
Why are we here? What’s a computer Why do we run programs? What is needed to create a program?
Applications Shell \ Kernel (OS) Hardware Structure of a typical OS There are many standard applications: • file system commands • text editors • compilers • text processing
Connecting • Create Acct • www.cs.drexel.edu/Account.php • Cluster • PuTTY/SSH • Log in • Password
Looking Around • Home directory • Startup and customization files • public_html • Files/dirs • cd, pwd, ls • Filesystem • Absolutle • Relative
Commands for Files Looking around ls, pwd, cd, pushd, popd Files/dirs rm, cp, mv, mkdir, rmdir, ln Viewing cat, less (more), od, w3m, pdftotext, antiword Comparing diff, cmp
Commands for Archiving • tar – Tape Archive • makes a large file from many files • Compression gzip, gunzip, bzip, compress
File Permissions • Three types: • read abbreviated r • write abbreviated w • execute abbreviated x • There are 3 sets of permission: • user • group • other (the world, everybody else)
ls -l and permissions -rwxrwxrwx UserGroup Others Type of file: - –plain file d –directory s – symbolic link
Bourne-again Shell (bash) • Shells • Startup • Types • Alias, shell builtin, disk utility (program) • Syntax • Options, args
man Pages man info
Some commands man, info date, cal who,finger du, df, quota
Basic control codes • Ctrl-D (^D) • set ignoreeof • Ctrl-C (^C) • Ctrl-U (^U) • Ctrl-Z (^Z) • Ctrl-L (^L)
Shell metacharacters • Some characters have special meaning to the shell: • I/O redirection < > | • wildcards * ? [ ] • others & ; $ ! \ ( ) space tab newline • These must be escaped or quoted to inhibit special behavior
Shell Variables • Values • Assignment • Reading • Common ones: • PATH, PS1, HOME, USER, HOSTNAME, PWD
Shell options set built-in noclobber, ignoreeof, vi, -n Alias, hashing
I/O 3 (4) files – stdin, stdout, stderr, stdlog Redirection Pipes
filters • Unix philosophy • Everything's a file • Text processing • Some common filters… • wc, tr, grep, sort, cut, awk, uniq, head, tail, wc
Quoting Escape char Strong quoting Weak quoting
Processes, Subshells • ps,pid, ppid • Exported variables • Background processes, &, ctrl-Z • jobs, kill
Editors • A text editor is used to create and modify text files. • The most commonly used editors in the Unix community: • vi (vim on Linux) • $ vimtutor • emac • $ emacs • Then, hit ctrl-h t (that’s control-h, followed by ‘t’) • You must learn at least one of these editors