So I’ve slowly been working my way through Security Tubes Python Scripting Expert (SPSE) course. But, I’ve not liked the way the python interpreter doesn’t have tab completion. After a little bit of digging I found the following so wanted to make sure I made a note of it and shared it with others.

Create a file in your home directory called .pyrc and insert the following lines into it:

1
2
import rlcompleter, readline
readline.parse_and_bind("tab: complete")

Now you need to ensure that this file is pulled into python each time it run, add the following to your .bashrc file:

1
export PYTHONSTARTUP="${HOME}/.pyrc"

Activate the changes in your current terminal and you’re sorted.

1
source ${HOME}/.bashrc

Leave a Reply