Skip to content

Instantly share code, notes, and snippets.

@gamemann
Last active August 2, 2023 22:06
Show Gist options
  • Select an option

  • Save gamemann/bd35929faec69e058388b395e2daa38e to your computer and use it in GitHub Desktop.

Select an option

Save gamemann/bd35929faec69e058388b395e2daa38e to your computer and use it in GitHub Desktop.
Matrix Linux Command

Linux command that outputs code animations similar to the movie The Matrix.

while :; do \
    echo \
        $LINES \
        $COLUMNS \
        $(( $RANDOM % $COLUMNS)) \
        $(printf "\U$(($RANDOM % 500))"); \
    sleep 0.05; \
done \
| gawk '{ \
    a[$3]=0; \
    for (x in a) { \
        o=a[x]; \
        a[x]=a[x]+1; \
        printf "\033[%s;%sH\033[2;32m%s",o,x,$4; \
        printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,$4; \
        if (a[x]>=$1){ \
            a[x]=0; \
        } \
    } \
}'

Preview

Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment