Google Colab Tips for Power Users
4. Jupyter Notebook Keyboard ShortcutsPermalink
If you are familiar with keyboard shortcuts from Jupyter Notebook, they don’t work directly in Colab. But I found a mental model to map between them.
Just add Ctrl + M
before whatever keyboard shortcut you were using in Jupyter. This rule of thumb works for the majority of common use-cases.
Action | Jupyter Notebook | Google Colab |
---|---|---|
Add a cell above | A | Ctrl + M + A |
Add a cell below | B | Ctrl + M + B |
See all keyboard shorcuts | H | Ctrl + M + H |
Change cell to code | Y | Ctrl + M + Y |
Change cell to markdown | M | Ctrl + M + M |
Interrupt the kernel | II | Ctrl + M + I |
Delete a cell | DD | Ctrl + M + D |
Checkpoint notebook | Ctrl + S | Ctrl + M + S |
Below are some notable exceptions to this rule for which either the shortcut is changed completely or kept the same.
Action | Jupyter Notebook | Google Colab |
---|---|---|
Restart runtime | 00 | Ctrl + M + . |
Run cell | Ctrl + Enter | Ctrl + Enter |
Run cell and add new cell below | Alt + Enter | Alt + Enter |
Run cell and goto the next cell below | Shift + Enter | Shift + Enter |
Comment current line | Ctrl + / | Ctrl + / |