file
From NetBSD Wiki
The file(1) utility is used to display the types of the specified files. For regular files, it looks for magic(5) numbers in the file content.
% file hello.c hello.c: ASCII C program text
Special files, symbolic links, etc. are classified with the stat(2) system call.
% file /dev/null /dev/wd0a /dev/null: character special (2/2) /dev/wd0a: block special (0/0)
With the -i option, the MIME type is displayed.
% file -i hello.c hello.c: text/x-c; charset=us-ascii
