Help File
Wish List


Hosted by:
  VA Linux


What Is Hawk / Ftwalk?

Ftwalk is several things rolled into one:

  1. A complete replacement for the venerable UNIX find command.
  2. A powerful extension to the generally marvelous UNIX awk program.
  3. A script language every bit as powerful as Perl et al., but much more familiar to users of well known standards like awk and C++.
  4. An interactive tool which is ideal for calculations, testing programming logic, or exploring UNIX system calls.

Ftwalk was originally conceived of as a merger of the UNIX find and awk programs: a program that searches through the file system for files that meet any criteria, like find, but where the criteria and subsequent actions are specified like awk: as a series of test and action blocks.

For example, if you wanted to search the file system to find all core files that have not been accessed in 7 or more days and remove those files, you might use the following UNIX command:

  find / -name core -atime +7 -exec rm {} \;
In Ftwalk the same command is:

  ftwalk 'name("core") && atime > 7 {remove}' /

For such simple cases Ftwalk is at least more readable, but the advantage of Ftwalk grows considerably when you want to search for more things in a single pass, and especially when you want to do something that find cannot grasp. Consider the following Ftwalk script:

  ftwalk '
    mtime < 7 {x[dirname] += sizeb}
    END       {for (i in x) printf("%8d %s\n", x[i], i)}' $HOME
This script tells you how many disk blocks are used by files that have been modified in the last seven days in each directory under your home directory: a quick first step to finding out where the disk space that you had last week has gone.

The current implementation of Ftwalk goes far beyond the initial concept, adding a rich type system, a wealth of built-in functions, an interactive monitor, on-line hypertext help, and much more.