Share
VIDEOS 1 TO 50
Linux Commands for Beginners: 28 - The File Command (And Easter Eggs)
Linux Commands for Beginners: 28 - The File Command (And Easter Eggs)
Published: 2013/09/02
Channel: LearnLinux.tv
Windows Command Line Tutorial - 3 - Opening Files and History
Windows Command Line Tutorial - 3 - Opening Files and History
Published: 2016/01/05
Channel: thenewboston
Linux Command Line - Directories and Files
Linux Command Line - Directories and Files
Published: 2014/07/28
Channel: Steven Gordon
Windows Command Line Tutorial - 9 - Copying and Moving Files
Windows Command Line Tutorial - 9 - Copying and Moving Files
Published: 2016/01/10
Channel: thenewboston
Windows Command Line Tutorial - 7 - File Attributes
Windows Command Line Tutorial - 7 - File Attributes
Published: 2016/01/10
Channel: thenewboston
Windows command prompt tutorial 1 - changing directories, listing files and folders
Windows command prompt tutorial 1 - changing directories, listing files and folders
Published: 2013/12/19
Channel: Magic Monk
How to create a file with MS-DOS Copy Con Command
How to create a file with MS-DOS Copy Con Command
Published: 2012/10/30
Channel: Blesson Jose
Windows Command Line Tutorial - 2 - Listing Files and Directories
Windows Command Line Tutorial - 2 - Listing Files and Directories
Published: 2016/01/05
Channel: thenewboston
Linux file command summary with examples
Linux file command summary with examples
Published: 2016/10/11
Channel: FactorPad
How to Rename the File using command prompt
How to Rename the File using command prompt
Published: 2014/09/15
Channel: rajesh v
Windows Command Line Tutorial - 8 - Deleting and Appending to Files
Windows Command Line Tutorial - 8 - Deleting and Appending to Files
Published: 2016/01/10
Channel: thenewboston
03. The Linux Command Line Ultimate Tutorial - FILE INFORMATION
03. The Linux Command Line Ultimate Tutorial - FILE INFORMATION
Published: 2017/10/25
Channel: Average Linux User
Hide Files or Folders Using Command Prompt
Hide Files or Folders Using Command Prompt
Published: 2013/10/24
Channel: AvoidErrors
Show Hidden Files on Flash Drive Using Command Prompt
Show Hidden Files on Flash Drive Using Command Prompt
Published: 2015/12/04
Channel: 10 Tutorials
How to Copy Files and Folders Faster using Command Prompt
How to Copy Files and Folders Faster using Command Prompt
Published: 2012/05/22
Channel: How to Support
Must Know - Command Prompt & Batch Files
Must Know - Command Prompt & Batch Files
Published: 2016/05/04
Channel: Gamers Nexus
wget - File Download Command-Line Utility - Linux OS
wget - File Download Command-Line Utility - Linux OS
Published: 2016/11/08
Channel: SrbinHacking
How to open files/folders in Command Prompt
How to open files/folders in Command Prompt
Published: 2016/09/26
Channel: amwin7
How to copy large file to USB/Drive use command prompt in Windows 10/8/7
How to copy large file to USB/Drive use command prompt in Windows 10/8/7
Published: 2015/11/18
Channel: E Angkor
How to create files & Folders Using the Command Line on Windows!
How to create files & Folders Using the Command Line on Windows!
Published: 2012/03/18
Channel: Bounasser Abdelwahab
Copy Files Using Command Prompt | Speed
Copy Files Using Command Prompt | Speed 'bout 10x faster than your normal speed!!
Published: 2015/08/16
Channel: Abhinav Hingmang
Linux/Mac Terminal Tutorial: How To Use The rsync Command - Sync Files Locally and Remotely
Linux/Mac Terminal Tutorial: How To Use The rsync Command - Sync Files Locally and Remotely
Published: 2017/10/10
Channel: Corey Schafer
Linux Command Line Tutorial For Beginners 17 - file permissions, symbolic permissions and chmod
Linux Command Line Tutorial For Beginners 17 - file permissions, symbolic permissions and chmod
Published: 2016/07/23
Channel: ProgrammingKnowledge
How to Encrypt & Decrypt Files or Folders Using Command Prompt
How to Encrypt & Decrypt Files or Folders Using Command Prompt
Published: 2017/05/22
Channel: Vincent's Tech Blog
Linux tar command tutorial
Linux tar command tutorial
Published: 2010/03/06
Channel: climagic
How To Opening And Editing A Text File In Command Prompt
How To Opening And Editing A Text File In Command Prompt
Published: 2016/10/16
Channel: BD info
Informatica -- FTP File using Command Task
Informatica -- FTP File using Command Task
Published: 2014/05/11
Channel: Mandar Gogate
Command Prompt Basics - Create and Edit txt files in CMD [Tutorial 4]
Command Prompt Basics - Create and Edit txt files in CMD [Tutorial 4]
Published: 2011/07/23
Channel: ProHelp
Change Multiple File Extensions in Command Prompt
Change Multiple File Extensions in Command Prompt
Published: 2014/11/04
Channel: Britec09
Ubuntu- Save terminal command output into a text file
Ubuntu- Save terminal command output into a text file
Published: 2017/07/28
Channel: Tutorials4u Help
How to Use Delete Command in Unix
How to Use Delete Command in Unix
Published: 2013/06/13
Channel: Windows and Linux Tutorials from Howtech
Linux Command Line Tutorial For Beginners 11 -  touch command
Linux Command Line Tutorial For Beginners 11 - touch command
Published: 2016/07/05
Channel: ProgrammingKnowledge
AWK Command : Session 3 : Select columns from CSV file
AWK Command : Session 3 : Select columns from CSV file
Published: 2017/02/11
Channel: Testing World
Run C Program in Command Prompt
Run C Program in Command Prompt
Published: 2016/03/13
Channel: Learning Strugglers
How to file transfer (SFTP) with command prompt
How to file transfer (SFTP) with command prompt
Published: 2010/03/15
Channel: gtrefraction
How to Download Files with cURL on Command Line
How to Download Files with cURL on Command Line
Published: 2017/01/18
Channel: Jeff Everhart
Raspberry Pi Linux Lesson 4: Creating and Editing Files with Nano Command
Raspberry Pi Linux Lesson 4: Creating and Editing Files with Nano Command
Published: 2015/05/25
Channel: Paul McWhorter
Change File Extensions Using Command Window
Change File Extensions Using Command Window
Published: 2013/12/30
Channel: WolfTM2008
Robocopy command in a bat file
Robocopy command in a bat file
Published: 2017/04/17
Channel: Neo Virakorn
How to read a binary file using unix / linux command line
How to read a binary file using unix / linux command line
Published: 2015/07/27
Channel: Unix Tech Tips
How To Run .sql Program File In Oracle Command Line | SQL Tutorial | PL/SQL | Oracle SQL 10g
How To Run .sql Program File In Oracle Command Line | SQL Tutorial | PL/SQL | Oracle SQL 10g
Published: 2016/10/14
Channel: Unpossible POG
Tutorial on how to make a Java JAR file with the command prompt
Tutorial on how to make a Java JAR file with the command prompt
Published: 2011/07/29
Channel: Alex Reidy
FTP command , Simple  upload / download file
FTP command , Simple upload / download file
Published: 2012/12/13
Channel: jaekoo cho
Delete Temp Files Using cmd Clean Temp files With Command
Delete Temp Files Using cmd Clean Temp files With Command
Published: 2016/07/20
Channel: Design Tyro
Shell scripting: While loop and read command: Read file line by line
Shell scripting: While loop and read command: Read file line by line
Published: 2015/11/10
Channel: Computer Programming University
How to delete a folder through CMD (Command Prompt)
How to delete a folder through CMD (Command Prompt)
Published: 2012/02/03
Channel: muhammadlilg
Meterpreter - FILE command help
Meterpreter - FILE command help
Published: 2015/12/26
Channel: Nikhil Tomar
Command Line Log File Analysis
Command Line Log File Analysis
Published: 2016/05/04
Channel: Joseph McCray
how to move the file using command prompt
how to move the file using command prompt
Published: 2015/06/29
Channel: rajesh v
How to Use Unix Copy Command
How to Use Unix Copy Command
Published: 2013/06/13
Channel: Windows and Linux Tutorials from Howtech
NEXT
GO TO RESULTS [51 .. 100]

WIKIPEDIA ARTICLE

From Wikipedia, the free encyclopedia
Jump to: navigation, search
File
Initial release 1973 (1973) as part of Unix Research Version 4; 1986 (1986) open-source reimplementation
Repository Edit this at Wikidata
Written in C
Operating system Unix, Unix-like, Cross-platform
Type file type detector
License BSD license, CDDL
Website http://darwinsys.com/file/

file is a standard Unix program for recognizing the type of data contained in a computer file.

History[edit]

The original version of file originated in Unix Research Version 4[1] in 1973. System V brought a major update with several important changes, most notably moving the file type information into an external text file rather than compiling it into the binary itself.

Most major BSD and Linux distributions use a free, open-source reimplementation which was written in 1986-87 by Ian Darwin[2] from scratch. It was expanded by Geoff Collyer in 1989 and since then has had input from many others, including Guy Harris, Chris Lowth and Eric Fischer; from late 1993 onward its maintenance has been organized by Christos Zoulas. The OpenBSD system has its own subset implementation written from scratch, but still uses the Darwin/Zoulas collection of magic file formatted information.

Specification[edit]

The Single Unix Specification (SUS) specifies that a series of tests are performed on the file specified on the command line:

  1. if the file cannot be read, or its Unix file type is undetermined, the file program will indicate that the file was processed but its type was undetermined.
  2. file must be able to determine the types directory, FIFO, socket, block special file, and character special file
  3. zero-length files are identified as such
  4. an initial part of file is considered and file is to use position-sensitive tests
  5. the entire file is considered and file is to use context-sensitive tests
  6. the file is identified as a data file

file's position-sensitive tests are normally implemented by matching various locations within the file against a textual database of magic numbers (see the Usage section). This differs from other simpler methods such as file extensions and schemes like MIME.

In most implementations, the file command uses a database to drive the probing of the lead bytes. That database is implemented in a file called magic, whose location is usually in /etc/magic, /usr/share/file/magic or a similar location.

Usage[edit]

The SUS[3] mandates the following options:

-M file, specify a file specially formatted containing position-sensitive tests; default position-sensitive tests and context-sensitive tests will not be performed.
-m file, as for -M, but default tests will be performed after the tests contained in file.
-d, perform default position-sensitive and context-sensitive tests to the given file; this is the default behaviour unless -M or -m is specified.
-h, do not dereference symbolic links that point to an existing file or directory.
-L, dereference the symbolic link that points to an existing file or directory.
-i, do not classify the file further than to identify it as either: nonexistent, a block special file, a character special file, a directory, a FIFO, a socket, a symbolic link, or a regular file. Linux[4] and BSD[5] systems behave differently with this option and instead output an Internet media type (“MIME type”) identifying the recognized file format.

Other Unix and Unix-like operating systems may add extra options than these, such as -s 'special files' (examples below).

The command tells only what the file looks like, not what it is (in the case where file looks at the content). It is easy to fool the program by putting a magic number into a file the content of which does not match it. Thus the command is not usable as a security tool other than in specific situations.

Examples[edit]

$ file file.c
file.c: C program text
$ file program
program: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked
    (uses shared libs), stripped
$ file /dev/hda1
/dev/hda1: block special (0/0)
$ file -s /dev/hda1
/dev/hda1: Linux/i386 ext2 filesystem

Note that -s is a non-standard option available only on some platforms, which tells file to read device files and try to identify their contents rather than merely identifying them as device files. Normally file does not try to read device files since reading such a file can have undesirable side effects.

$ file compressed.gz
compressed.gz: gzip compressed data, deflated, original filename, `compressed', last
    modified: Thu Jan 26 14:08:23 2006, os: Unix
$ file -i compressed.gz    # (on Linux)
compressed.gz: application/x-gzip; charset=binary
$ file data.ppm
data.ppm: Netpbm PPM "rawbits" image data
$ file /bin/cat
/bin/cat: Mach-O universal binary with 2 architectures
/bin/cat [for architecture ppc7400):        Mach-O executable ppc
/bin/cat (for architecture i386):       Mach-O executable i386

Libmagic library[edit]

As of version 4.00 of the Ian Darwin/Christos Zoulas version of file, the functionality of file is incorporated into a libmagic library that is accessible via C (and C-compatible) linking;[6][7] file is implemented using that library.[8][9]

References[edit]

  1. ^ "Source of the UNIX V4 "file" man page". 
  2. ^ The early history of this program is recorded in its private CVS repository; see [1] the log of the main program
  3. ^ The Open Group Base Specifications Issue 7 — file command
  4. ^ file(1) – Linux Programmer's Manual – User Commands
  5. ^ file(1) – NetBSD General Commands Manual
  6. ^ libmagic(3) – Linux Programmer's Manual – Library Functions
  7. ^ libmagic(3) – NetBSD Library Functions Manual
  8. ^ Zoulas, Christos (February 27, 2003). "file-3.41 is now available". File (Mailing list). Retrieved January 1, 2013. 
  9. ^ Zoulas, Christos (March 24, 2003). "file-4.00 is now available". File (Mailing list). Retrieved January 1, 2013. 

External links[edit]

Manual pages[edit]

Other[edit]

Disclaimer

None of the audio/visual content is hosted on this site. All media is embedded from other sites such as GoogleVideo, Wikipedia, YouTube etc. Therefore, this site has no control over the copyright issues of the streaming media.

All issues concerning copyright violations should be aimed at the sites hosting the material. This site does not host any of the streaming media and the owner has not uploaded any of the material to the video hosting servers. Anyone can find the same content on Google Video or YouTube by themselves.

The owner of this site cannot know which documentaries are in public domain, which has been uploaded to e.g. YouTube by the owner and which has been uploaded without permission. The copyright owner must contact the source if he wants his material off the Internet completely.

Powered by YouTube
Wikipedia content is licensed under the GFDL and (CC) license