Is there an equivalent of tail -f on Windows?
In Powershell you can use Get-Content with the -Wait flag:
Get-Content filename.log -Wait
You can shorten Get-Content to gc
. That question suggested as a possible duplicate has an answer which mentions this and some useful extra parameters -
see https://stackoverflow.com/a/188126. I'm not sure if it's really a duplicate, though, since that question is talking about general Windows alternatives to Linux tail
, rather than about tail -f
.
In Powershell use:
cat .\<file_name> -Tail 10 -Wait
Yes. you can use tail
on windows, which is a small price to pay to get access to a lot of GNU-tools on windows as well as tail
. Because its bundle with git for windows
, its pretty heavily tested and stable.
First install git-bash
from https://gitforwindows.org/
Next, put git-bash
on windows path using and reboot your workstation:
setx path "%path%;C:\Program Files\Git\bin\"
Now, you should be able to use tail -n 20 -F logging_file.log
to tail any file and show the last 20 lines.
If you are on Linux/Unix and you want to continuously see logs you can use the following command:
ssh [email protected] 'bash -c "tail -n 20 -F /c/Users/username/Desktop/logging_file.log"'