The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Find and replace via SSH

Discussion in 'General Discussion' started by marquis_ce, Apr 21, 2008.

  1. marquis_ce

    marquis_ce Member

    Joined:
    Apr 11, 2008
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    It is possible to find a spesific file in whole server

    PHP:
    find / | grep index.html
    and also it is possible to delete a spesific file in whole server

    PHP:
    find / -name index.html -type f -ls -exec rm -{} \; 
    I wonder if it is possible to find a word in source code of all html files in the server.
    For example i want to change a bg color of a site in all html pages.
     
  2. troxalias

    troxalias Well-Known Member

    Joined:
    Nov 21, 2001
    Messages:
    96
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Athens - Greece
    If your are using a recent linux version you can execute the following to search all files recursively under the current directory.
    Code:
    grep -R bgcolor * 
    Alternatively you can execute
    Code:
    find / -name \* -exec grep -R {} \;
     
Loading...

Share This Page