Forrest logo
tool overview
On this page you find all important commands for the CLI tool dos2unix. If the command you are looking for is missing please ask our AI.

dos2unix

Dos2unix is a commonly used command line tool for converting text files between different line endings formats, specifically the DOS/Windows format (CR+LF) and the Unix/Linux format (LF). The tool recognizes the differences between these formats and allows for efficient conversion.

The primary purpose of dos2unix is to remove the extra carriage return (CR) characters added at the end of each line in DOS/Windows files, so they are compatible with Unix/Linux systems. This conversion ensures proper line endings when transferring files between these platforms.

On Unix-like operating systems, dos2unix is often a built-in tool that comes pre-installed, making it readily available for use. On Windows, it can be downloaded and installed as a standalone executable.

Dos2unix can be executed from the command line by providing the necessary arguments to specify the input file(s) and output file(s), allowing for batch processing of multiple files at once.

The tool also supports options for preserving file attributes, applying recursive conversion on directories, handling binary files, and displaying verbose information during the conversion process.

Dos2unix is lightweight, efficient, and widely used in scripting scenarios, build processes, and file conversions for compatibility purposes.

In addition to converting DOS/Windows files to Unix/Linux format, dos2unix also supports the reverse conversion, i.e., converting Unix/Linux files to DOS/Windows format.

The command line interface of dos2unix allows for easy integration with other tools and automation scripts, making it a valuable tool for system administrators, developers, and anyone working with cross-platform file operations.

Dos2unix is open source software, available under the GNU General Public License, and has been actively maintained and improved over the years.

List of commands for dos2unix:

  • dos2unix:tldr:03d47 dos2unix: Change the line endings of a file.
    $ dos2unix ${filename}
    try on your machine
    explain this command
  • dos2unix:tldr:cebf3 dos2unix: Create a copy with Unix-style line endings.
    $ dos2unix -n ${filename} ${new_filename}
    try on your machine
    explain this command
tool overview