LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How can you get uptime shown in username@host (https://www.linuxquestions.org/questions/slackware-14/how-can-you-get-uptime-shown-in-username%40host-174018/)

Shr00mBoXx 04-24-2004 08:40 AM

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

Y@bon 04-24-2004 09:21 AM

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.

Shr00mBoXx 04-24-2004 10:38 AM

Thanky ou for that... but is there anyway to make it just say the uptime instead of... the whole uptime display... ?

Y@bon 04-24-2004 11:39 AM

Sure, uptime | awk '{print $3" "$4" & "$5}' | sed s/,//g for example.

Shr00mBoXx 04-24-2004 11:50 AM

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

Y@bon 04-24-2004 12:18 PM

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

Shr00mBoXx 04-24-2004 01:27 PM

my friend told me that he added his to the .bashrc file... would I beable to do that?

At0mic_PC 04-24-2004 04:39 PM

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.