Show Menu
Cheatography

PS1 environment variable Cheat Sheet by

PS1 code

\a : an ASCII character
\d : the date in “Weekday Month Date” format
\D{format} : the format is passed to strfti­me(3) and the result is inserted into the prompt string; an empty format results in a locale­-sp­ecific time repres­ent­ation. The braces are required
\e : an ASCII escape character
\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 : a new line
\r : a 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
\A : the current time in 24-hour HH:MM format
\u : the username of the current user
\v : the version of bash
\V : the release of bash, version + patch level (e.g., 2.00.0)
\w : the current working directory, with $HOME abbrev­iated with ~
\W : the basename of the current working directory, with $HOME abbrev­iated with ~
\! : the history number of the last command
\# : the command number of the last command
\$ : if the effective UID is 0, a #, otherwise a $
\nnn : the character corres­ponding to the octal number nnn
\\ : a backslash
\[ : begin a sequence of non-pr­inting charac­ters, which could be used to embed a terminal control sequence into the prompt
\] : end a sequence of non-pr­inting characters
everything else in terpreted literraly

PS1 formating

\e[codem : indicate the start of a formating
\e[m : indicate the end of all formating
code : set;colour;background

set, reset, foreground colours, background colours

SET
RESET
FOREGROUND
BACKGROUND
1 : bold/b­right
0 : reset all
30 : black
40 : black
2 : dim
1 : reset bold/b­right
31 : red
41 : red
4 : underlined
2 : reset dim
32 : green
42 : green
5 : blink
24 : reset underlined
33 : yellow
43 : yellow
7 : reverse
25 : reset blink
34 : blue
44 : blue
8 : hidden
27 : reset reverse
35 : magenta
45 : magenta
 
28 : reset hidden
36 : cyan
46 : cyan
   
37 : light gray
47 : light gray
   
39 : default
49 : defautl
   
90 : dark gray
100 : dark gray
   
91 : light red
101 : light red
   
92 : light green
102 : light green
   
93: light rellow
103 : light yellow
   
94 : light blue
104 : light blue
   
95: light magenta
105 : light magenta
   
96 : light cyan
106 : light cyan
   
97 : white
107 : white
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by gregcheater