LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   linux df command (https://www.linuxquestions.org/questions/linux-newbie-8/linux-df-command-336828/)

glaz 06-24-2005 12:26 PM

linux df command
 
Is there a way to run some command (maybe df) under linux RedHat 7 to display the memory used for the file system. When i do df, it simply shows me the hard disk partitioning space, but i need to see what the file system space allocation is.
For example i need to see this: (This was done on unix Solaris)
$ df
/ (/dev/dsk/c0t0d0s0 ): 525518 blocks 291846 files
/usr (/dev/dsk/c0t0d0s6 ):13617292 blocks 1600490 files
/proc (/proc ): 0 blocks 29913 files
/dev/fd (fd ): 0 blocks 0 files
/etc/mnttab (mnttab ): 0 blocks 0 files
/var/run (swap ): 2999904 blocks 218303 files
/tmp (swap ): 2999904 blocks 218303 files
/export/home (/dev/md/dsk/d0 ):12725334 blocks 3021243 files
/usr/old-basecode (/dev/dsk/c2t5d0s7 ):43155254 blocks 3021401 files
/usr/old-develop (/dev/dsk/c2t5d1s7 ):96311384 blocks 6381718 files
/usr/develop (condor:/develop1 ):1058587144 blocks 144717366 files
/snap (condor:/home1 ):1058587144 blocks 144717366 files
/home/mysql (condor:/home1/mysql):1058587144 blocks 144717366 files
/home/rgb (condor:/home1/rgb ):1058587144 blocks 144717366 files
/usr/basecode (condor:/basecode1 ):1058587144 blocks 144717366 files
/home/greg (condor:/home1/greg):1058587144 blocks 144717366 files

I need to see similar under linux.
TIA.

azucaro 06-24-2005 12:53 PM

df -h /filesystem/to/check/ (human readable)

or

df -k /filesystem/to/check/ (in kilobytes)

I usually just navigate to the filesystem I want to see and type " df -h . " to see its usage.

glaz 06-24-2005 01:04 PM

This is what i get when i do what you said, still tells me the space of /dev/hda3, not the spae of /tmp

[greg@localhost tmp]$ df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 72G 7.3G 61G 11% /

perfect_circle 06-24-2005 01:10 PM

Quote:

Originally posted by glaz
This is what i get when i do what you said, still tells me the space of /dev/hda3, not the spae of /tmp

[greg@localhost tmp]$ df -h /tmp
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 72G 7.3G 61G 11% /

You are using the wrong command if you want to see the size of a directory.
df -> report filesystem disk space usage
du-> estimate file space usage

try
Code:

du -hs /tmp

yoursmile 06-24-2005 01:13 PM

Code:

du /  -h
or

Code:

du /usr -h --max-depth=1
:)

azucaro 06-24-2005 01:21 PM

Sorry bout that. I was wrong about the last argument. But you can type df -h to see similar output for all filesystems on your machine. At least on Solaris 8 it does that :)

Cheers.

glaz 06-24-2005 01:32 PM

So does that give me the size of current directory or the allocated space for it.
Like i tried those commands and it give me this:

[root@localhost /]# du -h /tmp
8.0K /tmp/orbit-root
4.0K /tmp/.iroha_unix
4.0K /tmp/.font-unix
4.0K /tmp/.X11-unix
4.0K /tmp/.ICE-unix
4.0K /tmp/ssh-KhqC4076
4.0K /tmp/.esd
40K /tmp

What do these numbers mean. I'm mainly interested in how much space linux allocates to /tmp or /usr directory and how much of it have I used up.

Yes azucaro, df works that way in Solaris under unix, but seems to be different in linux.

perfect_circle 06-24-2005 02:00 PM

Quote:

Originally posted by glaz
So does that give me the size of current directory or the allocated space for it.
Like i tried those commands and it give me this:

[root@localhost /]# du -h /tmp
8.0K /tmp/orbit-root
4.0K /tmp/.iroha_unix
4.0K /tmp/.font-unix
4.0K /tmp/.X11-unix
4.0K /tmp/.ICE-unix
4.0K /tmp/ssh-KhqC4076
4.0K /tmp/.esd
40K /tmp

What do these numbers mean. I'm mainly interested in how much space linux allocates to /tmp or /usr directory and how much of it have I used up.

Yes azucaro, df works that way in Solaris under unix, but seems to be different in linux.

This shows you the size of every file in the /tmp directory as it should.
If you read my post you shall see a "du -hs /tmp"
Quote:

-s, --summarize
display only a total for each argument
In the command you have used the last line is what you are looking for.

glaz 06-24-2005 02:16 PM

but how do i know what is the limit for the /tmp or /usr
Doesn't linux put caps on them

perfect_circle 06-25-2005 10:50 AM

Quote:

Originally posted by glaz
but how do i know what is the limit for the /tmp or /usr
Doesn't linux put caps on them

No, by default the limit of a directory is the size of the partition containing it.
If you want to limit it you may put quota in the users.


All times are GMT -5. The time now is 09:32 AM.