technical documents

webmaster housekeeping

Posted by: Dan on February 2, 2008 12:23:54 AM +00:00
Here are some common, simple tasks to help with administrating your websites.

Find that error

Typically, when we're setting up new sites or scripts, we'll encounter some kind of error. To monitor your lighttpd error log for example:

tail -f ~/var/log/lighttpd.error.log

Tail is a command that will display the last few lines of any text file. The -f flag will open tail and keep the log file open - then we go to our browser and refresh, hopefully we'll see the relevant error in the tail output.

Note, to get out of tail -f, press the Ctrl+C key combination.

Some useful variations:

tail -n 100 ~/var/log/lighttpd.error.log

This will display the last 100 lines of the error log on your console. To make it even easier to scan those lines, you can pipe (|) the output to the "less" command and then be able to scroll up and down:

tail -n 100 ~/var/log/lighttpd.error.log | less

Less is handy as a "paging" program for the command line; instead of dumping all 100 lines to your console and scrolling up, less lets you use the up / down arrow keys to scroll up and down. To scroll down a screen at a time, press the "v" key... to scroll up a screen at a time, press the "b" key.

Note, to exit the less program, press the "q" key.


Updated: 05 Apr 10 06:32