list largest files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers list largest files
# 1  
Old 08-14-2010
list largest files

hi all,

i want to list the five largest files in current directory ...

.
# 2  
Old 08-14-2010
Code:
ls -lS|head -6

You need -6 as there will be a total line from ls. You could always 'grep -v total' if you don't want to see it.

The -S option causes ls to sort by the file size from largest to smallest.
This User Gave Thanks to agama For This Post:
# 3  
Old 08-15-2010
Code:
find . -prune -exec ls -s {} \; | sort -n -r | head -5

# 4  
Old 08-15-2010
Code:
find  -maxdepth 1  -printf 'File Name: "%5f" ----> %6s \n' | sort -k5rn | head -5

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Finding largest files takes too long

Good evening. because the folder has thousand of files it takes too long and have some trouble to get the largest files and then compress files or delete it, for instance find . -size +10000000c -exec ls -ld {} \; |sort -k5n | grep -v .gz The above commad took an hour and i have to cancel... (10 Replies)
Discussion started by: alexcol
10 Replies

2. UNIX for Beginners Questions & Answers

Display largest files in multiple directories

Trying to locate the 25 largest files with read/execute world permissions to be displayed from a combination of 4 different directories. I'm rather new at UNIX and trying to learn the basics. This is what I have come up with so far: find /dir1 /dir2 /dir3 /dir4 -perm -u+rx | sort -nr | head... (1 Reply)
Discussion started by: malk71
1 Replies

3. Shell Programming and Scripting

Take a list if strings from a file and search them in a list of files and report them

I have a file 1.txt with the below contents. -----cat 1.txt----- 1234 5678 1256 1234 1247 ------------------- I have 3 more files in a folder -----ls -lrt------- A1.txt A2.txt A3.txt ------------------- The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies

4. Shell Programming and Scripting

awk second largest, third largest value

I have two text files like this: file1.txt: 133 10 133 22 133 13 133 56 133 78 133 98 file2.txt: 158 38 158 67 158 94 158 17 158 23 I'm basically trying to have awk check the second largest value of the second column of each text file, and cat it to its own text file. There... (13 Replies)
Discussion started by: theawknewbie
13 Replies

5. UNIX for Dummies Questions & Answers

Best way to find largest files in a directory

What is the best way to find the largest files in a directory? I used du -k|sort -rn |less. I got a results for this. But if I used the following command , I got another result...a different order in the same directory. Why is that? ls -la |awk '{print $5," ",$9}' sort -rn|less. I saw that... (6 Replies)
Discussion started by: Pouchie1
6 Replies

6. Shell Programming and Scripting

Find largest files

Hello, i am on linux 2.6.13-1.1526_FC4smp , and i would be very greatfull if someone could help to find the largest files on that server. I know i can find files with find command or list them with ls , but is there a way that i could list let's say 10 biggest files on server ? :o (11 Replies)
Discussion started by: tonijel
11 Replies

7. UNIX for Dummies Questions & Answers

How to find the list of 5 largest file in current directory?

Hello, How to find the list of 5 largest(size wise) file in current directory?i tried using ls -l | sort -t " " -r +5 -6 -n | head -5 but this is not giving correct output as ls -l command gives 1 extra line of output that is how many total files are there!so by running the above... (4 Replies)
Discussion started by: salman4u
4 Replies

8. UNIX for Dummies Questions & Answers

finding largest files (not directories)?

hello all. i would like to be able to find the names of all files on a remote machine using ssh. i only want the names of files, not directories so far i'm stuck at "du -a | sort -n" also, is it possible to write them to a file on my machine? i know how to write it to a file on that... (2 Replies)
Discussion started by: user19190989
2 Replies

9. Filesystems, Disks and Memory

find the 5o largest files in a directory

I'm trying to find the 50 largest file in a directory named /sasdb and its' subdirectories. I'm using the find command and a pipe to awk Not sure if I'm actually getting the largest files from this directory and its subdirectories. Here is the code I used... find /sasdb -ls | awk '{print... (8 Replies)
Discussion started by: igidttam
8 Replies

10. UNIX for Dummies Questions & Answers

list largest files in a directory & its subdirectories

I need to find the largest files in a directory & it's subdirectories. I'm not sure what options on ls -l will work to give me this. or is there another way to do this? Thanks, igidttam (6 Replies)
Discussion started by: igidttam
6 Replies
Login or Register to Ask a Question