grep
command searches a
list of files for a string. A typical use might be:
grep mydefs.h *.c
If you have ever forgotten to change a header file in one of your
source files, and you don't know about grep
, it's time to
learn. There are heaps of options, so start by reading the
man page.
find
recursively searches
the filesystem from a specified start point, matches files based on
various criteria , and performs operations on the matched files. The
simplest use is to "find" files (duh...):
find . -name wander.c -print
find /comp -name *.o -exec rm {}
The first command searches from the current directory, matches files named wander.c and prints their locations. The second example searches everywhere below /comp for .o files, and deletes them. (Typed in at the command line, you would have to escape all the meta-characters.) As usual, there are a million options, so start by scanning the man page.
diff
that compares two files, and
shows the difference between them (sort of). The only problem is that
the language diff
reports in is sed
, which
makes it a bit obtuse. Enter xdiff
and
gdiff
, which do the same thing, except the report is a
color coded, and graphically displayed. Much better for humans! There
are differences between them, but mostly it boils down to whether you
like GNU utilities or X11 utilities better.Example: Oops, lemma 3.1.4 is false. The following command helps you decide which end from which to start fixing it.
xdiff paper.tex paper.tex~
less
is a better more. In
particular, it lets you backup in a document. Your first step is scan
the man page and try it once. Your second step will
then be to alias "more" to "less".
Comments to:
webmaster@geom.umn.edu
Created: Fri Sep 8 11:39:00 1995 ---
Last modified: Jun 18 1996