Member-only story

Speed up your Bash, Python and Julia Command Line Editing

Most interactive command lines offer a lot more advance editing than you may be aware of?

Erik Engheim
Nov 11, 2020
An example of a Julia REPL (command line) session

Even if you are a seasoned shell scripter or have used the Python, Julia or Ruby command line REPL for a long time you may not be aware of that most of them understand the standard Readline library keyboard key combinations.

Are you editing function calls or even whole function on the Python or Julia REPL by just using arrow keys and the delete button? You may not be aware that there are much faster ways for work.

Eric Johnson created this nice cheatsheet over the most used commands for the REPL, but I will pair it down further to the key combinations I think are most useful to know sorted by frequency of use:

  1. Ctrl-a Start of the current line.
  2. Ctrl-e end of line.
  3. Alt-f forward one word.
  4. Alt-b backwards one word.
  5. Ctrl-w delete last word.
  6. Ctrl-u cut backwards until start of line.
  7. Ctrl-y yank last text deleted. This means paste last text deleted.

There are more combinations that these, but by just learning these 7 combinations you can speed up your work on the command line or REPL a lot.

Happy hacking!

--

--

Erik Engheim
Erik Engheim

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

No responses yet