grep all the files in the system

I have a following grep(1) command running on FreeBSD 8.0 machine:

[Cmd=]grep -s -r -I -D skip 'string' /[/Cmd]

As I understand, it should ignore binary files, FIFO's and sockets. It has been running more than 48h on my 60GiB HDD and if I check the I/O usage with "top -m io -o total", the grep(PID 26858) has very low I/O usage:

Code:
  PID USERNAME     VCSW  IVCSW   READ  WRITE  FAULT  TOTAL PERCENT COMMAND
  105 root            0      0      0      0      0      0   0.00% adjkerntz
62193 user            1      1      0      0      0      0   0.00% top
62166 user            0      0      0      0      0      0   0.00% sleep
62085 user            0      0      0      0      0      0   0.00% bash
62041 root            0      0      0      0      0      0   0.00% cron
61875 user            0      0      0      0      0      0   0.00% more
61874 user            0      0      0      0      0      0   0.00% zcat
61873 user            0      0      0      0      0      0   0.00% sh
61872 user            0      0      0      0      0      0   0.00% man
61711 user            0      0      0      0      0      0   0.00% sleep
26858 user            0      0      0      0      0      0   0.00% grep


It looks like this grep command actually does not process all the files in the system. Any ideas what might cause this? :OOO
 
Are you using the base grep or the one maybe at /usr/local/bin/grep? The latter hangs some port builds here, for instance.
 
-s may have suppressed a message that would tell what is happening. Check your swap usage. find(1) with -exec grep {} \+ might be better suited. Directories could be excluded, too.
 
jb_fvwm2 said:
Are you using the base grep or the one maybe at /usr/local/bin/grep? The latter hangs some port builds here, for instance.

It is FreeBSD 6.4, grep(1) version is 2.5.1 and it is located in /usr/bin/grep. Unfortunately, I'm not able to upgrade grep(1).


wblock@ said:
-s may have suppressed a message that would tell what is happening. Check your swap usage. find(1) with -exec grep {} \+ might be better suited. Directories could be excluded, too.

I tried without the -s key and last file it handles is /dev/cuad0:

Code:
grep: /dev/klog: Device busy
grep: /dev/ctty: Device not configured
grep: /dev/io: Operation not permitted
grep: /dev/uflash: Device not configured
grep: /dev/cuad0: Device busy


Swap info is following:

Code:
[user@router ~]$ swapinfo -k 1K
Device          1K-blocks     Used    Avail Capacity
/dev/ad6s1b       2043576  1116372   927204    55%
[user@router ~]$
 
28513479.jpg


Sorry, it was obligatory.
 
SirDice said:
Sigh.. FreeBSD 6.4 went End-of-Life in November 2010 and is not supported anymore.

But in your first post you talked about FreeBSD 8.0, which also has been End-of-Life since November 2010.

So, which one is it?

http://www.freebsd.org/security/#unsup

I tried the "grep -r -I -D skip 'string' /" with both FreeBSD 8.0 and FreeBSD 6.4. On a FreeBSD 6.4 it's stuck after the "/dev/cuad0" file. Unfortunately, there seems to be no way to check which file it's currently processing? There is no lsof present.

PS: it is a Juniper router with JUNOS which uses FreeBSD 6.4 :)
 
m4rtin said:
it is a Juniper router with JUNOS which uses FreeBSD 6.4 :)
JunOS is based on FreeBSD but that's pretty much where the comparison ends. It has absolutely nothing to do with FreeBSD.

If this is really a question about JunOS I'm going to close the thread.
 
Back
Top