Skip to main content

12.3) Searching (cont'd)


Or perhaps you want to search all files in the current directory for a value of ‘0.43’, then type:

grep ‘0.43’ *

What about if you want to search inside all files in your current directory and all the files in directories below where you are in the directory tree? You can do this on many but not all computers. Some system administrators restrict the following command but if it is available then it can be useful on your system. It does take a lot of resource for the computer to search inside all files across your whole directory tree so use it sparingly. It can be tried with putting a –r option to indicate to search recursively. Note, if you have a lot of files and a lot of directories then you may want to abandon the command if it takes too long. You can cancel any Unix command by pressing the ‘ctrl’ and ‘c’ buttons at the same time and releasing.

To cancel any Unix command if it is taking too long or perhaps isn’t working as you expect then type: ‘ctrl’ and hold down the ‘c’ button at the same time.