Generally, when we use Mac, the host name indicated by the default terminal is relatively long, and users with a little attention need to modify the host name, which is a little refreshing. For example, we can see that the host name is long before the command is modified.
We can see that it is "userdeMacBook-Pro". If we can shorten the modification or customize the modification, we can use the following simple method. You can directly run a command to modify the host name.
1. Open the terminal and enter the command
The code is as follows: |
Copy code |
Sudo scutil -- set HostName new name
|
For example, set the parameters as follows:
The code is as follows: |
Copy code |
Sudo scutil -- set HostName itbulu
|
We only need to replace the red part with the desired host name.
Second, close the terminal and re-open it.
After the terminal is closed and re-opened, we can see that the terminal host name is newly created. Of course, if we don't care about it, we can also choose not to set it. Lao Jiang seems to have set the Mac of colleagues in the company.
Method for host name under Mac:
Vim ~ /. Profile
Export PS1 = "[\ u @ \ h \ W] \ $"
Note:
\ U-current user name
\ H-host name hostname
\ W-current directory
\ W-complete path of the current directory
\ D-current system date
\ T-current system time