Viewing a huge for read only and looking for a specific word

Posted on 2006-06-08
Last Modified: 2010-04-20
Hi everyone,
I am working from my windows workstation on VPN to our servers, where have Linux installed. I want to read only a log file, which is huge and I only wan to look at the lat 2000 lines, but when I use the command tail -2000 filename.log  I cant browse up the black window of the VPN to see the rest of the view, so am I doing wrong??
Many thanks
Miss “B”

Question by:mbayader
    LVL 4

    Assisted Solution

    tail -n2000 filename.log | more
    If less is installed then use less instead of more. Less allows you to browse upwards.
    LVL 22

    Accepted Solution


    tail -n2000 filename.log > anotherfile.txt

    You can then view anotherfile.txt in your favourite editor...and also use any search/pattern matching tools rather than just searching through 2000 lines with the naked eye:)

    or...if you are only interested in certain lines:

    tail -n2000 filename.log | grep "interesting error"

    selects only lines containing the text "interesting error". Obviously you can | this to more (or less) or send the output to a file.

    Same applies if you want some lines removed:

    tail -n2000 filename.log | grep -v "boring error"

    Obviously this can be chained:

    tail -n2000 filename.log | grep -v "boring error" | grep -v "boring error2"

    etc. And again you can send this to 'more' or a file.


    Author Comment

    Many thanks guys, that was good.
    Best regards,
    Miss "B"

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now