Sams Teach (Web hosting service) Yourself Shell Programming in 24 Hours
Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 18: Miscellaneous Tools Previous Chapter Next Chapter Sections in this Chapter: The eval Command The expr Command The : Command The bc Command The type Command remsh/rsh/rcmd/remote (Remote Shell) The sleep Command Summary The find Command Questions xargs Terms Previous Section Next Section The find Command find: Starting Directory find: Combining Options find: -name Option find: Negating Options find: -type Option find: -print Action find: -mtime, -atime, -ctime find: -exec Action find: -size Option The find command is a very powerful, very flexible way to create a list of files that match given criteria. The basic syntax is find start-dir options actions Here is a simple find example: find / -name alpha -print This example looks for all files named alpha and displays the full pathname to the screen (standard output). It is a useful command to know about when you are sure you have a file named alpha but can’t remember what directory it is in or want to know whether it exists in more than one directory. Here is some possible output from that command: /reports/1998/alpha /reports/1998/region2/alpha /tmp/alpha I will shortly cover the elements of the find command in detail. Files can be selected not only by name but also by size, last modification date, last access date, and so on. First let me give you a more complex example with a brief explanation of each part of the example, so you get a sense of what options and actions look like: find /reports/1998 -name alpha -type f -print -exec lp {} ; Table 18.1 provides a breakdown of these elements. Table 18.1 A Sample find Command Command Element Description
In case you need quality webspace to host and run your web applications, try our personal web hosting services.