When debugging, it's nice to be able to easily see only what you want from your application log in real time. For *nix guys this is the norm, but Windows people have been crippled by the cmd.exe shell for ages and don't realise how easy it is. Luckily if you use Git for source control you will have Git Bash and/or Git Shell installed, which have some useful commands you can use.
The first is tail
, which prints the last n lines of an input you give it (10 lines by default). You can use the -f
option to "follow" the input, meaning it will give you nice scrolling text as the file updates assuming you tail a file as input.
Next up is grep
which finds text patterns from an input and prints each line that matches. You can use simple text search grep search
or regex with the -E
option grep -E 'regex'
.
Finally, you should be aware of "pipes" |
, which allow you to pass output from one command into the input of another.
So, to put all this together, let's say you want to watch a log file fo