LinuxQuestions.org
Visit Jeremy's Blog.
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, 09: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, 01:39 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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, 01:52 PM   #3
pan64
Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 5,020

Rep: Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324
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 08:02 AM
Bad Magic Number??? Acej Linux - Newbie 4 10-07-2008 09:33 AM
securing linux HDD mounting with magic number ?? Bluesuperman Linux - Security 1 11-27-2004 08:52 AM
Bad Magic Number joseph Linux - Software 1 01-05-2004 04:22 AM
Magic number Rex_chaos Linux - General 6 05-01-2002 10:21 PM


All times are GMT -5. The time now is 02:55 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration