How to modify the Ubuntu terminal Display user name and hostname, this problem for the familiar person, trivial, but sometimes knowledge should always accumulate some, even a small knowledge point, sometimes come to the time to find forget how to do, so record. The steps are simple.
"Declaration" Welcome reprint, but please keep the article original source: http://blog.csdn.net/yelangjueqi/article/details/45556657
1. Before modification
Format: User name @ host name
2. Start modifyingThe steps are as follows:
A. Modifying hostname, which is the host name
Open the file and modify the name to zh
save exit, reopen a terminal, and discover that the hostname has been modified.
B. Go to the home directory and open:. BASHRCfile (by modifying the configuration file, you can guarantee that the changes will still take effect after rebooting)
Search string:PS1, find the following snippet:
the green section \uto \h, the terminal will display the same user name as the hostname:
over! Restart the machine
PS: The meaning that the default special symbol represents:
\d: Represents the date, formatted as weekday month date, for example: "Mon-1"
\h: The full host name. For example: My machine name is: Fc4.linux, then this name is Fc4.linux
\h: Only the first name of the host is taken, as in the example above, then Fc4,.linux is omitted
\ t: Display time in 24-hour format such as: HH:MM:SS
\ t: Display time in 12-hour format
\a: Display time in 24-hour format: hh:mm
\u: Current user's account name
version information for \v:bash
\w: The full working directory name. Home directory will be replaced by ~
\w: Use basename to get the working directory name, so only the last directory is listed
\#: The first few commands issued
\$: Prompt character, if root, Prompt is: #, normal user is: $
Ubuntu modifies the host name and user name displayed by the terminal