LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-05-2013, 08:00 AM   #1
svhost2
LQ Newbie
 
Registered: Apr 2013
Posts: 1

Rep: Reputation: Disabled
Magic Number in linux


Hi,
I want to know why a special files have the magic number in end of it?(most files have their magic number on top of the file)
Thanks
 
Old 04-05-2013, 12:39 PM   #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
Maybe because the first bytes of those files are reserved for other uses. On the other hand, the magic number specification provides the ability to specify an offset and the offset can be retrieved from the file, as clearly stated in man magic:
Quote:
Offsets do not need to be constant, but can also be read from the file being examined. If the first character following the last > is a ( then the string after the parenthesis is interpreted as an indirect offset.
Just take in mind that magic numbers in many cases are not there to be... magic numbers. They are unique sequences of bytes that help programs in *nix systems (along with the file command) to identify the file type, but they could have been inserted originally for other purposes.
 
Old 04-05-2013, 12:52 PM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
yes, the first answer is correct, probably you can show us an interesting example.....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad Magic Number I Use Dial Linux - Newbie 1 07-28-2009 07:02 AM
Bad Magic Number??? Acej Linux - Newbie 4 10-07-2008 08:33 AM
securing linux HDD mounting with magic number ?? Bluesuperman Linux - Security 1 11-27-2004 07:52 AM
Bad Magic Number joseph Linux - Software 1 01-05-2004 03:22 AM
Magic number Rex_chaos Linux - General 6 05-01-2002 09:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:53 PM.

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