How to get regular stuff working: Difference between revisions

From Alpine Linux
(1. Added internal link to 'BusyBox' 2. Added guidance that alias files could, with review, be adapted as .ashrc and sourced; gave internal link to 'Shell aliases'. 3. Unclear reference "{{Main|Change default shell}}" in subheading removed, offering internal link to "Change default shell" in text instead.)
m (→‎Filesystem support: link directly to overview)
 
(25 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Alpine Linux is built around [[Musl]] libc and [[BusyBox]]. This makes it small and very resource efficient. The utilities in BusyBox generally have fewer options and hence missing some extended functionality. This page explains how to get the regular utilities working as found in GNU/Linux distributions.
Alpine Linux is built around [[Musl| musl libc]] and [[BusyBox]] and software packages are thinned out and split into [[#Subpackages and missing functionality|subpackages]]. This makes it small and very resource efficient. The [[BusyBox#BusyBox applets|utilities in BusyBox]] tend to only implement standard options and lack GNU-specific extensions. This page explains how to get the utilities typically found in GNU/Linux distributions.
 
Many utilities on this page are provided either by a package containing multiple collected utilities, or through a meta package. The [[Alpine Package Keeper|apk info]] command and its various flags (<code>--provides</code>, <code>--depends</code>, <code>--who-owns</code>, etc) is useful for determining exactly what is provided by what.


== Core utilities ==
== Core utilities ==
{{Main|GNU core utilities}}
{{Main|GNU core utilities}}


Most of the basic file, shell and text manipulation utilities commonly grouped under [https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands Core Utilities] are provided by [[BusyBox]]. To replace it with original {{pkg|coreutils}} package:{{Cmd|# apk add {{pkg|coreutils}}}}
Most of the basic file, shell and text manipulation utilities commonly grouped under [https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands core utilities] are provided by [[BusyBox]]. To replace it with GNU {{pkg|coreutils}} package:{{Cmd|# apk add {{pkg|coreutils}}}}
 
== Linux utilities ==
 
A set of approximately 100 basic Linux system utilities not included in the GNU core utilities, such as <code>mount</code>, <code>cfdisk</code>, <code>more</code>, <code>lsblk</code> and <code>kill</code> are maintained under [https://en.wikipedia.org/wiki/Util-linux util-linux]. The {{pkg|util-linux}} package is split into multiple subpackages (see below), so it is possible to install only some of them individually. To have the complete {{pkg|util-linux}} package:{{Cmd|# apk add {{pkg|util-linux}}}}


== Util-linux ==
The standard file pager <code>less</code> is not actually provided by {{pkg|coreutils}} or {{pkg|util-linux}}, but rather by the standalone package {{pkg|less}}.


A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as <code>mount</code>, <code>cfdisk</code>, <code>more</code>, <code>lsblk</code> and <code>kill</code> are maintained under [https://en.wikipedia.org/wiki/Util-linux Util-linux]. The {{pkg|util-linux}} package is split into multiple subpackages, so it is possible to install only some of them individually. To have the complete {{pkg|util-linux}} package:{{Cmd|# apk add {{pkg|util-linux}}}}
== Subpackages and missing functionality  ==


The full featured file pager utility <code>less</code> can be installed from the {{pkg|less}} package.
When a package is installed in Alpine Linux, no assumption is made as to what features the user wants, so [[Alpine_Package_Keeper#Subpackages|subpackages]] are not installed by default. As such, the user might get a false impression of missing functionality.


== Search utilities  ==
For example, the {{pkg|networkmanager}} package for [[NetworkManager]] has 20+ subpackages based on features. If the user installs the {{pkg|networkmanager}} package, ''only'' the NetworkManager utility will get installed. To manage Wi-Fi networks, use commands like <code>nmcli</code> and <code>nmtui</code>, or launch the GTK applet, the user is expected to add the required subpackages {{pkg|networkmanager-wifi}}, {{pkg|networkmanager-cli}}, {{pkg|networkmanager-tui}}, and {{pkg|network-manager-applet}} respectively.


Standard search tools <code>grep</code> and <code>find</code> can be installed by installing the packages {{pkg|grep}} and {{pkg|findutils}} as follows:{{Cmd|# apk add  {{pkg|grep}} {{pkg|findutils}} }}
This is in contrast to many other Linux distributions, where when NetworkManager is installed all the above functionality plus that of {{pkg|networkmanager-bluetooth}}, {{pkg|networkmanager-adsl}}, {{pkg|networkmanager-wwan}}, {{pkg|networkmanager-openvpn}}, {{pkg|networkmanager-l2tp}}, {{pkg|networkmanager-ppp}}, and the like are automatically installed, along with their dependencies.


== Bash shell ==  
== Search utilities  ==


The default shell used by Alpine Linux is the [[BusyBox|busybox]] variant of the [[BusyBox#Ash_shell|ash shell]]. Its syntax is comparable to {{pkg|bash}};  one's <code>~/.bashrc</code> file (or, alternatively, a different shell alias file) could be considered as a basis, say, for an <code>~/.ashrc</code> file, reviewing it carefully for syntax/cli variants against that of busybox, and [[BusyBox#Ash_shell|configured to be sourced]] for busybox shells.
The standard search tools <code>find</code> and <code>xargs</code> are provided by the {{pkg|findutils}} package:{{Cmd|# apk add {{pkg|findutils}}}}


To install {{pkg|bash}} shell: {{Cmd|# apk add {{pkg|bash}} {{pkg|bash-completion}}}}
GNU Grep is available as the {{pkg|grep}} package. The {{pkg|ripgrep}} package is also available and provides <code>rg</code>.


The default shell [[Change_default_shell|could be changed]].
== Shell management ==
{{Main|Shell management}}
The default shell used by Alpine Linux is the Busybox variant of the [[Shell_management#Ash_shell|ash shell]]. This is a POSIX compliant shell. All popular shells are available in Alpine Linux and the [[Shell_management#Change_default_shell|default shell can be changed]], if desired.


== Hardware management ==
== Hardware management ==
Line 29: Line 37:


The packages {{pkg|hwdata-pci}} and {{pkg|hwdata-usb}} are dependencies for the above utilities and they are installed automatically. These packages can be removed once the hardware configuration has been completed.
The packages {{pkg|hwdata-pci}} and {{pkg|hwdata-usb}} are dependencies for the above utilities and they are installed automatically. These packages can be removed once the hardware configuration has been completed.
== Filesystem support ==
{{Main|Filesystems}}
Alpine supports [[Filesystems#Overview|a variety of filesystems]]. Support (and tooling) for them may be had through their various packages: {{pkg|dosfstools}}, {{pkg|exfatprogs}}, {{pkg|zfs}}, etc...


== Disk management ==
== Disk management ==
{{Main|File management}}
{{Main|File management}}
Managing disks including removable disks is much easier with udisks.{{Cmd|# apk add {{pkg|udisks2}}}} To see the mounted disks:{{Cmd|# udisksctl status}}
 
[[File management#Udisks|udisks]] and [[File management#GVfs|GVfs]] make managing (removable) disks much easier.
{{cmd|# apk add {{pkg|udisks2}} {{pkg|gvfs-fuse}}}}


== Network management ==
== Network management ==
Line 38: Line 53:
For network, you may want to install {{pkg|iproute2}}. {{Cmd|# apk add {{pkg|iproute2}}}}  
For network, you may want to install {{pkg|iproute2}}. {{Cmd|# apk add {{pkg|iproute2}}}}  


== Subpackages and missing functionality  ==
== Locale and key management ==
 
* [[Locale|Locales]], including keyboards, languages and date and time formats are typically configured with the [[Alpine_configuration_management_scripts#setup-alpine|setup-alpine]] and like scripts, and within desktop environment settings.
When a package is installed in Alpine Linux, no assumption is made on what features the user wants, so [[Alpine_Package_Keeper#Subpackages|subpackages]] are not installed by default. The user might get a false impression of missing functionality. Alpine Linux [https://pkgs.alpinelinux.org package database] page shows the list of available subpackages.
 
For eg: [[NetworkManager]], the standard network configuration tool is split into 20+ subpackages based on features. If the user installs {{pkg|networkmanager}} package or {{pkg|network-manager-applet}} only the NetworkManager utility and the applet will get installed. To manage Wifi networks or to use commands like <Code>nmcli</Code> and <Code>nmtui</Code> the user is expected to add the required subpackages {{pkg|networkmanager-wifi}}, {{pkg|networkmanager-cli}} and {{pkg|networkmanager-tui}} respectively.  


In other Linux distributions when NetworkManager is installed, all the above features plus bluetooth, adsl, wwan, vpn, l2tp, ppp etc are automatically installed along with their dependencies.
* Consult the [[Compose_key|Compose Key]] wikipage to create foreign currency symbols, accents and diacritics, endashes (–) and emdashes (—), etc.


== Development environment ==
== Development environment ==
{{Main|Developer_Documentation}}
{{Main|Developer Documentation}}
Compiling in Alpine Linux may be more challenging because it uses [Musl] instead of glibc. The {{pkg|build-base}} meta package provides regular compiler stuff such as {{pkg|binutils}}, {{pkg|gcc}}, {{pkg|g++}}, {{pkg|make}} etc..
Compiling codebases in Alpine Linux may be more challenging because it uses [[Musl|musl instead of glibc]]. The {{pkg|build-base}} meta package provides regular compiler stuff such as {{pkg|binutils}} (providing <code>ld</code>, <code>objdump</code>, <code>readelf</code>, etc...), {{pkg|gcc}}, {{pkg|g++}}, {{pkg|make}}, etc...


{{Cmd|# apk add {{pkg|build-base}}}}
{{Cmd|# apk add {{pkg|build-base}}}}


The {{pkg|alpine-sdk}} meta package is provided to build packages for Alpine Linux. It includes {{pkg|abuild}}, {{pkg|build-base}}, and {{pkg|git}}.
The {{pkg|alpine-sdk}} meta package is provided to build packages for Alpine Linux. It includes {{pkg|abuild}}, {{pkg|build-base}}, and {{pkg|git}}.


{{Cmd|# apk add {{pkg|alpine-sdk}}}}
{{Cmd|# apk add {{pkg|alpine-sdk}}}}


To install CMake:
{{pkg|cmake}} may be desirable to have installed.


{{Cmd|# apk add {{pkg|cmake}} {{pkg|extra-cmake-modules}}}}
{{Cmd|# apk add {{pkg|cmake}} {{pkg|extra-cmake-modules}}}}
Line 63: Line 75:


[[Category:Installation]]
[[Category:Installation]]
[[category: System Administration]]
[[Category:System Administration]]

Latest revision as of 03:27, 12 April 2026

Alpine Linux is built around musl libc and BusyBox and software packages are thinned out and split into subpackages. This makes it small and very resource efficient. The utilities in BusyBox tend to only implement standard options and lack GNU-specific extensions. This page explains how to get the utilities typically found in GNU/Linux distributions.

Many utilities on this page are provided either by a package containing multiple collected utilities, or through a meta package. The apk info command and its various flags (--provides, --depends, --who-owns, etc) is useful for determining exactly what is provided by what.

Core utilities

Most of the basic file, shell and text manipulation utilities commonly grouped under core utilities are provided by BusyBox. To replace it with GNU coreutils package:

# apk add coreutils

Linux utilities

A set of approximately 100 basic Linux system utilities not included in the GNU core utilities, such as mount, cfdisk, more, lsblk and kill are maintained under util-linux. The util-linux package is split into multiple subpackages (see below), so it is possible to install only some of them individually. To have the complete util-linux package:

# apk add util-linux

The standard file pager less is not actually provided by coreutils or util-linux, but rather by the standalone package less.

Subpackages and missing functionality

When a package is installed in Alpine Linux, no assumption is made as to what features the user wants, so subpackages are not installed by default. As such, the user might get a false impression of missing functionality.

For example, the networkmanager package for NetworkManager has 20+ subpackages based on features. If the user installs the networkmanager package, only the NetworkManager utility will get installed. To manage Wi-Fi networks, use commands like nmcli and nmtui, or launch the GTK applet, the user is expected to add the required subpackages networkmanager-wifi, networkmanager-cli, networkmanager-tui, and network-manager-applet respectively.

This is in contrast to many other Linux distributions, where when NetworkManager is installed all the above functionality plus that of networkmanager-bluetooth, networkmanager-adsl, networkmanager-wwan, networkmanager-openvpn, networkmanager-l2tp, networkmanager-ppp, and the like are automatically installed, along with their dependencies.

Search utilities

The standard search tools find and xargs are provided by the findutils package:

# apk add findutils

GNU Grep is available as the grep package. The ripgrep package is also available and provides rg.

Shell management

The default shell used by Alpine Linux is the Busybox variant of the ash shell. This is a POSIX compliant shell. All popular shells are available in Alpine Linux and the default shell can be changed, if desired.

Hardware management

Install pciutils and usbutils for identifying and configuring PCI and USB hardware using the full featured version of lspci and lsusb commands respectively.

# apk add pciutils usbutils

The packages hwdata-pci and hwdata-usb are dependencies for the above utilities and they are installed automatically. These packages can be removed once the hardware configuration has been completed.

Filesystem support

Alpine supports a variety of filesystems. Support (and tooling) for them may be had through their various packages: dosfstools, exfatprogs, zfs, etc...

Disk management

udisks and GVfs make managing (removable) disks much easier.

# apk add udisks2 gvfs-fuse

Network management

For network, you may want to install iproute2.

# apk add iproute2

Locale and key management

  • Locales, including keyboards, languages and date and time formats are typically configured with the setup-alpine and like scripts, and within desktop environment settings.
  • Consult the Compose Key wikipage to create foreign currency symbols, accents and diacritics, endashes (–) and emdashes (—), etc.

Development environment

Compiling codebases in Alpine Linux may be more challenging because it uses musl instead of glibc. The build-base meta package provides regular compiler stuff such as binutils (providing ld, objdump, readelf, etc...), gcc, g++, make, etc...

# apk add build-base

The alpine-sdk meta package is provided to build packages for Alpine Linux. It includes abuild, build-base, and git.

# apk add alpine-sdk

cmake may be desirable to have installed.

# apk add cmake extra-cmake-modules

ccache and a lot other tools are also available in Alpine Linux.