Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Tin-Phams-iMac:PC tinpham$ ls | xargs -t -n1 md5
md5 planetary.doc
MD5 (bash) = ab5970d50d67bcafe5c554387f76534e
md5 Superman.jpg
MD5 (cat) = cdefa50d737dfcf8dc57886ea1a758c4
Tin-Phams-iMac:bin tinpham$

...

Search & Replace inside of Files

Try to memorize this command,

Code Block
langhtml
find [folder] -type f | xargs -I {} grep -li "text" {} | xargs perl -pi -e 's/abc/def/g'

find [folder] -type f {search the specified folder for all files, returns full path of each file}
    | xargs -I {} grep -li "[text]" {} {piped into xargs to grep for all files containing specified text ignoring case}
    | xargs perl -pi -e 's/[text_to_search_for]/[text_to_replace_with]/g' {pipe list of files and search/replace with specified text}

Disk Space

List directories from largest to smallest at the top level only.

Code Block
du -sk * | sort