The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 12:37 PM
find and replace command in one line using one command vasikaran UNIX for Dummies Questions & Answers 10 08-20-2008 10:40 AM
Help Required: Command to find IP address and command executed of a user loggedout Security 2 08-06-2008 08:12 PM
Little bit weired : Find files in UNIX w/o using find or where command jatin.jain Shell Programming and Scripting 10 09-19-2007 06:47 AM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-20-2008
TonySolarisAdmi TonySolarisAdmi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 11
Help run ls command along with find command

Hi,
I want to run ls -lrt command along with find command. I want to get the list of files with timestamp, owner, group and permissions for the files larger than 1024k. I tried the below command, but it displays only the file names.

ls -lrt | find . -name "*.*" -size +1024k -print


Any help

Thanks
  #2 (permalink)  
Old 08-20-2008
ynilesh's Avatar
ynilesh ynilesh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 222
Code:
find . -name "*.*" -size +1024k -print | xargs /bin/ls -lrt
- nilesh
  #3 (permalink)  
Old 08-20-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,212
Something like this?

Code:
find . -name "*.*" -size +1024k -exec ls -lrt {} \;
Regards
  #4 (permalink)  
Old 08-20-2008
TonySolarisAdmi TonySolarisAdmi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 11
Nilesh and Franklin

Thanks for your help.

Thanks
  #5 (permalink)  
Old 08-24-2008
bztian bztian is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 2
Thank you too :)

Thank you too - I'm just becoming more familiar with Linux and I was looking for something like this off and on for awhile

oh btw - When you send in the -exec command with the ls -(options) command, why do you need to add the "{} \;"?
  #6 (permalink)  
Old 08-24-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,212
Hi and welcome,

In the manpage of the find command there is an explanation of the -exec action and the use of {}.

Regards
  #7 (permalink)  
Old 08-24-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Quote:
Originally Posted by bztian View Post
oh btw - When you send in the -exec command with the ls -(options) command, why do you need to add the "{} \;"?
The {} gets replaced with the found file's name, and the \; shows where the -exec command line ends, so you can continue to specify other options to find.
You could even have multiple -exec actions:

Code:
find . -type f -exec ls -l {} \; -exec touch {} \;
Without the \; how would you know where the first -exec command ends and we are back in find's command line proper again? The command you -exec could even be another find so looking for familiar options is not a good way to disambiguate; and besides, other programs than find have options like -type and -name too.

Having said that, -exec is usually the last thing you do, and the file name of the found file is usually the last thing in that command line, so it does seem a bit redundant in those cases. A common exception would be the mv command where the found file is usually the thing you want to move.
Sponsored Links
Closed Thread

Bookmarks

Tags
find, find -exec

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0