Visit Our UNIX and Linux User Community


Space hogging files and folders


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Space hogging files and folders
# 1  
Old 10-23-2009
Space hogging files and folders

How can i find the biggest files and folders in /(root) file systems?
# 2  
Old 10-23-2009

Code:
sudo du / 2>/dev/null | sort -rn | head

Code:
sudo du -a / 2>/dev/null | sort -rn | head

# 3  
Old 10-23-2009
Thanks,

When running the following command:
Code:
du /var/ 2>/dev/null | sort -rn | head

I am getting the output:
Code:
41432328        /var/
19771516        /var/lib
15910316        /var/spool
15910188        /var/spool/mail
15796124        /var/lib/enswitch
5772612 /var/lib/enswitch/mailboxes
5725264 /var/log
5262072 /var/lib/enswitch/recordings
5211044 /var/lib/enswitch/recordings/sip
4639680 /var/lib/enswitch/backups

But when i am running the command:
Code:
du -h /var/ 2>/dev/null | sort -rn | head

I am getting the output:
Code:
1020K   /var/lib/enswitch/recordings/sip/989/940
1020K   /var/lib/enswitch/recordings/sip/934/177
1020K   /var/lib/enswitch/recordings/sip/896
1020K   /var/lib/enswitch/recordings/sip/828/262
1020K   /var/lib/enswitch/recordings/sip/574
1020K   /var/lib/enswitch/recordings/sip/564/910
1020K   /var/lib/enswitch/recordings/sip/540/758
1020K   /var/lib/enswitch/recordings/sip/438/264
1020K   /var/lib/enswitch/recordings/sip/425/287
1020K   /var/lib/enswitch/recordings/sip/301/566

I think i should have got the earlier output with the sizes in human readable form. But the output seems to be different. What is the reason?
Thanks in advance
# 4  
Old 10-23-2009
Quote:
Originally Posted by proactiveaditya
I think i should have got the earlier output with the sizes in human readable form. But the output seems to be different. What is the reason?

"human readable" is a misnomer; it is really "abbreviated".

Since you are sorting abbreviations, not numbers, your results reflect that. 1030K is numerically larger than 1020M.

Previous Thread | Next Thread
Test Your Knowledge in Computers #209
Difficulty: Medium
The development work for OSPF prior to its publication as open standard was undertaken largely by the Digital Equipment Corporation.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies

2. UNIX for Dummies Questions & Answers

Copying folders with only certain files

Hello gurus, quick question I have a bunch of folders each having subfolders that have 3 files with the same name but different in content. So I want to copy the subfolders with only those 3 files to another location. Just making up some names here, Folder1 SubfolderX1 SubfolderY1 ... (1 Reply)
Discussion started by: ritakadm
1 Replies

3. Shell Programming and Scripting

Find folders with timestamp and disk space used

Hi, I want write a script that finds a set of folders written between a certain time and then find the disk space used by those folders. Can someone please help. Thanks, Sparcman:( (1 Reply)
Discussion started by: sparcman
1 Replies

4. Shell Programming and Scripting

List all the files in the present path and Folders and subfolders files also

Hi, I need a script/command to list out all the files in current path and also the files in folder and subfolders. Ex: My files are like below $ ls -lrt total 8 -rw-r--r-- 1 abc users 419 May 25 10:27 abcd.xml drwxr-xr-x 3 abc users 4096 May 25 10:28 TEST $ Under TEST, there are... (2 Replies)
Discussion started by: divya bandipotu
2 Replies

5. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

6. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

7. AIX

pconsole process hogging

AIX6.1 in topas 'pconsole" processing utilization showing high (48.1 %) in pgsp column what is pconsole process, can kill it Thanks in Advance (0 Replies)
Discussion started by: sunnybee
0 Replies

8. HP-UX

to get the timestamp of files from the files and folders in Unix

Hi, I had a directory and many subdirectories and files with in it. Now i want to get the timestamp of files from the files and folders recursively. :( Please help me to generate a script fort he above mentioned requirement! Appreciate for ur qick response Thanks in advance! ... (2 Replies)
Discussion started by: kishan
2 Replies

9. Shell Programming and Scripting

removing old files except configuration files and folders

Dear all, I want to remove files older than 2 months in the /home/member directory. But except the configuration files (like .bash_profile .config/ .openoffice/ .local/ .kde/ etc..) I have tried with the command find . -mtime +60 -wholename './.*' -prune -o -print -exec mv {} \; but it... (1 Reply)
Discussion started by: jamcalicut
1 Replies

10. UNIX for Advanced & Expert Users

VI hogging system resources???

Hello all. I was on my pc last night when I noticed that my hard drive light was on and when I typed in "uptime" I recieved some crazy load averages. load average: 3.30, 3.07, 2.95. Anyway I type in "top" to see what processes are being the resource hogs and im surprised as hell to see that one... (2 Replies)
Discussion started by: ThePreacher
2 Replies

Featured Tech Videos