LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-01-2011, 12:11 PM   #1
dinakumar12
Member
 
Registered: Mar 2010
Location: INDIA (chennai)
Distribution: centos
Posts: 271
Blog Entries: 7

Rep: Reputation: 18
editing & viewing contents of files in /bin


Hi all,

i just want to know,how can we edit the files of /bin folder.

for ex: we have a file named mkdir which is being executed when we run the mkdir command at the terminal.

I just want to read the code inside that mkdir file. That binary file has to be converted to text,which should be human readable.

Please post your suggestions.

Thanks in advance,
Dinesh.
 
Old 01-01-2011, 12:14 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Usually the man page for a given command gives you some info about the package it's in. For example, for mkdir, the package is coreutils. So, you can go to the web page for coreutils (google it) and obtain the source code.

Edit: there may be package manager specific ways of getting the information too, as well as just googling the executable name, obviously.

Also, I'm not sure what this has to do with servers, so I've reported it to be moved to a more suitable place.

Last edited by Nylex; 01-01-2011 at 12:16 PM.
 
1 members found this post helpful.
Old 01-01-2011, 12:50 PM   #3
dinakumar12
Member
 
Registered: Mar 2010
Location: INDIA (chennai)
Distribution: centos
Posts: 271

Original Poster
Blog Entries: 7

Rep: Reputation: 18
Hi Nylex,

Thank you for your reply and its very much useful.
Sorry for posting this here.
 
Old 01-01-2011, 12:58 PM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
No problem. A mod should move your thread at some point .
 
Old 01-01-2011, 01:04 PM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
If you really want to "find the text" in an elf file, use the strings command; it you want to see everything in a file, with strings readable, use the hexdump -C command. If you want to actually see the source code for the command, download it from the source repository for your distribution.

For your specific example, the generic source code would (probably - I haven't checked this) be in the GNU archive or the Linux kernel archives.

If, on the other hand, you just want to know how to use some command, the command invoked with a -h or --help option will often (but not always) suffice, the man command will usually show more information, and the info command (or pinfo if you've installed it) sometimes gives you even more info.

For example:
Code:
$ mkdir --help
Usage: mkdir [OPTION]... DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.

Mandatory arguments to long options are mandatory for short options too.
  -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask
  -p, --parents     no error if existing, make parent directories as needed
  -v, --verbose     print a message for each created directory
  -Z, --context=CTX  set the SELinux security context of each created
                      directory to CTX
      --help     display this help and exit
      --version  output version information and exit

Report mkdir bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'mkdir invocation'

Last edited by PTrenholme; 01-01-2011 at 01:21 PM. Reason: Added example
 
1 members found this post helpful.
Old 01-01-2011, 04:31 PM   #6
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
Quote:
Originally Posted by dinakumar12 View Post
Hi all,

i just want to know,how can we edit the files of /bin folder.

for ex: we have a file named mkdir which is being executed when we run the mkdir command at the terminal.

I just want to read the code inside that mkdir file. That binary file has to be converted to text,which should be human readable.

Please post your suggestions.

Thanks in advance,
Dinesh.
Be careful what you wish for; you might just get it.

notes
  • 'Human Readable' does not imply 'Human Comprehensible'
  • Even if you got 'Human Comprehensible', it wouldn't necessarily help you with your objectives, if they are to do something different from what is currently occuring

please understand PTrenholme's post (which is very helpful, considering your exact questions, but I suspect that you haven't actually asked for the things that will really help you achieve your aim, whatever that is), and the implications thereof, and tell us more about your actual problem
 
1 members found this post helpful.
Old 01-02-2011, 01:36 PM   #7
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Moved: This thread is more suitable in "Linux Software" and has been moved accordingly to help your thread/question get the exposure it deserves.
 
1 members found this post helpful.
  


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
editing/viewing password files qwertyjjj Linux - Newbie 9 08-09-2009 07:57 PM
Editing contents of 8 files at once mmahulo Linux - Newbie 7 12-22-2008 04:07 AM
Simple Utility for viewing/extracting contents in ISO files Burgin General 5 06-01-2004 11:26 PM
viewing contents of CD drive aymbpc Linux - Newbie 2 08-31-2003 05:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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