apk [options] command
apk [options] command pkgName
apk [options] command pkgName1 pkgName2
# apk update
apk search pkgName
例如:
#apk search htop
输出:
htop-doc-2.0.2-r0
htop-2.0.2-r0
#apk search -v -d 'htop'
htop-doc-2.0.2-r0 - An interactive process viewer (documentation)
htop-2.0.2-r0 - An interactive process viewer
显示结果:
htop-doc-2.0.2-r0 - An interactive process viewer (documentation)
htop-2.0.2-r0 - An interactive process viewer
#apk search -v
#apk search -v 'php7*'
句法:
#apk add pkgName
#apk add pkgName1 pkgName2
apk add htop
输出结果:
(1/1) Installing htop (2.0.2-r0)
Executing busybox-1.25.1-r0.trigger
OK: 39 MiB in 28 packages
#apk add apache2 php7-apache2 php7-gd php7-mysqli
#apk add --allow-untrusted /path/to/foo.apk
#apk del pkgName
#apk del pkgName1 pkgName2
apk del htop
(1/1) Purging htop (2.0.2-r0)
Executing busybox-1.25.1-r0.trigger
OK: 39 MiB in 27 packages
apk update && apk upgrade
echo "alias update='apk update && apk upgrade'" >> /.bashrc
# apk update
# apk add -u htop
# apk info
# apk info -vv | grep 'foo'
# apk info -vv | sort
# apk info --who-owns /etc/passwd
/etc/passwd is owned by alpine-baselayout-3.0.4-r0
# apk info --who-owns /sbin/apk
/sbin/apk is owned by apk-tools-2.6.8-r2
# apk -L info pkgName
# apk -L info htop
htop-2.0.2-r0 contains:
usr/bin/htop
usr/share/applications/htop.desktop
usr/share/pixmaps/htop.png
# apk -e info pkgName
#############################################
### find out if atop PACKAGE is installed ###
#############################################
# apk -e info atop
# apk -R info atop
atop-2.2_p3-r0 depends on:
so:libc.musl-x86_64.so.1
so:libncursesw.so.6
so:libz.so.1
# apk info -r pkgName
# apk info -r bash
bash-completion-2.4-r0
# apk info -s pkgName
# apk info -s atop
atop-2.2_p3-r0 installed size:
520192
# apk info -d pkgName
# apk info -d bash
bash-4.3.46-r5 description:
The GNU Bourne Again shell
# apk info -a pkgName
# apk info -a bash
apk info -a bash
bash-4.3.46-r5 description:
The GNU Bourne Again shell
bash-4.3.46-r5 webpage:
http://www.gnu.org/software/bash/bash.html
bash-4.3.46-r5 installed size:
700416
bash-4.3.46-r5 depends on:
busybox
so:libc.musl-x86_64.so.1
so:libncursesw.so.6
so:libreadline.so.6
bash-4.3.46-r5 provides:
bash-4.3.46-r5 is required by:
bash-completion-2.4-r0
bash-4.3.46-r5 contains:
bin/bashbug
bin/bash
bash-4.3.46-r5 triggers:
bash-4.3.46-r5 has auto-install rule:
bash-4.3.46-r5 affects auto-installation of:
bash-doc-4.3.46-r5
bash-4.3.46-r5 replaces:
bash-4.3.46-r5 license:
GPL3+
# apk stats
installed:
packages: 28
dirs: 163
files: 7097
bytes: 41205760
triggers: 1
available:
names: 11710
packages: 7961
atoms:
num: 5934
bash-4.3#
bash-4.3# apk stats
installed:
packages: 28
dirs: 163
files: 7097
bytes: 41205760
triggers: 1
available:
names: 11710
packages: 7961
atoms:
num: 5934
Command Usage xample
apk update Update the package list apk update
apk upgrade Upgrade the system apk update
apt ugrade
apk add pkg Add a package apk add apache
apk del pkg Delete a package apk del nginx
apk search -v Search for packages apk search -v
apk search -v -d ‘nginx*’
apk search -v ‘apache*’
apk info List all installed pacakges apk info
apk fix Repair package or upgrade it without modifying main
dependencies apk fix
apk policy pkg Show repository policy for packages apk policy bash
apk stats Show statistics about repositories and installations apk stats