Files and Directories: ls and touch

Prof. Brian D. Davison

Computer Science & Engineering, Lehigh University

Announcements

Writing ls (using same approach)

Directories

Reading Directories

Using Directory Functions

Writing first version of ls.c

main()
    opendir()
    while ( readdir() )
       print d_name

    closedir()
    return 0

Something a little different

How well does our ls work?

First, let's consider the utility touch(1)

How do we add -l to our ls?

How does stat() work?

How well does our ls -l work?

Where are type and permissions stored?

Bits and subfields

UIDs and GIDs