Command to list our directory size


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Command to list our directory size
# 1  
Old 03-21-2012
Command to list our directory size

Is there any command that can list out all the files size including directory in 1 command?
`ls` will only give 2048 for a directory, which i'm looking for the actual size.
# 2  
Old 03-21-2012
Code:
 
du -h directoryname | awk '{a=$1}END{print a}'

# 3  
Old 03-21-2012
Code:
 
#du -sh <dirname>

is enough I guess..


Illustration:-

Code:
 
#ls -ld zones
drwxr-xr-x   4 root     root         512 Mar  4  2009 zones
# du -sh zones
  14G   zones

# 4  
Old 03-21-2012
Code:
du -ah directoryName

# 5  
Old 03-22-2012
is there something like ls -l which list out all the information as well?

Last edited by lsy; 03-22-2012 at 04:41 AM..
# 6  
Old 03-22-2012
Quote:
'du' seems like cannot support a path.
eg: du -ah /tmp/abc
use
Code:
du -ah ./tmp/abc

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms. Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Discussion started by: jmgibby
2 Replies

2. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Discussion started by: shaal89
0 Replies

3. UNIX for Dummies Questions & Answers

Sort by size, then list file in each directory

Hi, I have directories with name like: aaa bbb ccc ... I would like to to see which directories are the largest and then list the files within each. I have success using: du -ks * | sort -rin | head -n 20 which gives me an output like: 120 bbb 27 ccc 3 aaa ... I would like... (3 Replies)
Discussion started by: ChatPerdu
3 Replies

4. Shell Programming and Scripting

command to reduce size of file/directory???

Hello, I want to compress any given file or directory. I used 1)gzip 2)zip But when I do "ls -l". I found that the zipped file is in fact greater in size than the original file. Can you please tell me the commands which will show me the difference in its size. (2 Replies)
Discussion started by: nsharath
2 Replies

5. HP-UX

command to list file size

I'm new to HP-UX and am looking for the command that will allow to me determine the total size of listed files. I'm being told that my backup selection is exceeding my tape drive size and need to determine how much information is being backed up. Help? (3 Replies)
Discussion started by: rgordon
3 Replies

6. UNIX for Dummies Questions & Answers

Dummy questions about how to get the size of a directory by command

Hi, 'ls -ld' is no use .... I want to get the total size of a directory. Any advice? Thanks in advance! (4 Replies)
Discussion started by: GCTEII
4 Replies

7. Shell Programming and Scripting

Dummy questions about how to get the size of a directory by command

Hi, 'ls -ld' is no use .... I want to get the total size of a directory including subdir. Any advice? Thanks in advance (2 Replies)
Discussion started by: GCTEII
2 Replies

8. Programming

list directory without use ls command?

Hi i need C code to list direcoty without using ls command and it sould take the path of the directory from the user? "please help me it is so important" (3 Replies)
Discussion started by: ashamry
3 Replies

9. UNIX for Advanced & Expert Users

Command to list Files less than or equal to 2k size

Hi, *.xml files stored on date wise folders. I need to extract *.xml files from all the folders. File size is lessthan or equal to 2K. Please let me know command or some shell program to due this job on linux m/c This is urgent, Thanks in advance - Bache Gowda (3 Replies)
Discussion started by: bache_gowda
3 Replies

10. UNIX for Dummies Questions & Answers

list file's by size order in sepecfied directory and sub directories

How do I list files of type "*.file" for example by size order recursively ? (2 Replies)
Discussion started by: ferretman
2 Replies
Login or Register to Ask a Question