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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-20-2017, 10:34 AM
|
#1
|
LQ Newbie
Registered: Jan 2016
Posts: 6
Rep:
|
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..
|
|
|
04-20-2017, 10:50 AM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,193
|
Quote:
Originally Posted by gartie
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.
|
|
|
04-20-2017, 12:21 PM
|
#3
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
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.
|
|
|
04-20-2017, 12:35 PM
|
#4
|
Senior Member
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950
|
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.
|
04-20-2017, 12:58 PM
|
#5
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,193
|
Quote:
Originally Posted by JeremyBoden
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.
|
|
|
All times are GMT -5. The time now is 01:44 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|