Last active
August 29, 2015 14:07
-
-
Save alesegdia/7c3d5c3db09e3d52cc25 to your computer and use it in GitHub Desktop.
Useful bash commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sort folders/files by disk usage | |
du -hc . | grep [.]/[^/]*$ | sort -h | |
# replace in all files | |
grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g' | |
# script to rename in all files: | |
#!/usr/bin/env bash | |
if [ $# -ne 3 ]; then | |
exit | |
fi | |
find $1 -type f -print0 | xargs -0 sed -i "s/$2/$3/g" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment