Save python history across sessions (linux, Ubuntu)
To get python to save history across sessions you put the file .pystartup in your home directory and you add the line
Open a terminal and go to your home directory.
(In Ubuntu 10.04 and other versions, navigate to Applications -> Accessories -> Terminal to bring up a terminal window. You should already be in your home directory.)
Add the line
export PYTHONSTARTUP=/home/name_of_home_directory/.pystartup
to the .bashrc file, replacing name_of_home_directory
with the name of your home directory.
(In Ubuntu 10.04 and other versions, you can open this file by typing
gedit .bashrc
at the command line. This will bring up a simple editor. Just add the line given above to the bottom of the file, save the file and close the gedit window.
The name of your home directory is the string that appears before the @
sign in your command line prompt, assuming you haven’t done anything to change this. For example, your prompt might look like this:
name_of_home_directory@mycomputer:~$
You can also find it by going to Places->Home Folder. The window that pops up will have the text
name_of_home_directory – File Browser
at the top.)
That should do it!
Thanks to archduke.