Account Customisation (zsh): Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
mNo edit summary
Line 9: Line 9:
  [zsh prompt]>                          [right side prompt]
  [zsh prompt]>                          [right side prompt]


All we have done here is exported the two variables for the left side of the command prompt (PS1) and the right side of the command prompt (RPS1). You can add these two commands to your .zshrc so that your command prompts will be set like so everytime you log in. Just place these lines in your .zshrc:
All we have done here is exported the two variables for the left side of the command prompt (PS1) and the right side of the command prompt (RPS1). You can add these two commands to your .zshrc so that your command prompts will be set like so every time you log in. Just place these lines in your .zshrc:


  export PS1="Your Left Side Command Prompt ==>"
  export PS1="Your Left Side Command Prompt ==>"
  export RPS1="Your Right Side Command Prompt ==>"
export RPS1="Your Right Side Command Prompt ==>"


and then source your .zshrc by typing:
and then source your .zshrc by typing:
Line 45: Line 45:
Your current tty e.g. pts/100
Your current tty e.g. pts/100


Including these in your command prompt exports allows you to have a clock on your command prompt which updates everytime you press return, and you can see your current working directory to save you typing "pwd" everytime you forget where you are. e.g.
Including these in your command prompt exports allows you to have a clock on your command prompt which updates every time you press return, and you can see your current working directory to save you typing "pwd" every time you forget where you are. e.g.


  cambo@prodigy (~) % export PS1="[%B%n%b @ %M]>"
  cambo@prodigy (~) % export PS1="[%B%n%b @ %M]>"
Line 53: Line 53:
== Adding colours to the command prompt ==
== Adding colours to the command prompt ==


Its still looking kinda plain isn't it..... Maybe we could add some colours to it to see what we can do. zsh has another special set of escape characters specifically for printing colours at the prompt and we can also add these sequences to our PS1/RPS1 variables.
Its still looking kinda plain isn't it? Maybe we could add some colours to it to see what we can do. zsh has another special set of escape characters specifically for printing colours at the prompt and we can also add these sequences to our PS1/RPS1 variables.


At this point it gets a little more complicated. But with a little perseverance you can have your own customized and coloured account. The following are the escape sequences for creating the coloured text.
At this point it gets a little more complicated. But with a little perseverance you can have your own customised and coloured account. The following are the escape sequences for creating the coloured text.


  %{\e[1;31m%}
  %{\e[1;31m%}
Line 126: Line 126:




So say i'm the only person in your .friends file whose username begins with "c". Typing "ps -fU c<-TAB->" will auto-complete to "ps -fU cambo" (NB* this will also work for an alias of that command if you have one set). This can be convenient if you have a list of commands that you use on a regular basis for which aliases would be unsuitable.
So say I'm the only person in your .friends file whose username begins with "c". Typing "ps -fU c<-TAB->" will auto-complete to "ps -fU cambo" (NB* this will also work for an alias of that command if you have one set). This can be convenient if you have a list of commands that you use on a regular basis for which aliases would be unsuitable.
zsh message (exporting ARGV0)
zsh message (exporting ARGV0)


You may have seen when you "spy" on another user's processes that they have a customized zsh message in the process list. More and more people do this as an added customisation (and annoyance ;)) to their account.
You may have seen when you "spy" on another user's processes that they have a customised zsh message in the process list. More and more people do this as an added customisation (and annoyance ;)) to their account.


  (~)[cambo@prodigy]>> ps -fU cambo  
  (~)[cambo@prodigy]>> ps -fU cambo  
496

edits

Navigation menu