5 ms·
Ask HN: Is there a Jupyter Notebook for terminal/shell
When I learn new tools like Docker for example there are a number of new commands and syntax I am picking up along the way.
I want to "SAVE" my work -- the commands I used and the output I got -- as a "Notebook" similar to how we do for Python notebooks using Jupyter. Also add some markdown notes or links to reference material or tutorials I am following.
This allows me to revisit my work of yesterday / last month / last year and quickly review what I already "know" (or relearn quickly following the same path) and then go to next logical step.
Is there such a tool or solution?
Thanks in advance
- joouha 4y agoYes! My project, euporie [1], is a TUI application for running and editing Jupyter notebooks in the terminal. It's interface similar to Jupyter Notebooks / Lab. It sounds like exactly what you are after. [1] https://github.com/joouha/euporie https://github.com/joouha/euporie
- isr 4y agoA couple of suggestions: - the xonsh (a full-featured unix shell, in python) kernel with jupyter - the acme editor, using `win` to give you a dumb terminal access to your shell (or indeed any repl). As well as being a shell/repl, you can also treat that window as a text buffer, manipulating it and saving it as such (very liberating feeling, in practice)
- bckr 4y agoI've wondered this exact same thing almost every day for the last year—Alas! I am still wondering.
- WCSTombs 4y agoSomething like this? https://github.com/takluyver/bash_kernel https://github.com/takluyver/bash_kernel
- raverbashing 4y ago"kids these days huh" :) You can save what you type with the 'script' command. script test_session Will save everything you type and their output to the test_session file until you exit the shell with Ctrl-D Look up "man script" for more details (funny it mentions 'typescript' but it is not that typescript) (and while I joke about 'kids these days' I learned this from the UNIX greybeards so there's that as well)
- sureshssarda 4y agoThis will not let you 'bookmark' selected commands which you can run later. I understand we can of course create aliases or small utility scripts, but having a place where we can just store these frequent commands is quite helpful especially with Docker, K8s or Azure/AWS CLI where commands are quite long to type and remember.
- raverbashing 4y ago> I understand we can of course create aliases or small utility scripts, but having a place where we can just store these frequent commands But that's exactly what an alias is. Put it on a script that you source when loading the terminal and there you have it Or you could have a "commands.txt" where you copy/paste commands Though yeah, maybe there should be a better solution (well, you can always look back history as well)
- albert_e 4y agoThanks -- this is useful to know. Appreciate the pointer. however, I am hoping for something that is far more interactively editable (like going up a couple of cells, editing and re running them in context) and also allows annotations / markdown / hyperlinks etc interspersed among the cells PS: I am also on Windows a lot of time
- spit2wind 4y ago[dead]
- pizza 4y agoYou could use a jupyter notebook for this Side-note: is the inverse of this available? E.g. open a jupyter notebook from in the middle of a python script
- iamlucaswolf 4y agoSorta-kinda: VSCode lets you execute code from regular Python files in a Jupyter session [1] by demarcating code cells with "# %%" [1] https://code.visualstudio.com/docs/python/jupyter-support-py#_jupyter-code-cells https://code.visualstudio.com/docs/python/jupyter-support-py...
- leplen 4y agoI use jupytext for this. For the cost of some header boilerplate I have python code that is seamlessly mirrored as a notebook.
- sureshssarda 4y agoI use VSCode and Markdown files. You can select anything and run that in the terminal by executing the action 'Terminal: Run Selected text in active terminal' I have also given it a shortcut: `Ctrl+e, e`. So I can just select something and execute it in the terminal. Works quite well. (Inspired by a similar feature in Emacs)
- kindofabigdeal 4y agoI would imagine emacs org mode probably has what you need
- wizwit999 4y agothe new warp.dev terminal is kinda similar tho not exactly
- kagevf 4y agoemacs org mode will work in the terminal. For example, in an org doc you can have something like this: * Python #+BEGIN_SRC python :results output def myTest(a): return a + 2 print (myTest(8)) #+END_SRC #+RESULTS: : 10 #+BEGIN_SRC python :results output def check_even(n): if n % 2 == 0: print("even") else: print("odd") check_even(5) check_even(2) #+END_SRC #+RESULTS: : odd : even
- dangrie158 4y agoYou can run any command in the shell by prefixing them with ! In the jupyter cell. However I don‘t think jupyter notebooks are super useful for that usecase as you can’t simply double click to open them
- janalsncm 4y agoYou can double click to open them! I have it working on my computer, I’m not exactly sure how I did it but it was something like this: https://stackoverflow.com/a/54489884 https://stackoverflow.com/a/54489884
- ThePhysicist 4y agoActually iPython started as a better Python shell, seems most people have forgotten these origins. The Jupyter notebook was born out of the same project and quickly replaced the shell as it obviously had much more possibilities for visualization and interactivity. If you have Jupyter installed you'll also have iPython. To run it, simply type > ipython You can use the %save magic command to save your session, there's lots more, check the documentation to discover it.
- mharig 4y agoYou may also use asciinema.org to record replayable tutorials. For adding notes, you can use a markdown file with the asciicast (the file format of asciinema) embedded. Edit: But I do not know of an integrated, comfortable way to combine asciinema and markdown. Enhancing the asciicast format with (markdown) comments and make the asciicast players display them would be nice.