Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
File (command)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Examples== For a [[C (programming language)|C]] [[source code]] file, {{code|file main.c}} reports: main.c: C program text For a compiled executable, {{code|file program}} reports information like: program: [[Executable and Linkable Format|ELF]] [[32-bit]] [[Least significant bit|LSB]] [[executable]], [[Intel 80386]], version 1 ([[SYSV]]), [[dynamically linked]] (uses [[Shared Library|shared libs]]), [[strip (Unix)|stripped]] For a block device [[Device file#Naming conventions|/dev/hda]], {{code|file /dev/hda1}} reports: /dev/hda1: [[Device file#Block devices|block special]] (0/0) By default, <code>file</code> does not try to read a device file due to potential undesirable effects. But using the non-standard option {{code|-s}} (available in the Ian Darwin branch), which requests to read device files to identify content, {{code|file -s /dev/hda1}} reports details such as: /dev/hda1: Linux/[[i386]] [[ext2]] [[filesystem]] Via Ian Darwin's non-standard option <code>-k</code>, the command does not stop after the first hit found, but looks for other matching patterns. The <code>-r</code> option, which is available in some versions, causes the [[Newline|new line]] character to be displayed in its raw form rather than in its octal representation. On Linux, {{code|file -k -r libmagic-dev_5.35-4_armhf.deb}} reports information like: libmagic-dev_5.35-4_[[armhf]].[[deb (file format)|deb]]: Debian binary package (format 2.0) - current [[ar (Unix)|ar]] archive - data For a compressed file, {{code|file compressed.gz}} reports information like: compressed.gz: [[gzip]] [[Data compression|compressed]] data, [[DEFLATE|deflated]], original filename, `compressed', last modified: Thu Jan 26 14:08:23 2006, [[Operating system|os]]: Unix For a compressed file, {{code|file -i compressed.gz}} reports information like: compressed.gz: [[media type|application/x-gzip]]; [[character set|charset]]=[[Binary file|binary]] For a PPM file, {{code|file data.ppm}} reports; data.ppm: [[Netpbm format|Netpbm PPM]] "rawbits" image data For a [[Mach-O]] [[universal binary]], {{code|file /bin/cat}} reports like: /bin/cat: Mach-O universal binary with 2 [[Instruction set architecture|architectures]] /bin/cat (for architecture [[PowerPC|ppc7400]]): Mach-O executable ppc /bin/cat (for architecture i386): Mach-O executable i386 For a [[symbolic link]], {{code|file /usr/bin/vi}} reports: /usr/bin/vi: symbolic link to vim Identifying a symbolic link is not available on all platforms and will be dereferenced if <code>-L</code> is passed or <code>POSIXLY_CORRECT</code> is set.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)