lecture 1: introduction, basic unix

21
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques

Upload: samira

Post on 12-Jan-2016

27 views

Category:

Documents


0 download

DESCRIPTION

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: - PowerPoint PPT Presentation

TRANSCRIPT

Lecture 1: Introduction, Basic UNIX

Advanced Programming Techniques

Why are we here?

What’s a computerWhy do we run programs?What is needed to create a program?

Structure of a typical OS

Applications

Shell

\Kernel (OS)

Hardware

There are many standard applications:

• file system commands

• text editors

• compilers

• text processing

Connecting

Create Acct www.cs.drexel.edu/Account.php

ClusterPuTTY/SSHLog inPassword

Looking Around

Home directoryStartup and customization filespublic_htmlFiles/dirscd, pwd, lsFilesystem Absolutle Relative

Commands for FilesLooking around

ls, pwd, cd, pushd, popdFiles/dirs

rm, cp, mv, mkdir, rmdir, lnViewing

cat, less (more), od, w3m, pdftotext, antiwordComparing

diff, cmp

Commands for Archiving

tar – Tape Archive makes a large file from many files

Compressiongzip, gunzip, bzip, compress

File Permissions

Three types: read abbreviated r write abbreviated w execute abbreviated x

There are 3 sets of permission:1. user2. group3. other (the world, everybody else)

ls -l and permissions

-rwxrwxrwx User Group Others

Type of file:- – plain filed – directorys – symbolic link

Bourne-again Shell (bash)

ShellsStartupTypes Alias, shell builtin, disk utility

(program)

Syntax Options, args

man Pages

maninfo

Some commandsman, infodate, calwho,fingerdu, df, quota

Basic control codes

Ctrl-D (^D) set ignoreeof

Ctrl-C (^C)Ctrl-U (^U)Ctrl-Z (^Z)Ctrl-L (^L)

Shell metacharactersSome 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

ValuesAssignmentReadingCommon ones: PATH, PS1, HOME, USER, HOSTNAME,

PWD

Shell options

set built-innoclobber, ignoreeof, vi, -nAlias, hashing

I/O3 (4) files – stdin, stdout, stderr, stdlogRedirectionPipes

filtersUnix philosophy Everything's a file Text processing

Some common filters… wc, tr, grep, sort, cut, awk, uniq, head, tail, wc

Quoting

Escape charStrong quotingWeak quoting

Processes, Subshellsps,pid, ppidExported variablesBackground processes, &, ctrl-Zjobs, kill

EditorsA 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