Tag Archives: unix

quick unix tips


When debugging a site, i like to keep a terminal up with the apache error log and access log. This is great and all but having one window for each logfile is kind of a pain. But did you know that you can give it all those files you want and get one output? If you give it more than one file it’ll print an overview with a header displaying the filename.

[code]$ tail -f logs/access.log logs/error.log logs/mysql.queries.log[/code]

-f will keep tail open and update the output uppon new additions


Grep is great when you want to find something specific. But did you know that you can search for a string in multiple files recursive? Say you want to find all files with a giving variable or string just do,

[code]$ grep -lr "string" .[/code]

-l gives you a filename with path
-r is recursive from path giving

Say you want to use a regex pattern you can do so by adding -e

Remember these tools all exists within Linux and Mac OS X!