10 score | Show 10 Largest Open Files$ lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB" " " $9 " " $1 }' | sort -n -u | tail |
8 score | List status of all GIT repos$ find ~ -name ".git" 2> /dev/null | sed 's/\/.git/\//g' | awk '{print "-------------------------\n\033[1;32mGit Repo:\033[0m " $1; system("git --git-dir="$1".git --work-tree="$1" status")}' |
7 score | Displays the quantity of connections to port 80 on a per IP basis$ clear;while x=0; do clear;date;echo "";echo " [Count] | [IP ADDR]";echo "-------------------";netstat -np|grep :80|grep -v LISTEN|awk '{print $5}'|cut -d: -f1|uniq -c; sleep 5;done |
6 score | Generate a sequence of numbers$ echo {01..10} |
5 score | Corporate random bullshit generator (cbsg)$ curl -s http://cbsg.sourceforge.net/cgi-bin/live | grep -Eo '^<li>.*</li>' | sed s,\</\\?li\>,,g | shuf -n 1 |
5 score | Convert directory of videos to MP4 in parallel$ for INPUT in *.avi ; do echo "${INPUT%.avi}" ; done | xargs -i -P9 HandBrakeCLI -i "{}".avi -o "{}".mp4 |
5 score | Rename all items in a directory to lower case$ for i in *; do mv "$i" "${i,,}"; done |
4 score | List IP addresses connected to your server on port 80$ netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head |
4 score | Ban all IPs that attempted to access phpmyadmin on your site$ grep "phpmyadmin" $path_to_access.log | grep -Po "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" | sort | uniq | xargs -I% sudo iptables -A INPUT -s % -j DROP |
4 score | Nmap scan every interface that is assigned an IP$ ifconfig -a | grep -Po '\b(?!255)(?:\d{1,3}\.){3}(?!255)\d{1,3}\b' | xargs nmap -A -p0- |
4 score | Change the encoding of all files in a directory and subdirectories$ find . -type f -name '*.java' -exec sh -c 'iconv -f cp1252 -t utf-8 "$1" > converted && mv converted "$1"' -- {} \; |
4 score | Tree-like output in ls$ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' |
4 score | Show dd status every so often$ watch --interval 5 killall -USR1 dd |
3 score | Find all log files modified 24 hours ago, and zip them$ find . -type f -mtime +1 -name "*.log" -exec zip -m {}.zip {} \; >/dev/null |
3 score | Ternary conditional clause$ [ test_statement ] && ( then_statement ) || ( else_statement ); |
3 score | Open another terminal at current location$ $TERMINAL & disown |
3 score | Run a command and copy its output to clipboard (Mac OSX)$ echo "Here comes the output of my failing code" | tee >(pbcopy) |
3 score | Extract your external IP address using dig$ dig +short myip.opendns.com @resolver1.opendns.com |
3 score | Remove offending key from known_hosts file with one swift move$ ssh-keygen -R <hostname> |
3 score | Remove offending key from known_hosts file with one swift move$ sed -i 18d .ssh/known_hosts |
2 score | Kill a process running on port 8080$ lsof -i :8080 | awk '{l=$2} END {print l}' | xargs kill |
2 score | List all packages with at least a class defined in a JAR file$ jar tf "$1" | grep '/.*\.class$' | xargs dirname | sort -u | tr / . |
2 score | Output an arbitrary number of open TCP or UDP ports in an arbitrary range$ comm -23 <(seq "$FROM" "$TO") <(ss -tan | awk '{print $4}' | cut -d':' -f2 | grep "[0-9]\{1,5\}" | sort | uniq) | shuf | head -n "$HOWMANY" |
2 score | Get executed script's current working directory$ CWD=$(cd "$(dirname "$0")" && pwd) |
2 score | Random Git Commit$ git commit -m "$(w3m whatthecommit.com | head -n 1)" |