Modify the default host name prompt and host name of the Mac terminal

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.