# Don't Starve Together Admin Console Commands Reference (/docs/dont-starve-together/admin-commands)



import { Step, Steps } from 'fumadocs-ui/components/steps';

Once you're an admin on a Don't Starve Together server, the in-game console (`~`) gives you a Lua REPL with access to the entire game state. This page is the complete reference for the day-to-day admin commands you actually need: rolling back grief, force-saving, spawning items, kicking, banning, and shutting down cleanly.

Prerequisites [#prerequisites]

Before any of this works:

1. Your Klei ID (`KU_xxxxxxxx`) must be in `Cluster_1/adminlist.txt` — see [Adding Admins](/docs/dont-starve-together/adding-admins)
2. `cluster.ini` must have `console_enabled = true` under `[MISC]`
3. You must be connected to the server in-game

Opening the Console [#opening-the-console]

Press the tilde key (`~`) to open the console. Type a command and press Enter.

By default commands run **client-side only**. To run a command on the **server** (which is what most admin actions need), press **Ctrl+Enter** instead — or toggle the "Remote" mode by clicking the icon at the top of the console.

Save & Rollback [#save--rollback]

The most-used commands. These are how you protect against grief.

| Command         | Description                                       |
| --------------- | ------------------------------------------------- |
| `c_save()`      | Force a save right now                            |
| `c_rollback()`  | Roll back to the most recent save                 |
| `c_rollback(N)` | Roll back N snapshots (default max is 6)          |
| `c_reset()`     | Reload the world from the last save (no rollback) |

**Workflow:** before something risky (boss fight, mod test, big build), run `c_save()`. If it goes wrong, `c_rollback(1)`.

Server Lifecycle [#server-lifecycle]

| Command                 | Description                                                   |
| ----------------------- | ------------------------------------------------------------- |
| `c_shutdown()`          | Save and shut the server down                                 |
| `c_shutdown(true)`      | Same — saves before exiting                                   |
| `c_shutdown(false)`     | Shut down **without** saving (use only if save is corrupted)  |
| `c_announce("message")` | Broadcast a message to all players                            |
| `c_regenerateworld()`   | **Wipes the current world and generates a new one.** No undo. |
| `c_regenerateshard()`   | Regenerate just the current shard (Master or Caves)           |

Spawning Items & Creatures [#spawning-items--creatures]

| Command                              | Description                                 |
| ------------------------------------ | ------------------------------------------- |
| `c_spawn("prefab")`                  | Spawn a single entity at your cursor        |
| `c_spawn("prefab", N)`               | Spawn N entities                            |
| `c_give("prefab")`                   | Give yourself one item                      |
| `c_give("prefab", N)`                | Give yourself N items                       |
| `c_give("prefab", N, AllPlayers[1])` | Give the item to a specific player by index |

Examples:

```lua
c_give("log", 40)
c_give("twigs", 40)
c_give("rocks", 20)
c_spawn("deerclops")
c_spawn("pigman", 5)
```

The full prefab name list is on the [DST wiki](https://dontstarve.fandom.com/wiki/Console/Don%27t_Starve_Together_Commands).

Player Management [#player-management]

| Command                   | Description                                             |
| ------------------------- | ------------------------------------------------------- |
| `TheNet:GetClientTable()` | List every connected client (returns a Lua table)       |
| `TheNet:Kick("KU_xxx")`   | Kick a player by Klei ID                                |
| `TheNet:Ban("KU_xxx")`    | Permanently ban a player by Klei ID                     |
| `TheNet:GetUserID()`      | Print your own Klei ID (run as a player to see your ID) |
| `c_listplayers()`         | Print the player list to the console (shorter alias)    |
| `c_kick(N)`               | Kick the player at index N in the player list           |
| `c_ban(N)`                | Ban the player at index N                               |

`c_kick(1)` is faster than `TheNet:Kick("KU_...")` when you just want to boot the most-recently-joined player.

Time & Weather [#time--weather]

| Command                                             | Description                         |
| --------------------------------------------------- | ----------------------------------- |
| `LongUpdate(N)`                                     | Skip N seconds of game time forward |
| `LongUpdate(480)`                                   | Skip one in-game day                |
| `TheWorld:PushEvent("ms_setseason", "winter")`      | Force change the season             |
| `TheWorld:PushEvent("ms_forceprecipitation", true)` | Start rain                          |
| `TheWorld:PushEvent("ms_setphase", "night")`        | Force night                         |
| `c_godmode()`                                       | Toggle godmode on yourself          |

Health, Sanity, Hunger [#health-sanity-hunger]

| Command                                     | Description                               |
| ------------------------------------------- | ----------------------------------------- |
| `ThePlayer.components.health:SetPercent(1)` | Heal yourself to full                     |
| `ThePlayer.components.sanity:SetPercent(1)` | Restore sanity to full                    |
| `ThePlayer.components.hunger:SetPercent(1)` | Fill hunger                               |
| `c_godmode()`                               | All three at once + invincibility         |
| `c_supergodmode()`                          | Godmode + free crafting + revive on death |

Useful One-Liners [#useful-one-liners]

```lua
-- Give every connected player 20 logs
for i,v in ipairs(AllPlayers) do v.components.inventory:GiveItem(SpawnPrefab("log"), 20) end

-- Set everyone's HP to full
for i,v in ipairs(AllPlayers) do v.components.health:SetPercent(1) end

-- Find your Klei ID
print(TheNet:GetUserID())

-- Print the player list
for i,v in ipairs(AllPlayers) do print(i, v.name, v.userid) end
```

Common Issues [#common-issues]

| Problem                                                         | Cause                                                  | Fix                                                                                                   |
| --------------------------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| "You don't have admin privileges"                               | Not in `adminlist.txt`, or didn't restart after adding | Add yourself, restart                                                                                 |
| Commands have no effect                                         | Running client-side, not server-side                   | Press **Ctrl+Enter** instead of Enter, or toggle Remote mode                                          |
| `c_rollback(N)` rolls back fewer days than expected             | DST keeps a max of 6 snapshots by default              | Increase `max_snapshots` in `cluster.ini [GAMEPLAY]`                                                  |
| `c_spawn("prefab")` spawns nothing                              | Wrong prefab name (case-sensitive)                     | Check the [DST wiki](https://dontstarve.fandom.com/wiki/Console/Don%27t_Starve_Together_Commands)     |
| `c_regenerateworld()` regenerated everything you wanted to keep | There is no undo.                                      | Always back up before running this. See [Backup & Restore](/docs/dont-starve-together/backup-restore) |

Related Guides [#related-guides]

* [Adding Admins](/docs/dont-starve-together/adding-admins)
* [Configure Your Server](/docs/dont-starve-together/configure-your-server)
* [World Generation](/docs/dont-starve-together/world-generation)
* [Reset Server](/docs/dont-starve-together/reset-server)
