Quick Introduction of Computer Files

We hear about files. Here is an explanation of the computer file.

Computer files are so-called because they bear a nodding relation to the old-fashioned manila files people once used to store bits of paper. Such files had tab markers with headings such as “Laundry Bills, 2008-2009,” allowing a primitive form of random access. For the moment, you can think of a computer file simply as a place for storing data and programs on your disk. Disk files also have tab markers known as filenames. Groups of files are stored in directories, which also have names. Both you and Unix use these directories and filenames when locating a file and accessing its contents.

A major service offered by Unix and most other operating systems is handling files by name. You usually do not need to be concerned with the physical location or structure of a file-Unix keeps track of these boring details. Your accounts payable data may reside on cylinder 87 starting at sector 102, and it may even move about during processing. All you need to know is the directory name,/usr/payables or whatever, and the file-name, say, ac. payable.

You or your application program may want to access a data file to examine or update its contents. Data or text files normally contain visible, printable characters encoded in ASCII format. You will meet commands that will display or print the contents of a text file by reading a sequence of characters from the disk. There are yet more commands that allow you to write to the disk in order to create and modify text files. You can also copy and rename files, or append one file to another. You can, dare I mention it, all too easily erase (or kill) files.

Multiuser systems need to offer safeguards to prevent users from reading and/or erasing other users’ files without due authority. Unix has an elaborate scheme of file ownerships and permissions whereby users and groups of users can protect their files. Each file in the system carries read, write and execute permissions that dictate who can do what with a file.

Binary files, unlike text files, which are easily readable by most humans, contain program code in a form understood only by your CPU. Although some groups of characters in binary code may coincide with ASCII characters, printing or displaying a binary file will give you gibberish and may even lock up your printer or terminal.

If you want to run a program, Unix needs to locate it by name. When you enter the command date, for example, Unix looks for a program file called date.

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


%d bloggers like this: