Centos PS1 settings

Source: Internet
Author: User


Default:


In/etc/bashrc

PS1 = "[\ [email protected] \ H \ W] \ $"


Description:

  • \: An ASCII Bell character (07)

  • \ D: The date in "weekday month date" format (e.g., "Tue May 26 ")

  • \ D {format}: The format is passed to strftime (3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required

  • \ E: An ASCII escape character (033)

  • \ H: The hostname up to the First '.'

  • \ H: The hostname

  • \ J: The number of jobs currently managed by the Shell

  • \ L: The basename of the shell's terminal device name

  • \ N: Newline

  • \ R: Carriage Return

  • \ S: The name of the shell, the basename of $0 (the portion following the final slash)

  • \ T: The current time in 24-hour hh: mm: SS format

  • \ T: The current time in 12-hour hh: mm: SS format

  • \@: The current time in 12-hour AM/PM format

  • \: The current time in 24-hour HH: Mm format

  • \ U: The username of the current user

  • \ V: The version of bash (e.g., 2.00)

  • \ V: The release of bash, version + patch level (e.g., 2.00.0)

  • \ W: The current working directory, with $ home abbreviated with a Tilde

  • \ W: The basename of the current working directory, with $ home abbreviated with a Tilde

  • \!: The History number of this command

  • \#: The command number of this command

  • \ $: If the specified tive uid is 0, a #, otherwise a $

  • \ NNN: The character corresponding to the octal number NNN

  • \\: A backslash

  • \[: Begin a sequence of non-printing characters, which cocould be used to embed a terminal control sequence into the prompt

  • \]: End a sequence of non-printing characters



Define by self:

/Etc/profile. d/prompt. Sh


#! /Bin/bash


If [$ (ID-u)-EQ 0]; then

PS1 = "[My-local-test \ [email protected] \ H: \ W] #"

Else

PS1 = "[My-local-test \ [email protected] \ H: \ W] $"

Fi

This article is from the "fun" blog, please be sure to keep this source http://305105.blog.51cto.com/295105/1562483

Centos PS1 settings

Related Article

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.