LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 12-17-2006, 08:34 AM   #1
mohsinjavedawan
LQ Newbie
 
Registered: Dec 2006
Posts: 1

Rep: Reputation: 0
viewing the source code


how can i view the source code for the general commands of the shell
for example ls, echo, cat etc

similarly how can i view the source code for standard c functions for example pow, strcpy, strlen.
 
Old 12-17-2006, 08:42 AM   #2
solnul
Member
 
Registered: Jan 2003
Distribution: Slackware
Posts: 82

Rep: Reputation: 15
The standard shell commands are mostly in the GNU packages bash and coreutils. The standard C library is a GNU package called GLIBC. You can find source for these on ftp.gnu.org/gnu. Other packages you may be interested in are GNU grep, and procps from procps.sf.net.
 
Old 12-17-2006, 08:45 AM   #3
solnul
Member
 
Registered: Jan 2003
Distribution: Slackware
Posts: 82

Rep: Reputation: 15
Oh, one other thing. If you use a distro with package management utilities there is a general answer to your problem. You can use look up which package owns a file, then download its source. For example:

For RPM-based (Fedora, Mandrake, SUSE, ...):
rpm -qf /path/to/file

For Debian/Ubuntu:
dpkg --search /path/to/file
 
Old 12-17-2006, 08:49 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The commands such as ls and cp are supplied by the coreutils package. Download a source package if you don't have one. The C library is called glibc. You can download the source for that as well. Look at "man <function>" and see which header contains the definition. The source for the function is probably in a directory by the same name, minus the .c.
 
  


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
Viewing source code for linux command mohdniyas Linux - Newbie 10 12-11-2006 11:29 AM
LXer: Voip Encryption, source code open source LXer Syndicated Linux News 0 07-09-2006 04:21 PM
viewing kernel`s source code python302 Programming 3 04-12-2006 02:55 PM
Viewing source code for a program... ksoma Programming 3 02-27-2005 05:05 AM


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