Last active
May 17, 2019 21:03
-
-
Save Alex-Just/6e73cb6ce1265b06d20cd979ec028d83 to your computer and use it in GitHub Desktop.
This file contains 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
# find by name | |
find . -name 'MYTEXT*' | |
# find text in files | |
grep -r "MYTEXT" . | |
# find dir by name | |
find . -name "MYTEXT" -type d | |
# free space | |
http://stackoverflow.com/questions/8110530/check-free-disk-space-for-current-partition-in-bash | |
df -k . | |
df -h | |
# Folder size | |
du -hcs | |
# File size | |
du -h filename | |
# List out the size of each file and directory (recursively) and sort by size decendingly | |
du -a -h --max-depth=1 | sort -hr | |
# List images by size | |
find . \( -iname \*.png -o -iname \*.jpg \) -not -path "./api*" -print0 | xargs -0 ls -l | sort -k5 -r | head -45 | |
# Recursively count all the files in a directory | |
find . -type f | wc -l | |
# How do I remove all .pyc files from a project? | |
find . -name \*.pyc -delete | |
# How to remove duplicated files in a directory? | |
http://superuser.com/a/691551/419124 | |
fdupes -rf . | grep -v '^$' > files | |
... # check files | |
xargs -a files rm -v | |
# How to find duplicate files with same name? | |
http://stackoverflow.com/a/2109068/1334996 | |
ls -1 | sort | uniq -c | grep -v " 1 " | |
# Total used disk space by files modified in last 30 days | |
find . -type f -mtime -30 -exec du -ks {} \; | cut -f1 | awk '{total=total+$1}END{print total/1024}' | |
# Count results | |
<expr> | wc -l | |
# Resume the stopped transfer. Note that the remote server must have rsync installed as well | |
rsync -P --rsh=ssh userid@remotehost.com:bigdata.tgz ./bigdata.tgz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment