Command to list large files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Command to list large files
# 8  
Old 06-08-2006
Quote:
Originally Posted by sysera
This may have come from ZazzyBob at some point, but I've been using it for a while.


In Linux this example shows the 10 largest in /opt. Change /opt to suit.

find /opt -type f -printf "%k %p\n" | sort -rn | head -10
Tried that:

UX:find: ERROR: Illegal option -- -printf

Tried a few variations... no go... BTW... I'm running *cringe*... SCO
# 9  
Old 06-08-2006
Ok.. I made *some* progress...

find / -size +1048576 -print

But.. it's not going through all of my directories and doesn't list the file size...
# 10  
Old 06-08-2006
try
Code:
find / -size +1048576 -print | \
while read file
do
     ls -l "$file"
done

(I would have used xargs here but your system seems to be, um, different.)

FWIW - some utilities on older distributions don't follow POSIX, and some companies don't always follow guidelines either. The stuff I showed you was POSIX.2 compliant -
which doesn't guarantee it will work everywhere.
Next time you have a question be sure to include your OS information. It helps.
# 11  
Old 06-08-2006
Thanks... works like a charm. I should have known to post my OS... Smilie

Thanks again, and best of luck.
# 12  
Old 06-08-2006
Oh... since I have ya... (grin)

Is there a way to exclude a directory? So.. if I want everything EXCEPT a directory (or multiple directories)...
# 13  
Old 12-05-2008
Try:

Quote:
du -a | sort -nr | more
or if you only want the 20 largest files:

Quote:
du -a | sort -nr | head -20
naturally you can amend the 20 to be the largest x amount of files Smilie

Please note this only give you the file size and name and not owner info or date.

You could also try:

Quote:
find . -size +100c -mount -exec ls -l {} \;
(this works on the current & child directories)

Last edited by Miss Chief; 12-05-2008 at 12:16 PM..
# 14  
Old 12-11-2008
No need to go to root directory. As it is already mentioned / as path, it starts from root only.
find / -size <give the size here you want> 2>/dev/null | head

It will give the first 10 files having greater than specified size.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

List only required files in single command

Hello, I would like to combine below 2 commands (list, egrep) them into a single command and list only the required files using AWK or anything else. Could you please help. ls *FA_GL_10K_TND_HIER*dat | egrep "UPD|INS|DEL"... (3 Replies)
Discussion started by: Ariean
3 Replies

2. Shell Programming and Scripting

How to get list of files only using ls without combining it with other command?

HI, I have requirement to fetch the list of files except the ok file by connecting to other server and then copy all the files that are fetched using the below command. ssh ${aSrcHOST} ls ${aSrcDIR}/grep -vi OK$ > filelist.txt The above code is also picking up any directory names and... (7 Replies)
Discussion started by: Nikhath
7 Replies

3. Shell Programming and Scripting

Grepping large list of files

Hi All, I need help to know the exact command when I grep large list of files. Either using ls or find command. However I do not want to find in the subdirectories as the number of subdirectories are not fixed. How do I achieve that. I want something like this: find ./ -name "MYFILE*.txt"... (2 Replies)
Discussion started by: angshuman
2 Replies

4. Shell Programming and Scripting

list files command output

Hi All, Below is the 2 different ouputs of the command "ls -lrt", my question is what exactly "total 0" & "total 8" means here ? $ ls -rtl total 0 -rw-r--r-- 1 oracle dba 0 Feb 10 20:16 c -rw-r--r-- 1 oracle dba 0 Feb 10 20:16 b -rw-r--r-- 1... (1 Reply)
Discussion started by: kannan84
1 Replies

5. Shell Programming and Scripting

Running rename command on large files and make it faster

Hi All, I have some 80,000 files in a directory which I need to rename. Below is the command which I am currently running and it seems, it is taking fore ever to run this command. This command seems too slow. Is there any way to speed up the command. I have have GNU Parallel installed on my... (6 Replies)
Discussion started by: shoaibjameel123
6 Replies

6. Shell Programming and Scripting

Searching for array in large list of files

I tried to make the title/subject detailed, but well.. have to keep it short as well. I am wanting to take a large list of strings, and search through a large list of files to hopefully find numerous matches. I am not sure the quickest way to do this though. // List of files file1.txt... (2 Replies)
Discussion started by: Rhije
2 Replies

7. UNIX for Dummies Questions & Answers

command to list dot files

hey. i am a bit new to unix and i am trying to figure out how to list the names of the 'dot' files that are in my account. what command does this? thank you very much for your help. (4 Replies)
Discussion started by: Jakeman1086
4 Replies

8. UNIX for Dummies Questions & Answers

List large files

Hi I need to list all files in the system: 1. Greater than specific size 2. All files sorted by size How can I do that? Thanks in advance. (2 Replies)
Discussion started by: GNMIKE
2 Replies

9. UNIX for Dummies Questions & Answers

Command to list all files

Hi Is there a command(s) which can be used to get a list of all files, including all files in all subdirectories on a given volume? Thanks :) All My Best, Jeffrey (6 Replies)
Discussion started by: groundlevel
6 Replies

10. UNIX for Dummies Questions & Answers

can we list other than c files in a directory with only 'ls' command?

Guys, can anybody help me in the following........ I have different types(c files,ordinary text files etc) in a directory. is there any way to list other than .c files using the 'ls' command only. i tried with the following. ls *.*. its not listing the .c files,but at the same time not... (3 Replies)
Discussion started by: venkat
3 Replies
Login or Register to Ask a Question