LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-30-2017, 11:54 AM   #1
arun natarajan
Member
 
Registered: Jun 2014
Posts: 111

Rep: Reputation: Disabled
find largest file recursively with human readable format size.


Hi,

Am able to find largest file size from a directory recursively using a find command.

Here i want to print the size in human readable format(K,M,G).

May i know, how it is possible

root@station3[22:14]/etc:find -type f -printf "%s\t%p\n" | sort -n | tail -1
6060612 ./udev/hwdb.bin
 
Old 01-30-2017, 12:16 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,463

Rep: Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115Reputation: 8115
Quote:
Originally Posted by arun natarajan View Post
Hi,
Am able to find largest file size from a directory recursively using a find command. Here i want to print the size in human readable format(K,M,G).

May i know, how it is possible
root@station3[22:14]/etc:find -type f -printf "%s\t%p\n" | sort -n | tail -1
6060612 ./udev/hwdb.bin
As has been suggested to you numerous times in the past, have you tried reading the man page on the find command??? Pay particular attention to the "-size" flag. And read the "Question Guidelines" link and the "How to ask a smart question" link in my posting signature. We're happy to help you, but YOU need to start doing basic research on your own first, and start applying what you've been told/taught.
 
1 members found this post helpful.
Old 01-30-2017, 01:00 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
man ls
search for "human"

the find is a bit "chatty", if you have a threshold for "largest" it
merely become eaiser, IMO.

Last edited by Habitual; 01-30-2017 at 01:03 PM.
 
Old 02-01-2017, 12:21 AM   #4
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Just use ncdu

find is great for a lot of stuff, but for "find[ing the] largest file recursively with human readable format size".. ncdu wins hands down.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what Linux command is used to convert Exit=19 event message into human readable format akmughal Linux - Newbie 5 06-19-2016 06:04 AM
what Linux command is used to convert Exit=19 event message into human readable format akmughal Linux - Newbie 3 06-17-2016 11:37 AM
How to find out Mode=040755 in human readable format akmughal Linux - Newbie 2 06-16-2016 11:12 AM
converting epoch time to human readable format SDF nano2 Programming 4 01-26-2012 05:15 AM
Converting a date in MySQL format to human readable in Perl resetreset Programming 7 02-11-2009 08:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration