1
score
|
Get a wide info of all pods on all namespaces with Kubectl$ kubectl get pods -A -o wide |
0
score
|
Oneliner checksum validation$ sha512sum filename.iso | grep -oE ".*\ " | (read checksum; [ "$Checksum" == checksumCheck ] && printf "\033[0;32mValid" || printf "\033[0;31mInvalid") |
0
score
|
Move file and cd with one command$ mv file dir && cd "$_" && pwd |
1
score
|
Report disk usage by file type$ find . -type f -empty -prune -o -type f -printf "%s\t" -exec file --brief --mime-type '{}' \; | awk 'BEGIN {printf("%12s\t%12s\n","bytes","type")} {type=$2; a[type]+=$1} END {for (i in a) printf("%12u\t%12s\n", a[i], i)|"sort -nr"}' |
0
score
|
Find with invert match - e.g. find every file that is not mp3$ find . -name '*' -type f -not -path '*.mp3' |
-1
score
|
Convert pip list --outdated for reuse in pip install -U$ pip install -U $(pip list --outdated 2> /dev/null | grep -v 'Version' | grep -v '------' | awk '{printf $1 " " }' && echo) |
0
score
|
Convert pip list --outdated for reuse in pip install -U$ python3 -m pip install -U $(python3 -m pip list outdated 2> /dev/null | grep -v 'Version' | grep -v '\-\-\-\-\-\-' | awk '{printf $1 " " }' && echo) |
0
score
|
Recursively remove all "node_modules" folders$ find . -name "node_modules" -exec rm -rf '{}' + |
0
score
|
Read other user's shell history, and convert epoch to human-readable date$ cat /home/john/.bash_history | awk '/#[0-9]*$/ {split($0, arr, "#"); print "#", strftime("%c",arr[2]);getline; print; }' |
1
score
|
Outputs list of $PATH dirs sorted by line length$ echo -e ${PATH//:/\\n} | awk '{print length, $0}' | sort -n | cut -f2- -d' ' |
0
score
|
Generate a sequence of numbers$ seq 1 10 |
0
score
|
Prints "Good" in green if the sha256 sum of a file matches the sum listed in a dist/checksum file and "Bad" in red if it does not match$ [[ $(sha256sum _downloaded_file_ | cut -d' ' -f 1) == $(grep -Po '\b[a-zA-Z0-9]{64}\b' _checksum_fle_) ]] && printf "\033[0;32mGood" || printf "\033[0;31mBad" |
0
score
|
Listen to a song from youtube$ listen-to-yt() { if [[ -z "$1" ]]; then echo "Enter a search string!"; else mpv "$(youtube-dl --default-search 'ytsearch1:' \"$1\" --get-url | tail -1)"; fi } |
0
score
|
(Pseudo)random 6-digit number$ let N=0 N=N+10**{0..5}*${RANDOM:0:1} |
0
score
|
Compute factorial of positive integer using only built-ins$ bang() ( eval let N=1 N*={1..$1} ; echo $N; ) |
2
score
|
Generate a sequence of numbers$ printf '%s\n' {1..10} |
0
score
|
Recursively compute factorial of positive integer using only built-ins$ bang() ( IFS=\*; let N=$1-1 k="$*" && bang $N $k || echo ${2-1} ) |
2
score
|
Using a single sudo to run multiple && arguments$ sudo -s <<< 'apt update -y && apt upgrade -y' |
1
score
|
Generate a sequence of numbers$ for i in {1..10};do echo $i;done |
0
score
|
List docker log sizes and remind how to empty them$ docker ps -qa | xargs docker inspect --format='{{.LogPath}}' | xargs sudo du -hl; sleep 1; printf "\r\n echo '' > \$(docker inspect --format={{.LogPath}} container_name_or_id) \r\n*****COPY****ABOVE****TO******CLEAR*****LOG*****CHANGE***CONTAINER_ID******* \r\n \n" |
2
score
|
Find files/dirs modified within a given period$ find . -type d -newermt "2019-01-01" \! -newermt "2019-02-01" -exec ls -ld {} \; |
1
score
|
Scan all open ports without any required program$ for i in {1..65535}; do (echo < /dev/tcp/127.0.0.1/$i) &>/dev/null && printf "\n[+] Open Port at\n: \t%d\n" "$i" || printf "."; done |
0
score
|
Extract audio only from video files using ffmpeg$ ffmpeg -i video.any -vn -acodec libvorbis audio.ogg |
2
score
|
Generate a random 32 characters password$ tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1 |