Remove all whitespaces in a file- Linux December 30, 2023 by Tarik Depending on your definition of whitespace, something like: tr -d ' \t\n\r\f' <inputFile >outputFile would do the trick.