如何从 powershell 控制台查看日志文件? (即 powershell 相当于“less”)
powershell 中“更少”的等价物是什么?
我看到“更多”,但它缺少我依赖的一些功能(例如搜索文件)
我寻找一个寻呼机(相当于“更少”),它允许搜索(匹配或忽略大小写)、一次多个文件等 。
我们的一些服务器运行 Windows 2008,而我缺乏安装 cygwin 的管理员权限
我听说过 Windows 2008,MSFT 联合起来并提供了一些易于管理的工具。
更新:
我应该给出一些背景信息:
- 我对 power shell 知之甚少
- 新的服务器上有 2008
- 虽然我喜欢以前的许多工具,但 dos 提示符不是其中之一
- 我希望 Powershell 具有相当于 grep,ls, less、xargs 等
- 我知道 powershell 为我们提供了这些工具,
- 我很快就提出了我的问题。
谢谢
What is the powershell equivalent of 'less'?
I see 'more', but it lacks some of the features I rely on (e.g. searching through the file)
I seek a pager (equivalent of 'less') which allows searching (match or ignore case), multiple files at once, etc.
Some of our servers run windows 2008 and I lack admin privileges to install cygwin
I had heard windows 2008, MSFT got their act together and provided some easy-for-admins tools.
Update:
I should give some context:
- I know little about power shell
- New servers have 2008 on them
- While I affection for many tools of yore, the dos prompt is not one of them
- I was hoping that Powershell had the equivalent of grep,ls,less, xargs, et
- I understood that powershell gave us those tools
- I fired off my question quickly.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
它读起来就像你知道你可以这样做:
(GC 是 Get-Content 的别名)。
您也许可以进行过滤等操作。可以通过运行以下命令找到更多信息:
(Get-Help gc 也可以正常工作)。
您可能感兴趣的位是限制\过滤器等...
It reads like you know you can do this:
(GC is an alias for Get-Content).
You may be able to do the filtering etc.. with this more information can be found by running these commands:
(Get-Help gc would work fine as well).
And the bits you may be interested in are limit\filter etc...
我只是使用 less 的 GOW 版本,工作正常。
I just use the GOW version of less, works fine.
我不知道在 powershell 中有任何直接类似的 less 可以轻松实现。你最好的选择是获得 less 的 Windows 实现,即 cygwin 之外的,这样您只需将二进制文件放入您的帐户可访问的位置即可。
I don't know of any direct analogue for less in powershell that you can implement easily. Your best bet is to get a windows implementation of less that is outside of cygwin, that way you can just drop in the binary somewhere accessible to your account.
要在 powershell 中获取 grep/vim/wget 和其他类似 Linux 的命令,我建议运行。
然后
获取所有这些的列表
to get grep/vim/wget and other Linux like commands in powershell I suggest running.
then
and to get a list of all of them
在 Windows 10 PowerShell + Cygwin 中,我使用:
以前我尝试直接使用 cygwin:
但由于 32b 位和 64 位之间的字符集设置无效,它显示了二进制文件。
In Windows 10 PowerShell + Cygwin I use:
Previously I was trying to use cygwin directly:
but it shows binary file because of invalid charset setting between 32b-bit and 64-bit.
如果您错过了这个 问题(得票最高)您可能会喜欢这个答案。
In the case you missed this question (top voted) you might enjoy this answer.