

If you have any questions or thoughts to share, use the feedback form below to reach us. 1.Youll typically use the find command with the syntax find /path -type f -iname filename. In this article, we shared some useful file command examples. That’s all! file command is a useful Linux utility to determine the type of a file without an extension. $ file -extension /dev/sdaįor more information and usage options, consult the file command man page. In addition, you can get a slash-separated list of valid extensions for the file type found by adding the –extension switch. dev/sda: application/octet-stream charset=binaryĨ. You can tell file command to output mime type strings instead of the more traditional human readable ones, using the -i option. If you want to report information about the contents only not the compression, of a compressed file, use the -Z flag. Adding the -z options instructs file to look inside compressed files.

dev/sda: DOS/MBR boot sector, extended partition table (last)ĥ. The -s option causes file to also read block or character special files, for example. To make file work faster you can exclude a test (valid tests include apptype, ascii, encoding, tokens, cdf, compress, elf, soft and tar) from the list of tests made to determine the file type, use the -e flag as shown.

You can also pass the names of the files to be examined from a file (one per line), which you can specify using the -f flag as shown. The simplest file command is as follows where you just provide a file whose type you want to find out. page -type f -print0 : The find action will start in the current directory, searching by name for files that match the.
