due to bug can not comment
This command deletes all files in all subfolders if their name or path contains "deleteme".
To dry-run the command without actually deleting files run:
find . | grep deleteme | while read line; do echo rm $line; done
This is quite usefull in Unix system share via NFS or AppleTalk with OSX clients that like to populate your filesystem with these pesky files
Look for a string in one of your codes, excluding the files with svn and ~ (temp/back up files). This can be useful when you're looking for a particular string in one of your source codes for example, inside a directory which is under version control (e.g. svn), removing all the annoying files with ~ (tilde) from the search. you can even change the command after -exec to delete (rm) or view (cat) files found by 'find' for example
I needed this for wine.
Useful for Maven multimodule projects, where you want to extract all packaged jar files.
Search in all html files and remove the lines that 'String' is found.
it recursively searches your project's directories and sum the lines of every source [.c or .h]. Then it gives you the total.
Original submitter's command spawns a "grep" process for every file found. Mine spawns one grep with a long list of all matching files to search in. Learn xargs, everyone! It's a very powerful and always available tool.
Good for finding outdated timthumb.php scripts which need to be updated, anything over 2.0 should be secure, below that timthimb is vulnerable and can be used to compromise your website. Show Sample Output
Find top 5 big files
When you do a ls -1 | xargs rm it wouldn't workd because those files have spaces. So you must use find -print0 and xargs -0
Will move in that case every file in the current folder older than 30 days to the "old" folder Replace "mv $i old/" by any command such as rm / echo to do something different.
find . -maxdepth 1 -iname ".*" | awk 'NR >= 2' Can be used to list only dotfiles without . nor .. Show Sample Output
After this command you can review doit.sh file before executing it. If it looks good, execute: `. doit.sh`
Will search recursively and output the searchResult.txt in the same folder you are located.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: