Linux/Unix – Managing Files..

 

File management tools include those for splitting, comparing, and compressing files, making backup archives, and tracking file revisions. Other management tools exist for determining the contents of a file, and for changing its timestamp.

 

Determining File Type and Format

When we speak of a file’s type, we are referring to the kind of data it contains, which may include text, executable commands, or some other data; this data is organized in a particular way in the file, and this organization is called its format. For example, an image file might contain data in the JPEG image format, or a text file might contain unformatted text in the English language or text formatted in the TeX markup language.

The file tool analyzes files and indicates their type and−−if known−−the format of the data they contain. Supply the name of a file as an argument to file and it outputs the name of the file, followed by a description of its format and type. To determine the format of the file `/usr/doc/HOWTO/README.gz’, type:

 

$ file /usr/doc/HOWTO/README.gz

/usr/doc/HOWTO/README.gz: gzip compressed data, deflated, original

filename, last modified: Sun Apr 26 02:51:48 1998, os: Unix

This command reports that the file `/usr/doc/HOWTO/README.gz’ contains data that has been compressed with the gzip tool. To determine the original format of the data in a compressed file, use the `−z’ option. To determine the format of the compressed data contained in the file `/usr/doc/HOWTO/README.gz’, type:

$ file −z /usr/doc/HOWTO/README.gz


/usr/doc/HOWTO/README.gz: English text (gzip compressed data, deflated,

original filename, last modified: Sun Apr 26 02:51:48 1998, os: Unix)

This command reports that the data in `/usr/doc/HOWTO/README.gz’, a compressed file, is English text.

NOTE: Currently, file differentiates among more than 100 different data formats, including several human languages, many sound and graphics formats, and executable files for many different operating systems.

 

Advertisements

About msotela

This blog is for anyone who wants to access the power of a Linux system as a systems administrator or user. You may be a Linux enthusiast, a Linux professional, or possibly a computer professional who is increasingly finding the Windows systems in your data center supplanted by Linux boxes.

Posted on March 15, 2009, in Unix/Linux. Bookmark the permalink. Leave a comment.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: