How To Install flex on Kali Linux
Introduction
In this tutorial we learn how to install flex on Kali Linux.
What is flex
flex is:
Flex is a tool for generating scanners: programs which recognized lexical patterns in text. It reads the given input files for a description of a scanner to generate. The description is in the form of pairs of regular expressions and C code, called rules. Flex generates as output a C source file, lex.yy.c, which defines a routine yylex(). This file is compiled and linked with the -lfl library to produce an executable. When the executable is run, it analyzes its input for occurrences of the regular expressions. Whenever it finds one, it executes the corresponding C code.
There are three methods to install flex 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 flex Using apt-get
Update apt database with apt-get using the following command.
sudo apt-get updateAfter updating apt database, We can install flex using apt-get by running the following command:
sudo apt-get -y install flexInstall flex Using apt
Update apt database with apt using the following command.
sudo apt updateAfter updating apt database, We can install flex using apt by running the following command:
sudo apt -y install flexInstall flex 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 updateAfter updating apt database, We can install flex using aptitude by running the following command:
sudo aptitude -y install flexHow To Uninstall flex on Kali Linux
To uninstall only the flex package we can use the following command:
sudo apt-get remove flexUninstall flex And Its Dependencies
To uninstall flex and its dependencies that are no longer needed by Kali Linux, we can use the command below:
sudo apt-get -y autoremove flexRemove flex Configurations and Data
To remove flex configuration and data from Kali Linux we can use the following command:
sudo apt-get -y purge flexRemove flex configuration, data, and all of its dependencies
We can use the following command to remove flex configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge flexDependencies
flex have the following dependencies:
References
Summary
In this tutorial we learn how to install flex package on Kali Linux using different package management tools: apt, apt-get and aptitude.