LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-12-2011, 05:18 AM   #1
soumya1
LQ Newbie
 
Registered: Sep 2011
Posts: 1
Blog Entries: 1

Rep: Reputation: Disabled
Understanding the file type


Hello,
This is Soumya. I am a beginer with the Linux, my problem is how to
understand from the list that which one is document and which one is a file
and which one is a image/movie, and if it is a file then how to know that
what kind of file it is ??

My next question is how to open a ppt file.
 
Old 09-12-2011, 05:33 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
If you mean from the output of the ls command, you cannot truly distinguish between types of files. Maybe the file name extension can be of some help, but take in mind that linux does not uses extensions as windows does. The most reliable tool to distinguish between file types is the file command. Example:
Code:
$ file testfile.doc
testfile.doc: CDF V2 Document, Little Endian, Os: Windows, Version 5.1, Code page: 1252, Title:  , Author: spinton, Template: Normal.dot, Last Saved By: spinton, Revision Number: 2, Name of Creating Application: Microsoft Office Word, Total Editing Time: 02:00, Create Time/Date: Thu Dec  4 09:38:00 2008, Last Saved Time/Date: Thu Dec  4 09:40:00 2008, Number of Pages: 1, Number of Words: 0, Number of Characters: 1, Security: 0
$ file testfile.txt
testfile.txt: ASCII text
$ file testfile.jpg
testfile.jpg: JPEG image data, EXIF standard 2.2
Regarding the ppt files, you need some office software, like OpenOffice, LibreOffice and so on.
 
Old 09-12-2011, 11:14 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Well, to be honest, extensions are still used, but mostly as a human construct. The underlying system itself doesn't care about them. Many individual programs can still base their operation on filename extensions also.

ls has a --color option, which will print different kinds of file in different colors. The defaults can be changed with the DIRCOLORS shell variable, and that can be generated from file using the dircolors application. It's been covered many times in many places, so do some googling.

For a more general understanding of how to use the shell, this is a good tutorial:
http://www.linuxcommand.org/index.php
 
Old 09-12-2011, 08:00 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
Quote:
Originally Posted by David the H. View Post
Well, to be honest, extensions are still used, but mostly as a human construct.
So very true. Back in the olden days, when I was a young 'un writing training materials in Display Write and later Word Perfect with 8 dot 3 filenames, we used extensions to associate the document to the course. Problem Solving was *.ps; Interpersonal Communication Skills was *.ics; and so on.

The "object oriented programming" became the buzzword of the da--er, all the rage. We no longer had files, we had "objects," and we could not object.

Who can stand against a nice mysterious-sounding buzzword with lots of syllables?
 
Old 09-13-2011, 04:13 AM   #5
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by frankbell View Post
So very true. Back in the olden days, when I was a young 'un writing training materials in Display Write and later Word Perfect with 8 dot 3 filenames, we used extensions to associate the document to the course. Problem Solving was *.ps; Interpersonal Communication Skills was *.ics; and so on.
Sure, it depends on the operating system. For Linux they are commonly used e.g. for the bash completion (defined in /etc/profile.d/complete.bash in openSUSE). Starting a command like bunzip2 and by a TAB TAB on the keyboard you get a list only of the files having the proper suffix. Nevertheless any file with any suffix could be used.

N.B.:

In other OS like Open VMS all files and directories had a three character extension too, directories .DIR and a file was speficied by [DIR1.DIR2.DIR3]FILE.TXT (not to mention their nice versioning in the FILES-11 file system).

In Mac OS (without the X) they had the creator-code and type-code in the directory entries (the .mp3 in the examples are superfluous). By these entries in the directory the OS knew which application created a file, nevertheless any application accepting the right type-code could open it. But starting with Mac OS X 10.6 they no longer honor these directory entries and stick to the suffix for defining the type of file and having one defined application per type to open it by a double-click.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Content-type/Mime type of the file using shellscript swathikumar Linux - Newbie 9 05-24-2011 11:48 PM
changing file system type to another filesystem type,does it effect on data? janakiramulu Ubuntu 1 02-04-2011 01:58 AM
Understanding Profile file in Solaris 10 rahulchandrak Solaris / OpenSolaris 3 01-10-2011 12:36 AM
Get file icon from extension, file type, or mime-type Guitarist88 Programming 3 04-21-2008 10:58 AM
Understanding File Permissions username132 Linux - Software 13 04-03-2006 04:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration