← 返回命令列表

Linux command

u2d 命令

文件

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

常用示例

Convert a file

u2d [path/to/file]

Convert multiple files

u2d [file1] [file2] [file3]

Convert and preserve modification date

u2d -k [path/to/file]

Convert only if file appears to be text

u2d -s [path/to/file]

Convert and write to a new file

u2d -n [input_file] [output_file]

说明

u2d (Unix to DOS) converts text files from Unix-style line endings to DOS/Windows-style line endings. Unix files use a single line feed character (LF, \n) for line breaks, while DOS/Windows files use a carriage return followed by a line feed (CRLF, \r\n). The command is typically a symbolic link or alias to unix2dos. It processes files in place by default, replacing the original file with the converted version. Multiple files can be specified on the command line for batch conversion. This conversion is necessary when transferring text files between Unix/Linux and Windows systems, as many Windows applications expect CRLF line endings and may display or process files incorrectly if they contain only LF terminators.

参数

-k, --keepdate
Keep the original modification date of the file after conversion.
-o, --oldfile
Convert file in place, overwriting the original. This is the default behavior.
-n, --newfile _infile_ _outfile_
Write converted output to a new file instead of modifying the original.
-s, --safe
Skip conversion of binary files to prevent corruption.
-q, --quiet
Quiet mode. Suppress informational messages.
-V, --version
Display version information.
-h, --help
Display help message.

FAQ

What is the u2d command used for?

u2d (Unix to DOS) converts text files from Unix-style line endings to DOS/Windows-style line endings. Unix files use a single line feed character (LF, \n) for line breaks, while DOS/Windows files use a carriage return followed by a line feed (CRLF, \r\n). The command is typically a symbolic link or alias to unix2dos. It processes files in place by default, replacing the original file with the converted version. Multiple files can be specified on the command line for batch conversion. This conversion is necessary when transferring text files between Unix/Linux and Windows systems, as many Windows applications expect CRLF line endings and may display or process files incorrectly if they contain only LF terminators.

How do I run a basic u2d example?

Run `u2d [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -k, --keepdate do in u2d?

Keep the original modification date of the file after conversion.