From StrategyWiki, the free strategy guide and walkthrough wiki
There are cheats/console commands which are common to all games running on the Source Engine, the most useful of which are listed below. The rest comprise various rendering, network and other options and commands useful only to developers and modders; further information on the developer console and possible commands can be found on the Valve developer wiki.
To begin with, open the developer console by pressing tilde ("~"), although this will only work if you've previously enabled the developer console in the game's advanced keyboard preferences. Before any cheats can be used, the command sv_cheats 1 must be entered. This will only work if you're running the server (i.e. you're playing a single player game, or hosting a multiplayer game), so you can't cheat in normal multiplayer!
- cl_drawhud: Toggle drawing the HUD; useful for taking screenshots.
- cl_showfps: Toggle showing the current FPS as part of the HUD.
- cl_leveloverview: Toggle showing an overview of the level (a bird's-eye view).
- developer: Toggle developer mode.
- exit: Exit the game.
- fov angle: Change your FOV to the specified angle in degrees.
- give item name: Give you the specified item name.
- god: Toggle God mode.
- help command name: Give help on the specified command name.
- hidehud: Hide the HUD.
- impulse number: Does various things depending on the numeric parameter, but "101" is the most commonly-used value, giving you full health and ammunition, as well as all weapons. For a full list of the available numbers, see the Valve developer wiki.
- map map name: Load the specified map.
- maps: List all available maps.
- noclip: Toggle noclip mode, where you can fly and walk through walls.
- notarget: Toggle notarget mode, where you are invisible to NPCs.
- r_drawviewmodel: Toggle drawing of the view model — your weapon.
[edit] Portal-specific cheats
| Console command |
Xbox 360 code |
PlayStation 3 code |
Description |
| change_portalgun_linkage_id number |
- ID 0:
, , , , , , , , , 
- ID 1:
, , , , , , , , , 
- ID 2:
, , , , , , , , , 
- ID 3:
, , , , , , , , , 
|
|
Changes the portal gun linkage ID (values 0-3 are allowed for number). |
| ent_create_portal_weight_box |
, , , , , , , , ,  |
, , , , , , , , ,  |
Create a cube. |
| fire_rocket_projectile |
, , , , , , , ,  |
|
Fire a rocket from your face. |
| fire_energy_ball |
, , , , , , , , ,  |
, , , , , , , , ,  |
Fire an energy pellet from your face. |
| sv_portal_placement_never_fail |
, , , , , , , , ,  |
|
Toggles allowing portal creation on any surface. |
| upgrade_portalgun |
, , , , , , , , ,  |
, , , , , , , , ,  |
Upgrades your portal gun to allow creation of both ends of a portal, or provides you with a portal gun if you don't have one. |