Current Size:
Chakra BreakPoints
base0px
sm480px
md768px
lg992px
xl1280px
2xl1536px
Current Height:Width
widthpx
heightpx

Subjects

Custom Cli Prompt

Date Created: 2024/04/21

Last Update: 2024/04/21

#shell #catch #reference #cli #prompt

Get our current prompt

echo $PS1

Our prompt is defined in our shell profile file. For example .bashrc or .zshrc. Either navigate to where the rc file is located. Normally in the user root, or use the following command to find the file.

grep PS1 ~/.bash_profile

Common Prompts

User@Hostname

export PS1="\u@\h"

or edit the .bashrc or .zshrc file directly

".bashrc"
# ...
PS1="\u@\h"
# ...

Differentiate Root User form Normal User

A common use case is to differentiate the root user from a normal user.

export PS1="\u@\H \W:\$ "
{/* TODO:
- add the success fail promp refernce
- add the git branch prompt reference
- add the time prompt reference
- add the user@hostname prompt reference
- add the path prompt reference
- add the custom prompt reference
*/}
## Reference
[how to set up linux prompt - cyberciti.biz](https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html)
[Prompt Customization - archilinux.org](https://wiki.archlinux.org/title/Bash/Prompt_customization)
(Deep dive.)

More Notes

All Notes
HomeProjects

Links

Home Articles Notes Projects About Style Guide Site Credits

Contact

 [email protected]

Location

🌎 Earth