
Introduction
In this tutorial we learn how to install direnv on Kali Linux.
What is direnv
direnv is:
direnv is an environment variable manager for your shell. It knows
how to hook into bash, zsh and fish shell to load or unload
environment variables depending on your current directory. This
allows one to have project-specific environment variables and not
clutter the “~/.profile” file.
Before each prompt it checks for the existence of an “.envrc” file in
the current and parent directories. If the file exists, it is loaded
into a bash sub-shell and all exported variables are then captured by
direnv and then made available to your shell.
Because direnv is compiled into a single static executable it is fast
enough to be unnoticeable on each prompt. It is also language
agnostic and can be used to build solutions similar to rbenv, pyenv,
phpenv, …
There are three methods to install direnv on Kali Linux. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.
Install direnv Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get update
After updating apt database, We can install direnv using apt-get by running the following command:
sudo apt-get -y install direnv
Install direnv Using apt
Update apt database with apt using the following command.
sudo apt update
After updating apt database, We can install direnv using apt by running the following command:
sudo apt -y install direnv
Install direnv Using aptitude
If you want to follow this method, you might need to install aptitude on Kali Linux first since aptitude is usually not installed by default on Kali Linux. Update apt database with aptitude using the following command.
sudo aptitude update
After updating apt database, We can install direnv using aptitude by running the following command:
sudo aptitude -y install direnv
How To Uninstall direnv on Kali Linux
To uninstall only the direnv package we can use the following command:
sudo apt-get remove direnv
Uninstall direnv And Its Dependencies
To uninstall direnv and its dependencies that are no longer needed by Kali Linux, we can use the command below:
sudo apt-get -y autoremove direnv
Remove direnv Configurations and Data
To remove direnv configuration and data from Kali Linux we can use the following command:
sudo apt-get -y purge direnv
Remove direnv configuration, data, and all of its dependencies
We can use the following command to remove direnv configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge direnv
Dependencies
direnv have the following dependencies:
References
Summary
In this tutorial we learn how to install direnv package on Kali Linux using different package management tools: apt, apt-get and aptitude.
