Bash Kernel for Jupyter

0.10.0 · active · verified Fri Apr 17

bash-kernel is a Jupyter kernel that allows users to run Bash commands and scripts directly within Jupyter notebooks. It enables interactive shell scripting, making it convenient for tasks involving command-line tools, system administration, and data processing workflows that benefit from shell utilities. The current version is 0.10.0, and it has a moderate release cadence, with several minor releases and bug fixes in recent months.

Common errors

Warnings

Install

Quickstart

After installing the `bash_kernel` package and running the install command, launch Jupyter Notebook or JupyterLab. Create a new notebook and select the 'Bash' kernel. You can then run standard Bash commands directly in the cells.

# First, install the kernel (if not already done):
# pip install bash_kernel
# python -m bash_kernel.install

# After installation, open Jupyter Notebook or JupyterLab.
# Create a new notebook and select the 'Bash' kernel.

# Example usage in a Jupyter notebook cell with Bash kernel:

# Print the current working directory
pwd

# Assign a variable and use it
NAME="Jupyter User"
echo "Hello, $NAME!"

# Execute a simple loop
for i in {1..3}; do
  echo "Count: $i"
done

# Example of using a command-line utility
ls -l /tmp

view raw JSON →