Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: understanding file type

by tomfahle (Priest)
on Jun 10, 2009 at 05:57 UTC ( #770204=note: print w/replies, xml ) Need Help??


in reply to understanding file type

Also have a look at File::LibMagic

#!/usr/bin/perl use warnings; use strict; use File::LibMagic ':easy'; my @files = qw( /bin/ls /etc/localtime /etc/timezone /etc/motd ); foreach my $file ( @files ) { print "$file:\n\t", MagicFile( $file ), "\n"; }

which yields

/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for +GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped /etc/localtime: timezone data /etc/timezone: ASCII text /etc/motd: symbolic link to `/var/run/motd'

on my Linux Box.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://770204]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2021-10-21 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (82 votes). Check out past polls.

    Notices?