3
score
|
Remove offending key from known_hosts file with one swift move$ sed -i 18d .ssh/known_hosts |
3
score
|
Create a visual report of the contents of a usb drive$ find /path/to/drive -type f -exec file -b '{}' \; -printf '%s\n' | awk -F , 'NR%2 {i=$1} NR%2==0 {a[i]+=$1} END {for (i in a) printf("%12u %s\n",a[i],i)}' | sort -nr |
2
score
|
Generate a sequence of numbers$ printf '%s\n' {1..10} |
2
score
|
Find files/dirs modified within a given period$ find . -type d -newermt "2019-01-01" \! -newermt "2019-02-01" -exec ls -ld {} \; |
2
score
|
Generate a random 32 characters password$ tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1 |
2
score
|
Search man pages and present a PDF$ man -k . | awk '{ print $1 " " $2 }' | dmenu -i -p man | awk '{ print $2 " " $1 }' | tr -d '()' | xargs man -t | ps2pdf - - | zathura - |
2
score
|
Kill a process running on port 8080$ lsof -i :8080 | awk '{l=$2} END {print l}' | xargs kill |
2
score
|
Big CSV > batches > JSON array > CURL POST data with sleep$ cat post-list.csv | split -l 30 - --filter='jq -R . | jq --slurp -c .' | xargs -d "\n" -I % sh -c 'curl -H "Content-Type: application/json" -X POST -d '"'"'{"type":1,"entries":%}'"'"' http://127.0.0.1:8080/purge-something && sleep 30' |
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
|
Retrieve dropped connections from firewalld journaling$ sudo journalctl -b | grep -o "PROTO=.*" | sed -r 's/(PROTO|SPT|DPT|LEN)=//g' | awk '{print $1, $3}' | sort | uniq -c |
2
score
|
Make a new folder and cd into it.$ mkcd(){ NAME=$1; mkdir -p "$NAME"; cd "$NAME"; } |
2
score
|
Convert all flac files in dir to mp3 320kbps using ffmpeg$ for FILE in *.flac; do ffmpeg -i "$FILE" -b:a 320k "${FILE[@]/%flac/mp3}"; done; |
2
score
|
Generates random texts$ tr -dc a-z1-4 </dev/urandom | tr 1-2 ' \n' | awk 'length==0 || length>50' | tr 3-4 ' ' | sed 's/^ *//' | cat -s | fmt |
2
score
|
Find recent logs that contain the string "Exception"$ find . -name '*.log' -mtime -2 -exec grep -Hc Exception {} \; | grep -v :0$ |
2
score
|
Parse nginx statistics output$ i=$(curl -s server/nginx_stats); IFS=$'\n'; i=($i); a=${i[0]/Active connections: } && a=${a/ }; r=${i[2]# [0-9]* [0-9]* }; echo "Active: $a, requests: $r" |
2
score
|
Install profiling versions of all libghc dpkg packages$ sudo dpkg -l | grep libghc | grep "\-dev" | cut -d " " -f 3 | tr '\n' ' ' | sed -e 's/\-dev/\-prof/g' | xargs sudo apt-get install --yes |
2
score
|
Have script run itself in a virtual terminal$ tty >/dev/null || { urxvt -hold -e "$0" "$@" & exit; } |
2
score
|
Remove .DS_Store from the repository you happen to staging by mistake$ find . -name .DS_Store -exec git rm --ignore-unmatch --cached {} + |
2
score
|
Get mac address from default interface OS X$ netstat -rn | awk '/default/ { print $NF }' | head -1 | xargs -I {} ifconfig {} | awk '/ether/ {print $2}' |
2
score
|
Dump network traffic with tcpdump to file with time-stamp in its filename$ date +"%Y-%m-%d_%H-%M-%Z" | xargs -I {} bash -c "sudo tcpdump -nq -s 0 -i eth0 -w ./dump-{}.pcap" |
2
score
|
Remove files and directories whose name is a timestamp older than a certain time$ ls | grep '....-..-..-......' | xargs -I {} bash -c "[[ x{} < x$(date -d '3 days ago' +%Y-%m-%d-%H%M%S) ]] && rm -rfv {}" |
2
score
|
Unhide all hidden files in the current directory.$ find . -maxdepth 1 -type f -name '\.*' | sed -e 's,^\./\.,,' | sort | xargs -iname mv .name name |
2
score
|
Create a thumbnail from the first page of a PDF file$ convert -thumbnail x80 file.pdf[0] thumb.png |
2
score
|
Send HTTP POST to a website with a file input field$ curl -L -v -F "value=@myfile" "http://domain.tld/whatever.php" |