LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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: 206

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: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:48 PM.

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