Don't Starve Together Console Commands
Every c_ console command for Don't Starve Together, how local and remote mode differ, and why Master and Caves need commands run on each shard.
Don't Starve Together's console is a live Lua prompt, not a fixed list of cheat codes. Commands are real function calls ā c_spawn("pigman", 3) is Lua, brackets, quotes and all ā which is why a mistyped command silently does nothing instead of telling you off.
Two things trip people up far more than the syntax: the difference between local and remote execution, and the fact that a Don't Starve Together server with caves is actually two separate server processes. Get either wrong and a perfectly valid command will appear to be ignored. Both are covered below.
Opening the console
Press the tilde key (~, the backtick key below Esc on a US layout) during play. You can rebind it in the controls menu.
The console is enabled by default in current builds. If the key does nothing, enable it explicitly by editing client.ini:
[MISC]
console_enabled = true That file lives in Documents\Klei\DoNotStarveTogether\ on Windows and macOS, and ~/.klei/DoNotStarve/ on Linux. Press Ctrl + L to clear the console log.
Local vs remote ā the distinction that breaks most commands
This is the single most common reason a command "doesn't work".
With the console open, pressing Ctrl toggles between local and remote mode. The prompt tells you which one you are in.
| Mode | Runs on | Use it for |
|---|---|---|
| Local | Your client only | Map reveals, client-side debugging |
| Remote | The server, for everyone | Practically everything ā spawning, giving, god mode, saving |
If you are not the host, almost every useful command must be run in remote mode, and remote mode requires you to be an admin on that server. Run c_spawn locally on a dedicated server and you get a client-side ghost of an object that does not really exist. No error, no item.
Check the mode before you blame the command
If a command produced no error and no result, you were almost certainly in local mode. Press Ctrl and run it again.
Getting admin on a dedicated server
Admin is granted by Klei User ID, not by password. Each player has an ID in the form KU_xxxxxxxx.
A player can find their own by opening the console and running:
TheNet:GetUserID() Add one ID per line to adminlist.txt:
KU_aBcDeFgH
KU_1234WxYz Editing that file at all means filesystem access to the cluster root, which is something you only get on a server you run yourself rather than one you have joined ā on a hosted Don't Starve Together server it sits in the file manager alongside the shard folders. The important detail is where it goes. It belongs in the cluster root, alongside cluster.ini ā not inside a shard folder:
Cluster_1/
āāā Master/ # the surface shard
ā āāā server.ini
āāā Caves/ # the caves shard
ā āāā server.ini
āāā cluster.ini
āāā cluster_token.txt
āāā adminlist.txt ā here
āāā whitelist.txt
āāā blocklist.txt Placed at the cluster root, it applies to both shards at once. Drop a copy into Master/ instead and it will not be read. Restart the server after editing.
Master and Caves are two separate servers
This is the part general command lists leave out, and it is the thing most likely to confuse a new server owner.
A caves-enabled Don't Starve Together cluster does not run one server process. It runs two ā the dedicated server binary is launched once per shard, with -shard Master for the surface and -shard Caves for the underground. They share a cluster token, an admin list and a mod list, but they are independent processes with their own worlds and their own console context.
Consequences that actually matter:
- A remote command executes on the shard you are currently standing in. Spawn something while on the surface and it appears on the Master shard. Walk into a sinkhole and run the same command and it lands in Caves.
- Both shards must run the same mods, with the same configuration. Mismatched
modoverrides.luabetween shards causes players to fail migration between surface and caves. - Some commands cross the shard boundary and some do not ā see the table below.
Commands that behave differently per shard
| Command | On Master | On Caves |
|---|---|---|
c_shutdown() |
Saves, then shuts down every shard in the cluster | Shuts down the Caves shard only |
c_regenerateworld() |
Regenerates both the surface and caves | Regenerates both |
c_regenerateshard() |
Regenerates the surface only | Regenerates the caves only |
c_save() |
Saves that shard | Saves that shard |
c_regenerateworld destroys the world immediately
There is no confirmation prompt and no undo. It wipes the surface and the caves together and generates a fresh world. If you only meant to reset the caves, you wanted
c_regenerateshard(). Take a backup first.
The Master shard is the one that manages the cluster, which is why c_shutdown() run there propagates a save-and-stop to Caves as well. Running it on Caves leaves the surface up and players on it.
Spawning and giving items
c_spawn("prefab", count)
c_give("prefab", count) c_spawn places the object on the ground under your cursor. c_give puts it straight into your inventory. Both default to a count of 1 if you omit it.
c_spawn("beefalo", 2)
c_give("goldnugget", 20) Prefab names are the internal code names, which are usually ā but not always ā the lowercase name with spaces removed. Spelling one wrong fails silently, so check it rather than guessing.
Character and player commands
| Command | Effect |
|---|---|
c_godmode() |
Toggles invulnerability for your character |
c_supergodmode() |
God mode plus refills health, hunger and sanity |
c_sethealth(n) |
Sets health, n as a fraction from 0 to 1 |
c_sethunger(n) |
Sets hunger, same scale |
c_setsanity(n) |
Sets sanity, same scale |
c_freecrafting(player) |
Unlocks all recipes for a player |
c_listallplayers() |
Prints every connected player and their index |
c_move(inst) |
Moves the target to your cursor |
c_despawn(player) |
Returns a player to character select |
c_select(inst) |
Selects an entity for later commands |
The stat commands take a fraction, not a percentage ā c_sethealth(0.5) is half health, and c_sethealth(50) is not what you want.
To act on someone else, list players first and index the result:
c_listallplayers()
c_move(AllPlayers[2]) Server and world commands
| Command | Effect |
|---|---|
c_save() |
Forces an immediate save |
c_rollback(count) |
Reverts the world by count saves |
c_shutdown(save) |
Shuts down; c_shutdown(false) exits without saving |
c_announce(msg) |
Broadcasts a message to everyone |
c_countprefabs("prefab") |
Counts how many of an entity exist in the world |
c_reset() |
Reloads the world from the last save |
TheNet:Kick(userid) |
Kicks a player by Klei User ID |
TheNet:Ban(userid) |
Bans a player by Klei User ID |
c_rollback(1) steps back one save, c_rollback(2) two, and so on. How far back you can go depends on how many snapshots the cluster keeps.
FAQ
What key opens the console in Don't Starve Together?
The tilde key, ~, which is the backtick key below Esc on a US keyboard. It can be rebound in the controls menu.
Why do my console commands do nothing?
Almost always because you are in local rather than remote mode. Press Ctrl with the console open to switch to remote, and confirm you are on the server's admin list.
How do I become an admin on my own dedicated server?
Add your Klei User ID ā get it with TheNet:GetUserID() ā to adminlist.txt in the cluster root next to cluster.ini, then restart the server.
Do I need to run commands on both Master and Caves?
For anything world-specific, yes. A remote command applies to the shard you are standing in, so to change both the surface and the caves you run it in each. c_shutdown() on Master is the exception ā it stops the whole cluster.
How do I reset only the caves?
Stand in the caves and run c_regenerateshard(). Using c_regenerateworld() would wipe the surface as well.
Does using console commands disable achievements?
No. Don't Starve Together has no achievement lockout for console use, though server owners can still restrict who is on the admin list.
Why does c_sethealth(100) not work?
Because the stat commands take a fraction between 0 and 1. Full health is c_sethealth(1).
Made with š by GameServerKings

Playing with friends?
Your own Don't Starve Together server is a world that stays up when you log off ā nobody has to host it from their own PC, and it's there whenever your group wants to play.
From $7.80 /month