The listing will be nice separated with dashes in chunks of identical files. Output format: Size Inode Mode Count_of_identical_files UID GID Date Time Path/Filename Show Sample Output
When I do a major change in my entities, I want to find a way to find all my Entities names and create the commande for me. So instead of doing ls src/Your/OwnBundle... and then do it manually, this helps a lot. Show Sample Output
shorter version. I believe find is faster than ls as well.
Provides a much cleaner, easier to read output than the closest alternative, ls -1R. This alternative makes it easier to differentiate directories from files: find . -printf '%y %p\n' | perl -ne 'if( m/(\w) (.*)\/(.*)/ ) { $t = $1; $p = $2; $f = $3; $t =~ s/[^d]/ /; $p =~ s/[^\/]/ /g; $p =~ s/\//|/g; print "$t $p/$f\n"; } elsif( m/(\w) (.*)/ ) { print "$1 $2\n"; } else { print "error interpreting: \"$_\"\n"; }' Show Sample Output
Find files matching multiple descriptions (*.c and *.cpp) excluding multiple directories (unit-test and android).
Using a for loop, rename all files with .MP3 extension to .mp3. Show Sample Output
This will make a backup of all hidden files and folders in the home folder.
This command won't delete resource forks from an HFS file system, only from file systems that don't natively support resource forks.
for those without the tree command. Show Sample Output
This doesn't require any non-standard programs.
This simple command removes all the .svn directories recursively. Useful when you want to get a clean code excluding .svn files. Check what is getting delete through this command " find . -name '.svn' -type d | xargs echo "
Ever done a find to get content and been messed up by .git, .svn, .hg or the like spamming your results? Did you really want to grep over every copy of the file that existed in your git history?
Replace:
grep -r PATTERN .
with:
grep PATTERN -- $(have_here)
or if you really have too many files to put in one argv:
have_here | xargs grep PATTERN --
This will check if there are any empty directories, or newly emptied directories, in a list of directories. It will then delete all of those directories. It works with gnu find and OSX/BSD find.
Sometimes you want to see all of the systcls for a given $thing. I happened to need to easily look at all of the vm sysctls between two boxes and compare them. This is what I came up with. Show Sample Output
Watch out if you have several USB drives plugged in: it scans the whole /media/ folder !!! You can replace /media/ by the path of a specific USB drive (something like /media/F77A-530B/) I use a sound recorder and I want to plug the recorder and grab the most recent sound. That's what this command does. Use mv instead of cp to move instead of copy. Change *.wav to the required file type.
Handles spaces in file names and directories. Optionally change directories as well by pipe to tr from dirname.
rm /SOME/PATH/*, when you hit "argument list too long".
here's a version which works on OS X.
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: