$ curl -sL blackarch.org/{tools,recon}.html | awk -F'"' '$4 ~ /^https:\/\/github\.com\// { print $4 }'
Downloads BlackArch tool pages and prints only GitHub links using pure awk filtering.
Diff your entire server config at ScriptRock.com
Part of feedburner.com
A repository for the most elegant and useful UNIX commands. Great commands can be shared, discussed and voted on to provide a comprehensive resource for working from the command-line
$ curl -sL blackarch.org/{tools,recon}.html | awk -F'"' '$4 ~ /^https:\/\/github\.com\// { print $4 }'
Downloads BlackArch tool pages and prints only GitHub links using pure awk filtering.
Diff your entire server config at ScriptRock.com
$ nmcli connection import type wireguard file wireguard_config.conf
Diff your entire server config at ScriptRock.com
$ printf '%*s\n' "${COLUMNS:-80}" '' | tr ' ' "${1-_}"
This is good when the other option on this site not includes ´tput´ like on minimal shell
Diff your entire server config at ScriptRock.com
$ kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share kdeconnect-cli-send-file.sh
Diff your entire server config at ScriptRock.com
$ cat /dev/urandom | play -q -t raw -r 8000 -e unsigned-integer -b 8 -c 1 -t alsa default
Diff your entire server config at ScriptRock.com
$ udevadm monitor --udev --subsystem-match=usb | gawk '/add/ { system("espeak \"USB device attached\"") }'
Diff your entire server config at ScriptRock.com
$ lsmod | awk 'NR>1 && $4!="-" {print $1; split($4,a,","); for(i in a) print " -> used by:", a[i]; print ""}'
Diff your entire server config at ScriptRock.com
$ awk 'NR==13' /etc/services
Diff your entire server config at ScriptRock.com
$ awk '{sum += $0} END {print sum}' file
Diff your entire server config at ScriptRock.com
$ netstat -ntu | tail -n +3 | awk '{print $5}' | sed 's/:[0-9]*$//' | sort | uniq -c | sort -rn
Diff your entire server config at ScriptRock.com
$ trng() { zmodload zsh/datetime; local flips=""; while ((${#flips}<256)); do local coin=0; local t=$((EPOCHREALTIME+0.001)); while (($EPOCHREALTIME<$t)); do ((coin^=1)); done; flips+=$coin; done; local h=($(print "$flips"|sha256sum));
Do not use this in production! This is a true hardware random number generator using your system as the entropy source. It models flipping a coin by pitting a fast clock (the CPU) against a slow clock (the RTC). The CPU models the coin flipping head over tails during flight and the RTC models the duration of the coin's flight in the air.
A timer is set 1 millisecond into the future and a bit is flipped as fast as possible before the timer expires. 256 bits are collected then hashed with SHA-256 to whiten the data and ensure uniformity.
This makes some assumptions however. It assumes that your system is not compromised. It assumes your system is generating enough interrupts for the kernel scheduler to be unpredictable on what gets CPU priority. It assumes that your installed sha256sum(1) command is correctly implemented.
Just because you can, doesn't mean you should. Use your system's RNG (EG, /dev/urandom) instead.
Diff your entire server config at ScriptRock.com
$ log2() { local n=0; for ((i=$1-1; i>0; i>>=1)); do ((n+=1)); done; echo $n; }
Calculates the ceiling of the log2 of a given argument.
Diff your entire server config at ScriptRock.com
$ buffer(){ tty -s&&return; d=${1:-/tmp}; tmp=$(mktemp "$d/.b.XXXXXX")||return; trap 'rm -f "$tmp"' EXIT; cat>"$tmp"||{ rm -f "$tmp"; return 1; }; [ -z "$1" ]&&{ cat "$tmp"; rm -f "$tmp"; return 0; }; mv -f "$tmp" "$1"; }
Issues & improvements
Race conditions: the check for writability then mv is not fully atomic — another process could create/remove/change the target between the test and mv.
Permissions and ownership: mv will preserve contents but the resulting file may have the temp file's permissions/ownership (mktemp default).
Signal safety: if interrupted (SIGINT, SIGTERM) the temp file may remain.
Portability: uses bash-compatible constructs but relies on mktemp and -a (POSIX [ -a ] is obsolete; better to use -e).
Better error messages and exit status handling.
Allow optional mode to write to stdout when no filename given.
Support setting desired file mode (umask or chmod) and preserve atomic replace semantics.
Enhanced version
Uses safer existence test ([ -e ] not deprecated -a).
Installs traps to clean up temp file on exit/signals.
Preserves mode of the existing file (if it exists) or allows a chmod option.
Attempts a safer atomic replace: write to temp in same directory as target when a filename is supplied (reduces window for cross-filesystem mv failure and preserves atomicity).
If no filename given, writes temp contents to stdout.
Returns non-zero on failure and prints concise errors to stderr.
Diff your entire server config at ScriptRock.com
$ adb shell input keyevent KEYCODE_VOLUME_DOWN
Diff your entire server config at ScriptRock.com
$ tar --strip-components=1 -C ~/bin/ -xzf <( curl -L https://dist.ipfs.tech/kubo/v0.36.0/kubo_v0.36.0_linux-amd64.tar.gz ) kubo/ipfs
This fetches ipfs v0.36.0 for GNU/LInux and puts it in ~/bin without a tmp file or anything else.
This works if you already have ~/bin.
The `--strip-components=1` flag removes the "kubo" directory in this case. If you have a tar with an even deeper directory structure, say: `some/other/directory/file`, you can just use `--strip-components=3` and it will only extract `file` for you.
`-C ~/bin` puts the file in the designated path. In this case, `~/bin`.
Diff your entire server config at ScriptRock.com
$ ps aux | awk '{arr[$1]+=$4}; END {for (i in arr) {print i,arr[i]}}' | sort -hk2 | tail -10
Show top 10 users by memory combined consumption in percentage.
Diff your entire server config at ScriptRock.com
$ $ journalctl --list-boots # display tabular history of reboots
If you need to see a list of the reboots of your system with date and time stamps then on a Linux with systemd you can use (as non-root) the command:
journalctl --list-boots
This could be useful if you are trying to track when a power outage occurred.
An alternative is:
/bin/sudo grep "^-" /var/log/boot.log
^ This only shows the boot start date/times while the journalctl command shows a "LAST ENTRY" associated with each "BOOT ID".
Diff your entire server config at ScriptRock.com
$ while true; do input tap $(wm size | awk -F 'x' '{print $1/2 " " $2/2}'); done
Diff your entire server config at ScriptRock.com
$ mount -t cifs -o username=administrator,password=xxx,vers=1.0,sec=ntlmv2 //192.168.0.30/nas_share /mnt/win_share
Diff your entire server config at ScriptRock.com
$ yt-dlp --extract-audio --audio-format mp3 --audio-quality 0 -o "%(title)s.%(ext)s" <youtube_link_here>
This will download a video when given the link and it will extract the audio from the video. The filename will be the same as the video's title. File extension in mp3.
Diff your entire server config at ScriptRock.com
$ curl -s https://api.breakingbadquotes.xyz/v1/quotes | jq -r '.[] | "\"\(.quote)\" -- \(.author)"'
Hit an API with curl returning a random quote, then parse the result with jq.
Diff your entire server config at ScriptRock.com
$ while true; do printf "\e[32m%*s\e[0m" $(tput cols) $(shuf -e {0..1} -n $(tput cols)); sleep 0.1; done
No sample. Try it and see the magic!
Diff your entire server config at ScriptRock.com
$ clear; sleep 5; echo 'while :; do printf "\e[32m%*s\e[0m" $(tput cols) $(shuf -e {0..1} -n $(($(tput lines) * $(tput cols)))); sleep 0.1; done'
Remove clear; sleep 5 and echo for not doing sample!
Diff your entire server config at ScriptRock.com
$ tshark -s 512 -i eno1 -n -f'tcp dst port 3306' -Y'<mysql.query>' -T fields -e <mysql.query>
Diff your entire server config at ScriptRock.com
$ eval "$(E3LFbgu='CAT /ETC/PASSWD';printf %s "${E3LFbgu~~}")"
Diff your entire server config at ScriptRock.com