LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-02-2008, 03:14 AM   #1
IanGlenn
LQ Newbie
 
Registered: Nov 2004
Posts: 11

Rep: Reputation: 0
Trying to look at sources for common unix/linux commands


I was wondering if there is somewhere where i can look at the source for some basic commands in unix/linux like ls and who.

I'm an aspiring programmer and I'm just curious to see the code.
 
Old 05-02-2008, 04:09 AM   #2
vin2008_linux
LQ Newbie
 
Registered: May 2008
Posts: 3

Rep: Reputation: 0
http://lxr.linux.no/
is the best one to have look @ code


I am not able to compile c code
gcc is not getting path of module.h and kernel.h

#include <module.h> /* Needed by all modules */
#include <kernel.h> /* Needed for KERN_INFO */

int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
=========================
[root@linuxguru.symantec.com][ /usr/src ]gcc -o hello-1.0 hello-1.c
hello-1.c:1:54: error: module.h: No such file or directory
hello-1.c:2:53: error: kernel.h: No such file or directory
hello-1.c: In function ‘init_module’:
hello-1.c:6: error: ‘KERN_INFO’ undeclared (first use in this function)
hello-1.c:6: error: (Each undeclared identifier is reported only once
hello-1.c:6: error: for each function it appears in.)
hello-1.c:6: error: expected ‘)’ before string constant
hello-1.c: In function ‘cleanup_module’:
hello-1.c:14: error: ‘KERN_INFO’ undeclared (first use in this function)
hello-1.c:14: error: expected ‘)’ before string constant
[root@linuxguru.symantec.com][ /usr/src ]vi hello-1.c
=
plz compile @ ur end and let me know ?

Last edited by vin2008_linux; 05-02-2008 at 04:12 AM. Reason: appending some quotes
 
Old 05-02-2008, 04:56 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Quote:
Originally Posted by IanGlenn View Post
I was wondering if there is somewhere where i can look at the source for some basic commands in unix/linux like ls and who.

I'm an aspiring programmer and I'm just curious to see the code.
ftp://ftp.gnu.org/gnu/

also, for a lot of Open-source SW, there are typically project pages at sourceforge.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic commands in unix/linux sathish80 Linux - Newbie 5 03-24-2006 01:45 PM
Linux commands not implemented in UNIX gayjaybird Linux - General 6 01-29-2006 12:04 AM
Cheet Sheet for common linux commands? neocookie Linux - General 7 09-23-2005 03:47 PM
Common Linux Commands/Applications in Suse 9.2 jedcred Linux - Newbie 1 03-12-2005 06:56 PM
What do you think are the top ten UNIX/LINUX commands marigb Linux - Newbie 24 05-17-2004 02:17 AM


All times are GMT -5. The time now is 05:03 PM.

Main Menu
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