1 | Content: |
How to find file/directory
1 | find ./ -name "*.git" -type d |
- find file: type f
- find directory: type d
How to move, copy or delete file/directory
1 | find ./ -name "*.git" -type d | xargs -i mv {} source |
- move the directory, ‘.git’, to ‘source’
1 | file * | grep "source" | awk '{print $1}' | cut -d':' -f1 | xargs ls | xargs -i mv {} C/ |
- find “source” and move to “C” directory
1 | find ./ -name "*.git" -type -d | xargs -i cp {} source |
- copy directory, ‘*.got’, to ‘C’ directory
1 | find ./ -name "*.git" -type -d | xargs rm |
- remove directory, ‘*.got’
How to find keyword in specific file/directory
1 | find ./ -name "*.git" -print0 | xargs -0 grep -r "main" --color |
1 | find ./ -name "*.git" -print0 | xargs -0 ag "main" |