Files
ostep-projects/initial-utilities
2018-01-16 10:39:54 -06:00
..

Unix Utilities

In this project, you'll build a few different UNIX utilities, simple versions of commonly used commands like cat, ls, etc. We'll call each of them a slightly different name to avoid confusion; for example, instead of cat, you'll be implementing my-cat.

Objectives:

  • Re-familiarize yourself with the C programming language
  • Learn a little about how UNIX utilities are implemented
  • Learn (as a side effect) how to use a proper code editor such as emacs

my-cat

The program my-cat is a simple program. Generally, it reads a file as specified by the user and prints its contents. A typical usage is as follows:

my-cat main.c

In this case, my-cat will read the file main.c and print out its contents.

You'll need to learn how to use a few library routines from the C standard library (often called libc) to implement the source code for this program, which we'll assume is in a file called my-cat.c. All C code is automatically linked with the C library, which is full of useful functions you can call to implement your program. Learn more about the C library here and perhaps here1.

my-grep

my-zip and my-unzip

my-sort

my-uniq

Footnotes

1: Unfortunately, there is a lot to learn about the C library, but at some point, you've just got to read documentation to learn what is available. Why not now, when you are young? Or, if you are old, why not now, before it's ... ahem ... too late?