Change the font color of termux without any additional tools using the .bashrc file

The .bashrc file is a shell script file, generally used as a user-specific configuration file for the BASH (Bourne Again SHell) shell. It is located in a user's home directory, and will be executed when that user logs into bash.
The script written in this file is automatically executed every times new shell terminal is opened (every time you open the terminal).
We can use it to execute certain commands in every time we open the terminal (color changes, calling of tools or scripts that we want to use).
Example of bash script for .bashrc files
For this step we need to open the .bashrc and put your code in it using text editor like nano vim... or any other text editor.
after open .bashrc file past this code :
PS1='\033[01;31m\h\033[01;34m \W \$\033[00m \033[1;93m'

Open .bashrc file 
with nano In termux 

PS1 - variable that display in the beginning of every command line and controls the appearance of every character you type.
in our example it is the responsable of the appearance of :
localhost ~ $
\033[01;31m - ANSI escape sequences responsable of the red color
\h - the current machine's hostname
\033[01;34m - ANSI escape sequences  responsible of the blue color
\W - the  basename  of the current working direc­tory
\$
\033[00m - ANSI escape sequences will reset text color (returns text color to default)
\033[1;93m - ANSI escape sequences responsable of the yellow color of every word you type in terminal.

Save the changes (if you use nano click control + x)
reopen your terminal and you will see the changes

In general the .bashrc file is used by the user to customize the terminal depending on his needs and in most cases doesn't exist by default in home directory, so you must create it. 
You need to use the command ls -a in home folder, the ls command can't show the hidden file and folder (there name start with "." dot) 

Comments

Post a Comment