Contents
iconv -f utf-8 -t ucs-4 < myfile >/dev/null # No error means utf-8 encoding # Error means NOT utf-8 encoding
Example
$ iconv -f utf-8 -t ucs-4 < utf8_file >/dev/null $ iconv -f utf-8 -t ucs-4 < non_utf8_file >/dev/null iconv: conversion error Conversion error detected while processing stdin.