Solved

total amount of octets used in a directory

Posted on 1998-06-11
7
337 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.
Suggested Courses

734 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