Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If I run

sudo pico /var/log/lighttpd/website/error.log

I get a very long file, and I cannot see last lines. If I run:

sudo tail -f /var/log/lighttpd/website/error.log | awk '{print $1 "--"  $2}'

I don't get anything ? What am I doing wrong ?

Also, how can I move to a specific line using pico editor ?

thanks

share|improve this question
    
Your commands work for me. How long is "very long"? (eg. how many lines? or MB or GB?) .. You have used tail -f, so I assume the file is growing. Is it growing very rapidly? .. and by the way, in Ubuntu pico is actually nano. To see this, run: readlink -e $(which pico) .. I've not used pico/nano before, but the man page only mentions a commandline option to open the file at a specific line,column, eg. pico +1000,7 filename ... PS.. it does take quite a while for the tail/awk combo to catch up with the new line additons when I add many lines very fast. This may be the proplem –  Peter.O Mar 23 '11 at 11:55
add comment

2 Answers

up vote 2 down vote accepted

Using nano for logfiles is not recommended as it loads the whole file into the memory. Use less:

less /var/log/lighttpd/website/error.log

Press F to get the effect from tail -f.

share|improve this answer
add comment

If you want to read only the last lines of the log use tail -aNumber /var/log/lighttpd/website/error.log

Replacing aNumber with the number of lines you want to see.

If you want to see the whole file use vi /var/log/lighttpd/website/error.log you could also use nano, it´s easier...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.