LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 11-03-2008, 12:35 PM   #1
dave247
Member
 
Registered: May 2004
Posts: 204

Rep: Reputation: 30
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?

Last edited by dave247; 11-03-2008 at 01:28 PM.
 
Old 11-03-2008, 04:23 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
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 http://tldp.org and get the Bash Guide for Beginners.
 
Old 11-03-2008, 04:36 PM   #3
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
head's what you want. man head for the syntax.
 
  


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
Script: put the output of a command into a variable. poincare999 Programming 4 11-04-2007 11:53 AM
Put a date/time from the command line Jzarecta Linux - Software 1 10-03-2007 12:48 PM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
Command to output file content line by line aznluvsmc Programming 2 09-12-2004 07:45 PM
Can I put execl command output into a file? CrazyDragon Programming 1 12-17-2003 04:34 AM


All times are GMT -5. The time now is 12:51 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration