Installing Missing Packages the Easy Way on Linux
This is a quick tip to making the installation of missing packages in certain Linux flavors easier.
Many Linux distributions come with a program called command-not-found
pre-installed (e.g., Ubuntu or Debian), that helps to discover missing packages. Say you just freshly installed Linux and type hg status
in a shell. Because hg
is not installed yet, you instead see the following:
Now this very useful, especially when the package has a different name from the command you are trying to run (like with mercurial). But why do I have to type (or copy) that message if I want to install the package? Turns out, there is an environment variable which when set, asks to install the package directly, like this:
Entering y
will install the package. Very convenient. To enable this feature, add the following line to ~/.bashrc
(or ~/.zshrc
, or wherever your shell initialization is):
Life just got so much better!
Questions or comments? Send me an email or find me on twitter @stefan_heule.