Computing.Net > Forums > Unix > find command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

find command

Reply to Message Icon

Name: phgct2004
Date: March 29, 2004 at 21:45:49 Pacific
OS: linux 9.0
CPU/Ram: 866/128
Comment:

hi,

how can i find the largest file in my current directory?

thank


phgct



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: March 29, 2004 at 22:13:44 Pacific
Reply:

Hi:

There's lots of ways of doing this. This find command delivers the five largest files in the current directory:

find . -follow -mount -type f -print | xargs ls -l |\
sort -r -n -k 5,5 | head -5

Regards,

Nails


0

Response Number 2
Name: phgct2004
Date: March 29, 2004 at 22:52:10 Pacific
Reply:

hi Nails,

when i using the command that u give me, the error message showing out the
"xargs: unmatched single quote"

what is this mean ? how to solve this proble?

thank

chui


phgct


0

Response Number 3
Name: Dlonra
Date: March 30, 2004 at 08:33:59 Pacific
Reply:

this find large files and directories
ls -l|sort +4 -n|tail -5
on linux
ls -lS|head -6
or
du -s *|sort -n|tail -5


0

Response Number 4
Name: nails
Date: March 30, 2004 at 09:09:25 Pacific
Reply:

Hi:

The "unmatched single quote" error doesn't make much sense since there's no single quotes in the find command I've posted. Two issues:

1) Are you aware that the "\" character at the end of the first line is a continuation character? This command works with "\" only if there's a carriage return immediately after it.

2) Do you have weird characters in the file names - especially spaces. If you have file names with spaces, you might try this command:

find . -type f -print | while read myfile; do echo "${myfile}"| awk '$NF >= 2' ; done

Regards,

Nails


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: find command

Using find command www.computing.net/answers/unix/using-find-command-/2853.html

Limiting the find command www.computing.net/answers/unix/limiting-the-find-command/6637.html

find command - korn shell www.computing.net/answers/unix/find-command-korn-shell/5568.html