File

From Wsms

Jump to: navigation, search

Note: This page should be titled file (all lowercase). It is Fd due to technical limitations of Mediawiki.

file tells you what kind of file you have dealing with:

common usage

Explore your system:

ggeller@roosevelt:~$ sudo -i
[sudo] password for ggeller:
root@roosevelt:~# file /dev/sda
/dev/sda: block special (8/0)
root@roosevelt:~# cat /dev/sda | file -
/dev/stdin: x86 boot sector; partition 2: ID=0x12, starthead 0, startsector 146694240, 9601200 sectors; partition 3: ID=0x82, starthead 239, startsector 68372640, 3916080 sectors; partition 4: ID=0x83, starthead 239, startsector 72288720, 74405520 sectors, code offset 0x48

file tells us that /dev/sda is a special block device. With the "-" argument, it reads the first part (512 bytes in this case) of standard input and tell about the contents of sda, namely a boot sector and a partition table.

see also

man file
dd
sudo
Linux_commands

Personal tools