on 08-05-2012 5:34 AM
Dear experts,
ls -lh
drwxr-xr-x 2 prdadm sapsys 4.0K 2012-08-05 09:39 sumit
du -h
40K ./sumit
As we know ls list total size of directory/file, here 't's 4.0k and du shows space used ,
what's Differnce between 4.0k and 40k
4.0 K is the size of the directory sumit which means the space occupied by the metadata of the files of the directory . Any directory size with ls -lh is 4.0 K , with ls -l its always 4096 bytes.
ls -l only shows the exact size of the files , for directories its always 4096 bytes or 4.0K ( with ls -lh)
40 K on the other hand is the total space occupied by the contents of the directory sumit which is output of du -h command.
Regards
Ratnajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Ratnajit,
f"or directories its always 4096 bytes or 4.0K ( with ls -lh)"
you mean, ls -lh always shows directories with 4.0K, but see below output for others directories:
drwxrwxrwx 2 prdadm sapsys 4.0K 2011-07-18 17:58 bin
drwxrwxrwx 2 prdadm sapsys 4.0K 2011-02-25 17:03 bin_backup
drwxrwxrwx 2 prdadm sapsys 4.0K 2011-07-18 18:25 buffer
drwxrwxrwx 2 prdadm sapsys 4.0K 2010-12-29 17:19 cluster_tables
drwxrwxrwx 2 prdadm sapsys 140K 2012-07-31 16:34 cofiles
drwxrwxrwx 2 prdadm sapsys 132K 2012-07-31 16:34 data
drwxrwxrwx 5 prdadm sapsys 4.0K 2012-08-05 07:55 EPS
drwxrwxrwx 2 prdadm sapsys 4.0K 2010-12-16 12:16 etc
-rw-rw-r-- 1 prdadm sapsys 380 2011-04-04 22:36 K926360.DEV
drwxrwxrwx 3 prdadm sapsys 260K 2012-08-05 07:56 log
drwxrwxrwx 2 prdadm sapsys 16K 2011-02-23 18:37 lost+found
drwxrwxrwx 2 prdadm sapsys 4.0K 2012-07-11 15:25 sapnames
drwxrwxrwx 2 prdadm sapsys 4.0K 2012-08-01 10:26 tm
Just a small clarification ,mostly you see directory sizes are of 4KB or 4096 bytes and this space is occupied by the metadata of files within this directory . If the number of files are really huge and hence the metadata is also large , then this value can be higher than 4 KB , but always in multiples of 4 KB. So space allocated for metadata of files within a directory is allocated in blocks of 4 KB. Hope this clarifies your doubt.
Regards
Ratnajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.