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?

Image for post
An example of a Julia REPL (command line) session

ven 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!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store