Skip to content

Instantly share code, notes, and snippets.

@ravyg
Last active May 25, 2018 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravyg/a03cb3596ae1b0a8ca23287726958b29 to your computer and use it in GitHub Desktop.
Save ravyg/a03cb3596ae1b0a8ca23287726958b29 to your computer and use it in GitHub Desktop.
General Unix Commands
# Find the number of line in a file type recuresively.
find . -name '*.php' | xargs wc -l
# Find occurence on on word say "carrot" in many files.
grep -ir carrot . | wc -l
# This helps in moving files so keep backup!!!
# Moves files with json extension from sub-folders recursively to single output folder.
find <parent/folders/subfolders> -type f -name '*.json' -exec mv -i {} <new/folder> \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment