LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-24-2004, 08:40 AM   #1
Shr00mBoXx
Member
 
Registered: Dec 2003
Distribution: Slackware 9.1
Posts: 63

Rep: Reputation: 15
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
 
Old 04-24-2004, 09:21 AM   #2
Y@bon
LQ Newbie
 
Registered: Oct 2003
Posts: 13

Rep: Reputation: 0
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.
 
Old 04-24-2004, 10:38 AM   #3
Shr00mBoXx
Member
 
Registered: Dec 2003
Distribution: Slackware 9.1
Posts: 63

Original Poster
Rep: Reputation: 15
Thanky ou for that... but is there anyway to make it just say the uptime instead of... the whole uptime display... ?
 
Old 04-24-2004, 11:39 AM   #4
Y@bon
LQ Newbie
 
Registered: Oct 2003
Posts: 13

Rep: Reputation: 0
Sure, uptime | awk '{print $3" "$4" & "$5}' | sed s/,//g for example.
 
Old 04-24-2004, 11:50 AM   #5
Shr00mBoXx
Member
 
Registered: Dec 2003
Distribution: Slackware 9.1
Posts: 63

Original Poster
Rep: Reputation: 15
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
 
Old 04-24-2004, 12:18 PM   #6
Y@bon
LQ Newbie
 
Registered: Oct 2003
Posts: 13

Rep: Reputation: 0
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 '...'.
 
Old 04-24-2004, 01:27 PM   #7
Shr00mBoXx
Member
 
Registered: Dec 2003
Distribution: Slackware 9.1
Posts: 63

Original Poster
Rep: Reputation: 15
my friend told me that he added his to the .bashrc file... would I beable to do that?
 
Old 04-24-2004, 04:39 PM   #8
At0mic_PC
Member
 
Registered: Jul 2003
Location: Mississippi
Distribution: Slack9.1
Posts: 159

Rep: Reputation: 30
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why "bash-2.05b$" in Terminal instead of "username@localhost username" jayelitumbiolo Linux - General 9 10-04-2009 03:16 AM
Uptime: 2.4 vs 2.6 Synesthesia Linux - General 4 10-17-2005 03:23 PM
24/7 uptime? jollyjoice General 20 01-25-2005 11:12 AM
useradd: invalid username username$ engyeow Fedora 5 12-05-2004 04:35 AM
uptime skate Linux - Software 16 08-14-2003 03:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration