a simple ps1 bash prompt (and one for zsh too)
export PS1='\n($?, $(cat /proc/loadavg | colrm 5 | xargs), $(du -hs | colrm 8 | xargs), $(ls -1 | wc -l)) \u@\H:\w/\n\$ '
this outputs something like
(0, 0.85, 6.8g, 13) david@sixhat.net:~/
$
where the individual values are (in order):
- the last command exit code
$?
- the load on the cpu
$(cat /proc/loadavg | colrm 5 | xargs)
- the size of current directory
$(du -hs | colrm 8 | xargs)
- the number of files/dirs in current directory
$(ls -1 | wc -l)
- the user@host:folder
\u@\h:\w/
- the prompt type (normal $ |root #)
\$
notice that it has no colours. although colours are a nice feature to have, they don't work in every terminal, but within your .profile
you can do conditional prompts based on colour support by the terminal.
what about zsh prompts?
well, zsh prompts are a little bit different to configure, but a similar one that i use in my macs is this:
export PS1='
%T %(1d.%B[First Day of Month]%b .)%U(%?,%j)%u %n@%m %F{red}%0~%f
%F{green}%B%(!.%#.;)%b%f '
The expansions are different from bash, so you are better off reading the manual about expansions, but the above one can give you a nice start.