simple find and exec example
Note that this will not work with files with spaces or characters that need to be escaped. Feel free to leave any comments to improve upon this command, and I'll add it in. Thanks! Show Sample Output
I hate -exec with find, and this pattern quickly expands to other tasks.
root@wow/var/spool/clientmqueue # rm spam-* /bin/rm: Argument list too long.
Recursively find php files and replace tab characters with spaces. Options: "\*.php" -- replace this with the files you wish to find "expand" -- replace tabs with spaces (use "unexpand" to replace spaces with tabs) "-t4" -- tabs represent 4 spaces Note: The IFS="" in the middle is to prevent 'read' from eating leading/trailing whitespace in filenames.
Takes a directory name as an argument (defaults to current directory if no arguments are given). Prints the newest file in the directory. Show Sample Output
Count your source and header file's line numbers For example for java change the command like this find . -name '*.java' -exec cat {} \;|wc -l Show Sample Output
This command is more robust because it handles spaces, newlines and control characters in filenames. It uses printf, not ls, to determine file size.
show directory three
Actually your func will find both files and directorys that contain ${1}. This one only find files. ..and to look only for dirs: finddir() { find . -type d -iname "*${*}*" ; }
"*" is important if you don't know exact name of file. Check it out and you'll see
This find files of name like *.log and truncates them.
This example uses the -exec option to move all matching files into a backup directory
Recursive grep through directory for file.
Assuming only VIM has *~ files in your current dir. If you have usefull data in a file named in the *~ pattern, DO NOT RUN this command!
Corrected.
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: