13 windows shell command-line-interface
很多时候我发现自己必须遵循Windows上日志文件的演变.有没有相当于Linux
tail -f <filename>
Run Code Online (Sandbox Code Playgroud)
在Windows终端上执行命令,最好不必安装外部软件?其他SO帖子谈论安装第三方程序.
nik*_*lia 15
在Powershell中,您可以将Get-Content与-Wait标志一起使用:
Get-Content filename.log -Wait
您可以将Get-Content缩短为gc.这个问题表明可能的重复有一个答案,提到这个和一些有用的额外参数 - 请参阅/sf/answers/13168851/.我不确定它是否真的是重复的,因为这个问题是关于Linux的一般Windows替代品tail,而不是tail -f.
是的。您可以在 Windows 上使用tail,只需付出很小的代价即可在 Windows 和tail. 因为它与 捆绑在一起git for windows,所以它经过了严格的测试并且稳定。
git-bash首先从https://gitforwindows.org/安装
接下来,git-bash使用 Windows 路径并重新启动工作站:
setx path "%path%;C:\Program Files\Git\bin\"
现在,您应该能够使用tail -n 20 -F logging_file.logtail 任何文件并显示最后 20 行。
如果您使用的是 Linux/Unix 并且想要连续查看日志,可以使用以下命令:
ssh username@10.15.3.3 'bash -c "tail -n 20 -F /c/Users/username/Desktop/logging_file.log"'
我知道你说没有外部程序。但是对于已经安装了Windows Subsystem for Linux (WSL)的人来说,他们无法tail在 Ubuntu 16.04 LTS 中正常工作,我发现这个帖子有人找到了解决方法:
如果有人通过 Google 发现这一点,似乎 WSL 中的 inotify 支持仅限于 WSL 文件访问,而不是 win32 文件访问,因此您必须告诉 tail 不要使用它:
Run Code Online (Sandbox Code Playgroud)tail -f /mnt/c/path/to/file ---disable-inotify(是的,三个破折号)
| 归档时间: |
|
| 查看次数: |
12771 次 |
| 最近记录: |