mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 06:02:26 +01:00
47 lines
1.0 KiB
Markdown
47 lines
1.0 KiB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||
|
||
[Home](./index.md) > [bitburner](./bitburner.md) > [NS](./bitburner.ns.md) > [ps](./bitburner.ns.ps.md)
|
||
|
||
## NS.ps() method
|
||
|
||
List running scripts on a server.
|
||
|
||
<b>Signature:</b>
|
||
|
||
```typescript
|
||
ps(host?: string): ProcessInfo[];
|
||
```
|
||
|
||
## Parameters
|
||
|
||
| Parameter | Type | Description |
|
||
| --- | --- | --- |
|
||
| host | string | Host address of the target server. If not specified, it will be the current server’s IP by default. |
|
||
|
||
<b>Returns:</b>
|
||
|
||
[ProcessInfo](./bitburner.processinfo.md)<!-- -->\[\]
|
||
|
||
Array with general information about all scripts running on the specified target server.
|
||
|
||
## Remarks
|
||
|
||
RAM cost: 0.2 GB
|
||
|
||
Returns an array with general information about all scripts running on the specified target server.
|
||
|
||
## Example
|
||
|
||
|
||
```ts
|
||
//(using NetscriptJS (Netscript 2.0))
|
||
export async function main(ns) {
|
||
const ps = ns.ps("home");
|
||
for (let i = 0; i < ps.length; ++i) {
|
||
ns.tprint(ps[i].filename + ' ' + ps[i].threads);
|
||
ns.tprint(ps[i].args);
|
||
}
|
||
}
|
||
```
|
||
|