2021-10-30 18:34:14 +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
|
|
|
|
|
|
|
|
|
|
Returns an array with general information about all scripts running on the specified target server.
|
|
|
|
|
|
|
|
|
|
<b>Signature:</b>
|
|
|
|
|
|
|
|
|
|
```typescript
|
2021-10-30 21:46:34 +02:00
|
|
|
|
ps(host?: string): ProcessInfo[];
|
2021-10-30 18:34:14 +02:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
|
| --- | --- | --- |
|
2021-10-30 21:46:34 +02:00
|
|
|
|
| host | string | Host or IP address of the target server. If not specified, it will be the current server’s IP by default. |
|
2021-10-30 18:34:14 +02:00
|
|
|
|
|
|
|
|
|
<b>Returns:</b>
|
|
|
|
|
|
|
|
|
|
[ProcessInfo](./bitburner.processinfo.md)<!-- -->\[\]
|
|
|
|
|
|
|
|
|
|
Array with general information about all scripts running on the specified target server.
|
|
|
|
|
|
|
|
|
|
## Remarks
|
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
|
RAM cost: 0.2 GB
|
2021-10-30 18:34:14 +02:00
|
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
|
|
|
2021-10-30 21:46:34 +02:00
|
|
|
|
```ts
|
2021-10-30 18:34:14 +02:00
|
|
|
|
//(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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|