Discussion Locked

AIX Query

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I need to query an AIX file system for specific text. Is there a simple command line for this?

4 replies

by stillatit

1. You can look for text occurring in any file in any specific directory using the grep command.

grep "text to find"

example: grep foo *

2. You can look for text occurring in file names anywhere on the structure with the find command.

find -name "*foo*" -print

3. If you are willing to have your machine read every file on your disk, you can combine these. You will have to go to the main page to double-check the syntax, but it is something like:

find / -exec \ grep "text to find" {} \;

or

find / -print -exec \ grep "text to find" {} \;

You can restrict the search to certain file names by adding a -name clause.

Note that if you have a large system this can take a VERY long time.

Note that if you do not run this as root, you will get error messages for each file and directory you cannot access.

Good luck.

This discussion is closed to new replies.