{"id":6101,"date":"2018-12-23T02:12:47","date_gmt":"2018-12-23T02:12:47","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=6101"},"modified":"2018-12-28T22:39:56","modified_gmt":"2018-12-28T22:39:56","slug":"linux-file-command-linuxize","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/23\/linux-file-command-linuxize\/","title":{"rendered":"Linux File Command | Linuxize"},"content":{"rendered":"<p>The Linux file command displays the type of a file. It\u2019s helpful when you have to find out the type of file you\u2019ve never seen before or the file does not have a file extension.<\/p>\n<h2>Linux File Command Syntax<\/h2>\n<p>The syntax for the Linux file command is as follows:<\/p>\n<p>It can take one or more file names as its arguments.<\/p>\n<h2>How to Use the file Command to Find the File Type<\/h2>\n<p>The file command classify files based on a series of tests and determines the file type based on the first successful test.<\/p>\n<p>In it\u2019s simplest form when used without any option, the file command will display the file name along with the file type:<\/p>\n<p>To show just the file type use the -b (&#8211;brief) option:<\/p>\n<p>As you can see from the output above the \/etc\/group file is a text file.<\/p>\n<h2>How to Find the File Type of Multiple Files<\/h2>\n<p>You can pass more than one files to the file command:<\/p>\n<p>file \/bin\/bash \/opt\/card.zip<\/p>\n<p>The command will print the type of each file on a separate file:<\/p>\n<p>\/bin\/bash: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter \/lib64\/ld-linux-x86-64.so.2, for GNU\/Linux 3.2.0, BuildID[sha1]=42602c973215ba5b8ab5159c527e72f38e83ee52, stripped<br \/>\n\/opt\/card.zip: Zip archive data, at least v1.0 to extract<\/p>\n<p>It also accepts wildcard characters. For example to find the type of each .jpg files in the current directory you would run:<\/p>\n<p>imgage001.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1&#215;1, segment length 16, progressive, precision 8, 2083&#215;1250, components 3<br \/>\nimgage031.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72&#215;72, segment length 16, comment: &#8220;Created with GIMP&#8221;, baseline, precision 8, 1280&#215;1024, components<\/p>\n<h2>How to View the Mime Type of a File<\/h2>\n<p>Use the -i (&#8211;mime) option to determine the mime type of a file:<\/p>\n<p>file -i \/var\/www\/index.html\/var\/www\/index.html: text\/html; charset=us-ascii<\/p>\n<h2>Conclusion<\/h2>\n<p>By now you should have a good understanding of how to use the Linux file command. For more information about the find command, see the <a href=\"https:\/\/linux.die.net\/man\/1\/file\">file man page<\/a>.<\/p>\n<p><a href=\"http:\/\/lxer.com\/module\/newswire\/ext_link.php?rid=264185\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Linux file command displays the type of a file. It\u2019s helpful when you have to find out the type of file you\u2019ve never seen before or the file does not have a file extension. Linux File Command Syntax The syntax for the Linux file command is as follows: It can take one or more &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/23\/linux-file-command-linuxize\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux File Command | Linuxize&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6101","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/6101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=6101"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/6101\/revisions"}],"predecessor-version":[{"id":6720,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/6101\/revisions\/6720"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=6101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=6101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=6101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}