How can you get uptime shown in username@host
sorry for not knowing the exact name of it... but I know my friend runs gentoo and he has it so on his laptop it shows his uptime, battery life, wifi stability and many other things in the part that consists of username@host.. I know he has edited the .bashrc file to do so... I was just wondering if anyone knew how I can get an uptime listed in there as well... thank you
|
Command is like this :
export PS1='`uptime`\n-> ' ' ' and not " " because the prompt string must always be interpreted and not once... And then let talk your imagination. |
Thanky ou for that... but is there anyway to make it just say the uptime instead of... the whole uptime display... ?
|
Sure, uptime | awk '{print $3" "$4" & "$5}' | sed s/,//g for example.
|
One last thing how can I get it to display...
username@hostname | Uptime:XhXmXs$ (or whatever the prompt looks like at the end :)) or something similiar... thank you so much for your help |
Try with a script which contains the command, and execute it in PS1...
Or place the AWK program in a file. Problem is the caracter ' cannot be included into '...'. |
my friend told me that he added his to the .bashrc file... would I beable to do that?
|
Try the program UP.
up v0.3 -- by: David Cantrell (david@burdell.org) up is a robust uptime display utility for Linux systems. Usage: up [option] --compare | -c Display uptime in standard uptime format, for quick comparison with other systems. --numbers | -n Output numbers only (useful for scripts?). They are in this order: decades, years, weeks, days, hours, minutes. Zero values are not eliminated. --noup | -u Displays the default uptime format without the preceding 'up'. --version | -v Return the version number and author information. --help | -h Display this screen. Can't remember where I got it. I think with my /sys script for xchat. |
All times are GMT -5. The time now is 03:40 AM. |