All commands (14,232)

  • Display a compact, columnized reference of printable ASCII characters and their shell-compatible octal escape sequences. Show Sample Output


    1
    for i in {1..256};do printf '%3d %b\n' $i \\0$((i/64*100+i%64/8*10+i%8));done|cat -t|column -c$((${COLUMNS:-80}/2))
    AskApache · 2026-08-13 07:42:31 0
  • The xorshift32 PRNG written by George Marsaglia in Bash, code golfed. Bash already has the $RANDOM and $SRANDOM environment variables, so this isn't all that useful. The seed "s" must be non-zero. Show Sample Output


    0
    n(){ s=$[s^s<<13];s=$[s^s>>17];s=$[s^s<<5];echo $[s&2**32-1]; }
    atoponce · 2026-07-31 03:42:35 0
  • https://djmag.com/top100djs Show Sample Output


    0
    elinks -dump https://djmag.com/top100djs | awk '/^[0-9]+$/ { rank=$0; next } rank && /^\[[0-9]+\]/ { gsub(/^\[[0-9]+\]/, ""); gsub(/^[ \t]+|[ \t]+$/, ""); print rank ". " $0; rank="" }'|sort -u
    wuseman1 · 2026-07-17 16:30:19 0
  • A lightweight and dependency-minimal way to record a selected region of your Wayland screen. By using `slurp`'s custom formatting directly (`%wx%h+%x+%y`), we eliminate the need for piping through helper tools like `sed` or `awk` to construct the geometry argument for `gpu-screen-recorder`. Requirements: slurp, gpu-screen-recorder


    1
    gpu-screen-recorder -w "$(slurp -f "%wx%h+%x+%y")" -f 60 -o "$HOME/rec_$(date +%Y%m%d_%H%M%S).mp4"
    wuseman1 · 2026-07-15 04:44:42 0
  • Ignores deleted files since main. dos2unix already skips binary files. Safely NUL-delimited. Add -i for a dry run.


    -1
    git diff --diff-filter=ACMRTUX --name-only main -z | grep -zvE '(.meta)' | xargs -0 dos2unix --add-eol
    Hype · 2026-06-23 03:50:58 0
  • Downloads BlackArch tool pages and prints only GitHub links using pure awk filtering.


    0
    curl -sL blackarch.org/{tools,recon}.html | awk -F'"' '$4 ~ /^https:\/\/github\.com\// { print $4 }'
    wuseman1 · 2026-02-12 08:38:04 0

  • 1
    nmcli connection import type wireguard file wireguard_config.conf
    wuseman1 · 2026-02-11 20:31:36 0
  • This is good when the other option on this site not includes ´tput´ like on minimal shell


    3
    printf '%*s\n' "${COLUMNS:-80}" '' | tr ' ' "${1-_}"
    wuseman1 · 2026-02-11 18:27:03 0

  • 1
    kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share kdeconnect-cli-send-file.sh
    wuseman1 · 2026-02-03 03:10:30 0

  • 0
    cat /dev/urandom | play -q -t raw -r 8000 -e unsigned-integer -b 8 -c 1 -t alsa default
    wuseman1 · 2026-01-27 13:25:49 0

  • 0
    udevadm monitor --udev --subsystem-match=usb | gawk '/add/ { system("espeak \"USB device attached\"") }'
    wuseman1 · 2026-01-27 12:24:27 0

  • 1
    lsmod | awk 'NR>1 && $4!="-" {print $1; split($4,a,","); for(i in a) print " -> used by:", a[i]; print ""}'
    wuseman1 · 2026-01-26 19:00:04 0

  • 4
    awk 'NR==13' /etc/services
    atoponce · 2025-11-25 18:40:02 0

  • -1
    awk '{sum += $0} END {print sum}' file
    atoponce · 2025-11-25 18:21:44 0

  • 5
    netstat -ntu | tail -n +3 | awk '{print $5}' | sed 's/:[0-9]*$//' | sort | uniq -c | sort -rn
    atoponce · 2025-11-25 18:15:39 0
  • 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. Show Sample Output


    1
    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));
    atoponce · 2025-11-24 18:13:40 0
  • Calculates the ceiling of the log2 of a given argument. Show Sample Output


    1
    log2() { local n=0; for ((i=$1-1; i>0; i>>=1)); do ((n+=1)); done; echo $n; }
    atoponce · 2025-11-24 17:17:14 0
  • 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.


    -5
    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"; }
    cryptology_codes · 2025-09-14 21:19:55 0

  • 0
    adb shell input keyevent KEYCODE_VOLUME_DOWN
    alikhalil · 2025-08-13 13:22:00 0
  • 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`. Show Sample Output


    1
    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
    renich · 2025-08-12 03:38:07 0
  • Show top 10 users by memory combined consumption in percentage. Show Sample Output


    -1
    ps aux | awk '{arr[$1]+=$4}; END {for (i in arr) {print i,arr[i]}}' | sort -hk2 | tail -10
    Raboo · 2025-08-01 07:06:55 0
  • 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". Show Sample Output


    1
    $ journalctl --list-boots # display tabular history of reboots
    mpb · 2025-07-22 14:52:34 0

  • 1
    while true; do input tap $(wm size | awk -F 'x' '{print $1/2 " " $2/2}'); done
    wuseman1 · 2025-05-27 13:32:54 0

  • 0
    mount -t cifs -o username=administrator,password=xxx,vers=1.0,sec=ntlmv2 //192.168.0.30/nas_share /mnt/win_share
    swarzynski · 2025-03-20 08:16:19 0
  • 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.


    11
    yt-dlp --extract-audio --audio-format mp3 --audio-quality 0 -o "%(title)s.%(ext)s" <youtube_link_here>
    keyboardsage · 2024-11-22 19:54:54 0
  •  1 2 3 >  Last ›

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Copy a file over SSH without SCP

C function manual

Retrieve a random command from the commandlinefu.com API
Seeing that we get back plain text anyway we don't need lynx. Also the sed-part removes the credit line.

FHDTV IPTV UK – Affordable Plans for Every Viewer
FHDTV IPTV UK is a premier choice for those who want premium television experiences without cable contracts limitations. With a focus on UK audiences FHDTV IPTV provides countless live TV channels entertainment and HD-quality programming across all categories. Whether you love movies documentaries or international channels FHDTV ensures smooth playback on your preferred devices. One of the main attractions of FHDTV IPTV is the risk-free free trial. Unlike many other services who lock premium access FHDTV offers full access during trial so you can evaluate its real performance before committing. It’s compatible with Smart TVs smartphones and even tablets allowing families to enjoy content on multiple devices simultaneously without lag. Affordability is another standout feature. Subscriptions are affordable with zero contracts or installation delays. Compared to traditional cable FHDTV IPTV offers thousands of channels at a fraction of the cost. It’s perfect for sports fans who don’t want to miss live action. FHDTV IPTV also leads in content variety. Viewers get access to global streams including news kids’ shows religious programming and exclusive movies. The interface is user-friendly and the EPG (electronic program guide) is quick making navigation and recordings simple—even for first-time users. Another remarkable feature is the customer support. FHDTV IPTV offers reliable assistance through chat or WhatsApp and most issues are solved in minutes. The platform provides clear setup guides and tutorials so that even new users can configure everything with ease. All in all FHDTV IPTV UK delivers performance functionality and top-tier content in one easy package. Its free trial is generous and it supports a wide range of devices. Whether you’re trying IPTV for the first time FHDTV IPTV UK is your best choice in 2025

list block devices
Shows all block devices in a tree with descruptions of what they are.

Record audio and video from webcam using ffmpeg
Record from a webcam, audio using ALSA encoded as MP3, video as MPEG-4.

capture mysql queries sent to server

Remove the first and the latest caracter of a string

sed : using colons as separators instead of forward slashes
Having to escape forwardslashes when using sed can be a pain. However, it's possible to instead of using / as the separator to use : . I found this by trying to substitute $PWD into my pattern, like so $ sed "s/~.*/$PWD/" file.txt Of course, $PWD will expand to a character string that begins with a / , which will make sed spit out an error such as "sed: -e expression #1, char 8: unknown option to `s'". So simply changing it to $ sed "s:~.*:$PWD:" file.txt did the trick.

Rename files in batch


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: