fileコマンド

今日もファイルを調べるコマンドについて。

fileコマンドでファイルの種類がわかる。

 ASCIIかUTF-8かバイナリかなど。。。

バイナリに対しては、ELF形式かとか動的リンクされてるとかstripされてるかとか、まだまだ調べ甲斐がありそう。

[shin@cent6-5 helloworld]$ file helloworld.c 
helloworld.c: ASCII C program text
[shin@cent6-5 helloworld]$ file helloworld_jp.c 
helloworld_jp.c: UTF-8 Unicode C program text
[shin@cent6-5 helloworld]$ file /dev/cdrom 
/dev/cdrom: symbolic link to `sr0'
[shin@cent6-5 helloworld]$ file /dev/sr0 
/dev/sr0: block special
[shin@cent6-5 helloworld]$ file /mnt/
/mnt/: directory
[shin@cent6-5 helloworld]$ file /proc/meminfo 
/proc/meminfo: empty
[shin@cent6-5 helloworld]$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped