Several command-line tools can replicate nkf (Network Kanji Filter) functionality on Linux. Here are the most capable alternatives: # Top Alternatives 1. iconv (Most Universal) Part of glibc/libc6, available on virtually all Unix-like systems. ## Convert encoding iconv -f SHIFT_JIS -t UTF-8 input.txt > output.txt ## Convert to EUC-JP iconv -f UTF-8 -t EUC-JP input.txt > output.txt ## Convert to ISO-2022-JP iconv -f UTF-8 -t ISO-2022-JP input.txt > output.txt Pros: Preinstalled on most systems, handles major Japanese encodings Cons: No auto-detection, limited MIME handling 2. recode (Most Feature-Rich) Versatile for charset and line-ending conversions. # Convert file encoding recode Shift_JIS..UTF-8 input.txt # Convert line endings recode LF..CRLF input.txt # UNIX to Windows # Convert multiple formats recode ISO-2022-JP..UTF-8 input.txt Pros: Handles both encoding AND line-endings in one command Cons: May need installation (sudo apt install recode) 3. uconv (ICU Suite - Most Powerful) From the International Components for Unicode library. # Convert with explicit encoding uconv -f SHIFT_JIS -t UTF-8 input.txt > output.txt # Auto-detect and convert (some versions) uconv -x any-ascii input.txt Pros: High performance, extensive Unicode support, handles BOM Cons: Requires icu package installation 4. enca (Best for Auto-Detection) Exremely Charset Analyzer-detects encoding automatically. # Detect encoding first enca -l ja input.txt # Convert assuming detected encoding enca -L none -x UTF-8 input.txt Pros: Excellent auto-detection for Japanese text Cons: Primarily detection-focused, conversion may need pairing with other tools 5. convmv (For File Renaming) Changes file names while converting encoding. # Preview changes convmv --list -r --notest . # Actually rename files convmv -r --notest -f SHIFT_JIS -t UTF-8 . Pros: Useful for batch renaming files with encoding issues Cons: Focused on filenames, not file contents Quick Comparison Table ToolAuto-DetectLine EndingsMIMEInstallationiconv[X][X][X]Built-inrecode[!]✅[!]Packageuconv[!]✅✅Packageenca✅[X][X]Packagenkf✅✅✅Package Recommended Workflow For most nkf use cases, I'd recommend: Simple encoding conversion: iconv (no install needed) Encoding + line endings: recode or pair iconv with to/from dos Auto-detection needed: enca + iconv combination Maximum feature parity: Install nkf itself (available in most repos) --- Replacements for Ghostscript & mutoolSince both are Artifex/ePapyrus-owned (AGPL), here are clean alternatives: Instead of Ghostscript: Tool License Owner Capabilities Poppler GPL-2.0/3.0 freedesktop.org (independent, community) PDF rendering, text extraction, page conversion PDFium BSD-3-Clause Google (open source, Chromium-derived) Rendering, viewing, printing Apache PDFBox Apache 2.0 Apache Foundation PDF creation, manipulation, rendering (Java) QPDF Apache 2.0 Independent (Jay Berkenbilt) Structural manipulation, splitting, merging Ghostscript Lite forks Various Community Some forks exist but less maintained Instead of mutool: Tool License Owner Capabilities poppler-utils GPL-2.0/3.0 freedesktop.org pdftotext, pdftoppm, pdftops, pdfinfo, pdfimages PDFium CLI tools BSD-3-ClauseGoogle/Chromium Rendering, rasterization QPDF Apache 2.0 Independent qpdf for structural ops (split, merge, linearize, decrypt) podofo LGPL Independent (SourceForge) PDF parsing, modification (C++ library) Poppler-utils is your closest drop-in replacement: #### Instead of: mutool draw -o page.png input.pdf pdftoppm -png input.pdf page # Instead of: mutool convert -o output.pdf input.ps pdftops input.ps output.pdf # (PS to PDF, limited) # Instead of: mutool show input.pdf trailer pdfinfo input.pdf # Instead of: mutool extract input.pdf pdfimages -all input.pdf extracted # Instead of: mutool clean input.pdf output.pdf qpdf --linearize input.pdf output.pdf If you need PostScript processing specifically: This is the one area where Ghostscript has no true peer. Poppler/PDFium handle PDF but not PostScript (.ps) files. If you work with PostScript: GNU Ghostscript fork - the pre-AGPL versions still exist (older GPL releases) GhostPDL Lite - limited community forks Or consider whether you even need PS anymore (most modern workflows are PDF-based) 🦀->🐝 Rust -> Zig Transition Tips Since you've already crossed over: zig build replaces cargo nicely-you'll love the build system Comptime replaces traits and proc macros (much cleaner) Allocator passing feels weird at first but is liberating No std::fmt hunting-std.fmt is right there, explicit Cross-compilation is a first-class citizen (no cross toolchain headaches!) One thing-since Poppler is C++, you might want to look at Zig's @cImport for C interop, or wrap it via a small C shim. Poppler also has glib bindings if that's easier to bind against. ```sh #!/bin/bash # convert_to_odt.sh for f in *.docx *.doc; do libreoffice --headless --convert-to odt "$f" 2>/dev/null || \ pandoc "$f" -o "${f%.*}.odt" done ``` # PDF -> TXT (direct) swift pdftext.swift input.pdf > temp.txt # TXT -> HTML textutil -convert html temp.txt -output output.html # TXT -> ODT textutil -convert odt temp.txt -output output.odt # TXT -> RTF textutil -convert rtf temp.txt -output output.rtf # TXT -> DOCX textutil -convert docx temp.txt -output output.docx # Manual extraction (since .docx is a ZIP archive) unzip -p file.docx word/document.xml | xmllint --format - # Or: ```sh unzip -p file.docx word/document.xml | sed 's/<[^>]*>//g' ``` # PDF -> HTML swift pdftext.swift input.pdf | textutil -convert html -stdin -stdout > output.html # Wait, textutil doesn't support stdin/stdout well. Do this instead: ```sh swift pdftext.swift input.pdf > /tmp/temp.txt \ && textutil -convert html /tmp/temp.txt -output output.html \ && rm /tmp/temp.txt ```