Terminal cheat sheet

From postmarketOS
Jump to navigation Jump to search

Here's a small reference for working with postmarketOS/Alpine Linux.

Package management

The package manager in postmarketOS is called apk, the Alpine Package Keeper. The list of packages can be found on https://pkgs.alpinelinux.org/packages and https://pkgs.postmarketos.org/packages as both repositories are added to postmarketOS installations.

Installing a package

$ apk add vim

Uninstalling a package

$ apk del vim

Upgrading the system. The -a option allows downgrading packages to what's available in the repository. This is sometimes needed when packages are moved from a git version to a stable release.

$ apk upgrade -a

The repositories are stored in /etc/apk/repositories as one repository url per line. There's also /etc/apk/world which is a list of packages that are explicitly installed. It's possible to add/remove packages from this list and then running apk fix to apply those changes.

Service management

The service manager in postmarketOS is openrc. The basic service management is done with the familiar service command.

$ service networkmanager status
$ service networkmanager start
$ service networkmanager stop
$ service networkmanager restart

To enable or disable services on boot you use the rc-update command.

List the services that are added to a runlevel
$ rc-update
             bootmisc | boot                                   
              chronyd |      default                           
                 dbus |      default                           
                devfs |                                 sysinit
                dmesg |                                 sysinit
                  gdm |      default                           
              haveged |      default                           
             hostname | boot                                   
              hwclock | boot                                   
            killprocs |                        shutdown        

Start NetworkManager on boot (in the default runlevel)
$ rc-update add networkmanager default

Stop NetworkManager starting on boot
$ rc-update del networkmanager default