Check These Out
This command will display all lines between 2 patterns: word-a and word-b
useful for grepping command outputs from file
delete multiple files from git index that have already been deleted from disk. this is pretty terrible, I'm looking for a better way.
(much better!! http://www.commandlinefu.com/commands/view/1246/git-remove-files-which-have-been-deleted)
Finds duplicates based on MD5 sum. Compares only files with the same size. Performance improvements on:
$find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
The new version takes around 3 seconds where the old version took around 17 minutes. The bottle neck in the old command was the second find. It searches for the files with the specified file size. The new version keeps the file path and size from the beginning.
This is a very hackish way to do it that I'm mainly just posting for fun, and I guess technically can more accurately be said to result in undefined behavior. What the command does is tell the shell to treat libpng like it's a shell plugin (which it's most certainly not) and attempt to install a "png_create_read" command from the library. It looks for the struct with the information about the command; since it's always the command name followed by "_struct", it'll look for a symbol called "png_create_read_struct". And it finds it, since this is the name of one of libpng's functions. But bash has no way to tell it's a function instead of a struct, so it goes ahead and parses the function's code as if it was command metadata. Inevitably, bash will attempt to dereference an invalid pointer or whatever, resulting in a segfault.
mount with:
mount -t msdos -o loop ./floppy.img /tmp/mnt
Yet another way to add a line at the top a of text file with the help of the tac command (reverse cat).
Found this little gem here: http://info.michael-simons.eu/2008/10/25/recursively-md5sum-all-files-in-a-directory-tree/
**NOTE** Tekhne's alternative is much more succinct and its output conforms to the files actual contents rather than with white space removed
My command on the other hand uses bash process substitution (and "Minimal" Perl), instead of files, to first remove leading and trailing white space from lines, before diff'ing the streams. Very useful when differences in indentation, such as in programming source code files, may be irrelevant
This will output the characters at 10 per second.