LinuxCommandLibrary

crush

Compress data files

TLDR

Start interactive mode

$ crush
copy

Run with debug logging
$ crush [[-d|--debug]]
copy

Run with debug logging in a specific directory
$ crush [[-d|--debug]] [[-c|--cwd]] [path/to/project]
copy

Run a single non-interactive prompt
$ crush run "[Explain the use of context in Go]"
copy

Run in dangerous mode (auto-accept all permissions)
$ crush [[-y|--yolo]]
copy

Display version
$ crush [[-v|--version]]
copy

SYNOPSIS

crush [file …]

DESCRIPTION

crush is a lightweight Unix utility designed to filter out carriage return characters (ˆM or \r, ASCII 13) from text streams. It reads input from specified files or standard input and writes the processed output to standard output, effectively converting DOS/Windows CRLF line endings to Unix LF format.

This tool is particularly handy for cleaning up text files transferred between systems with differing line ending conventions, avoiding issues in editors, scripts, or diffs caused by extraneous \r characters. Unlike fuller-featured converters, crush performs only this single transformation—no encoding detection, tab expansion, or binary handling.

For example, piping through crush strips ^M from email headers, logs, or scripts. It processes files sequentially without modifying originals, making it safe for batch operations like crush *.txt > cleaned/. Combine with tools like sponge for in-place edits.

Though not part of core GNU/Linux distributions, source code is compact (often <100 lines C or Perl) and easily compiled or found in toolboxes.

CAVEATS

Outputs only to stdout; no in-place editing or overwrite flags. Treats input as text—may corrupt binary files. No error handling for permissions or empty files.

EXAMPLE

crush dosfile.txt > unixfile.txt
find . -name '*.txt' | xargs crush > all_clean.txt
cat messy.log | crush | sponge messy.log

ALTERNATIVES

Equivalent: tr -d '\r'
Full DOS/Unix: dos2unix

HISTORY

Developed by Rich Salz around 1992 as a simple "toolbox" utility. Distributed via early web pages and Usenet; persists in niche collections and ports despite equivalents in coreutils.

SEE ALSO

tr(1), dos2unix(1), col(1), sed(1)

Copied to clipboard