use double quotation marks or single quotation marks to combine the variable content, but pay special attention to it. special characters in double quotation marks can retain the variable property, however, special characters in single quotes are only common characters; 5. if necessary, special characters (such as Enter, $, \, space character, and ') must be converted into general characters by backslash (\). 6. you can use the reference character ('command') in the information provided by othe
character (' command '); (especially note that ' is the button on the left of the number key 1 above the keyboard, not the single quote! )7. If the variable is amplified variable content, you need to double quotes and $ variable names such as: "$PATH":/home continue to accumulate content;8. If the variable needs to be executed in another subroutine, export will be required to change the variable to an environment variable, such as export PATH9. Usual
At this point, we will often encounter such a problem: the operation of the server because of something interrupted, back to continue to operate the time will certainly be ifconfg to confirm whether I want to operate the server, because it can not be recognized from the image.
Therefore, it is necessary to optimize this PS1 command-line prompt. Every operation and siege Lion must have its own habits, but I still recommend a server batch management in
Linux PS1 prompt definition PS1: Is the user's usual prompt.PS2: The first line is not finished, wait for the second line to enter the prompt.The Linux system prompt is defined with the system variable PS1. The general system default form is: [username@host working directory]$.Use echo $PS 1 to get the PS1 value, i.e.
2016.1.11 today learned to change the color of PS1, how to add PS1 variable to find a file (. bash_profile), or BASHRCExport ps1= "\[\e[32;1m\]test $PWD > \[\e[0m\]"#显示绿色, where test is an additional addition to the content to be displayedExport ps1= "\[\e[35;1m\]test $PWD > \[\e[0m\]#显示红色 have a reference blog http://
Change the color of the PS1 variable.
2016.1.11 today I learned how to change the color of PS1. How to add the PS1 variable to find the file (. bash_profile) or bashrcExport PS1 = "\ [\ e [32; 1m \] Test $ PWD> \ [\ e [0m \]"# Display green, where Test adds additional content to be displayedExport
# PS1 = 'custom content' pay attention to the single quotation mark examples on both sides: PS1 = '(/u @/H/D/T)/$ 'your PS1: the user's usual prompt. PS2: the first line is not complete. Wait for the prompt entered in the second line. Linux system prompts are defined by the system variable ps1. The default format is [u
At this time, we will certainly often encounter such a problem: the operation of the server because of something interrupted, go back to the operation will certainly be ifconfg to confirm whether I want to operate the server, because the image can not be recognized.
Therefore, it is necessary for us to optimize this PS1 command line prompt. Every operation of the Victoria siege Lions must have their own habits, but I still recommend a server batch ma
Operating Environment:
System: Mac 10.12
Editor: Vim
One, no brain configuration:1. Open the Midrange input:VI ~/.bash_profile2. Open and edit the. bash_profile file:Press keyboard "I" to enter edit modeCopy the following code:Export clicolor=1export PS1="Press esc--"W" and press "Q"--"restart terminal--" complete!Second, advanced operation:Escape characters:The above example uses a backsl
Tags: lin China strong BSP Bash result machine name need to be notifiedMy PS1 command prompt: ps1= "\[\e[32;40m\][\[\e[32;40m\]\u \[\e[32;40m\]>>\h \[\e[32;40m\]\w \[\e[36;40m\] (\A) \[\e[32; 40m\]] \[\e[0m\]\$ "1. Set the display of PS1 facePS1 (is the number 1 instead of the letter L), each version of Bash's PS1 vari
Linux Terminal command line prompt art-PS1 advanced words not to mention, first glance at my command line prompt (a little big): the command line in the figure explains: calendar [calendar date/lunar date and time] calendar [number of directories under the current directory + number of items below the current directory] [current absolute directory] calendar [user name @ host name-number of items... linux Terminal command line prompt art-
Linux Command Prompt PS1 settings-Linux general technology-Linux programming and kernel information, the following is a detailed description. 1. Current prompt:
Echo $ PS1
2. Set the prompt:
Set it in the. bash_profile file under the root directory of the user (this file does not exist, it is created), for example:
PS1 = "[\ u @ \ W] \ $"
Export
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 t
By default, Ubuntu kernel outputs the complete path. When the path name is long, the prompt method is unfriendly. Modify the settings of the PS1 variable by following these steps to allow the terminal to output the relative path. Similar to the Red Hat system. Change idea: Change w to W to show absolute path, and add [] brackets. First modify the/etc/bash. bashrc file www.linuxidc.com @ linuxidc-laptop :~ $ Sudovim/etc/bash. bashrc modify the followin
Linux environment variables PS1 set linux environment variables PS1 is simply set command prompt display content, as follows: www.2cto.com1root@10.1.1.200 :~ # The meaning of the prompt in the PS1 variable: \ d: indicates the date. The format is weekdaymonthdate, for example, Wed... linux environment variables PS1 set
The. ps1 file is a script file written by PowerShell. In Windows systems, it is not allowed to execute. ps1 files by default, so how can the system allow the execution of. ps1 files?
What is a ". PS1" file?
This is the script text written by PowerShell, you can write a section of PowerShell code in Notepad, then save
The color code is basically clipped between "\ e [" and "m": \ e [32; 1 m
You can use \ e [0 m to disable color output. In particular, when B is set to 1, the highlighted and bold text is displayed.
Common color codes:
Foreground background color
--------------- 30 40 black 31 41 red 32 42 green 33 43 yellow 34 44 blue 35 45 purple 36 46 cyan 37 47 white
Code meaning
---------------- 0 OFF1 highlighted 4 underline5 flashing 7 reversed white display 8 invisible
Change the color of the prompt in
By default, the Ubuntu terminal will output the full path, the path name is very long, the hint is very unfriendly, the following steps to modify the settings of the PS1 variable, you can let the terminal output relative path. Similar to the style of the Red Hat system. Modify the idea: Change W to W to display absolute paths, and add [] brackets.By default, the Ubuntu terminal will output the full path, the path name is very long, the hint is very un
If you don't want to talk about it, first glance at my command line prompt (a little big ):
The command line in the figure is as follows:Calendar [date of the Gregorian calendar/date of the lunar calendar]Else [number of directories under the current directory + number of items below the current directory] [current absolute Directory]Users [username @ host name-the number of terminals required _ hosts]
Related configuration files
Global configuration file:/etc/bash. bashrc or/ect/bashrc
Single-
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.