Find the answer to your Linux question:
Results 1 to 3 of 3
Hey, how can I find a specific text in any file on my system? Ive tryed this Bash Line (script) su root -c "time grep "find / "|cowsay" And Ive ...
  1. #1
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422

    Find text in files

    Hey, how can I find a specific text in any file on my system?
    Ive tryed this Bash Line (script)
    su root -c "time grep "find / "|cowsay"
    And Ive even tryed it without the Fancy Cow
    su root -c "time grep "find / ""
    Ah, well let me just drop down everything Ive tryed:
    Code:
    su root -c "time grep "find / "|cowsay"
    su root -c "time grep "find / "
    grep "find / "
    grep "find / *"
    grep | find / *
    find / * grep
    Oh, now I might thought of something

    Code:
    #!bin/bash
    
    find / >> TempListofFiles
    grep cat TempListofFiles
    rm TempListofFiles
    Damn doens work either :/

    Well, how to do this?
    Since Ive spread one file all over the place and I need to remove them all -.-'

    Thanks,
    Robin
    New Users, please read this..
    Google first, then ask..

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    To check every file on the system:

    Code:
    find / -type f -exec grep -l "text to look for" {} \;

  3. #3
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    Quote Originally Posted by vsemaska View Post
    To check every file on the system:

    Code:
    find / -type f -exec grep -l "text to look for" {} \;
    its faster to use xargs
    Code:
    find / -type f -print0 | xargs -0 grep -l "test"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...