Bash!


In [ ]:
# bash, but from your browser
ls

In [ ]:
echo "hello world"

Beyond your dad's terminal

In addition to running commands like in a normal terminal you can mix text in between your commands.

This is very useful if you are writing instructions or a README for others to follow. Instead of having to copy and paste commands from a text file they can just run the next cell in the notebook.

Copying a file

(This is a pretend README for copying Leonardo's notebook )

Let's first check the contents of the imgs sub directory:


In [ ]:
ls imgs

We can copy it with the usual copy command and give it a shorter name:


In [ ]:
cp imgs/leonardo.jpg imgs/leo.jpg

In [ ]:
ls imgs

Inline displaying

To check the image was successfully copied, let's display it in the notebook:


In [ ]:
# Display images in your notebook, from bash
cat imgs/leo.jpg | display

Double check we did not modify the image while copying it:


In [ ]:
compare imgs/leonardo.jpg imgs/leo.jpg -highlight-color red imgs/diff.jpg 
cat imgs/diff.jpg | display

In [ ]:
rm imgs/leo.jpg imgs/diff.jpg

In [ ]:
# The bash kernel is still quite new and a side project
# so it doesn't have all the features everyone would want.

In [ ]:
ping -c 4 8.8.8.8