Jump to content

Account Customisation (zsh): Difference between revisions

no edit summary
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 22: Line 22:
zsh has some system escape sequences which can be used in your command prompt also. These sequences are special characters which relate to system properties. They can be included in your command prompts to make your prompt more dynamic. Some of the common escape sequences are:
zsh has some system escape sequences which can be used in your command prompt also. These sequences are special characters which relate to system properties. They can be included in your command prompts to make your prompt more dynamic. Some of the common escape sequences are:


%d
 
Your current working directory relative to /home/
{| border="1" cellpadding="2"
%~
!width="300"|Property
Your current working directory relative to /home/member/u/username
!width="225"|Escape Sequence
%B....%b
|-
Begin and end bold print
|Your current working directory relative to /home/ || %d
%U....%u
|-
Begin and end underlined print
|Your current working directory relative to /home/member/u/username || %~
%M
|-
server name - murphy.redbrick.dcu.ie
|Begin and end bold print || %B....%b
%m
|-
The part of the hostname up to the first . - murphy
|Begin and end underlined print || %U....%u
%n
|-
Your Login Name
|server name, eg - murphy.redbrick.dcu.ie || %M
%T
|-
System time in HH:mm format
|The part of the hostname up to the first . - murphy || %m
%*
|-
System time in HH:mm:ss format
|Your Login Name || %n
%D
|-
Today's Date in YY-MM-DD
|System time in HH:mm format || %T
%l
|-
Your current tty e.g. pts/100
|System time in HH:mm:ss format || %*
|-
|Today's Date in YY-MM-DD || %D
|-
|Your current tty e.g. pts/100 || %l
|}
 


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.
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.
Line 56: Line 62:


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.
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.


{| border="1" cellpadding="2"
{| border="1" cellpadding="2"
Line 83: Line 90:
|Back to normal || %{\e[0m%}
|Back to normal || %{\e[0m%}
|}
|}


Here's the tricky part. These colour escapes sequences have to be printed to the prompt within the export command.  
Here's the tricky part. These colour escapes sequences have to be printed to the prompt within the export command.  
Line 130: Line 138:




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 receive" (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 r<-TAB->" will auto-complete to "ps -fU receive" (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)
== Removing the help message ==
Everytime you sign into redbrick, you get the help message. <br>
If you're tired of seeing this all you need to do is add a file called .nohelp in your home directory.  You can use the touch command to create a blank file.
receive@murphy (~) % touch .nohelp


== Customised zsh messages ==
== Customised zsh messages ==
Line 164: Line 179:


If you have any problems or mess something up and need help, just talk to [[Helpdesk]].
If you have any problems or mess something up and need help, just talk to [[Helpdesk]].
[[Category:Helpdesk]]