Cycle through a 256 colour palette

$ yes "$(seq 232 255;seq 254 -1 233)" | while read i; do printf "\x1b[48;5;${i}m\n"; sleep .01; done

Just for fun.


Generates a TV noise alike output in the terminal

$ while true;do printf "$(awk -v c="$(tput cols)" -v s="$RANDOM" 'BEGIN{srand(s);while(--c>=0){printf("\xe2\x96\\%s",sprintf("%o",150+int(10*rand())));}}')";done

Generates a TV noise alike output in the terminal.


List packages manually installed with process currently running

$ ps -eo cmd | awk '{print $1}'| sort -u | grep "^/" | xargs dpkg -S 2>/dev/null | awk -F: '{print $1}' | sort -u | xargs apt-mark showmanual

Sometimes we install programs, we forget about them, and they stay there wasting RAM. This one-liner try to find them.


Calculate pi to an arbitrary number of decimal places

Host cpu performance

$ openssl speed md5

Measure the cpu performance: In-case if the cpu is thermal throttling then you can find it using this command. Check the first line of the output. Example: Doing md5 for 3s on 16 size blocks: 11406892 md5's in 2.98s ? #(When cpu is not throttling) Doing md5 for 3s on 16 size blocks: 110692 md5's in 2.98s ?? #(When cpu is thermal throttling) Practical use case: Once we had cooling outage in data center which caused thermal throttling in some of the worker nodes. We used this tool to prove that some servers are not performing well because of the cpu thermal throttling.


Display which distro is installed

Rip audio from a video file.

$ mplayer -ao pcm -vo null -vc dummy -dumpaudio -dumpfile <output-file> <input-file>

eplace and accordingly.


Make bash look like DOS

Create a DOS floppy image

$ dd if=/dev/zero bs=1024 count=1440 > floppy.img && mkdosfs floppy.img

mount with: mount -t msdos -o loop ./floppy.img /tmp/mnt


Convert a date to timestamp

$ date --utc --date "2009-02-06 09:57:54" +%s

Simple way to get a timestamp from a date.


Equivalent of alias in cmd.exe: doskey (macros)

$ doskey l=dir /OD $*

doskey is the Windows cmd.exe equivalent of the Unix alias. '$*' means 'all parameters' This example is like alias l='ls -alrt': it will display files from oldest to newest, for one or more directories. doskey /MACROS list macros defined for cmd.exe, like 'alias' list aliases defined for the current Unix shell.


Another Curl your IP command

$ curl -s | sed 's/[a-zA-Z<>/ :]//g'

Just another curl command to get your public facing IP.


List of commands you use most often

$ history | awk '{print $2}' | sort | uniq -c | sort -rn | head


Count down from 10

$ for (( i = 10; i > 0; i-- )); do echo "$i"; sleep 1; done

Countdown from 10 or whatever you want.


Get your public IP address using Amazon

Console clock

$ while sleep 1; do tput sc; tput cup 0 $(($(tput cols)-29)); date; tput rc; done &

You will see it on the corner of your running terminal.


commandlinefu/commandlinefu.txt · Zuletzt geändert: 2021/01/31 00:01 von sommteck