Termux - Custom Prompt¶
Termux is a terminal emulator and Linux environment for Android. I wanted to customise my prompt in the same way that I have done on my desktop/laptop machines. Ordinarily I would have a .bashrc in my home directory where I would make the changes to the prompt (PS1). However Termux doesn’t recognise this.
I found a reference to configuring this: http://blog.ataboydesign.com/2015/12/01/termux-is-the-one-for-android/
Following this method the changes to PS1 are made in “/data/data/com.termux/files/usr/etc/bash.bashrc”. I had been successfully using this method for a while with no ill effects. That was until today when I realised an update to Termux had overwritten the changes. Not what I wanted.
1# .profile 2if [ -n "BASH_VERSION" ]; then 3 # Echo msg to indicate file is run - can be removed later 4 echo "Profile load.bashrc" 5 # include .bashrc if it exists 6 if [ -f "$HOME/.bashrc" ]; then 7 . "$HOME/.bashrc" 8 fi 9fi
Create and edit “.bashrc” with any custom options. Exit and restart Termux and your custom configuration should be loaded.