How To Install dos2unix on Debian 11

In this tutorial we learn how to install dos2unix on Debian 11. dos2unix is convert text file line endings between CRLF and LF

Introduction

In this tutorial we learn how to install dos2unix on Debian 11.

What is dos2unix

dos2unix is:

This package contains utilities dos2unix, unix2dos, mac2unix, unix2mac to convert the line endings of text files between UNIX (LF), DOS (CRLF) and Mac (CR) formats.

Text files under Windows and DOS typically have two ASCII characters at the end of each line: CR (carriage return) followed by LF (line feed). Older Macs used just CR, while UNIX uses just LF. While most modern editors can read all these formats, there may still be a need to convert files between them.

This is the classic utility developed in 1989.

There are three methods to install dos2unix on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install dos2unix Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install dos2unix using apt-get by running the following command:

sudo apt-get -y install dos2unix

Install dos2unix Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install dos2unix using apt by running the following command:

sudo apt -y install dos2unix

Install dos2unix 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 dos2unix using aptitude by running the following command:

sudo aptitude -y install dos2unix

How To Uninstall dos2unix on Debian 11

To uninstall only the dos2unix package we can use the following command:

sudo apt-get remove dos2unix

Uninstall dos2unix And Its Dependencies

To uninstall dos2unix and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove dos2unix

Remove dos2unix Configurations and Data

To remove dos2unix configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge dos2unix

Remove dos2unix configuration, data, and all of its dependencies

We can use the following command to remove dos2unix configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge dos2unix

Dependencies

dos2unix have the following dependencies:

References

Summary

In this tutorial we learn how to install dos2unix package on Debian 11 using different package management tools: apt, apt-get and aptitude.