largest file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers largest file
# 1  
Old 10-23-2009
largest file

My directory only contains files..no sub directories..I want to know about the largest file in directory..Largest in terms of size..And what if I want to know about first 3 largest files..

Is it possible to know largest file in terms of its filename??
# 2  
Old 10-23-2009
Hi.

If your ls has the option -S, then:

Code:
ls -lS | head -3

Otherwise:
Code:
ls -l | sort -rnk5 | head -3

(assuming the fifth field is the size)
# 3  
Old 10-23-2009
Code:
du -ks * | sort -nr | head -1

# 4  
Old 10-23-2009
Code:
find . -type f -exec ls -s {} \; | sort -n -r | head -5

No sub directories !

Code:
find . -maxdepth 1 -type f -exec ls -s {} \; | sort -n -r | head -5

# 5  
Old 10-23-2009
@thegeek : u r making it very complicated..but thanks anyways..
thanks pludi and scottn
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Help with keep the largest record in file

Input file US Score 10 UK Ball 20 AS Score 50 AK Ball 10 PZ Ballon 50 PA Score 70 WT Data 10 . . Desired output file UK Ball 20 PZ Ballon 50 PA Score 70 WT Data 10 . . (1 Reply)
Discussion started by: perl_beginner
1 Replies

3. Shell Programming and Scripting

To Find the largest file in the given directory.

Hi Experts, 1. In unix how to list the largest file in given directory. The answer will in single line statement. 2. I have Sun solaris live CD .I try to compile sample c program using "CC compiler".But its shows "cc command not found". Please help on this. Thanks in advance.... (4 Replies)
Discussion started by: kkl
4 Replies

4. Shell Programming and Scripting

Command to find largest file.

Hi All, Is there a direct Linux command to find the largest file by checking recursively in all the directories. (3 Replies)
Discussion started by: paragkalra
3 Replies

5. Shell Programming and Scripting

Find and display largest file on system

What is the correct command for finding and displaying the largest file on the system? I don't know how to specify "largest" with "find", and pipe that to something that will display the file contents. Or should I be using cat, more, less, ls, or something else? (4 Replies)
Discussion started by: raidkridley
4 Replies

6. HP-UX

find the largest file in whole system

find the largest file in whole system (7 Replies)
Discussion started by: megh
7 Replies

7. Shell Programming and Scripting

largest value from within a file

hi, i am having a file that looks like this : myhome111 oper 11 myhome333 oper 19 ... how can i get the largest value from this file ..in this example i am consiering 19 as the largest value.. how can i do that.. as this file is having other numbers also within it like 111, 333... (4 Replies)
Discussion started by: kripssmart
4 Replies

8. Shell Programming and Scripting

find largest file

Hi, 1)I have XX directory and have lot of files ,I want to find largest file in that directory 2)how calculate the size of file in MB. Thanks, Mohan (15 Replies)
Discussion started by: mohan705
15 Replies

9. Shell Programming and Scripting

file of largest size in pwd

How to find file of the largest size in pwd? (4 Replies)
Discussion started by: rameshparsa
4 Replies

10. Programming

Finding largest file in current directory?

I was hoping to get some assistance with this C program I am working on. The goal is to find the largest file in the current directory and then display this filename along with the filesize. What I have so far will display all the files in the current directory. But, how do I deal with "grabbing"... (1 Reply)
Discussion started by: AusTex
1 Replies
Login or Register to Ask a Question