Close Navigation
Learn more about IBKR accounts
Jupyter Notebook Shortcuts

Jupyter Notebook Shortcuts

Posted June 14, 2023
Jovan Medford - via AlgoTrading101 Blog
AlgoTrading101

The article “Jupyter Notebook Shortcuts” first appeared on AlgoTrading101 blog.

Notebooks are tools that allow us to use markdown along with our code, to improve readability and really add to that storytelling aspect of a project. JuPyteR — short for Julia,Python and R — is probably the most popular notebook used and comes as part of the standard anaconda installation process.

When you click on the Help tab of Jupyter’s taskbar you’ll see a list of references, the user interface tour and much more. Included in this would be the Keyboard Shortcuts menu which lets you view all of the possible ways to quickly execute common track-pad tasks using your keyboard. Today we’ll be talking about the most useful of these options.

The Keyboard Shortcuts menu is divided into 2 categories called Command Mode and Edit Mode. We will be keeping this structure as we move on to the main event in our article.

Before we begin it is important for Mac users to keep the following conversion in mind:

Ctrl — ⌘ command key

Shift — ⇧ Shift

Alt —  option

Edit Mode

To enter the edit mode, press the Enter key. These shortcuts may seem very familiar to the ones you may use in other text editors and general computer use.

Ctrl-S: Save and Checkpoint 

Tab: code completion or indent

Indenting Selected Text

Ctrl-]: indent Ctrl-[: indent to the left (dedent)

More Text Editing

Ctrl-A: select all Ctrl-Z: undo

Ctrl-/: comment Ctrl-D: delete whole line

Ctrl-U: undo selection Insert: toggle overwrite flag

Go To

Ctrl-Home: go to cell start Ctrl-Up: go to cell start Ctrl-End: go to cell end

Ctrl-Down: go to cell end Ctrl-Left: go one word left 

Ctrl-Right: go one word right 

Delete / Redo

Ctrl-Backspace: delete word before Ctrl-Delete: delete word after

 Ctrl-Y: redo Alt-U: redo selection 

Run

Shift-Enter: run cell, select below Ctrl-Enter: run selected cells

Alt-Enter: run cell and insert below

Split

Ctrl-Shift-Minus: split cell at cursor

Command Mode 

To enter the command mode, press the Esc key.

Enter: enter edit mode F: find and replace 

Insert Cells

A: insert cell above B: insert cell below

Run and Insert Cells

Shift-Enter: run cell, select below Alt-Enter: run cell and insert below 

Change Cell Type

Y: change cell to code M: change cell to markdown R: change cell to raw

Change Markdown Header Size — Up to 6 sizes with 1 being the Largest

1: change cell to heading size 1 2: change cell to heading size 2 

Select Multiple Cells

Shift-Up: extend selected cells above Shift-Down: extend selected cells below

Cut, Copy and Paste

X: cut selected cells C: copy selected cells

Shift-V: paste cells above V: paste cells below

Merge Cells

Shift-M: merge selected cells, or current cell with cell below if only one cell is selected

Z: undo cell deletion O: toggle output of selected cells

The keystrokes for the following are misleading. We have listed them as they are in the keyboard shortcut menu, however it is important for you to remember that the actual process does NOT include the comma. So for deleting selected cells you would actually type DD .

D,D: delete selected cells I,I: interrupt the kernel 0,0: restart the kernel 

Miscellaneous

H: show keyboard shortcuts Q: close the pager

Shift-L: toggles line numbers in all cells, and persist the setting

Shift-Space: scroll notebook up Space: scroll notebook down

Aside

The command palette runs any command by name. To open the command palette, use Esc to enter command mode and then press P .

Conclusion

Shortcuts can prove quite useful in helping you to maintain focus by avoiding some extra scrolling with your mouse. In fact Brainscape claims that just by using keyboard shortcuts alone, you can increase your overall productivity by 3.3%, saving yourself a total of 64 wasted hours in a year. Whether you believe this or not, at the very least using shortcuts definitely helps you cut-down on using that annoying track pad, while making you look super cool at the same time.

I kid, but until next time, do enjoy the shortcuts that you’ve learned today!

Join The Conversation

If you have a general question, it may already be covered in our FAQs. If you have an account-specific question or concern, please reach out to Client Services.

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclosure: Interactive Brokers

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from AlgoTrading101 and is being posted with its permission. The views expressed in this material are solely those of the author and/or AlgoTrading101 and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.