internet time @ ???

rnd's website |

Alpine Linux

This page will host an assortment of tips and tricks collected while using Alpine Linux.

About Alpine Linux

Alpine Linux is a minimalist Linux distro built with musl libc (as opposed to glibc), OpenRC as an init system and busybox as the default set of shell utilities. It is frequently used in Docker containers due to its small size, but it can also make a good workstation distribution, if you are willing to make some sacrifices. (In fact, I use it to run my personal work computers.)

Its package manager, apk, is fast and easy to use, and creating one’s own packages is performed by building from an APKBUILD file very similar to Arch Linux’s PKGBUILDs.

This page will include various information that I found useful regarding this OS.


apk is Alpine Linux’s package manager. Its interface is similar to that of apt or yum, where commands are given as words (in contrast to pacman, where commands are single-letter arguments).

In addition, there’s abuild, a system for building packages that’s quite similar to the one in Arch Linux – in fact, APKBUILD files that define how a package is built are in many ways just PKGBUILD files with slightly different syntax.

An interesting feature is that apk always keeps track of, and automatically removes, any orphaned packages (packages that were installed to satisfy a dependency of another package, but are no longer necessary because that package was removed or no longer depends on it).

list apk package sizes

This script has been broken by a recent update, which displays all package size information in a “human-readable” format as opposed to a number of bytes. As of the moment of this update, there’s no way to disable that change.

This script will list the sizes of all packages in your Alpine Linux install.


PACKAGES=`apk info -e -s \*`

a=`echo "$PACKAGES" | awk 'NR % 3 == 1' | cut -d ' ' -f 1`
a=`echo "$PACKAGES" | awk 'NR % 3 == 2'`

for i in ${!PKGNAMES[@]}; do
        echo -e "${PKGSIZES[$i]} - ${PKGNAMES[$i]}"

Run it with ./ | sort -n | uniq to get a properly-sorted and deduplicated list.

vim shell

By default, the shell is /bin/ash, which is a hardlink to busybox. Vim’s default shellpipe options don’t account for that, which results in :make and other similar commands missing any text outputted to stderr. Use

set shell=/bin/sh

in your .vimrc to set the shell to /bin/sh and fix that.