How does linux recognize file types?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How does linux recognize file types?
# 1  
Old 06-15-2011
How does linux recognize file types?

Hey ,

I was wondering how does Linux recognize file types if he doesn't use extensions to determine the file type ?

It's just a question not for a script or something else.

thnxSmilie
# 2  
Old 06-15-2011
There is a program called file which uses a database of "magic numbers" ( /usr/share/magic) to determine the content-type of a file.
This User Gave Thanks to Skrynesaver For This Post:
# 3  
Old 06-15-2011
Thanks i just found on google the same answer
# 4  
Old 06-15-2011
Unlike Windows, it has an executable bit to help tell programs apart from random files. But the kernel's job in detecting file types is fairly easy. Executables and libraries start with "\7fELF". Script files begin with #!. Anything else won't go.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Convert UNIX text file in Windows to recognize line breaks

Hi all, I have some text files that I prepared in vi some time ago, and now I want to open and edit them with Windows Notepad. I don't have a Unix terminal at the moment so I need to do the conversion in Windows. Is there a way to do this? Or just reinsert thousands of line breaks again :eek: ? (2 Replies)
Discussion started by: frys_hp
2 Replies

2. Windows & DOS: Issues & Discussions

Convert UNIX text file in Windows to recognize line breaks

Hmmm I think I found the correct subforum to ask my question... I have some text files that I prepared in vi some time ago, and now I want to open and edit them with Windows Notepad. I don't have a Unix terminal at the moment so I need to do the conversion in Windows. Is there a way to do this?... (1 Reply)
Discussion started by: frys_hp
1 Replies

3. Shell Programming and Scripting

Cp -r except certain file types

the following excludes certain directories successfully cp -r probe/!(dir) /destination I want to exclude certain file types and tried unsuccessfully cp -r probe/!(*.avi) /destination (2 Replies)
Discussion started by: tmf
2 Replies

4. Red Hat

Copy certain file types recursively while maintaining file structure on destination?

Hi guys, I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash. I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also... (1 Reply)
Discussion started by: rockf1bull
1 Replies

5. UNIX for Dummies Questions & Answers

How to find the partition types in linux

How do we find the partition type in Linux? df -T will give me the mounted partition types like ufs, ext3 etc. How do I find out for say a newly added disk to the system? Please advise... Thanks (2 Replies)
Discussion started by: lubu
2 Replies

6. Red Hat

newbie: Linux Server Names & Types..!!!

Any one tell me about the list of Redhat Linux Enterprise 5 SERVERS and their functions. thanks (3 Replies)
Discussion started by: salman103
3 Replies

7. Shell Programming and Scripting

How to recognize if a file still opened by any process?

Is there a way to tell for sure if a file currently is opened by any running process? I have a task to filter a text file which is produced by some long process. I have no way to communicate with that process, but I have access to a location, where that proces produce an output file. Need... (3 Replies)
Discussion started by: alex_5161
3 Replies

8. Filesystems, Disks and Memory

associated file types

I have a file of type .for extension .In a guui based unix environment like solaris if I double click on that file a specific program designed by me has to run which takes this file as the parameter and exceutes the program. Can anyone help me? (8 Replies)
Discussion started by: nhk_srd
8 Replies

9. UNIX for Dummies Questions & Answers

So many types of LINUX's!

I installed Redhat into my system. The reason? This was the version my friend was running and he told me about this one, so I downloaded and installed it. Simple enough :D But as I am searching the net, I am coming across many other forms of linux made by other companies. Redhat seems to be... (2 Replies)
Discussion started by: Minnesota Red
2 Replies

10. UNIX for Dummies Questions & Answers

How can I force my Linux RedHat to recognize my modem??

yeah, I tried basically everything I can find from reading books and asking people but I haven't gotten it to work. is there anything else that can be done. I mean, this internal modem I got is like the last thing I expected Linux not to find (2 Replies)
Discussion started by: TRUEST
2 Replies
Login or Register to Ask a Question