How To Install mksh on Debian 9
Introduction
In this tutorial we learn how to install mksh
on Debian 9.
What is mksh
mksh is:
mksh is the successor of the Public Domain Korn shell (pdksh), a Bourne/POSIX compatible shell which is largely similar to the original AT&T Korn Shell (ksh88/ksh93). It includes bug fixes and feature improvements, in order to produce a modern, robust shell good for interactive and especially script use. mksh has UTF-8 support (in string operations and the Emacs editing mode). The code has been cleaned up and simplified, bugs fixed, standards compliance added, and several enhancements (for extended compatibility to other modern shells, as well as a couple of its own) are available. This shell is Debian Policy 10.4 compliant and works as /bin/sh on Debian systems (use the /bin/lksh executable) and is a good rescue and initrd shell (consider the /bin/mksh-static executable).
The mksh binary is a complete, full-featured shell. It provides a ??consistent across all platforms?? guarantee, using 32-bit integers for arithmetics, possibly deviating from POSIX.
The mksh-static binary is a version of mksh, linked against klibc, musl, or dietlibc (if they exist for that Debian architecture and are usable) and optimised for small code size, for example for use on initrd or initramfs images, installation or rescue systems. Except for omitting some features to be smaller, it is similar to the mksh binary otherwise. Note the exact feature set may differ depending on which C library was used to compile it.
The lksh binary is a script shell based on mksh intended to run old ksh88 and pdksh scripts, but not for interactive use. When used as /bin/sh it follows POSIX most closely, including use of the host??s ??long?? C data type for arithmetics. It also contains kludges so it can run as /bin/sh on Debian beyond what Policy dictates, to work around bugs in maintainer scripts and LSB init scripts shipped by many packages, such as including a rudimentary printf(1) builtin, permitting a shell function to be named stop overriding the default alias, more loose interpretation of shell extglobs, etc.
A sample ~/.mkshrc is included in /usr/share/doc/mksh/examples and provided as /etc/mkshrc conffile, which is sourced by another file /etc/skel/.mkshrc users are recommended to copy into their home.
There are three methods to install mksh
on Debian 9. We can use apt-get
, apt
and aptitude
. In the following sections we will describe each method. You can choose one of them.
Install mksh Using apt-get
Update apt database with apt-get
using the following command.
sudo apt-get update
After updating apt database, We can install mksh
using apt-get
by running the following command:
sudo apt-get -y install mksh
Install mksh Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install mksh
using apt
by running the following command:
sudo apt -y install mksh
Install mksh Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude
using the following command.
sudo aptitude update
After updating apt database, We can install mksh
using aptitude
by running the following command:
sudo aptitude -y install mksh
How To Uninstall mksh on Debian 9
To uninstall only the mksh
package we can use the following command:
sudo apt-get remove mksh
Uninstall mksh And Its Dependencies
To uninstall mksh
and its dependencies that are no longer needed by Debian 9, we can use the command below:
sudo apt-get -y autoremove mksh
Remove mksh Configurations and Data
To remove mksh
configuration and data from Debian 9 we can use the following command:
sudo apt-get -y purge mksh
Remove mksh configuration, data, and all of its dependencies
We can use the following command to remove mksh
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge mksh
Dependencies
mksh have the following dependencies:
References
Summary
In this tutorial we learn how to install mksh
package on Debian 9 using different package management tools: apt
, apt-get
and aptitude
.