<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [NS](./bitburner.ns.md) &gt; [ls](./bitburner.ns.ls.md)

## NS.ls() method

List files on a server.

**Signature:**

```typescript
ls(host: string, substring?: string): string[];
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

host


</td><td>

string


</td><td>

Hostname/IP of the target server.


</td></tr>
<tr><td>

substring


</td><td>

string


</td><td>

_(Optional)_ A substring to search for in the filename.


</td></tr>
</tbody></table>

**Returns:**

string\[\]

Array with the filenames of all files on the specified server.

## Remarks

RAM cost: 0.2 GB

Returns an array with the filenames of all files on the specified server (as strings). The returned array is sorted in alphabetic order.

