df -k | grep (somthing)

Hi all,

I am getting an hole out put of df -k for df -k | grep /
Please let me how can i get for exact one... i want to grep it..!

More ever..

Want to know few things...!

I am using solaris 9
and want know how to get the CPU utlization from TOP command
want calulate CPU utlization (100-ideal value) and memory utilization
(Total memore - free memory ) / Total momery

want these thing as a script..

Please friends soe one help me.

Get only / with df -k

[XXXXXX@XXXX Temporal]$ df -k | grep "/$"
/dev/cciss/c0d0p7 1004024 310028 642992 33% /

CPU utilization:

In my case, we have 4 for cpus, i take total line and idle field
$ top -n 1
16:44:03 up 24 days, 20:09, 6 users, load average: 1.08, 1.02, 1.01
441 processes: 439 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: cpu user nice system irq softirq iowait idle
total 26.3% 0.0% 0.7% 0.0% 0.0% 0.0% 72.9%
cpu00 38.0% 0.0% 0.0% 0.0% 0.0% 0.0% 61.9%
cpu01 3.7% 0.0% 0.9% 0.0% 0.0% 0.0% 95.2%
cpu02 62.8% 0.0% 0.0% 0.0% 0.0% 0.0% 37.1%
cpu03 0.9% 0.0% 1.9% 0.0% 0.0% 0.0% 97.1%

$ top -n 1 | grep total | tr -s " " | cut -d" " -f9
73.8%

-----------------------------------------------------------
#!/bin/sh

FREE_CPU=`top -n 1 | grep total | tr -s " " | cut -d" " -f9`
echo "Free CPU: ${FREE_CPU}"
-----------------------------------------------------------

Or you could just do this:

df -k /

saves a little typing :slight_smile: