bitburner-src/markdown/bitburner.ns.ps.md
Olivier Gagnon f4ac7344c4 doc
2022-01-08 13:25:06 -05:00

1.1 KiB
Raw Blame History

Home > bitburner > NS > ps

NS.ps() method

List running scripts on a server.

Signature:

ps(host?: string): ProcessInfo[];

Parameters

Parameter Type Description
host string Host address of the target server. If not specified, it will be the current servers IP by default.

Returns:

ProcessInfo[]

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 1

// NS1:
const scripts = ps("home");
for (let i = 0; i < scripts.length; ++i) {
    tprint(scripts[i].filename + ' ' + scripts[i].threads);
    tprint(scripts[i].args);
}

Example 2

// NS2:
const ps = ns.ps("home");
for (script of ps) {
    ns.tprint(`${script.filename} ${ps[i].threads}`);
    ns.tprint(script.args);
}