How to edit the terminal prompt name in MacOS
If you work in the Terminal like I do, you’d like to see some customizations done to personalize it. This tip will show you how to customize the Terminal prompt.
Thank you for reading this post, don't forget to subscribe!
The Terminal prompt is shown just before where you type in the commands to execute commands. Sometimes, users like to personalize this prompt for one reason or another.
Here’s how:
- Open Terminal (Finder > Applications > Utilities > Terminal).
- First, ensure you’re in the HOME Directory by issuing the command: cd ~/
- To prove you’re in the right directory and show hidden files, type in: ls-la
- Check and see if a file named bash_profile exists.
- If it doesn’t exist, create one by typing in: touch .bash_profile
- You’ll have to edit this file by typing: open -e .bash_profile
- Add this line to the file and save it: export PS1=”u$ “
- Quit Terminal and relaunch it in step #1 to see your new prompt.
- That’s it.
In addition:
Here’s an abbreviated list of commands that can change the prompt:
\d
– Current date\t
– Current time\h
– Host name\#
– Command number\u
– User name\W
– Current working directory (ie: Desktop/)\w
– Current working directory with full path (ie: /Users/Admin/Desktop/)
There are other things you can do to customize the prompt, like using Emojis, colors, and more. You can do a search via Google or DuckDuckGo for more information.