Search the Community
Showing results for tags 'grep'.
Found 1 result
-
Among the many reasons every web developer should want SSH from a web host, like security, is the ability to edit your web pages directly from the command line. With shell access, you can use the myriad of GNU/Linux system tools to exercise complete control and domination over your web site. Here are some of the tools I use most often: Vim (or vi) This is the first text editor I ever learned to use. Among the functions in vi that I use most often are "set nu" to show line numbers, "%s/<text to replace>/<replacement text>/g" to replace all matching text in a file, "r <filename>" to read a file and insert it into the current file at the line after the cursor, and "/" to search for a string. Emacs I used emacs for a few college courses, but I was always more comfortable with vi, so I didn't stick with emacs. However, in recent years, I've been discovering some of the wonderful features in emacs, like the ability to write your own commands in elisp and the alt+q command to automatically insert line breaks -- a feature that I have found to be indispensible. grep When your web site grows in the number of files, grep comes in handy when you want to find some specific text, and determine which file contains that text. For example, if I want to edit the style for a specific div id or class, and I have multiple stylesheets, I can use the following command to list all the files that contain the div id I'm looking for. grep -l <text to find> ./*.css (the l option tells grep to list the file names of the css files that contain the text in the place of <text to find>.