Useful Command

Find Classfile in Jar

for x in $(find . -iname '*.jar'); do jar -tf $x | grep -i 'Utils' && echo "FoundIn: $x"; done

Count Executed Command

sed 's/[;|][[:space:]]*/\n/g' .bash_history | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 20

All IP Connected To My Host Command

netstat -lantp | grep ESTABLISHED |awk '{print $5}' | awk -F: '{print $1}' | sort -u

Web Request

curl -v -k https://www.youtube.com/ > /dev/null
curl -X POST -HContent-type:application/json --data '{"userId":1,"userName":"Mahmood"}' http://localhost:8080/rest/adduser
curl -H "Accept: application/json" http://localhost:8080/rest/user/1
curl -u mahmood@cefalo.com:mypass2 -X PUT -HContent-type:application/json --data '{"id":1,"password":"secre","locale":"en-US"}' http://localhost:9000/user
curl  -X GET -H "UserId:mahmood@cefalo.com" -H "Token:64b32a3bd9f4be9f353d68bb441eb861b708abf5" -H "Timestamp:sas" http://192.168.1.70:9000/medicine

Find fat directory

find . -type d -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

Find fat file

find . -type f -print0 | xargs -0 du -s | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

Download website with WGET

wget --mirror  --convert-links --reject="index.html*" -nc -R jpg,png -P . bangla.bdnews24.com/
wget -r -p -nc -U mozilla -R jpg,png,zip -e robots=off www.prothom-alo.com
wget --mirror  --convert-links  -nc -R jpg,png -P . http://www.bonikbarta.com/

Turn off laptop screen

xset dpms force off

Show all uncommitted git files

find . -type d -name '.git' | while read dir ; do sh -c "cd $dir/../ && echo -e \"\nGIT STATUS IN ${dir//\.git/}\" && git status -s" ; done
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License