-   Debian (
-   -   trying to output only first line of command out put (

dave247 11-03-2008 12:35 PM

find command: trying to specify number of results to display
so im fiddling around with commands trying to learn scripts and i am trying to find the oldest file on the system.

I did 'find -iname / "*.*" -atime +300 -exec ls -lart -1 {} \;

and it seems to work fine but prints out several files and I only want the top most one -- the largest.

Is there a way to output only the first displayed result of this command or any other commands such as ls and stuff?

pixellany 11-03-2008 04:23 PM

cut and sed can both be used to select which lines to print/display. I think "head" also.

What texts are you using? You may want to go to and get the Bash Guide for Beginners.

pwc101 11-03-2008 04:36 PM

head's what you want. man head for the syntax.

All times are GMT -5. The time now is 03:17 AM.