df -k | grep (somthing)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting df -k | grep (somthing)
# 1  
Old 03-04-2008
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.
# 2  
Old 03-04-2008
I'm not sure if you want this

Get only / with df -k

[XXXXXX@XXXX Temporal]$ df -k | grep "/$"
/dev/cciss/c0d0p7 1004024 310028 642992 33% /
# 3  
Old 03-04-2008
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}"
-----------------------------------------------------------
# 4  
Old 03-04-2008
Or you could just do this:

df -k /

saves a little typing Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

2. UNIX for Dummies Questions & Answers

Piping grep into awk, read the next line using grep

Hi, I have a number of files containing the information below. """"" Fundallinfo 6.3950 14.9715 14.0482 """"" I would like to grep for Fundallinfo and use it to read the next line? I ideally would like to read the three numbers that follow in the next line and... (2 Replies)
Discussion started by: Paul Moghadam
2 Replies

3. Shell Programming and Scripting

Bash 3.2 - Array / Regex - IF 3rd member in array ends in 5 digits then do somthing...

Trying to do some control flow parsing based on the index postion of an array member. Here is the pseudo code I am trying to write in (preferably in pure bash) where possible. I am thinking regex with do the trick, but need a little help. pesudo code if == ENDSINFIVEINTS ]]; then do... (4 Replies)
Discussion started by: briandanielz
4 Replies

4. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

5. Shell Programming and Scripting

AWK/GREP: grep only lines starting with integer

I have an input file 12.4 1.72849432773174e+01 -7.74784188610632e+01 12.5 9.59432114416327e-01 -7.87018212757537e+01 15.6 5.20139995965960e-01 -5.61612429666624e+01 29.3 3.76696387248366e+00 -7.42896194101892e+01 32.1 1.86899877018077e+01 -7.56508762501408e+01 35 6.98857157014640e+00... (2 Replies)
Discussion started by: chrisjorg
2 Replies

6. UNIX for Dummies Questions & Answers

Advanced grep'in... grep for data next to static element.

I have a directory I need to grep which consists of numbered sub directories. The sub directory names change daily. A file resides in this main directory that shows which sub directories are FULL backups or INCREMENTAL backups. My goal is to grep the directory for the word "full" and then... (2 Replies)
Discussion started by: SysAdm2
2 Replies

7. UNIX for Dummies Questions & Answers

| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax

Hello, I'm working on unix with grep (GNU grep) 2.5.1. I'm going through some of the newer regex syntax using Regular Expression Reference - Advanced Syntax a guide. ls -aLl /bin | grep "\(x\)" Which works, just highlights 'x' where ever, when ever. I'm trying to to get (?:) to work but... (4 Replies)
Discussion started by: MykC
4 Replies

8. Shell Programming and Scripting

Isolating a specified line - awk grep or somthing else?

I'm trying to isolate attached hard drives that auto-mount to /media so that I can use them as variables in a bash script... so far I'm here: variable=$(ls /media | grep -v cdrom ) This lists all the connected drives, each on it's own line and doesn't list anything I don't want (cdrom... (2 Replies)
Discussion started by: Starcast
2 Replies

9. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

10. SuSE

kazaa or somthing like it?!?!?!?

hey i'm looking for somthing like kazaa that i can use to download some music on, i've relly liked teh progs you guys recommended for MSN so i figured i'd get soem more recomendations....lol thanks. (7 Replies)
Discussion started by: byblyk
7 Replies
Login or Register to Ask a Question