2022-10-21 17:16:00 +02:00
|
|
|
|
<!-- 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.
|
|
|
|
|
|
2023-02-11 19:18:50 +01:00
|
|
|
|
**Signature:**
|
2022-10-21 17:16:00 +02:00
|
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
ps(host?: string): ProcessInfo[];
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
|
| --- | --- | --- |
|
2023-02-11 19:18:50 +01:00
|
|
|
|
| host | string | _(Optional)_ Host address of the target server. If not specified, it will be the current server’s IP by default. |
|
2022-10-21 17:16:00 +02:00
|
|
|
|
|
2023-02-11 19:18:50 +01:00
|
|
|
|
**Returns:**
|
2022-10-21 17:16:00 +02:00
|
|
|
|
|
|
|
|
|
[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.
|
|
|
|
|
|
2023-04-28 20:19:30 +02:00
|
|
|
|
## Example
|
2022-10-21 17:16:00 +02:00
|
|
|
|
|
|
|
|
|
|
2023-04-28 20:19:30 +02:00
|
|
|
|
```js
|
2022-10-21 17:16:00 +02:00
|
|
|
|
const ps = ns.ps("home");
|
2024-05-27 23:42:31 +02:00
|
|
|
|
for (const script of ps) {
|
2023-04-28 20:19:30 +02:00
|
|
|
|
ns.tprint(`${script.filename} ${script.threads}`);
|
|
|
|
|
ns.tprint(script.args);
|
2022-10-21 17:16:00 +02:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|