Monitoring very large (log)files can be done very easily with BareGrep and BareTail. Those very little applications can make a big difference when it comes to productivity and speed during monitoring of production critical systems.
Baretail free download, and many more programs. I also like BareTail. It is a Windows tool that emulates the basic behaviour of tail with the -f follow flag in Linux in its ability to display the contents of a file as it gets written to. It also has some other useful features, such as the ability to highlight lines in a file that it is tracing based on the content of the line. I found Bare Metal's BareTail, which I'm having difficulty configuring. I have written a simple batch to execute & open the log file but it is not able to, which is not very surprising, as the server needs a username/password which I don't know how to specify.
Although the applications are running fine, I was often missing some small extra features. So I made some small AutoHotKey script to get what I wanted:
- Within BareGrep: press Ctrl+Shift+U: open the file in UltraEdit and scroll to the line that was selected within BareGrep
- Within BareGrep: press Ctrl+Shift+F: open the selected file in BareTail and find the selected line.
My complete automated setup of BareTail+ can be downloaded here. All source files are included.
Tested on Windows XP, no uninstaller available.
Update 14/09/2010: new version of AutoHotKeyScript with properties for paths of BareGrep, BareTail and editor. New version of the 'grep this folder' explorer integration.
Update 23/11/2010 v1.1: new version with support for Notepad++ editor linenumber syntax ( -n)
Update 10/03/2016 v2.0: new version with support for Ctrl+Shift+e to view selected file in Explorer, Ctrl+Shift+N (same as Ctrl+Shift+U) open selected file in text editor, integrate admin elevation when enabling or disabling explorer integration to write to registry, store user config in %userprofile% dir instead of program files dir so no admin elevation is required for preference update and config storage.
PowerShell is a powerful tool and it enables the Windows servers to compete with the Shell and Linux command line features. One of the useful command in linux is tail which helps us to view the file as it gets updated mostly used to view the log files.
Baretail Free Download
For instance, we start a service and we want to know if the service is coming up and check the errors in the log file, live without having to re-open the file.
Until I was introduced to this PowerShell command method, I was using either baretail
or notepad++
to tail the log files in Windows
PowerShell tail Command Get-Content
Powershell has a command named Get-Content
it exactly does the job as it was named after. It gets content from the file. This command has a flag
or attribute named Tail
which make it equivalent to the Linux tail command
Here is a simple tail command equivalent windows powershell Get-Content command.
Execution result of the preceding command is given below.
PowerShell tail -f Command Get-Content
Baretail Weekend
the wonderful feature of tail is to watch for changes as it happens and see the live logs as it is getting updated. which is done using a -f
flag in Linux tail command
In windows, the same is achieved with another flag/option named Wait
here is the windows PowerShell tail -f command equivalent Get-Content command
In fact, it is the same command as previous but an extra -Wait
has been added.
As shown in the screenshot you can see the cursor is at the end of the file it has not returned to terminal and monitoring (or) waiting for more lines to come.
Baretail Logging
Conclusion
Hope this article helped you to find the Linux Equivalent Windows find command in Powershell and now you know how to tail the log file in windows without using any special tools like baretail etc.
Cheers
Sarav
Follow us on Facebook or Twitter
For more practical videos and tutorials. Subscribe to our channel
Find me on Linkedin My Profile
For any Consultation or to hire us hello@gritfy.com
If you like this article. Show your Support! Buy me a Coffee.
Signup for Exclusive 'Subscriber-only' Content
More from Middleware Inventory
Baretail Alternative
- Powershell Find String in file - How to use windows find command
If you are here, Then you might have had a similar requirement I had, which is to find a specific file across multiple directories and to grep or Search for a string present in that file. ( more like what we do with xargs in Linux) I am a Linux…
- Netstat command windows - Usage and Examples
Introduction Like Linux, Windows does have a netstat command and it can come handy when you are in need of network-related monitoring and troubleshooting. Consider you have any of the following requirement How to find who or which process owns the port in Windows Server To see how many HTTP/DB…
- Arbitary File Download Vulnerability
Overview Some websites may provide file viewing or download functionality because of business needs. If you do not limit user from viewing or downloading files, a malicious user may attempt to view or download any file from your server. Attackers may construct malicious requests to download sensitive files from the…
- Stop, Start, Restart Windows Service Command Line - How to
Windows Service management through the command line is really a good approach when you want to manage plenty of services and perform day to day actions like stop, start and restart I think you would agree, If I say GUI is fun for entry-level but when it comes to performing the…
- ansible search for string in file or check if string exists in file
The Objective of this post is to show how to search for a string in a file with ansible. ansible provides various ways to accomplish the same. We will cover, three major ways to search for a string in a file. Lineinfile module Using the Shell module and grep command…