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
In Linux environment variables, PS1 is an important environment variable: PS (PromptSign): refers to a command prompt. for example, on a Fedora12 terminal: [liutao @ liutao ~] $. When setting the PS1 environment variable, we need to use some preset special symbols to set PS1. The following is laruence... in Linux environment variables,
PS1 (is the number 1 instead of the letter L), there may be a small difference in the special notation within each version of Bash's PS1 variable, and you can bash the man first. The following are the meanings that the default special symbols in the FC4 environment represent:
\d: Represents a date, formatted as weekday month date, for example: "Mon Aug 1"
\h: The full host name. For example: My machine
# 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
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
We all know that in bash, you can change the color of the prompt by PS1 variables. When the command output is long, it is often not easy to see where the output begins at the first glance, change the PS1 variable by changing it, you can change the color of the bash prompt so that you can look at the crowd and find where the output begins. Also, setting colors can make the command line more beautifulWe can c
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 you allow the system to execute. ps1 files?What is the. ps1 file?This is the script text that PowerShell writes, you can write a PowerShell code in Notepad, then save it as "Xxx.ps1",
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
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
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-
Take bash shell as an ExampleIn general, the default. bashrc should be:~ /. BashrcExport PS1 = '\ U @ \ H: \ W \ $'The above means: user @ host: Current directory $Escape SequenceIf you use a colored prompt to increase personalization, you need to use escape sequences. The escape sequence is a control command that allows shell to execute a special step. Generally, escape sequences start with ESC (which is also the reason for its naming ). ^ [. This re
[Email protected]:~$ vim. BASHRC ps1= ' ${debian_chroot:+ ($debian _chroot)}\[email protected]\033[1;33mhttp:// 990487026.blog.51cto.com\e[m\w\$ 'Save, create a new window:Look at the effect:650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/83/B8/wKiom1d7OeTDs4mHAAAV8u1xAgI702.png "title=" 1467693446.png "alt=" Wkiom1d7oetds4mhaaav8u1xagi702.png "/>This article is from the "Soul Bucket" blog, please be sure to keep this source http://99048702
Prompt "Unable to load file PS1 when running PowerShell directly because scripting is forbidden in this system." For more information, see "Get-help about_signing".Mainly because there is no permission to execute the script.Run Get-help about_signing tips to understand execution policy inputGet-executionpolicyShow RestrictedThe execution of any script is not allowed.by commandGet-help Set-executionpolicy has the following execution strategy:Then modif
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.