Windows Powershell中的Unix命令等效项
Windows Powershell中的命令ls-la的等效形式是什么?Windows Powershell中的Unix命令等效项,shell,powershell,command-line,Shell,Powershell,Command Line,Windows Powershell中的命令ls-la的等效形式是什么?Get ChildItem-Force将显示隐藏的项目,但是-la的格式不能在Powershell中直接镜像,尽管它返回的是对象而不是字符串,请使用选择x,y,z获取您要查找的详细信息。对于-l-switch,顺序不正确,但这将让您开始: ls -force|Select-Object attributes, fullname, length, LastAccessTime, LastWriteTime, CreationT
Get ChildItem-Force
将显示隐藏的项目,但是-la
的格式不能在Powershell中直接镜像,尽管它返回的是对象而不是字符串,请使用选择x,y,z
获取您要查找的详细信息。对于-l
-switch,顺序不正确,但这将让您开始:
ls -force|Select-Object attributes, fullname, length, LastAccessTime, LastWriteTime, CreationTime, @{N='Owner';E={$_.GetAccessControl().Owner}}|Format-Table
要查看哪些属性可用于选择对象
,可以使用以下选项:
Get-ChildItem -force|Get-Member -MemberType Properties
正如Clijsters在评论中指出的那样:如果您使用的是linux,
ls
可能不是有效的Powershell别名,因此请使用Get ChildItem
或gci
Get命令ls | Get Help
。在PowerShell中,您可以使用ls
作为Get ChildItem
和Get Help
的别名来学习如何使用它。@Clijsters由于这是某种unix问题,Get Help的-full
将更好地模拟手册页;)Get命令ls | Get Help-full
或更短并分页:Help-full ls
更有趣的是,我在示例中使用了ls
,并告诉您不要在示例中使用ls
。。。现在我很困惑,如果我错了,我建议不要在您的示例中使用ls
,因为在linux的PowerShell上,它不是Get ChildItem
@Clijsters的别名。谢谢您的提示,添加了更多信息。