← 返回命令列表

Linux command

nkf 命令

文本

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Convert to UTF-8

nkf -w [input.txt] > [output.txt]

Convert to Shift-JIS

nkf -s [input.txt] > [output.txt]

Convert to EUC-JP

nkf -e [input.txt] > [output.txt]

Auto detect and convert

nkf -w --guess [input.txt]

Convert in place

nkf -w --overwrite [file.txt]

Show input encoding

nkf --guess [file.txt]

说明

nkf (Network Kanji Filter) converts Japanese text encodings. Handles UTF-8, Shift-JIS, EUC-JP. The tool auto-detects encodings. Essential for Japanese text processing.

参数

-w
Convert to UTF-8.
-s
Convert to Shift-JIS.
-e
Convert to EUC-JP.
--guess
Detect encoding.
--overwrite
Modify file in place.
--help
Display help information.

FAQ

What is the nkf command used for?

nkf (Network Kanji Filter) converts Japanese text encodings. Handles UTF-8, Shift-JIS, EUC-JP. The tool auto-detects encodings. Essential for Japanese text processing.

How do I run a basic nkf example?

Run `nkf -w [input.txt] > [output.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -w do in nkf?

Convert to UTF-8.