grep syntax error?
Hi guys,
I'm studying for LPI, and got to solve this question: Quote:
1) Code:
grep -H -I -i -n -R 'root:x:0:0:root:/root:/bin/bash' / > /var/tmp/output 2> /var/tmp/error Code:
find / -type f | xargs grep -H -I -i -n 'root:x:0:0:root:/root:/bin/bash' > /var/tmp/output 2> /var/tmp/error The problem: both commands doesn't finish.. They hang and I have to kill the processes after 15 minutes... So, how can I solve it? I am expecting 'probably': /etc/passwd inside /var/tmp/output and a lot of denial permission errors inside /var/tmp/error. Right? Thanks in advance! sleep |
Why not let the command complete? You're on the right track
|
Just lost all that I typed so here is the short version... ;)
The following worked for me (as root) Code:
# grep -Rl 'root:x:0:0:root:/root:/bin/bash' / Code:
# find / -type f -exec grep -l 'root:x:0:0:root:/root:/bin/bash' {} \; Hope this helps |
sl33p,
Reduce the problem space. grep in /etc, not / Add the options in one at a time. The grep works properly here but its very slow (I tested on /etc) if you want to process every file on the filesystem maybe 15 min isn't long enough. The fact the the command runs at all, shows the syntax is correct. |
All times are GMT -5. The time now is 05:59 PM. |