07-27-2008
none of the suggestions work
here is a list of the commands and what output they produce (btw I use Leopard OS X):
uptime | cut -d" " -f4-8 | sed 's/,//g'
-> up 9 mins 2 users
uptime | sed 's/, *[0-9]* users.*$//'
-> 0:18 up 10 mins
uptime | sed 's/.*up \(.*\),.user.*/\1/'
-> 0:19 up 10 mins, 2 users, load averages: 0,61 0,54 0,31
I want it look like that: x days y h z min
I do not want to see the current time, the word up, commas, colons nor the load averages. Furthermore if the machine has only be running for a couple of minutes it should look like that: z min
-> so the output should print nothing else except the minutes (for hours the same: it should not display days yet)
I have been playing around with uptime | awk etc. but this command did not produce the required output since it changes depending on how long the machine has been running for.
Is there a command that solves my problem or is it impossible to produce the required output due to the changing uptime of the computer?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi Folks
uptime
12:24pm up 2 days, 3:12, 4 users, load average: 0.00, 0.00, 0.00
what does the load average figure mean..
regards
Hrishy (2 Replies)
Discussion started by: xiamin
2 Replies
2. UNIX for Dummies Questions & Answers
I'm trying to get the uptime of my computer (Mac OS X) and I can go into the terminal and type "uptime" OK, and that gives me a string with the uptime in it. The problem is that the string changes a lot, and its very difficult to get the data I'm trying to extract out cleanly.
Now I have 3... (2 Replies)
Discussion started by: Freefall
2 Replies
3. UNIX for Dummies Questions & Answers
On HP-UX, the 13th argument of uptime is sometime the load and sometime the word AVERAGE:???
14 Jun 06 5:00pm up 44 days, 54 mins, 0 users, load average: 0.00, 0.02, 0.03
14 Jun 06 5:15pm up 44 days, 1:09, 0 users, load average: 0.00, 0.01, 0.01
When the time is in minutes, then the load... (1 Reply)
Discussion started by: qfwfq
1 Replies
4. AIX
Hey guys!!
Was tring to figure out how to find the uptime of an HMC? Any clue
Bala (2 Replies)
Discussion started by: balaji_prk
2 Replies
5. Solaris
HI All,
I have problem with "uptime" on one of the sun server.(SunOS 5.9 Generic_118558-11 sun4u sparc SUNW,Sun-Fire-V240).when i am issuing uptime command its not showing uptime.even its not showing output for who -b.
$ uptime
11:01am 1 user, load average: 0.06, 0.04, 0.03
$ who -b
$... (3 Replies)
Discussion started by: jeevanbv
3 Replies
6. AIX
HELLO ALL
HOW CAN I CHECK HMC UPTIME :confused: :confused: VERSION 6 :D (7 Replies)
Discussion started by: kalaso
7 Replies
7. Shell Programming and Scripting
Hi,
I need some help about a script i need to write.
I want to check , if some specific process, are running since 2 hours.
I tried to use a loop , grep my pid and use find -ctime on /proc directory, to list what i need.
for i in `ps -ef |grep process |grep -v grep|awk '{print $2}'`... (2 Replies)
Discussion started by: rokerij
2 Replies
8. Linux
Hi All
is there a way that i can return uptime if the machine has been on for longer than 4 days
thanks
ab (3 Replies)
Discussion started by: ab52
3 Replies
9. Shell Programming and Scripting
Hi!
I want to extract the uptime from the output of the uptime command.
The output:
11:53 up 3:02, 2 users, load averages: 0,32 0,34 0,43
I just need the "3:02" part. How can I do this?
Dirk (6 Replies)
Discussion started by: Dirk Einecke
6 Replies
10. War Stories
Hi All,
Having recently started a new job, a Data Center Migration in fact I have been tasked with looking at some of the older Solaris boxes when I came across this little gem.
nismas# uname -a
SunOS nismas 5.5.1 Generic_103640-27 sun4u sparc SUNW,Ultra-1
nismas# uptime
10:37am up 2900... (2 Replies)
Discussion started by: gull04
2 Replies
LEARN ABOUT OPENSOLARIS
ruptime
ruptime(1) User Commands ruptime(1)
NAME
ruptime - show host status of local machines
SYNOPSIS
ruptime [-ar] [-l | -t | -u]
DESCRIPTION
The ruptime utility gives a status line like uptime (see uptime(1)) for each machine on the local network; these are formed from packets
broadcast by each host on the network approximately every three minutes.
Machines for which no status report has been received for 11 minutes are shown as being down.
Normally, the listing is sorted by host name, but this order can be changed by specifying one of the options listed below.
OPTIONS
The following options are supported:
-a Counts even those users who have been idle for an hour or more.
-r Reverses the sorting order.
-l | -t | -u These options are mutually exclusive. The use of one overrides the previous one(s).
-l Sorts the display by load average.
-t Sorts the display by up time.
-u Sorts the display by number of users.
FILES
/var/spool/rwho/whod.* data files
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWrcmdc |
+-----------------------------+-----------------------------+
SEE ALSO
uptime(1), rwho(1), in.rwhod(1M), attributes(5)
SunOS 5.11 6 Nov 2000 ruptime(1)