GeistHaus
log in · sign up

https://feeds2.feedburner.com/Command-line-fu

rss
25 posts
Polling state
Status active
Last polled May 19, 2026 02:18 UTC
Next poll May 20, 2026 03:26 UTC
Poll interval 86400s
Last-Modified Tue, 19 May 2026 01:18:50 GMT

Posts

Extract GitHub repository URLs from BlackArch tools pages
$ 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.

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/43210/extract-github-repository-urls-from-blackarch-tools-pages
Print a full-width horizontal line using the current terminal width (custom character supported)
$ printf '%*s\n' "${COLUMNS:-80}" '' | tr ' ' "${1-_}" This is good when the other option on this site not includes ´tput´ like on minimal shell

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/43206/print-a-full-width-horizontal-line-using-the-current-terminal-width-custom-character-supported
True random number generator in pure ZSH
$ 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.

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/42757/true-random-number-generator-in-pure-zsh
Enhanced Buffer in order to avoir mistakes with redirections that empty your files
$ 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.

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/42202/enhanced-buffer-in-order-to-avoir-mistakes-with-redirections-that-empty-your-files
Extract one file from a remote tar.gz and put it where you want it
$ 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`.

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/41880/extract-one-file-from-a-remote-tar.gz-and-put-it-where-you-want-it
Display history of reboots
$ $ 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".

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/41592/display-history-of-reboots
Download and Extract mp3 from Youtube Video
$ 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.

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/38091/download-and-extract-mp3-from-youtube-video
This command will help you to hunt the current mysql query statement in real time. (-R is deprecated, using updated -Y)
$ tshark -s 512 -i eno1 -n -f'tcp dst port 3306' -Y'<mysql.query>' -T fields -e <mysql.query>

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/36696/this-command-will-help-you-to-hunt-the-current-mysql-query-statement-in-real-time.-r-is-deprecated-using-updated-y
Read /etc/passwd with printf in a smarter and shorter way then some deliberately obfuscated shell commands from unethicals.
$ eval "$(E3LFbgu='CAT /ETC/PASSWD';printf %s "${E3LFbgu~~}")"

commandlinefu.com

Diff your entire server config at ScriptRock.com

http://www.commandlinefu.com/commands/view/36695/read-etcpasswd-with-printf-in-a-smarter-and-shorter-way-then-some-deliberately-obfuscated-shell-commands-from-unethicals.