CS11001/CS11002 Programming and Data Structures Autumn/Spring - - PowerPoint PPT Presentation

cs11001 cs11002 programming and data structures autumn
SMART_READER_LITE
LIVE PREVIEW

CS11001/CS11002 Programming and Data Structures Autumn/Spring - - PowerPoint PPT Presentation

Introduction Title page CS11001/CS11002 Programming and Data Structures Autumn/Spring Semesters Introduction Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Last modified: July 8, 2010 Introduction


slide-1
SLIDE 1

Introduction Title page

CS11001/CS11002 Programming and Data Structures Autumn/Spring Semesters Introduction

Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Last modified: July 8, 2010

slide-2
SLIDE 2

Introduction Syllabus

Syllabus

slide-3
SLIDE 3

Introduction Syllabus

Syllabus

Introduction to digital computers

slide-4
SLIDE 4

Introduction Syllabus

Syllabus

Introduction to digital computers Basic programming constructs

Variables and simple data types Assignments Input/output Conditions and branching Loops and iteration Iterative searching and sorting algorithms

slide-5
SLIDE 5

Introduction Syllabus

Syllabus

Introduction to digital computers Basic programming constructs

Variables and simple data types Assignments Input/output Conditions and branching Loops and iteration Iterative searching and sorting algorithms

Advanced programming constructs

Functions and recursion Recursive sorting algorithms Arrays and strings Structures Pointers and dynamic memory allocation

slide-6
SLIDE 6

Introduction Syllabus

Syllabus (contd.)

slide-7
SLIDE 7

Introduction Syllabus

Syllabus (contd.)

Performance analysis of programs

slide-8
SLIDE 8

Introduction Syllabus

Syllabus (contd.)

Performance analysis of programs Data structures

Abstract data types Ordered lists Stacks and queues

slide-9
SLIDE 9

Introduction Syllabus

Syllabus (contd.)

Performance analysis of programs Data structures

Abstract data types Ordered lists Stacks and queues

Programming language: C

slide-10
SLIDE 10

Introduction References On C

Textbooks and references

slide-11
SLIDE 11

Introduction References On C

Textbooks and references

Use any standard textbook on ANSI C

slide-12
SLIDE 12

Introduction References On C

Textbooks and references

Use any standard textbook on ANSI C Do not use books written on specific C compilers (Turbo C, gcc)

slide-13
SLIDE 13

Introduction References On C

Textbooks and references

Use any standard textbook on ANSI C Do not use books written on specific C compilers (Turbo C, gcc)

1

Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, Prentice Hall of India.

2

  • E. Balaguruswamy, Programming in ANSI C, Tata

McGraw-Hill.

3

Byron Gottfried, Schaum’s Outline of Programming with C, McGraw-Hill.

4

P . Dey and M. Ghosh, Programming in C, Oxford University Press.

slide-14
SLIDE 14

Introduction References On data structures

Textbooks and references

slide-15
SLIDE 15

Introduction References On data structures

Textbooks and references

5

Seymour Lipschutz, Data Structures, Schaum’s Outlines Series, Tata McGraw-Hill.

6

Ellis Horowitz, Satraj Sahni and Susan Anderson-Freed, Fundamentals of Data Structures in C, W. H. Freeman and Company.

7

  • R. G. Dromey, How to Solve it by Computer, Prentice-Hall
  • f India.
slide-16
SLIDE 16

Introduction References On data structures

Textbooks and references

5

Seymour Lipschutz, Data Structures, Schaum’s Outlines Series, Tata McGraw-Hill.

6

Ellis Horowitz, Satraj Sahni and Susan Anderson-Freed, Fundamentals of Data Structures in C, W. H. Freeman and Company.

7

  • R. G. Dromey, How to Solve it by Computer, Prentice-Hall
  • f India.

8

http://cse.iitkgp.ac.in/∼pds/notes/

9

http://cse.iitkgp.ac.in/∼pds/notes/swf/

slide-17
SLIDE 17

Introduction Marks distribution

Marks distribution

slide-18
SLIDE 18

Introduction Marks distribution

Marks distribution

Two class tests: 10 × 2 = 20

slide-19
SLIDE 19

Introduction Marks distribution

Marks distribution

Two class tests: 10 × 2 = 20 Mid-semester test: 30

slide-20
SLIDE 20

Introduction Marks distribution

Marks distribution

Two class tests: 10 × 2 = 20 Mid-semester test: 30 End-semester test: 50

slide-21
SLIDE 21

Introduction Marks distribution

Marks distribution

Two class tests: 10 × 2 = 20 Mid-semester test: 30 End-semester test: 50 Final marks of a student: M = m × α, where

slide-22
SLIDE 22

Introduction Marks distribution

Marks distribution

Two class tests: 10 × 2 = 20 Mid-semester test: 30 End-semester test: 50 Final marks of a student: M = m × α, where

m = Total marks obtained in 100, and

slide-23
SLIDE 23

Introduction Marks distribution

Marks distribution

Two class tests: 10 × 2 = 20 Mid-semester test: 30 End-semester test: 50 Final marks of a student: M = m × α, where

m = Total marks obtained in 100, and α = Classes attended / Total number of classes.

slide-24
SLIDE 24

Introduction Test schedule (tentative)

Tentative schedule of theory tests

slide-25
SLIDE 25

Introduction Test schedule (tentative)

Tentative schedule of theory tests

Class Test 1: First week of September/February

slide-26
SLIDE 26

Introduction Test schedule (tentative)

Tentative schedule of theory tests

Class Test 1: First week of September/February Mid-semester Test: As per institute schedule

slide-27
SLIDE 27

Introduction Test schedule (tentative)

Tentative schedule of theory tests

Class Test 1: First week of September/February Mid-semester Test: As per institute schedule Class Test 2: First week of November/April

slide-28
SLIDE 28

Introduction Test schedule (tentative)

Tentative schedule of theory tests

Class Test 1: First week of September/February Mid-semester Test: As per institute schedule Class Test 2: First week of November/April End-Semester Test: As per institute schedule

slide-29
SLIDE 29

Introduction Test schedule (tentative)

Tentative schedule of theory tests

Class Test 1: First week of September/February Mid-semester Test: As per institute schedule Class Test 2: First week of November/April End-Semester Test: As per institute schedule Two or three lab tests are conducted by respective lab instructors

slide-30
SLIDE 30

Introduction Coverage schedule

Tentative schedule for coverage

slide-31
SLIDE 31

Introduction Coverage schedule

Tentative schedule for coverage

Before Class Test 1: Until “iterations” (all loop constructs)

slide-32
SLIDE 32

Introduction Coverage schedule

Tentative schedule for coverage

Before Class Test 1: Until “iterations” (all loop constructs) Before MidSem Test: Until “introduction to pointers”

slide-33
SLIDE 33

Introduction Coverage schedule

Tentative schedule for coverage

Before Class Test 1: Until “iterations” (all loop constructs) Before MidSem Test: Until “introduction to pointers” Before Class Test 2: Until “linked structures”

slide-34
SLIDE 34

Introduction Coverage schedule

Tentative schedule for coverage

Before Class Test 1: Until “iterations” (all loop constructs) Before MidSem Test: Until “introduction to pointers” Before Class Test 2: Until “linked structures” Before EndSem Test: Everything

slide-35
SLIDE 35

Introduction Structure of a C program

How to write C programs

Skeleton of a C program

slide-36
SLIDE 36

Introduction Structure of a C program

How to write C programs

Skeleton of a C program Include header files

slide-37
SLIDE 37

Introduction Structure of a C program

How to write C programs

Skeleton of a C program Include header files Declare global variables, constants and function prototypes

slide-38
SLIDE 38

Introduction Structure of a C program

How to write C programs

Skeleton of a C program Include header files Declare global variables, constants and function prototypes Function bodies

slide-39
SLIDE 39

Introduction Structure of a C program

How to write C programs

Skeleton of a C program Include header files Declare global variables, constants and function prototypes Function bodies There must be a main function in any C program.

slide-40
SLIDE 40

Introduction Structure of a C program An example

A complete example

#include <stdio.h> #define PI_4_BY_3 4.1887902048 double radius = 10; double sphereVol ( double r ) { return PI_4_BY_3 * r * r * r; } main () { double area; area = sphereVol(radius); printf("Radius = %lf, volume = %lf.\n", radius, area); }

slide-41
SLIDE 41

Introduction Some simple C programs The traditional starter

The traditional starter

#include <stdio.h> main () { printf("Hello, world!\n"); }

slide-42
SLIDE 42

Introduction Some simple C programs The traditional starter

The traditional starter

#include <stdio.h> main () { printf("Hello, world!\n"); }

This program takes no input, but outputs the string “Hello, world!” in a line.

slide-43
SLIDE 43

Introduction Some simple C programs The short-circuit program

The short-circuit program

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%d\n",n); }

slide-44
SLIDE 44

Introduction Some simple C programs The short-circuit program

The short-circuit program

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%d\n",n); }

This program accepts an integer as input and outputs the same integer.

slide-45
SLIDE 45

Introduction Some simple C programs The square finder

The square finder

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%d\n",n*n); }

slide-46
SLIDE 46

Introduction Some simple C programs The square finder

The square finder

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%d\n",n*n); }

This program takes an integer n as input and outputs the square n2 of n.

slide-47
SLIDE 47

Introduction Some simple C programs A faulty reciprocal finder

A faulty reciprocal finder

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%d\n",1/n); }

slide-48
SLIDE 48

Introduction Some simple C programs A faulty reciprocal finder

A faulty reciprocal finder

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%d\n",1/n); }

The division 1/n is of integers (quotient).

slide-49
SLIDE 49

Introduction Some simple C programs A faulty reciprocal finder

A faulty reciprocal finder

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%d\n",1/n); }

The division 1/n is of integers (quotient). The format %d is for printing integers.

slide-50
SLIDE 50

Introduction Some simple C programs The correct reciprocal finder

The correct reciprocal finder

#include <stdio.h> main () { int n; scanf("%d",&n); printf("%f\n",1.0/n); }

slide-51
SLIDE 51

Introduction PDS laboratory

PDS Laboratory

slide-52
SLIDE 52

Introduction PDS laboratory Log in

Getting started

slide-53
SLIDE 53

Introduction PDS laboratory Log in

Getting started

Switch on your monitor.

slide-54
SLIDE 54

Introduction PDS laboratory Log in

Getting started

Switch on your monitor. Switch on your PC.

slide-55
SLIDE 55

Introduction PDS laboratory Log in

Getting started

Switch on your monitor. Switch on your PC. Allow the machine to boot. Wait until the log in prompt comes.

slide-56
SLIDE 56

Introduction PDS laboratory Log in

Getting started

Switch on your monitor. Switch on your PC. Allow the machine to boot. Wait until the log in prompt comes. Supply your log-in and password:

Login: s<nn> Password: s<nn> Here s is your section (a for 1, b for 2, and so on) <nn> is the number of your PC.

This opens your window manager (usually KDE) with icons, the bottom panel, and so on. You are now ready to start your work.

slide-57
SLIDE 57

Introduction PDS laboratory Edit, compile and run

Getting started

slide-58
SLIDE 58

Introduction PDS laboratory Edit, compile and run

Getting started

Click on the terminal icon to open a shell (command prompt).

slide-59
SLIDE 59

Introduction PDS laboratory Edit, compile and run

Getting started

Click on the terminal icon to open a shell (command prompt). Edit your program (new or already existing) by an editor.

emacs myprog.c &

slide-60
SLIDE 60

Introduction PDS laboratory Edit, compile and run

Getting started

Click on the terminal icon to open a shell (command prompt). Edit your program (new or already existing) by an editor.

emacs myprog.c &

Write your program in the editor and save it.

slide-61
SLIDE 61

Introduction PDS laboratory Edit, compile and run

Getting started

Click on the terminal icon to open a shell (command prompt). Edit your program (new or already existing) by an editor.

emacs myprog.c &

Write your program in the editor and save it. Go to the shell and compile your program:

cc myprog.c

If compilation is successful, an executable called a.out will be created.

slide-62
SLIDE 62

Introduction PDS laboratory Edit, compile and run

Getting started

Click on the terminal icon to open a shell (command prompt). Edit your program (new or already existing) by an editor.

emacs myprog.c &

Write your program in the editor and save it. Go to the shell and compile your program:

cc myprog.c

If compilation is successful, an executable called a.out will be created. Run your program:

./a.out

slide-63
SLIDE 63

Introduction PDS laboratory Edit, compile and run

Getting started

Click on the terminal icon to open a shell (command prompt). Edit your program (new or already existing) by an editor.

emacs myprog.c &

Write your program in the editor and save it. Go to the shell and compile your program:

cc myprog.c

If compilation is successful, an executable called a.out will be created. Run your program:

./a.out

Continue your edit-compile-debug-run-debug cycle.

slide-64
SLIDE 64

Introduction PDS laboratory Shut down

Getting started

slide-65
SLIDE 65

Introduction PDS laboratory Shut down

Getting started

Close all the windows you opened.

slide-66
SLIDE 66

Introduction PDS laboratory Shut down

Getting started

Close all the windows you opened. Log out from your window manager. This leaves you again in the log-in console.

slide-67
SLIDE 67

Introduction PDS laboratory Shut down

Getting started

Close all the windows you opened. Log out from your window manager. This leaves you again in the log-in console. Select the item to shut down the machine. Wait until the machine completely shuts down.

slide-68
SLIDE 68

Introduction PDS laboratory Shut down

Getting started

Close all the windows you opened. Log out from your window manager. This leaves you again in the log-in console. Select the item to shut down the machine. Wait until the machine completely shuts down. Switch off your monitor.

slide-69
SLIDE 69

Introduction PDS laboratory Using emacs

Using emacs

slide-70
SLIDE 70

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor.

slide-71
SLIDE 71

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c &

slide-72
SLIDE 72

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c & Type in your program in the text area

slide-73
SLIDE 73

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c & Type in your program in the text area Navigate with mouse and cursor keys

slide-74
SLIDE 74

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c & Type in your program in the text area Navigate with mouse and cursor keys Save your file before closing emacs.

slide-75
SLIDE 75

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c & Type in your program in the text area Navigate with mouse and cursor keys Save your file before closing emacs.

“File -> Save (Current buffer)”

slide-76
SLIDE 76

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c & Type in your program in the text area Navigate with mouse and cursor keys Save your file before closing emacs.

“File -> Save (Current buffer)” Click the save button (disk)

slide-77
SLIDE 77

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c & Type in your program in the text area Navigate with mouse and cursor keys Save your file before closing emacs.

“File -> Save (Current buffer)” Click the save button (disk) “File -> Save buffer as” (to another file)

slide-78
SLIDE 78

Introduction PDS laboratory Using emacs

Using emacs

emacs is a powerful text editor. Run emacs as: emacs myprog.c & Type in your program in the text area Navigate with mouse and cursor keys Save your file before closing emacs.

“File -> Save (Current buffer)” Click the save button (disk) “File -> Save buffer as” (to another file)

Save your file once in every 15 minutes.

slide-79
SLIDE 79

Introduction PDS laboratory Using gvim

Using gvim

slide-80
SLIDE 80

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor.

slide-81
SLIDE 81

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c

slide-82
SLIDE 82

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c Hit Insert before you start typing matter

slide-83
SLIDE 83

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c Hit Insert before you start typing matter You will exit the insert mode if you hit Insert when you are already in the insert mode

slide-84
SLIDE 84

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c Hit Insert before you start typing matter You will exit the insert mode if you hit Insert when you are already in the insert mode Hit Esc to exit insert mode

slide-85
SLIDE 85

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c Hit Insert before you start typing matter You will exit the insert mode if you hit Insert when you are already in the insert mode Hit Esc to exit insert mode When in doubt, it is safe to hit Esc several times to come back to view mode

slide-86
SLIDE 86

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c Hit Insert before you start typing matter You will exit the insert mode if you hit Insert when you are already in the insert mode Hit Esc to exit insert mode When in doubt, it is safe to hit Esc several times to come back to view mode Navigate with mouse and cursor keys

slide-87
SLIDE 87

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c Hit Insert before you start typing matter You will exit the insert mode if you hit Insert when you are already in the insert mode Hit Esc to exit insert mode When in doubt, it is safe to hit Esc several times to come back to view mode Navigate with mouse and cursor keys You need to save the file by clicking on the appropriate icon (disk).

slide-88
SLIDE 88

Introduction PDS laboratory Using gvim

Using gvim

gvim is another powerful text editor. Run gvim as: gvim myprog.c Hit Insert before you start typing matter You will exit the insert mode if you hit Insert when you are already in the insert mode Hit Esc to exit insert mode When in doubt, it is safe to hit Esc several times to come back to view mode Navigate with mouse and cursor keys You need to save the file by clicking on the appropriate icon (disk). Save your file once in every 15 minutes.

slide-89
SLIDE 89

Introduction PDS laboratory A practice program

A practice program

#include <stdio.h> char name[100]; int i; main () { printf("Hello, may I know your full name? "); scanf("%s",name); printf("Welcome %s.\n",name); printf("Your name printed backward is : "); for (i=strlen(name)-1; i>=0; --i) printf("%c",name[i]); printf("\n"); }

slide-90
SLIDE 90

Introduction PDS laboratory A corrected version

A practice program (corrected)

#include <stdio.h> char name[100]; int i; main () { printf("Hello, may I know your full name? "); fgets(name,100,stdin); name[strlen(name)-1] = ’\0’; printf("Welcome %s.\n",name); printf("Your name printed backward is : "); for (i=strlen(name)-1; i>=0; --i) printf("%c",name[i]); printf("\n"); }

slide-91
SLIDE 91

Introduction PDS laboratory Using a web browser

Using a web browser

slide-92
SLIDE 92

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror.

slide-93
SLIDE 93

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror. Set a proxy:

slide-94
SLIDE 94

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror. Set a proxy:

10.3.100.211:8080 10.3.100.212:8080 144.16.192.218:8080 144.16.192.245:8080 144.16.192.247:8080

slide-95
SLIDE 95

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror. Set a proxy:

10.3.100.211:8080 10.3.100.212:8080 144.16.192.218:8080 144.16.192.245:8080 144.16.192.247:8080

Bypass proxy for local machines.

slide-96
SLIDE 96

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror. Set a proxy:

10.3.100.211:8080 10.3.100.212:8080 144.16.192.218:8080 144.16.192.245:8080 144.16.192.247:8080

Bypass proxy for local machines. Type in a URL (web address) in the location field

slide-97
SLIDE 97

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror. Set a proxy:

10.3.100.211:8080 10.3.100.212:8080 144.16.192.218:8080 144.16.192.245:8080 144.16.192.247:8080

Bypass proxy for local machines. Type in a URL (web address) in the location field

http://cse.iitkgp.ac.in/∼pds/

slide-98
SLIDE 98

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror. Set a proxy:

10.3.100.211:8080 10.3.100.212:8080 144.16.192.218:8080 144.16.192.245:8080 144.16.192.247:8080

Bypass proxy for local machines. Type in a URL (web address) in the location field

http://cse.iitkgp.ac.in/∼pds/ http://cse.iitkgp.ac.in/∼pds/semester/2010a/

slide-99
SLIDE 99

Introduction PDS laboratory Using a web browser

Using a web browser

Open a web browser: mozilla or konqueror. Set a proxy:

10.3.100.211:8080 10.3.100.212:8080 144.16.192.218:8080 144.16.192.245:8080 144.16.192.247:8080

Bypass proxy for local machines. Type in a URL (web address) in the location field

http://cse.iitkgp.ac.in/∼pds/ http://cse.iitkgp.ac.in/∼pds/semester/2010a/ http://cse.iitkgp.ac.in/∼pds/notes/

slide-100
SLIDE 100

Introduction PDS laboratory Assignments and submissions

Assignments and submissions

slide-101
SLIDE 101

Introduction PDS laboratory Assignments and submissions

Assignments and submissions

Click the link on the day’s assignment.

slide-102
SLIDE 102

Introduction PDS laboratory Assignments and submissions

Assignments and submissions

Click the link on the day’s assignment. If your assignment is a PDF file, save it to your machine.

slide-103
SLIDE 103

Introduction PDS laboratory Assignments and submissions

Assignments and submissions

Click the link on the day’s assignment. If your assignment is a PDF file, save it to your machine. Use xpdf in order to view PDF files.

xpdf newassgn.pdf

slide-104
SLIDE 104

Introduction PDS laboratory Assignments and submissions

Assignments and submissions

Click the link on the day’s assignment. If your assignment is a PDF file, save it to your machine. Use xpdf in order to view PDF files.

xpdf newassgn.pdf

Consult your lab instructor to know how to submit your programs.

slide-105
SLIDE 105

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

slide-106
SLIDE 106

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs

slide-107
SLIDE 107

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/

slide-108
SLIDE 108

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../

slide-109
SLIDE 109

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../ List all files in a directory: ls -lF

slide-110
SLIDE 110

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../ List all files in a directory: ls -lF View a file: cat filename

slide-111
SLIDE 111

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../ List all files in a directory: ls -lF View a file: cat filename Copy a file to another: cp file1.c file2.c

slide-112
SLIDE 112

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../ List all files in a directory: ls -lF View a file: cat filename Copy a file to another: cp file1.c file2.c Copy a file to a directory: cp file1.c progs/file3.c

slide-113
SLIDE 113

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../ List all files in a directory: ls -lF View a file: cat filename Copy a file to another: cp file1.c file2.c Copy a file to a directory: cp file1.c progs/file3.c Move a file to another: mv file1.c file2.c

slide-114
SLIDE 114

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../ List all files in a directory: ls -lF View a file: cat filename Copy a file to another: cp file1.c file2.c Copy a file to a directory: cp file1.c progs/file3.c Move a file to another: mv file1.c file2.c Move a file to a directory: mv file1.c progs/file3.c

slide-115
SLIDE 115

Introduction PDS laboratory Some useful Unix commands

Some useful Unix commands

Create a directory: mkdir progs Go to a new directory: cd progs/ Go to the parent directory: cd ../ List all files in a directory: ls -lF View a file: cat filename Copy a file to another: cp file1.c file2.c Copy a file to a directory: cp file1.c progs/file3.c Move a file to another: mv file1.c file2.c Move a file to a directory: mv file1.c progs/file3.c Delete a file: rm filename