These are the increasing collection of awesome shell commands, as they help a lot with my computer work. I hope to use these as soon as I need them, and if they can also help you, I will feel happy.

Awesome Shell Commands

Filesystem

Find all files recursively by file types

If you want to move all the files, you can use “-exec” and “-o”. Here is an example of how you can perform the task.


find /data/ -type f \( -name "*.pdf" -o -name "*.epub" -o  -name "*.mobi" -o -name "*.azw3" -o -name "*.txt" \) -exec mv {} books/ \;

Text

Replace

If you want to recursively replace all the words in all files in a directory. Here is an example of how you can perform the task.


# on Mac
export LC_ALL='C'
find . -type f -name "*" -print0 | xargs -0 sed -i ''  -e 's/old/new/g'