Java Reference
In-Depth Information
is a compiled class file). The long listing ls -l will tell us more: permissions,
links, owner, group, size (in bytes), and the date of last modification.
$ ls -l
total 2414
-rw-r--r-- 1 albing users 132 Jan 22 07:53 ReadMe.txt
-rw-r--r-- 1 albing users 637 Jan 22 07:52 Shift.class
-rw-r--r-- 1 albing users 336 Jan 22 07:55 Shift.java
-rw-r--r-- 1 albing users 1374 Jan 22 07:58 anIcon.gif
-rw-r--r-- 1 albing users 8564 Jan 22 07:59 dispColrs
-rw-r--r-- 1 albing users 1943 Jan 22 08:02 jam.jar
drwxr-xr-x 2 albing users 48 Jan 22 07:52 moresrc
-rw-r--r-- 1 albing users 2435522 Jan 22 07:56 moresrc.zip
$
While ls is only looking at the “outside” of files, 5 there is a command that
looks at the “inside,” the data itself, and based on that, tries to tell you what
kind of file it found. The command is called file , and it takes as arguments a
list of files, so you can give it the name of a single file or you can give it a whole
long list of files.
NOTE
Remember what was said about pattern matching in the shell: we can let the
shell construct that list of files for us. We can give file the list of all the files
in our current directory by using the “ * ” on the command line so that the shell
does the work of expanding it to the names of all the files in our directory (since
any filename will match the star pattern).
$ file *
ReadMe.txt: ASCII text
Shift.class: compiled Java class data, version 45.3
Shift.java: ASCII Java program text
anIcon.gif: GIF image data, version 89a, 26 x 26,
dispColrs: PNG image data, 565 x 465, 8-bit/color RGB, non-interlaced
jam.jar: Zip archive data, at least v2.0 to extract
moresrc: directory
moresrc.zip: Zip archive data, at least v1.0 to extract
$
5. Technically, ls (without arguments) need only read the directory, whereas ls -l looks at
the contents of the inode in order to get all the other information (permissions, size, and so
on), but it doesn't look at the data blocks of the file.
Search WWH ::




Custom Search