> For the complete documentation index, see [llms.txt](https://devops-collective-inc.gitbook.io/a-unix-person-s-guide-to-powershell/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devops-collective-inc.gitbook.io/a-unix-person-s-guide-to-powershell/commands-detail-l.md).

# Command 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:

```
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:

```
$ ls
README.md
```

but *ls -a* gives

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

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

```
$ ls


    Directory: C:\Users\matt\Documents\WindowsPowerShell\functions

Mode                LastWriteTime     Length Name  
----                -------------     ------ ---- 
-a---        04/06/2015     13:20       1422 README.md

$ ls -force

    Directory: C:\Users\matt\Documents\WindowsPowerShell\functions


Mode                LastWriteTime     Length Name               
----                -------------     ------ ----              
d--h-        04/06/2015     13:20            .git             
-a-h-        20/05/2015     17:33      12288 .function-prompt.ps1.swp
-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.

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

## lsusb

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

```
gwmi Win32_USBControllerDevice
```

*gwmi* is an alias for *get-wmiobject*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devops-collective-inc.gitbook.io/a-unix-person-s-guide-to-powershell/commands-detail-l.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
