Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions _commands/tools/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,59 @@
---

file
---
TODO: Add documentation for this command by submitting a pull request.
-------
<!--TODO: Add documentation for this command by submitting a pull request.-->
<!-- one line explanation would go here -->
`file` prints the file type of a file in a human-readable format

<!-- minimal example -->
~~~ bash
*short* example of command usage and output
$ file test.cpp
test.cpp: c program text, UTF-8 Unicode text

~~~


<!--more-->

### Useful Options / Examples

#### Example command
Useful on Unix since file extensions sometimes are completely unrelated to their actual type.

##### Break it down
~~~bash
file starter-files.csvs
starter-files.csv: Zip archive data, at least v2.0 to extract
~~~

#### `file`

~~~bash
$ file [options] filename ...
~~~

Options include:

#### Example command
1. `b` to only show the file type (rather than the file name followed by the file type)
2. `i` to show the file's mime type
3. `z` to view compressed files without decompressing


----

#### `file -bi filename`

~~~bash
$ file -z bar.txt.gz
$ bar.txt.gz: ASCII text (gzip compressed data, was "bar.txt", last modified: Wed Sep 7 19:31:23 2016, from Unix)

file -bi file.txt
file.txt: text/plain; charset=us-ascii
~~~

##### Break it down

* The -b option will print only the file type
* The -i option will print the file's mime type rather than a human-readable description of the file type
----