Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-29-2011, 12:45 AM   #1
LQ Newbie
Registered: Mar 2011
Posts: 7

Rep: Reputation: 0
Terminal Commands (find)

Im having a few problems with the find command. IM rather new to linux so it could be very simple sorry to waste your time but all help would be great.

What i want to do is search a directory for files that are more then 500kb this is what i have come up with but it doesnt seem to be working very well.

find /usr/bin -exec {-size +500k};

im not real sure why its not working i think it has something to do with the exec command but i feel i need it from what i have read. If someone could explain it to me what i have done and what i need to do that would be great.

Thanks in advance.
Old 03-29-2011, 12:59 AM   #2
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
Use simply
find /usr/bin -size +500k
You can use -exec if you want to manipulate each result of the find command and pass the results as argument to the specified command.
Silly example:
find /usr/bin -size +5000k -exec ls --color=yes {} \;
Old 03-29-2011, 01:05 AM   #3
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
You don't seem to be doing anything with the -exec option, so I don't understand why you think you need it.

The {} curly braces are probably being eaten by Bash because it uses them in a few different contexts. Again, I don't understand why you think you need them.

The following command will find all files in the current directory, and recurse all subdirectories, greater than 9K in size.

find -type f -size +9k
This command will do the same, but will not recurse subdirectories.

find -maxdepth 1 -type f -size +9k
This last command will show a long style listing of all selected files sorted by size.

find -maxdepth 1 -type f -size +9k -exec ls -hlS '{}' \;



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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Terminal commands working in terminal but not in a script GreYFoXGTi Linux - Newbie 1 08-04-2010 09:36 AM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
Need help for Windows cmd commands into Linux terminal commands. windowsNilo Linux - Software 2 07-02-2008 06:26 PM
Need help for Windows cmd commands into Linux terminal commands. windowsNilo Linux - General 2 07-01-2008 06:53 AM

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration