Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 36 ยท Getting Started

The Command Menu and Keyboard Shortcuts

Use the DevTools Command Menu to run commands, open files and screenshot pages, plus essential shortcuts, with a runnable fuzzy-search stand-in that shows how it ranks.

DevTools has more features than any menu bar could hold. The Command Menu solves this: it is a searchable palette, like the one in many code editors, that finds every panel, setting and tool by name. Once you learn to use it, you stop hunting through menus and start typing what you want.

Opening the Command Menu

Press Ctrl+Shift+P (Cmd+Shift+P on macOS) while focus is in DevTools. A text box appears; type a few letters and pick a result with the arrow keys and Enter.

The same box does several jobs, switched by the first character you type:

Prefix What it does Example
(none) / > Run a command dark theme
? List available prefixes ?
! Run a snippet !my-snippet
@ Go to a symbol in the open file @render
: Go to a line number in the open file :120
(file name) Open a file app.js

Pressing Ctrl+P (Cmd+P) opens the same box in file mode, which is the fastest way to jump to a source file. You do not need to remember folders.

Commands worth knowing

Type these words in the Command Menu to find the tools. The exact wording follows your Chrome version, so search by a keyword and pick the closest result.

  • Screenshot: offers Capture full size screenshot, Capture node screenshot (the selected element), Capture area screenshot and Capture screenshot (visible area). Full-size screenshots are the quickest way to save a whole long page as an image.
  • Show Rendering: opens a drawer tool with paint flashing, layout shift regions, frame rendering stats and emulation of media features (for example prefers-color-scheme or reduced motion).
  • Show Coverage: reports how much CSS and JavaScript a page loaded but never used.
  • Show Network request blocking, Show Animations, Show Sensors, Show Issues and many more.
  • Disable JavaScript: turns off script execution for the tab while DevTools is open, to see what the page looks like without it.
  • Switch to dark theme and Switch to light theme: change the DevTools UI.
  • Reload DevTools, Hide Console drawer, Dock to bottom.

If you cannot find a tool, do not scroll through settings. Open the Command Menu and type a word that describes what you want, such as throttle, emulate, screenshot or media. It is almost always faster.

Essential shortcuts to memorize

You do not need dozens. These cover most of a normal day:

Action Windows / Linux macOS
Command Menu Ctrl+Shift+P Cmd+Shift+P
Open file Ctrl+P Cmd+P
Search in the current panel Ctrl+F Cmd+F
Search across all loaded sources Ctrl+Shift+F Cmd+Option+F
Inspect element tool Ctrl+Shift+C Cmd+Shift+C
Device mode on/off Ctrl+Shift+M Cmd+Shift+M
Toggle drawer Esc Esc
Clear the Console Ctrl+L Cmd+K
Show all shortcuts Settings, Shortcuts Settings, Shortcuts

Chrome also lets you customize shortcuts: open Settings (F1, or the gear icon), choose Shortcuts, and change or add key combinations. There is even a "match shortcuts from" preset for the VS Code keymap.

How fuzzy matching works

The Command Menu does not require you to type a full word. Typing dkth finds "Switch to dark theme" because the letters appear in order, even with gaps. This is called subsequence or fuzzy matching. Better matches (letters closer together, at word starts) rank higher.

The stand-in below implements a simple version. It is not Chrome's code, but it shows why short, sloppy queries work.

JS Stand-in: a tiny fuzzy command matcher

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Real Chrome ranks results differently and also weights recently used commands, but the lesson holds: type fewer letters than you think you need.

Reading prefixes as a tiny language

The first character decides what the box does. The stand-in below parses an input string and says which mode Chrome would be in. Again, this is a model of the behavior described above, not the product's code.

JS Stand-in: detect the Command Menu mode

Press Run (or Ctrl + Enter) to see the console output here.

No output.

In the real tool, Ctrl+Shift+P starts in command mode and Ctrl+P starts in file mode. Both are the same box with a different default.

Working faster: a short routine

A routine that many developers adopt:

  1. Ctrl+P, type part of a file name, Enter to open it.
  2. :45 (in the same box) to jump to line 45.
  3. Ctrl+Shift+F to search all loaded files for a string, such as an error message or an API path.
  4. Ctrl+Shift+P, type screenshot, capture the result for a bug report.

The same four steps replace a lot of mouse work.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which shortcut opens the Command Menu on Windows?

    Ctrl+Shift+P opens the Command Menu; Ctrl+Shift+M is device mode, Ctrl+Shift+C is Inspect, Ctrl+Shift+J is the Console.
  2. 2. What does typing a colon followed by a number in the file box do?

    The colon prefix means go to line, for example :120.
  3. 3. Which Command Menu command saves the entire page, not just the visible part, as an image?

    Full size screenshot captures the whole scrollable page.
  4. 4. Why does the query 'dkth' find 'Switch to dark theme'?

    Fuzzy matching only needs the typed letters to appear in order.

Summary

  • The Command Menu (Ctrl+Shift+P) finds every command; Ctrl+P opens files in the same box.
  • Prefixes switch modes: > commands, @ symbols, : line numbers, ! snippets, ? help.
  • Learn a handful of shortcuts: Command Menu, open file, search all sources, Inspect, device mode, Esc.
  • Screenshots, Coverage, Rendering and many tools are reached by typing their names.

Next: Device Mode and Responsive Testing