LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 03-27-2013, 01:31 AM   #1
yashfire007
Member
 
Registered: Jan 2013
Distribution: CentOS, RHEL 6.4
Posts: 77

Rep: Reputation: Disabled
Exclamation command to check whole free space


Hai to all,

I have installed Centos 5.9 in 80GB with 7 partitions...
I need to check the total used and free space in 80GB. Please tell me how to check the total used & free space...
 
Old 03-27-2013, 01:37 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,347

Rep: Reputation: 135Reputation: 135
Try this command:

Code:
df -ah
 
Old 03-27-2013, 01:42 AM   #3
yashfire007
Member
 
Registered: Jan 2013
Distribution: CentOS, RHEL 6.4
Posts: 77

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by divyashree View Post
Try this command:

Code:
df -ah
I have tried this command , its output is

Filesystem Size Used Avail Use% Mounted on
/dev/sda8 4.8G 688M 3.9G 15% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/sda12 2.9G 71M 2.7G 3% /tmp
/dev/sda11 2.9G 198M 2.5G 8% /var
/dev/sda9 3.8G 73M 3.6G 2% /home
/dev/sda7 4.8G 2.7G 1.8G 61% /usr
/dev/sda6 251M 16M 222M 7% /boot
tmpfs 624M 0 624M 0% /dev/shm
none 0 0 0 - /proc/sys/fs/binfmt_misc
sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs
nfsd 0 0 0 - /proc/fs/nfsd


But i need to check the whole hard disk used & free space. This was an interview question asked to me last week.
 
Old 03-27-2013, 01:57 AM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
To check total hard disk size, try:
Code:
~$ fdisk -l | grep 'Disk'

Last edited by shivaa; 03-27-2013 at 01:59 AM.
 
Old 03-27-2013, 02:14 AM   #5
kooru
Senior Member
 
Registered: Sep 2012
Location: Italy
Distribution: Slackware, NetBSD
Posts: 1,252
Blog Entries: 4

Rep: Reputation: 259Reputation: 259Reputation: 259
or

total used

Code:
df | grep '/dev/sda' | awk '{s+=$3} END {print s}
total free

Code:
df | grep '/dev/sda' | awk '{s+=$4} END {print s}

Last edited by kooru; 03-27-2013 at 02:17 AM.
 
1 members found this post helpful.
Old 03-27-2013, 02:21 AM   #6
mddesai
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch
Posts: 479

Rep: Reputation: 132Reputation: 132
Check the last line:

Code:
# df -h --total
 
Old 03-27-2013, 03:19 AM   #7
yashfire007
Member
 
Registered: Jan 2013
Distribution: CentOS, RHEL 6.4
Posts: 77

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shivaa View Post
To check total hard disk size, try:
Code:
~$ fdisk -l | grep 'Disk'
thank you for your reply
The output is

[root@localhost ~]# fdisk -l | grep 'Disk'
Disk /dev/sda: 160.0 GB, 160041885696 bytes


Above shows total hard disk space, i need to see total free space also.
Is there any possibility..
 
Old 03-27-2013, 03:57 AM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,102

Rep: Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982
"man parted"
 
  


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
How to check LVM Free space? aparna8877 Linux - General 2 12-16-2011 10:50 AM
how do you check the free space mahmoud Linux - Newbie 2 01-03-2008 10:32 AM
how to do a free space regular check baronlynx Linux - General 1 10-04-2005 07:01 PM
How to check free disk space TigerLinux Linux - Newbie 9 10-04-2005 05:04 PM
How do I check free partition space explorer Linux - General 5 04-14-2004 12:35 PM


All times are GMT -5. The time now is 05:43 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration