Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the ack tool to find string or IP address in file system

but please see the follwoing

why ack not find the IP = under /etc/sysconfig/*

the IP = 1: exist under network dir in uoo file


./ack -r  /etc/sysconfig/*
   <not get anything?>

./ack -r  /etc/sysconfig/network/*

example of uoo file

 more /etc/sysconfig/network/uoo
share|improve this question
up vote 0 down vote accepted

Did you try 'ack -a'?

From BetterThanGrep,

 -a, --all-types       All file types searched;

Option -r is not required (afaik) default behavior is recursive.
To turn off recursion you use the '-n' option.

Now, to check if the '-a' is going to help you,
Try your command with the '-l' option (instead of the '-r' option).
Then try it again with the '-L' option.

You will figure what is going on based on where the 'uoo' file shows up in your search results.

Here is what happens,

-l, --files-with-matches
                        Only print filenames containing matches
-L, --files-without-matches
                        Only print filenames with no matches

So, if your file does not show up on either of these forms, you need to add in the '-a' option
(ack is more powerful than grep but its also a bit tricky).

share|improve this answer
Even better than -a is --text. – Andy Lester Sep 7 '10 at 14:17

By default, ack goes on whitelists of filetypes. If ack doesn't see the file as a certain type, then it ignores it.

Ack is really a programmer's tool, not a sysadmin tool.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.