Solved

total amount of octets used in a directory

Posted on 1998-06-11
7
317 Views
Last Modified: 2010-05-18
I don't know if there's an unix command giving the total number of octets (or inode) used by all the files in a directory (and its subdirectory...)???
thanks.
0
Comment
Question by:steph84
  • 4
  • 2
7 Comments
 
LVL 2

Expert Comment

by:seedy
ID: 2007866
du gives you the disk utilization of files.  
'du -s -k .' will give you the number of 1kb blocks that is used by all the files and subdirectories in the current directory.

inode:  Do you want to know how many inodes are used up?  One per file!
0
 
LVL 2

Expert Comment

by:seedy
ID: 2007867
du gives you the disk utilization of files.  
'du -k *' will give you the number of 1kb blocks that is used by each of the file or the files under the directory in the current directory.

inode:  Do you want to know how many inodes are used up?  One per file!
0
 

Author Comment

by:steph84
ID: 2007868
perfect you should answer that i grade you!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:braveheart
ID: 2007869
"du -k" performs a recursive directory search and gives the answer in Kb.

"ls -l" gives the answer in bytes (octets) but you have to specify each directory (unless you are only interested in the current directory), with or without wildcards, on the command line.

"ls -i" will print the inode number of each file (one per file) in the first column of the report.
0
 
LVL 2

Expert Comment

by:seedy
ID: 2007870
braveheart, I hope you did not mean to do that!
steph84,  if you want to award the points to me, you should reject  braveheart's answer to reopen the question for me.

0
 
LVL 3

Expert Comment

by:braveheart
ID: 2007871
seedy, your answer gives the result in Kb, not octets (bytes) so I offered an alternative. If steph84 wants to give the points to
you I won't stand in the way. It is easy enough to split the points if so desired.
0
 
LVL 2

Accepted Solution

by:
seedy earned 50 total points
ID: 2007872
'du -s -k .' will give the number of 1kb blocks used by all the files and subdirectories in the current directory.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now