Tricks Development Web: Use of the GREP

Use of the GREP

Sometimes I am with the problem that I must alter certain Styles CSS of some Web that arrives at my hands. Sometimes with the help of the Firebug or some other tool of developer including in the navigators Web I see the name of div, you go and I can locate certain elements, but with himself not locate concrete file CSS where they are these specific elements in the styles (it does not give to the name of the file nor the route me of file CSS), usually it happens in cases in which I must alter styles of a CMS, Prestashop, Magento€¦ etc.
problem-to find-div
Now what I do? In These CMS usually there are several directories CSS located in different places, the unloading all and I look for div one by one to me €œheader_user_info€? Is Uff that I do not have nor idea of where will be€¦ What oppression, and lost time no? Not you preocupeis!
First of all, to say that already I imagine that there are hundreds of methods to solve this problem, perhaps much more simple of which I explain here, although I believe that to many will interest to them to know the use the GREP, by the enormous amount of resources and exits that it gives you in LINUX (and as the majority of Web servers is in apache with Linux running then perhaps it comes well to know it).
I concretely as I am of the old school in these cases not break much the head and I go to the terminal of Linux and we connected through SSH to our Web server (if, that full window of commandos that we do not understand, you are not scared because she does not bite nor she leaves the screen to strangle to you)

What is Commando GREP?

Commando GREP is a commando of System that therefore works in all the versions of LINUX: Centos, Ubuntu€¦ etc.
He is one of my favourites in LINUX, and him coat hundreds of utilities concatenating it with others in workings of Computer science Systems, but a long time ago I realized that can also be useful in workings of Development Web, and when something touches much to me the noses I do not doubt in going to him.
First of all for the novices in linux to tell them that each commando has his manual including, and we can accede to him writing man.


Commando GREP Busca text chains within All the files or directories who we specify, something that in Windows I believe that we could not do, and we would have to open a text editor and search between all the files (one by one) in which we think that he is including the text chain.

Use of the GREP?

Now if we want we come to enter the route of the servant where he is httpdocs, although if we preferred it we can operate from the root or another directory anyone, I do it I took root by comfort, not to write the routes in each one of the commandos who I write. In my case the route is the following one, this already will depend on where you have created the directory where it is pointing your name of domain.


Now that we are in a level of directory over httpdocs or public of the Web which we are working we executed the Grep of the following way:
Syntax: grep - R €œelement-del-div€ /ruta-del-httpdocs-de-la-web
it means: look for the chain recursivamente to me €œelement-del-div-that-is€ in all the files that are in the directory where it hangs my Web.


And now we see as easily the Grep gives the perfect exit us of commando, pointing the files that contain the text chain corresponding to ours id=€ header_user_info€, easy and simple.
Now I ask to you that you offer different solutions to me from this problem, and thus you help me to complete this article using a mixture of your knowledge and mine.

I hope that this article serves to you as help,
A greeting,
By “scar Carrillo