LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 01-23-2009, 04:05 AM   #1
the_cpp
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Rep: Reputation: 0
How to get the source code of command line ?


I just want to see how the command line such as : "cat", "split", "ls"...ect source code ? Are they written in C or other language ? I don't know where to search those ? Anyone could help me out ? Thanks in advance !
 
Old 01-23-2009, 04:13 AM   #2
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
I usually use codesearch.google.com to have a look at the source.
I did a search for you
http://www.google.com/codesearch/p?h...ard%20Stallman
 
Old 01-23-2009, 04:55 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
Remember also that bash (and other shells) also provides some built-in commands that can supersede the stand-alone ones usually found in /bin.
 
Old 01-23-2009, 05:07 AM   #4
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
Many commands are provided by the coreutils package: you can start by downloading the coreutils source tarball and start from there. As already mentioned by David the H. some statements are BASH built-ins, hence you have to look at the BASH source code. And yes, the Linux operating system is written in C as well as most of the common utilities. If you're not sure what a command is (shell script, shell built-in, external command) you can try type.
Code:
$ type type
type is a shell builtin
$ type cat
cat is /bin/cat
$ file /bin/cat
/bin/cat: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for
GNU/Linux 2.6.9, stripped
Good luck!
 
Old 01-23-2009, 06:29 AM   #5
taylor_venable
Member
 
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892

Rep: Reputation: 41
Quote:
Originally Posted by colucix View Post
If you're not sure what a command is (shell script, shell built-in, external command) you can try type.
Oh, that is cool. I didn't know about that!
 
Old 01-24-2009, 01:44 AM   #6
the_cpp
LQ Newbie
 
Registered: Nov 2008
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks a lot guys ! Much more than I respected !
 
Old 01-24-2009, 10:01 AM   #7
renjithrajasekaran
Member
 
Registered: Jan 2009
Posts: 29

Rep: Reputation: 15
Google Is the Best place to start looking ... I am sure - with just the right amount of patience - you'll hit jackpot.


Linux Archive

Last edited by renjithrajasekaran; 01-25-2009 at 04:04 AM.
 
  


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
Executing command line through Code socialjazz Programming 2 10-02-2006 04:09 PM
posting code from command line frankie_DJ Linux - Newbie 3 08-09-2005 09:51 AM
Fortran g95 source-code line truncation feature is annoying elavid Programming 1 06-09-2005 12:15 PM
C program code to run a Linux command line Linh Programming 10 06-11-2003 02:59 PM
Add lines of code to files from command line robeb Linux - General 2 06-12-2002 04:54 AM


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