UNIX Challenge

Joined
Feb 9, 2005
Messages
2,340
Reaction score
82
Points
48
Location
DFW
Your Mac's Specs
MacBook Pro 13" | MacBook Pro 13" | Mac Mini 2GHz C2D
I had this challenge in my class. No one got it and it took the 2 instructors a week to figure it out:

in one command line (pressing enter only once)

make a file that contains the largest file in your home directory and every directory in your home directory.

Post your answers.

Have fun!!!
 

RavingMac

Well-known member
Staff member
Moderator
Joined
Jan 7, 2008
Messages
8,303
Reaction score
242
Points
63
Location
In Denial
Your Mac's Specs
16Gb Mac Mini 2018, 15" MacBook Pro 2012 1 TB SSD
I had this challenge in my class. No one got it and it took the 2 instructors a week to figure it out:

in one command line (pressing enter only once)

make a file that contains the largest file in your home directory and every directory in your home directory.

Post your answers.

Have fun!!!

I'm betting on Van to get this one . . . ;)
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Hrm, it took them a week to figure it out?



for i in $(find ~/ -type d 2> /dev/null); do du -h $i; sort -rn|head -1; done
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Like I meant to say . . .
You were right the second time. That one's a little beyond me at this point. I would have to spend some good time working that one out. ;)
 
OP
fearlessfreap24
Joined
Feb 9, 2005
Messages
2,340
Reaction score
82
Points
48
Location
DFW
Your Mac's Specs
MacBook Pro 13" | MacBook Pro 13" | Mac Mini 2GHz C2D
very close, I either didnt let it run it's course or it did not make a file and it only list the directories and their sizes.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Opps, I typoed.



whaddya expect for nothing more than a few seconds of typing ;)

Actually, looking at it... it'll post up the directory... so...


for i in $(find ~/ -type d 2> /dev/null); do du -a $i |sort -rn|head -2|tail -1; done
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top