Open the .bashrc file
Enter in the terminal: vi ~/.bashrc (or vim ~/.bashrc if vim is installed)
At the end of the file, add
export PS1='[\u@\h \w]$ '
in,
\u means the current username
\h represents the current hostname (hostname)
\w means the current path
In fact, it can also be reduced to a shorter one and only keep the current path, as follows
export
PS1=
'[\w]$ '
Save and exit, and restart the terminal.