Posts Tagged ‘python shell’

Add History and Tab Completion to the Default Python Shell

You want history and TAB completion in your default Python shell. You are aware of bpython and ipython, but you miss this functionality in the default shell.

Edit ~/.bashrc:

# ~/.bashrc

Download from here and rename it to ~/

the bpython interpreter

August 14, 2011 Leave a comment

“bpython is a fancy interface to the Python interpreter for Unix-like operating systems (I hear it works fine on OS X). It is released under the MIT License. It has the following features:

  • In-line syntax highlighting.
  • Readline-like autocomplete with suggestions displayed as you type.
  • Expected parameter list for any Python function.
  • “Rewind” function to pop the last line of code from memory and re-evaluate.
  • Send the code you’ve entered off to a pastebin.
  • Save the code you’ve entered to a file.
  • Auto-indentation.
  • Python 3 support.

For more, see our about-page or just skip right to the screenshots.”


sudo apt-get install bpython

Tip: add the following line to your ~/.bashrc file:

alias bpy='bpython'

Then you can start the bpython interpreter with “p“. Short and simple :)


  • classic “python” interpreter
  • ipython

IPython, an enhanced Python shell

March 19, 2011 Leave a comment

IPython is an interactive shell for the Python programming language that offers enhanced introspection, additional shell syntax, syntax highlighting, tab completion and rich history. It is a component of the SciPy package.” (source)


In the book Python for Unix and Linux System Administration, there is a long chapter (Ch. 2) dedicated to IPython!

Installation and usage
Install it via apt-get:

sudo apt-get install ipython

I made the alias “ip” for the command “ipython”. Note that there is a command “ip” for manipulating routing and tunnels that the alias will hide, but it’s not likely I’ll ever use that command.

alias ip='ipython'

The config file of IPython is located at ~/.ipython/

Categories: python Tags: , ,