💾 Archived View for republic.circumlunar.space › users › johngodlee › posts › 2017-08-14-bash-prompt… captured on 2021-12-04 at 18:04:22. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
DATE: 2017-08-14
AUTHOR: John L. Godlee
This is what my bash prompt looks like at the moment:
Here is what the various parts refer to:
And here is a link to a .bashrc,
The bash prompt is a piece of text placed at start of a command line interface using the bash shell. The primary function of the prompt is to let the user know that the computer is ready for the next command, the secondary function is to provide the user with some information about the status of the current session.
The default bash prompt looks like this:
so fire up your terminal of choice and see that your bash prompt looks similar. The default prompt shows the currently logged in username, the hostname (i.e. the name of th computer), the current directory path relative to ~ and finally a $, which marks the end of the prompt and the start of the area that you can type commands.
The .bashrc, among other things related to how bash functions, is where you can define a custom bash prompt. .bashrc is normally found in the root (~) directory. Check if you have a ~/.bashrc using:
cat ~/.bashrc
If bash says that there is no such file, create one using:
touch ~/.bashrc
Finally, start editing .bashrc using your favourite text editor, e.g. vim:
vim ~/.bashrc
To start with, let's replace the default bash prompt with something really simple like this:
To achieve this, type the following into your .bashrc:
PS1='\