determine file type
An entry on how to determine file type.
This linux command file determine file types classification in three different ways namely filesystem tests, magic number tests, and language tests. The first test that succeeds causes the file type to be printed.
Determining file types are usually being used inside bash or perl script before any file read/write operation takes place. By doing so, any file validation algorithm can be performed first before any file or write access can be granted or continued.
Simple Usage
~~~~~~~~~~~~
# file /dev/sda1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sda1: block special (8/1)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# file F7.ISO
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.iso: ISO 9660 CD-ROM filesystem data UDF filesystem data (unknown version, id 'NSR0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# file textfile.txt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
textfile.txt: ASCII English text
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# file /dev/cdrom0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/cdrom: symbolic link to `scd0'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Categories
- HowTos (611)
- Linux Devices (39)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
►
2008
(2302)
-
►
October
(140)
- Linus Torvalds on Linux Distributions
- AMD to Spin off Manufacturing Operations
- MySQL cofounder David Axmark leaving Sun
- Mono to contribute back to CLI; Microsoft says it ...
- Monitor your network with GroundWork Monitor Commu...
- The LXF Guide: Write a Perl module
- 8 Best First-person Shooter Games for Linux
- AppDeploy Community Launches Free Windows Installe...
- Ubuntu Tweak - Sneak Peak at Latest Version!
- POS stack targets Linux netbooks
- RIP LinuxWorld
- Firefox extension blocks dangerous Web attack
- Wikia co-founder to speak at linux.conf.au
- Wikia co-founder to speak at linux.conf.au
- Look Ma, No ‘X’
- Look Ma, No ‘X’
- Forget the damn Linux netbooks. Can Windows replac...
- Forget the damn Linux netbooks. Can Windows replac...
- Amarok 2.0 Beta 2 was released
- 6 Years As A Professional Software Developer
- Amarok 2.0 Beta 2 was released
- 6 Years As A Professional Software Developer
- Distribution Release: EnGarde Secure Linux 3.0.21
- Torvalds talks about his brand new blog
- Become a multimedia pro with the Vector Linux Mult...
- Linux Robot - Watch This Space
- Distribution Release: EnGarde Secure Linux 3.0.21
- Torvalds talks about his brand new blog
- Become a multimedia pro with the Vector Linux Mult...
- Linux Robot - Watch This Space
- Linux-Based E-Voting In Brazil
- Is .NET on Linux Finally Ready?
- Linux-Based E-Voting In Brazil
- Multi-core networking stack ported to PowerPC
- Google rev's photo editor for Linux
- Project releases version 2.0 of open source .Net
- One more 2.6.27 prepatch
- Stallman vs. Clouds
- How to Create and Use a Password Reset Disk in Win...
- OpenOffice.org Grows Up
- 45+ Sources and Sets of Photoshop Custom Shapes
- Clean up your filesystems with fslint
- NPX-9000 UMPC is inexpensive but underpowered
- Will Chrome Find a Home With SaaS?
-
►
October
(140)
Monday, September 3, 2007
determine file type
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy


0 comments:
Post a Comment