Server Linux Command Prompt disclosure

Source: Internet
Author: User


has been in Ubuntu12.04 and 12.10 Desktop under the play, now to Centos6.3 Server version under the development, the feeling is very different. Overcoming one has a feeling of not being smooth after having that kind of standing on top of the mountain. think about programming a lot of the time, isn't it? Take the time to go into a problem, get through, the key is not to improve yourself, found the fun is the most interesting .


Command prompt, probably the closest we have. If you don't make any configuration, you'll get a picture like this:


You start you may not notice, time long you find there is strange, excellent coder will find ways to optimize, method is very easy to locate, also relatively easily set up, we please Google search by themselves, here do not repeat, can not find the message.


Set up to see familiar and friendly hints:(plus: Export ps1= ' [\[email protected]\h \w]\$ ')




Feel very satisfied, there is no need to delve into ' [\[email protected]\h \w]\$ ' These strange symbols of the meaning, this time is really not necessary. Old Root login is not a good habit, a new user Luckbo, with the feeling is also OK,


When Luckbo need sudo su, here need to be configured separately, can refer to here, CentOS Ordinary users add sudo permissions, found from the normal account LUCKBO switch to root, the prompt has magically changed back to the


The crux of the problem is that the same configuration should be done in the bash_profile of the ordinary account LUCKBO. After setting it, OK.

If you are interested, you will find that you can also do some personalized settings:




Vim ~/.bash_profile Add: Export ps1= ' \[\e[32;1m\][\[email protected]\h \w]$>\[\e[0m\] ' can't forget to do: source ~/.bash_profile


My understanding of this pattern is very similar to the regular one, and in part it is as follows:

<span style= "FONT-SIZE:14PX;" >\d: Represents the date, formatted as weekday month date, for example: "Mon Aug1" \h: 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, as in the above example, the 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: The current user's account name \v:bash version information \w: Full working directory name. Home directory will replace \w: with the basename to get the working directory name, so only the last directory \#: The first command issued \$: prompt character, if it is root, the prompt is: #, ordinary users are:$</span>


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.