dos2unix: command not found

dos2unix command converts files using the DOS extended character set to their ISO standard counterparts. If dosfile and unixfile are the same, the file is overwritten after the conversion is done.

dos2unix Command Options

Option Description
-cmode, –convmodemode Set the conversion mode to mode. Possible values are ASCII, 7bit ISO, and Mac. The default is ASCII.
-h,–help Print a command-line summary and exit.
-k, –keepdate Make the modification date of the output file be the same as that of the input file.
-ninfile outfile …, –newfileinfile outfile … New file mode. Filenames must be provided in pairs: the first one is the input file, the second is the output file.
-ofile…;–oldfilefile… Old file mode. Each input file in converted in place. This is the default.
-q, –quiet Do not print any warnings or messages.
-V, –version Print version information and exit.

If you encounter the below error while running dos2unix command:

dos2unix: command not found

you may try installing the dos2unix as shown below as per your choice of distribution:

Distribution Command
OS X brew install dos2unix
Debian apt-get install dos2unix
Ubuntu apt-get install dos2unix
Alpine apk add dos2unix
Arch Linux pacman -S dos2unix
Kali Linux apt-get install dos2unix
CentOS yum install dos2unix
Fedora dnf install dos2unix
Raspbian apt-get install dos2unix

dos2unix Command Examples

1. Change the line endings of a file:

$ dos2unix filename

2. Create a copy with Unix-style line endings:

$ dos2unix -n filename new_filename
Related Post