dos2unix command not found

In this troubleshooting guide we learn how to fix dos2unix command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

dos2unix: command not found

or when using sudo you get the following error message

sudo: dos2unix: command not found

Solutions to dos2unix: command not found

How To Fix dos2unix: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu dos2unix is provided by dos2unix package.

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.

To fix this problem, we can install more using the command below.

sudo apt-get -y install dos2unix

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install dos2unix.

sudo apt -y install dos2unix

Or if you have aptitude installed you can use the following command.

sudo aptitude install dos2unix

Summary

In this tutorial we learn how to fix dos2unix command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.