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 ) > [kill ](./bitburner.ns.kill_1.md )
## NS.kill() method
2023-04-28 00:21:06 +02:00
Terminate the script(s) with the provided filename, hostname, and script arguments.
2022-10-21 17:16:00 +02:00
2023-02-11 19:18:50 +01:00
**Signature:**
2022-10-21 17:16:00 +02:00
```typescript
2023-02-14 03:50:38 +01:00
kill(filename: string, hostname?: string, ...args: ScriptArg[]): boolean;
2022-10-21 17:16:00 +02:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
2023-02-14 03:50:38 +01:00
| filename | string | Filename of the script to kill. |
| hostname | string | _(Optional)_ Hostname where the script to kill is running. Defaults to the current server. |
| args | [ScriptArg ](./bitburner.scriptarg.md )<!-- --> \[\] | Arguments of the script to kill. |
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
boolean
2023-04-28 00:21:06 +02:00
True if the scripts were successfully killed, and false otherwise.
2022-10-21 17:16:00 +02:00
## Remarks
RAM cost: 0.5 GB
2023-04-28 00:21:06 +02:00
Kills the script(s) with the provided filename, running on the specified host with the specified args. To instead kill a script using its PID, see [the other ns.kill entry ](./bitburner.ns.kill.md )<!-- --> .
2022-10-21 17:16:00 +02:00
2023-02-14 03:50:38 +01:00
## Example
2022-10-21 17:16:00 +02:00
2023-02-14 03:50:38 +01:00
```js
// kill the script "foo.js" on the same server the current script is running from, with no arguments
2023-02-14 07:32:01 +01:00
ns.kill("foo.js");
2022-10-21 17:16:00 +02:00
2023-02-14 03:50:38 +01:00
// kill the script "foo.js" on the "n00dles" server with no arguments.
2023-02-14 07:32:01 +01:00
ns.kill("foo.js", "n00dles");
2022-10-21 17:16:00 +02:00
2023-10-03 02:14:44 +02:00
// kill the script foo.js on the current server that was run with the arguments [1, “foodnstuff”, false]:
2023-02-14 03:50:38 +01:00
ns.kill("foo.js", ns.getHostname(), 1, "foodnstuff", false);
2022-10-21 17:16:00 +02:00
```