open('/home/theia/.bash_history', 'a').close() bashrc = open('/home/theia/.bashrc', 'a') bashrc.write('\n') bashrc.write('HISTCONTROL=""') bashrc.write('\n') bashrc.write("PROMPT_COMMAND='history -a'") bashrc.write('\n') # Close the file bashrc.close()