commands detail - l

locate

There isn’t a builtin PowerShell version of locate, but Chrissy LeMaire’s has written an Invoke-Locate script, ‘in the spirit of (Linux/Unix) GNU findutils’ locate’. It works really well.

https://gallery.technet.microsoft.com/scriptcenter/Invoke-Locate-PowerShell-0aa2673a

ls

The PowerShell equivalent of the Unix ls is:

1 Get-ChildItem 

… for which there are aliases dir, ls and gci

ls -a

In linux, ls -a displays hidden files as well as ‘normal’ files.

So ls gives:

1 $ ls
2 README.md

but ls -a gives

1 $ ls -a
2 .  ..  .function-prompt.ps1.swp  .git  README.md

The Powershell equivalent of ls -a is get-childitem -force. Here, I’ve used the alias ls

 1 $ ls
 2 
 3 
 4     Directory: C:\Users\matt\Documents\WindowsPowerShell\functions
 5 
 6 Mode                LastWriteTime     Length Name  
 7 ----                -------------     ------ ---- 
 8 -a---        04/06/2015     13:20       1422 README.md
 9 
10 $ ls -force
11 
12     Directory: C:\Users\matt\Documents\WindowsPowerShell\functions
13 
14 
15 Mode                LastWriteTime     Length Name               
16 ----                -------------     ------ ----              
17 d--h-        04/06/2015     13:20            .git             
18 -a-h-        20/05/2015     17:33      12288 .function-prompt.ps1.swp
19 -a---        04/06/2015     13:20       1422 README.md              
ls -ltr

The Powershell equivalent of the unix ls -ltr (or the DOS dir /OD), which lists files last update order.

1 dir c:\folder | sort-object -property lastwritetime

lsusb

The unix command lsusb shows USB devices. The PowerShell equivalent is:

1 gwmi Win32_USBControllerDevice

gwmi is an alias for get-wmiobject