title: How to change the kernel of a jupyter notebook from the command line
body: <p>I know that one can switch the kernel of a Jupyter notebook from within the notebook itself, <a href="https://doc.cocalc.com/howto/jupyter-kernel-selection.html#jupyter-classic" rel="nofollow noreferrer">for example</a>, by going to the <code>Kernel -&gt; Change kernel</code> menu.</p>
  <p><em>I was just wondering if it's possible to do this programmatically with a shell script (or from command line).</em></p>
  <p>I have many Jupyter notebooks that were in python kernel and need to be changed to the R kernel. Doing the conversion manually for all of them would be tedious. I searched around, but only found answers about how to change kernel via the Jupyter UI as linked above.</p>
  <p>(This is with Ubuntu 20.04, and classic JupyterHub)</p>