← 返回命令列表

Linux command

d2u 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Convert a file

d2u [file.txt]

Convert multiple files

d2u [file1.txt] [file2.txt] [file3.txt]

Convert and keep backup

d2u -b [file.txt]

Convert with custom backup

d2u -b -e [.bak] [file.txt]

Convert to a new file

d2u -n [input.txt] [output.txt]

Convert files in place

d2u -q [file.txt]

说明

d2u converts text files from DOS/Windows line endings (CRLF - Carriage Return + Line Feed) to Unix line endings (LF - Line Feed only). It is an alias or alternative name for the dos2unix utility. The tool modifies files in place by default, making it convenient for batch conversion. It automatically detects binary files and skips them unless forced. Multiple files can be processed in a single command. This conversion is commonly needed when transferring text files from Windows to Unix/Linux systems, or when working with files that have mixed line endings from version control systems.

参数

-b, --backup
Keep backup of original file.
-e _SUFFIX_, --extension _SUFFIX_
Backup file extension (default: .bak).
-n, --newfile _infile_ _outfile_
Convert infile and write to outfile (new file mode).
-q, --quiet
Quiet mode, suppress output.
-k, --keepdate
Preserve original file timestamp.
-f, --force
Force conversion even on binary files.
-l, --newline
Add an additional newline after each converted line break.
-o, --oldfile
In-place conversion mode (default).
-h, --help
Display help information.

FAQ

What is the d2u command used for?

d2u converts text files from DOS/Windows line endings (CRLF - Carriage Return + Line Feed) to Unix line endings (LF - Line Feed only). It is an alias or alternative name for the dos2unix utility. The tool modifies files in place by default, making it convenient for batch conversion. It automatically detects binary files and skips them unless forced. Multiple files can be processed in a single command. This conversion is commonly needed when transferring text files from Windows to Unix/Linux systems, or when working with files that have mixed line endings from version control systems.

How do I run a basic d2u example?

Run `d2u [file.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -b, --backup do in d2u?

Keep backup of original file.