Question: Using the man pages for ls, sort, and head as references,write a one-line script to list the details of the five largestfiles in the current

Using the man pages for "ls", "sort", and "head" as references,write a one-line script to list the details of the five largestfiles in the current directory. NOTE: Youcan NOT use the "-S" option of "ls"command. Call the script "top5.sh".

Thus, you should be able to run your "top5" script to get anoutput similar to the following:

% ./top.sh 5

and get a result like

-rwxr-xr-x 1 root root 17935 May 9 2005 biggest-file
drwxr-xr-x 2 root root 4096 Jan 22 15:40 tie-for-2a
drwxr-xr-x 2 root root 4096 Dec 10 11:13 tie-for-2b
drwxr-xr-x 2 root root 4096 Dec 10 11:13 tie-for-2c
-rwxr-xr-x 1 root root 2371 Oct 31 2004 5th-largest

Turn in the script (not the list!).

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER The script top5sh can be written as follows ls l sort k5nr head 5 Let... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Electrical Engineering Questions!