Spring Into Linux

Although Linux handles other types of files (such as block device), this chapter only discusses ordinary, also called normal, files and symbolic links. Ordinary files include data, configuration, text, graphics, directories, and other files. Links are filenames that only point to another file. Ordinary files are categorized by the information they contain. Linux desktops and applications recognize file types by the filename extension, just as Windows recognizes .doc extensions as MS Word files.

File extensions are associated with an application. When you double-click a file, the file extension determines which application the file is opened in. A document with an .sxw extension is opened in OpenOffice. New applications usually create associations for their file extensions during installation.

You can change the associations manually if necessary. To add or edit an association, highlight a file with the extension, right-click, and select Edit File Type to see the screen on the right. The top pane shows .HTML, .htm, and .HTM should be opened using Konqueror. Click Add to add an extension using a pattern, such as *.abcdef. Linux extensions can be any number of characters, not just three.

More than one application can be listed in the lower pane. For instance, you could add Mozilla before Konqueror. The file is opened in Mozilla if possible; if not, the file opens in Konqueror. Clicking the Add button displays a list of applications to select from.

Whereas desktops and applications recognize extensions, Linux doesn't. It looks inside a file to determine file type. You can use thefile command at the command line to see the actual file type, regardless of the extension, as follows:

file testfile testfile: ASCII text

The file command has a very large list of file types it recognizes. In general, files with "text" in the file type, such as "c program text," can be looked at and edited with Linux tools. Data is a file type used when Linux can't recognize a more specific type.

    Категории