Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

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

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”

0
mbayader
Asked:
mbayader
2 Solutions
 
bobgunzelCommented:
tail -n2000 filename.log | more
If less is installed then use less instead of more. Less allows you to browse upwards.
0
 
pjedmondCommented:
or:

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.

HTH:)
0
 
mbayaderAuthor Commented:
Many thanks guys, that was good.
Best regards,
Miss "B"
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now