LinuxQuestions.org
Review your favorite Linux distribution.
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 01-31-2010, 02:10 AM   #1
ss_me
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Rep: Reputation: 0
Exclamation Need command !!




Hi all,

I am just starting out in LINUX and I know the basic commands but I am a having a problem. I scoped the man pages but I can't get it. Maybe one of know... Can anyone tell me the cmd to figure out the system a file was created on? I just can't figure out this problem. If anyone here can help, it would be great. Thank you
 
Old 01-31-2010, 02:23 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Try
Quote:
file MYFILE
Try "man file" for more details.

'Hope that helps...
 
Old 01-31-2010, 02:29 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
AFAIK generally neither the name nor the OS type of the system used to create a file are preserved when it is copied to a Linux system. A Linux file consists of an inode and data (actually the data for small files may be kept in the inode and multiple inodes are used for large files). Unless the information you want is written into the data by the application that created the file it will not be available because it is not contained in the inode.

See the stat(1) and stat(2) commands for more information about what is in an indode.
 
Old 01-31-2010, 02:40 AM   #4
ss_me
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Original Poster
Rep: Reputation: 0
I tried file myfile and I get the type of file but not the system. Catkin says that you can't get that info but my professor insists that you can. Does it make a difference to know that the file I want to examine is a .c file? Thank you.
 
Old 01-31-2010, 02:48 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by ss_me View Post
Does it make a difference to know that the file I want to examine is a .c file? Thank you.
Yes, assuming it is C source code, in which case it is a plain text file typically manually generated and thus generally has no embedded information about the name of the system it was generated on.

Is it possible that your professor is thinking about line ends? On DOS and Windows, ASCII "carriage return" and "line feed" are used for line end while Linux uses "line feed" only. The fromdos (and dos2unix?) command can be used to convert.
 
1 members found this post helpful.
Old 01-31-2010, 02:54 AM   #6
ss_me
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Got it!! It makes sense Catkin. Thank you very much!
 
Old 01-31-2010, 10:42 AM   #7
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 548

Rep: Reputation: 116Reputation: 116
It's quite a common "exam" question to ask a variation of that, I think I had one which asked why the length of two files were different, one on linux, one on unix. The answer of course being that the windows file was using an extra for every line!
If you ever need to try and find out some info about a binary file then you can use the "strings" command and sometimes extract some useful information. I remember someone once releasing an application with a hard-coded password in it - we were able to use strings and pull it straight out of there!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Only execute 2nd command on successufl execution of 1st command kregec05 Linux - Newbie 3 08-19-2009 11:29 AM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 03:14 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 07:30 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 03:23 AM
Key stroke/command to shut down x and go into the command prompt screen? Fear58 Linux - General 1 07-14-2004 08:14 PM


All times are GMT -5. The time now is 06:01 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration