To make changes to your terminal prompt permanent, you need to add the customization to your shell's configuration file. Here’s how to do it for common shells:
For Bash Shell:
Open the
.bashrcfile in your home directory:nano ~/.bashrcAdd or modify the
PS1variable with your desired prompt customization. For example:export PS1="\u@\h:\w\$ "Save the file and exit the editor.
Apply the changes by running:
source ~/.bashrc
For Zsh Shell:
Open the
.zshrcfile in your home directory:nano ~/.zshrcAdd or modify the
PROMPTvariable with your desired prompt customization. For example:export PROMPT="%n@%m:%~%# "Save the file and exit the editor.
Apply the changes by running:
source ~/.zshrc
For Other Shells:
If you are using a different shell, look for its specific configuration file (like .kshrc for Korn shell or .cshrc for C shell) and follow a similar process.
By adding your prompt customization to these configuration files, the changes will persist across terminal sessions.
