The Art of the Command Line - ls (seen from Jupyter ... seen from MyBinder)

In the spirit of the github repo "the art of the command-line", or Chris Allen's cheatsheets I wanted to put together some cheat sheets and notes about GNU, unix, linux utilities.

But I wanted to produce them using the bash_kernel of the Jupyter notebook thereby allowing to have a notebook representation of the cheat sheet in an executable form (providing Jupyter+bash_kernel are available of course).  I'll put these cheatsheets on github, in a fork of the art-of-the-command-line, here.

In an earlier draft of this blog post I wrote
Ideally, I'd like to point you to an online executeable version of these cheatsheets in the same way we can reference tmpnb, or notebooks but unfortunately none of them provide a bash_kernel.  At least on github you can view them, and also clone them to try out locally.
Thankfully I realized today that this is not the case.
Thanks to Docker, thanks to the Binder project ( you can run such notebooks online.

By clicking on the link at the bottom of this page you will launch a container on the mybinder site prepopulated with my ls tutorial notebook in a form that you can modify.

So here's a very first shot at that looking at that venerable performer 'ls'.  OK, not the most exciting example for the moment but more will come, especially combinations of tools.
But why ls?

Well many moons ... many many many moons ago actually, like in the 80s/90s I would look at some HP-UX pages and be surprised - I didn't know about that option!  So I vowed to periodically return to man pages and have another look.  Of course 20-30 years on I don't do that as there are so many commands ... but I should ... sometimes at least.

So I figured that probably even ls has a few surprises - like it's only very recent that I discovered the '-h' human readable option on ls, du and even sort (unfortunately OS-X seems to miss this option on sort).  So as an example on Linux, or Windows/Cygwin, instead of looking at disk usage with
    du -s * | sort -n
I now do
    du -sh * | sort -h
which will show disk space in human readable form and sorted, e.g.
    10k tmp/
    2.1M src/
    1.5G Downloads/

Anyway, you can run the actual notebook tutorial here

In later posts I produce some more exciting tutorial notebooks, and I'll also talk more about Binder.
I have a lot of plans for Jupyter, Binder, Docker, ...


Popular Posts