find the largest file in whole system


 
Thread Tools Search this Thread
Operating Systems HP-UX find the largest file in whole system
# 1  
Old 06-28-2008
find the largest file in whole system

find the largest file in whole system
# 2  
Old 06-28-2008
open a bottle of wine
# 3  
Old 06-28-2008
After the wine try
Code:
find / -type f -exec  ls -s {} \; | sort -n | tail -1

This will take a long time.
# 4  
Old 07-28-2008
To find files greater than 3 GB, enter the following:
find / -size +3000000000c -exec ls -l {} \;
# 5  
Old 07-28-2008
Hammer & Screwdriver Perhaps making an assumption, but

If one assumes the file to be above a certain threshold, the process can be somewhat quickened by combining a couple of the suggestions given so far. Perhaps try something like:

Code:
find / -size +100000c 2>/dev/null -exec ls -l {} \; | sort +4 | tail -3

This will:
only look for files larger than 100,000
redirecting errors, like directories not allowed to be viewed because of security rights
and therefore, sort a smaller set
and then give info on three largest it finds
# 6  
Old 08-05-2008
Yet another slight refinement special for not too dated find commands on HP-UX
(don't know which PHCO_* patch this was, search HPs' online patch database)
would be to use the plus instead of the trailing semicolon with find commands.
Then it would rather behave like piped to xargs for the exec-ed command
which improves performance and thus decreases waiting time.
e.g. looking for file exceeding 2GB (which would require largefiles support)
Code:
# find / -type f -size +4194304 -exec ll {} +

Here is the excerpt from find's manpage regarding the -exec and + speciality
Code:
      -exec cmd                True if the executed cmd returns a zero value
                               as exit status.  The end of cmd must be
                               punctuated by a semicolon (;) or a plus sign
                               (+) (semicolon and plus are special to the
                               shell and must be escaped).  When + is used,
                               cmd aggregates a set of path names and
                               executes on the set.  Any command arguments
                               between the first occurrence of {} and + are
                               ignored.  The reason for preferring + to a ;
                               is vastly improved performance.  Any command
                               argument {} is replaced by the current path
                               name.  cmd may contain supplementary code set
                               characters.

# 7  
Old 08-05-2008
On my HP box the + thingy seems to have come with this patch
Code:
# swlist -l product|grep PHCO.*find
  PHCO_36502            1.0            find(1) cumulative patch

which can be read from
Code:
$ /usr/sbin/swlist -l fileset -a readme PHCO_36502 | more

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find smallest & largest in every column

Dear All, I have input like this, J_15TEST_ASH05_33A22.13885.txt: $$ 1 MAKE SP1501 1 1 4 6101 7392 2 2442 2685 18 3201 4008 20 120 4158 J_15TEST_ASH05_33A22.13885.txt: $$ 1 MAKE SP1502 1 1 4 5125 6416 2 ... (4 Replies)
Discussion started by: attila
4 Replies

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

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

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

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

6. Shell Programming and Scripting

To find largest and shortest word in eld

I got a file called Album in that there is list of songs i want to find the Longest and shortest song name in field 2 ie ($2).... Please help me with "awk" (2 Replies)
Discussion started by: Markwaugh
2 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. 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

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

10. 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
Login or Register to Ask a Question