Basic Commands in JupyterLab

JupyterLab is a versatile tool for data analysis, scientific research, and software development. With its user-friendly interface, combined with a robust set of features, JupyterLab was the ideal tool to pair with the CrossCompute Framework making both a go-to choice for professionals and enthusiasts alike. In this article, let’s walk through some of the basic commands that will help you get started with JupyterLab.

Starting Up JupyterLab

To launch JupyterLab, you simply need to run the following command in your terminal (assuming you have JupyterLab installed):

jupyter lab

This command will start up the JupyterLab server and typically opens the interface in your default web browser.

Creating a New Notebook

Once inside JupyterLab, creating a new notebook is just a click away:

  • Click the “+” icon on the top left to open the launcher.

  • Under the “Notebook” section, choose the kernel that corresponds to the programming language you wish to use (e.g., Python 3).

Opening and Closing Files

To open a file:

  • Use the file browser on the left-hand sidebar to navigate to your file.

  • Click on the file to open it in a new tab.

To close a file, simply click the “x” on the file’s tab.

Running Code in a Cell

To run code in a Jupyter notebook:

  • Click on the cell with the code you want to run.

  • Press “Shift + Enter” on your keyboard, or click the “Run” button in the toolbar.

This executes the code in the cell and typically displays the output directly below it.

Saving Your Work

To save your notebook:

  • Press “Command + S” on macOS or “Ctrl + S” on Windows/Linux.

  • Alternatively, click the floppy disk icon in the toolbar.

Cutting, Copying, and Pasting Cells

To cut, copy, or paste cells within a notebook:

  • To cut a cell, select it and press “X”.

  • To copy a cell, select it and press “C”.

  • To paste a cell, press “V”.

These actions can also be performed using the corresponding icons in the notebook toolbar or the Edit menu.

Undoing Actions

To undo an action in a cell, simply press “Command + Z” on macOS or “Ctrl + Z” on Windows/Linux.

Stopping a Running Cell

If you need to stop code execution:

  • Click the “Stop” button in the toolbar (it looks like a square).

  • Or, go to the “Kernel” menu and select “Interrupt Kernel”.

Restarting the Kernel

Sometimes you may need to restart the kernel:

  • Go to the “Kernel” menu.

  • Select “Restart Kernel…”.

  • Confirm by clicking “Restart” in the dialog that appears.

Shutting Down a Kernel

To shut down a kernel when you’re done:

  • Go to the “Kernel” menu.

  • Select “Shut Down Kernel”.

JupyterLab’s intuitive interface makes it accessible, and getting comfortable with the basic commands we covered together in this article will greatly enhance your productivity and efficiency. As you become more adept with these commands, you’ll find that JupyterLab can become a flexible and powerful environment for not just creating tools with CrossCompute but all your computing needs.

For more detailed information, tips, and shortcuts, be sure to check out the JupyterLab Documentation. Here, you’ll find comprehensive guides and resources to help you make the most of JupyterLab’s capabilities, whether you’re a beginner or an experienced user.