LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-20-2017, 10:34 AM   #1
gartie
LQ Newbie
 
Registered: Jan 2016
Posts: 6

Rep: Reputation: Disabled
get total used space in rhel5


hi all,

I am trying to get the total used space in rhel5. In rhel6 I can issue the command
df --total -h | tail -1 |grep total |awk '{print $3}'
however, in rhel5 the --total parameter does not exist.
Does anyone have a quick workaround for this?

thanks..
 
Old 04-20-2017, 10:50 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,193

Rep: Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068
Quote:
Originally Posted by gartie View Post
hi all,
I am trying to get the total used space in rhel5. In rhel6 I can issue the command df --total -h | tail -1 |grep total |awk '{print $3}'
however, in rhel5 the --total parameter does not exist. Does anyone have a quick workaround for this?
RHEL 5 is ancient, so I don't even have a reference system to look at..did you read the man page on the df command, and find the equivalent? If there isn't one, you can script this to take the input from "df -kPH" (or whatever DF you're after), and total them up for you.
 
Old 04-20-2017, 12:21 PM   #3
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
You could download the coreutils source for a more recent version and build/install it in a non-standard location, then point your script to that version of df instead of the system default.
 
Old 04-20-2017, 12:35 PM   #4
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950

Rep: Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513
It works in current Debian.
or
Code:
df | awk '{print $3}' | grep -v Used | awk '{ sum += $1 } END { print sum }'
and divide the answer by 1024^2 to get the answer in GB.
 
1 members found this post helpful.
Old 04-20-2017, 12:58 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,193

Rep: Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068Reputation: 8068
Quote:
Originally Posted by JeremyBoden View Post
It works in current Debian.
or
Code:
df | awk '{print $3}' | grep -v Used | awk '{ sum += $1 } END { print sum }'
and divide the answer by 1024^2 to get the answer in GB.
Nice one.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] consumed space bigger than total disc space? WiseDraco Slackware 6 02-19-2015 01:12 AM
RHEL5.3 is not showing total physical memory JATA01 Linux - Hardware 7 08-27-2010 04:31 AM
Total available/used space of all drives MartenH Linux - Newbie 16 03-29-2009 04:04 PM
total free space is different than actual sushmi Linux - Newbie 2 06-04-2007 01:48 AM
format only gives me less than total space ctrl-a Linux - Newbie 4 10-12-2004 04:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:44 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