open('/home/deadlock/.bash_history', 'a').close() bashrc = open('/home/deadlock/.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()