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!
So, i was having problems with a vps yesterday. For some reason it spend a bunch of memory and cpu on nothing. So i started looking for ways the fix this and how to monitor it all. I fell across this great site which has a bunch of things you can check out. The link is http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html
So ive moved my entire website and all my minor projects to a new fancy vps. Its provided by slicehost which is awesome! From start till finish was about 5 minutes. How fast is that! – just wow…
In my setup i ran into a problem with apt, yes im a Debian when it comes to servers.
So i wanted to setup a new environment with PHP5.3 and MySQL5.1. Since Lenny (latest stable release of Debian) is way behind, as usual, i checked out dotdeb. They provide the latest and greatest in Debian packages, and yes also a PHP .deb pack. So i added the repository but apt wouldnt fetch the php5.3 package. After a few tries with taking out lines from sources.list i tried another apt tool, aptitude which just worked.
In my search for why this was, the great Guillaume Plessis commented on my question and gave me the following link on apt pinning. So i added a few lines in the preferences file and apt-get install now works just as aptitude!
This is also great if you want to run a stable environment but now and then check out the latest and greatest from unstable or testing.