TOC
chapter |
---|
OPTIONS |
ADD |
DEL |
System maintenance |
FIX |
UPDATE |
UPGRADE |
CACHE |
Querying information about packages |
INFO |
LIST |
SEARCH |
STATS |
DOT |
POLICY |
Repository maintenance |
INDEX |
FETCH |
VERIFY |
MANIFEST |
RC |
RC-STATUS |
RC-UPDATE |
RC-SERVICE |
OPTIONS
Global options
-h, --help # Show generic help or applet specific help
-p, --root DIR # Install packages to DIR
-X, --repository REPO # Use packages from REPO
-q, --quiet # Print less information
-v, --verbose # Print more information (can be doubled)
-i, --interactive # Ask confirmation for certain operations
-V, --version # Print program version and exit
-f, --force # Enable selected --force-* (deprecated)
--force-binary-stdout # Continue even if binary data is to be output
--force-broken-world # Continue even if 'world' cannot be satisfied
--force-non-repository # Continue even if packages may be lost on reboot
--force-old-apk # Continue even if packages use unsupported features
--force-overwrite # Overwrite files in other packages
--force-refresh # Do not use cached files (local or from proxy)
-U, --update-cache # Alias for --cache-max-age 1
--progress # Show a progress bar
--progress-fd FD # Write progress to fd
--no-progress # Disable progress bar even for TTYs
--purge # Delete also modified configuration files (pkg removal) and uninstalled packages from cache (cache clean)
--allow-untrusted # Install packages with untrusted signature or no signature
--wait TIME # Wait for TIME seconds to get an exclusive repository lock before failing
--keys-dir KEYSDIR # Override directory of trusted keys
--repositories-file # REPOFILE Override repositories file
--no-network # Do not use network (cache is still used)
--no-cache # Do not use any local cache path
--cache-dir CACHEDIR # Override cache directory
--cache-max-age AGE # Maximum AGE (in minutes) for index in cache before refresh
--arch ARCH # Use architecture with --root
--print-arch # Print default arch and exit
Commit options
-s, --simulate # Show what would be done without actually doing it
--clean-protected # Do not create .apk-new files in configuration dirs
--overlay-from-stdin # Read list of overlay files from stdin
--no-scripts # Do not execute any scripts
--no-commit-hooks # Skip pre/post hook scripts (but not other scripts)
--initramfs-diskless-boot # Enables options for diskless initramfs boot
ADD
Add PACKAGEs to 'world' and install (or upgrade) them, while ensuring that all dependencies are met
apk add [OPTIONS...] PACKAGE...
--initdb # Initialize database
-u, --upgrade # Prefer to upgrade package
-l, --latest # Select latest version of package (if it is not pinned), and print error if it cannot be installed due to other dependencies
-t, --virtual NAME # Instead of adding all the packages to 'world', create a new virtual package with the listed dependencies and add that to 'world'; the actions of the command are easily reverted by deleting the virtual package
examples
apk add $pkg=$version # install and fix package $pkg in version $version. ex: apk add bash=5.0.0-r0
apk add $pkg=~$major_version # install and fix package $pkg in major version $major_version. ex: apk add bash=~5.0
apk add $pkg=$version # install version $version of package $pkg & remove version holding. ex: apk add bash>5.0.0-r0
apk add --allow-untrusted $path/$pkg.apk # install untrusted package from file
DEL
Remove PACKAGEs from 'world' and uninstall them
apk del [OPTIONS...] PACKAGE...
-r, --rdepends # Recursively delete all top-level reverse dependencies too
FIX
Repair package or upgrade it without modifying main dependencies
apk fix [OPTIONS...] PACKAGE...
-d, --depends # Fix all dependencies too
-r, --reinstall # Reinstall the package (default)
-u, --upgrade # Prefer to upgrade package
-x, --xattr # Fix packages with broken xattrs
--directory-permissions # Reset all directory permissions
UPDATE
Update repository indexes from all remote repositories
apk update
UPGRADE
Upgrade currently installed packages to match repositories
apk fix [OPTIONS...]
-a, --available # Resets versioned world dependencies, and changes to prefer replacing or downgrading packages (instead of holding them) if the currently installed package is no longer available from any repository
-l, --latest # Select latest version of package (if it is not pinned), and print error if it cannot be installed due to other dependencies
--no-self-upgrade # Do not do early upgrade of 'apk-tools' package
--self-upgrade-only # Only do self-upgrade
CACHE
Download missing PACKAGEs to cache and/or delete unneeded files from cache
apk cache [OPTIONS...] sync | clean | download
-u, --upgrade # Prefer to upgrade package
-l, --latest # Select latest version of package (if it is not pinned), and print error if it cannot be installed due to other dependencies
examples
apk cache -v sync # clean cache & download missing packages
INFO
Give detailed information about PACKAGEs or repositories
apk info [OPTIONS...] PACKAGE...
-L, --contents # List contents of the PACKAGE
-e, --installed # Check if PACKAGE is installed
-W, --who-owns # Print the package owning the specified file
-R, --depends # List packages that the PACKAGE depends on
-P, --provides # List virtual packages provided by PACKAGE
-r, --rdepends # List all packages depending on PACKAGE
--replaces # List packages whom files PACKAGE might replace
-i, --install-if # List the PACKAGE's install_if rule
-I, --rinstall-if # List all packages having install_if referencing PACKAGE
-w, --webpage # Show URL for more information about PACKAGE
-s, --size # Show installed size of PACKAGE
-d, --description # Print description for PACKAGE
--license # Print license for PACKAGE
-t, --triggers # Print active triggers of PACKAGE
-a, --all # Print all information about PACKAGE
LIST
List packages by PATTERN and other criteria
apk list [OPTIONS...] PATTERN
-I, --installed # List installed packages only
-O, --orphaned # List orphaned packages only
-a, --available # List available packages only
-u, --upgradable # List upgradable packages only
-o, --origin # List packages by origin
-d, --depends # List packages by dependency
-P, --providers # List packages by provider
SEARCH
Search package by PATTERNs or by indexed dependencies
apk search [OPTIONS...] PATTERN
-a, --all # Show all package versions (instead of latest only)
-d, --description # Search package descriptions (implies -a)
-x, --exact # Require exact match (instead of substring match)
-e # Synonym for -x (deprecated)
-o, --origin # Print origin package name instead of the subpackage
-r, --rdepends # Print reverse dependencies of package
--has-origin # List packages that have the given origin
STATS
Show statistics about repositories and installations
apk stats
examples
apk stats # Show statistics about repositories and installations
DOT
Generate graphviz graphs
apk dot [OPTIONS...] PKGMASK...
--errors # Output only parts of the graph which are considered erroneous: e.g. cycles and missing packages
--installed # Consider only installed packages
POLICY
Show repository policy for packages
apk policy
INDEX
Create repository index file from FILEs
apk index [OPTIONS...] FILE...
-o, --output FILE # Write the generated index to FILE
-x, --index INDEX # Read INDEX to speed up new index creation by reusing the information from an old index
-d, --description TEXT # Embed TEXT as description and version information of the repository index
--rewrite-arch ARCH # Use ARCH as architecture for all packages
FETCH
Download PACKAGEs from global repositories to a local directory
apk fetch [OPTIONS...] PACKAGE...
-L, --link # Create hard links if possible
-R, --recursive # Fetch the PACKAGE and all its dependencies
--simulate # Show what would be done without actually doing it
-s, --stdout # Dump the .apk to stdout (incompatible with -o, -R, --progress)
-o, --output DIR # Directory to place the PACKAGEs to
VERIFY
Verify package integrity and signature
apk verify FILE...
MANIFEST
Show checksums of package contents
apk manifest PACKAGE...
RC-STATUS
run-level
- boot – Generally the only services you should add to the boot runlevel are those which deal with the mounting of filesystems, set the initial state of attached peripherals and logging. Hotplugged services are added to the boot runlevel by the system. All services in the boot and sysinit runlevels are automatically included in all other runlevels except for those listed here
- single – Stops all services except for those in the sysinit runlevel
- reboot – Changes to the shutdown runlevel and then reboots the host
- shutdown – Changes to the shutdown runlevel and then halts the host
- default – Used if no runlevel is specified. (This is generally the runlevel you want to add services to.)
rc-status
rc-status # show services attached to actual run-level
rc-status boot # show services attached to run-level 'boot'
-l --list # Show list of run levels
-a --all # Show services from all run levels
-s --servicelist # Show service list
-m, --manual # show manually started services
-u, --unused # show services not assigned to any runlevel
-c, --crashed # show crashed services
-S, --supervised # show supervised services
RC-UPDATE
rc-update
rc-update show {run-level} # show services attached to a run-level
rc-update add {service} {run-level} # attach service to a run-level
rc-update del {service} {run-level} # dettach service to a run-level
rc
rc $runlevel # change run-level to $runlevel
RC-SERVICE
rc-service
rc-service {service} start # start service
rc-service {service} stop # stop service
rc-service {service} restart # restart service
-e, --exists <arg> # tests if the service exists or not
-c, --ifcrashed # if the service is crashed run the command
-i, --ifexists # if the service exists run the command
-I, --ifinactive # if the service is inactive run the command
-N, --ifnotstarted # if the service is not started run the command
-s, --ifstarted # if the service is started run the command
-S, --ifstopped # if the service is stopped run the command
-l, --list # list all available services
-r, --resolve <arg> # resolve the service name to an init script
-Z, --dry-run # dry run (show what would happen)
-q, --quiet # run quietly (repeat to suppress errors)