Running Linux Command in Jupyter Notebook: A Step Guide – Jupyter Notebook Tutorial

By | June 8, 2022

Many programmers are using jupyter notebook for python programming, however, we have to run some linux commands by it. In this tutorial, we will introduce you how to do.

Run linux command in jupyter notebook

It is easy to run linux command in jupyter notebook. We can do as follows:

Step 1: input a linux command, for example pwd

Step 2: select this cell and press shift+enter

run linux command in jupyter notebook

Step 3: this linux command will be run and we will see the reuslt.

Moreover, some jupyter notebooks may need to input linux command with the format: !command. For example: !pwd. It also can run it as above steps.

run linux command in jupyter notebook example 2

Run python script in jupyter notebook

We also can run python script in jupyter notebook, here is the tutorial:

Jupyter Notebook Run Python Script (.py) File and Command Line: A Simple Guide