How to save a lot of time by have a short cut to Restart Kernel and Run All Cells?

First off, I love to quit jupyter lab or jupyter notebook by going to the Linux console by
Ctl-c twice and then clicking on the X next to the Firefox tab that says “JupyterLab”.
This will automatically close the window that says “Server Connection Error”.
Hence this Clt-c twice and a click on x is how I quit from jupyter in the least possible time.

My next question has to do with optimization of workflow.

I am sorry the following may already have
an existing solution but the last time I checked the answer seems elusive.

Now as I have been using the jupyterlab for some time, everytime I make a change to the
text, I have to navigate to Kernel → Restart Kernel and Run All Cells.
It is just me, I love to rerun everything this way since even a smallest change will have the expected resut on the last cell. But this is taking a toll on me. To move the cursor up
to Kernel and select Restart Kernel and Run All Cells can take 5 secs.
Question: Is there a keyboard short cut to act as Kernel->Restart Kernel and Run All Cells to do the same thing thus saving me time and
a bit of frustration? Yes. I know I probably should not use the browser but to use vi to edit a .py and
run the .py but then
some matplotlib figures may pop out along the way.
Even though the browser way is a bit clumsy but if needed I can always
scroll on another view window to see the plots if I need.

When I write a C or Fortran program, I usually have one window to edit, and another window to
type “make” to compile and run the latest binary. This saves me a lot of time with this “shortcut”.

Someone posted a shortcut you can add to JupyterLab here (<=== UPDATE: that link seems now dead). There’s an older tutorial doing the same thing here; however, the interface has changed quite a bit since then and so only use it as a guide. And a slightly newer step-by-step here. (Where at one time to look for other overrides was posted here. I don’t know if that is still where the typescript is found; however, it may help guide you to where to look around if you need to do additional, fancier things.)

1 Like

Very good tip! Thanks a lot.

The note says Clt+Alt+R but it seems it is Clt-Alt-r.
If not I should press 4 keys (Shift+r to get an R)?

{
“shortcuts”: [
{
“command”: “runmenu:restart-and-run-all”,
“keys”: [
“Ctrl Alt R”
],
“selector”: “[data-jp-code-runner]”,
“title”: “Restart Kernel and Run All”,
“category”: “Run Menu”
},
{
“command”: “notebook:change-cell-to-raw”,
“keys”: [
“R”
],
“disabled”: true,
“selector”: “.jp-Notebook:focus”
}
]
}

What is the “R” for (second block)? I tried it out but it has no effect.