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 01-31-2009, 01:47 AM   #1
john83reuben
Member
 
Registered: Oct 2007
Location: Kuala Lumpur,Malaysia
Distribution: Debian Etch, OpenSuse
Posts: 132

Rep: Reputation: 17
Binary files


Hi guys,

I just wana know something. IN unix, we have regular files. THere are two types of regular files : 1) Text files and 2) Binary files

MY question is what are the example of binary files in Unix system. Where are the locations ( few examples will do )

If nt mistaken, in /bin ... there are many binary files,issit? for example is /bin/echo a binary file .

If yes, y do they made is as binary file. Y not make is normal text file, so that we can able to modify whateva unix commands for fun.


Hope 2 receive an answer.

Thank you
 
Old 01-31-2009, 02:19 AM   #2
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
You can modify whatever you like. Just grab the source rpm (or pure source), modify it, rebuild it, and then install it. You can do this with the vast majority of packages on most linux distros. There are a few packages that the source is not available (mostly drivers, nvidia, etc).
 
Old 01-31-2009, 02:19 AM   #3
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Double posted for some reason.

Last edited by lazlow; 01-31-2009 at 02:20 AM.
 
Old 01-31-2009, 03:56 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Quote:
Originally Posted by john83reuben View Post
Hi guys,

I just wana know something. IN unix, we have regular files. THere are two types of regular files : 1) Text files and 2) Binary files

MY question is what are the example of binary files in Unix system. Where are the locations ( few examples will do )
If you look in /usr/bin you will see loads of binary and executable files. Note that not all binaries are executable and not all executables are binary (a shell script would be an example of the latter).

Quote:
If nt mistaken, in /bin ... there are many binary files,issit? for example is /bin/echo a binary file .
Yes. If you want to see loads more try
Code:
ls /usr/bin
at a terminal and you'll get a long list of binaries.

Quote:
If yes, y do they made is as binary file. Y not make is normal text file, so that we can able to modify whateva unix commands for fun.
Not just in *nix but in all computers, most commands are compiled from source code (which can be written, edited and understood by [some] humans) and turned into binary code in a form that computers understand. If you want to change a command, then you can get the source code (this is possible in linux but not usually possible in Windows or Mac stuff) and play with it all you want and then recompile and voilą, you have a new and improved command.

I hope that helps you.
Cheers,
jdk
 
Old 01-31-2009, 05:40 AM   #5
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
It looks like a while playing with the file command, and maybe even reading its manpage, is called for.
 
Old 01-31-2009, 07:39 AM   #6
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
Actually, there is only one kind of file in any operating system: binary files. A "text" file simply has characters in it that are human readable. A "binary" file has data that is encoded so that a computer program can efficiently interpret the information inside.

An interesting *nix comand is 'file'. It will tell you what a file is based on know patterns, usually headers or the first couple of bytes in the file. Try it: 'file /etc/passwd' or 'file /usr/bin/bash' and see what it tells you.

Bottom line is, they are all simply files - streams of bytes.
 
Old 02-02-2009, 09:17 AM   #7
john83reuben
Member
 
Registered: Oct 2007
Location: Kuala Lumpur,Malaysia
Distribution: Debian Etch, OpenSuse
Posts: 132

Original Poster
Rep: Reputation: 17
ok, how bout hardlinks. base on my understanding, Linux files don't actually live in directories. They are assigned an inode number, which Linux uses to locate the physical files.

So my question is,

for example:
when u ls -il
155719 -rw-r--r-- 1 john users 0 2009-02-02 23:13 data1
155720 -rw-r--r-- 1 john users 0 2009-02-02 23:13 data2
155721 lrwxrwxrwx 1 john users 5 2009-02-02 23:13 data3 -> data1

we have three files. I created a symbolic link based on data1. So does it mean that, data1 and data2 are hardlinks???( Y i say data1 and data2 are hardlinks, because the physical file is in somewhere, it uses the inode number to get to the physical file).

Am i correct here???? please advice..


Thank you

Last edited by john83reuben; 02-02-2009 at 09:18 AM.
 
Old 02-02-2009, 06:33 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Try this: http://publib.boulder.ibm.com/iserie...mstlinkcmp.htm
 
  


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
binary files in C sagar13 Programming 10 10-02-2004 01:29 PM
Binary Files? Teralon 9 Linux - General 2 02-10-2004 10:36 PM
Binary files sodaforce Linux - Software 1 09-07-2003 05:31 PM
Using binary files KDE4me Linux - Newbie 1 04-24-2003 08:00 AM
binary files walterw Programming 7 01-27-2003 08:27 AM

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

All times are GMT -5. The time now is 04:21 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