download the source code of some commands
Hi all: I want to see some source code of some commands,for example,halt,reboot,uptime,and so on. but i don't kown where to download? can you give me some advice? Thanks in advance!
All commands are bin files. You should find the scripts for them in /usr/bin only. Ashish Bunkar Linux Engineering Dell | BDC office +91-80-28078131, mobile +91-7259183696 Ashish_Bunkar@dell.com<mailto:narayanan_d@dell.com> From: kernelnewbies-bounces@kernelnewbies.org [mailto:kernelnewbies-bounces@kernelnewbies.org] On Behalf Of ?? Sent: Thursday, June 21, 2012 6:19 PM To: kernelnewbies Subject: download the source code of some commands Hi all: I want to see some source code of some commands,for example,halt,reboot,uptime,and so on. but i don't kown where to download? can you give me some advice? Thanks in advance!
2012/6/21 <Ashish_Bunkar@dell.com>
All commands are bin files. You should find the scripts for them in /usr/bin only.****
**
scripts ? can you give an example for an command? Thanks!
**
*Ashish Bunkar*
Linux Engineering****
*Dell* | BDC**
*office* +91-80-28078131, *mobile* +91-7259183696****
Ashish_Bunkar@dell.com <narayanan_d@dell.com>****
** **
** **
** **
*From:* kernelnewbies-bounces@kernelnewbies.org [mailto: kernelnewbies-bounces@kernelnewbies.org] *On Behalf Of *?? *Sent:* Thursday, June 21, 2012 6:19 PM *To:* kernelnewbies *Subject:* download the source code of some commands****
** **
Hi all: I want to see some source code of some commands,for example,halt,reboot,uptime,and so on.
but i don't kown where to download? can you give me some advice?
Thanks in advance!****
王哲 <wangzhe5004@gmail.com> writes:
Hi all: I want to see some source code of some commands,for example,halt,reboot,uptime,and so on.
but i don't kown where to download? can you give me some advice?
Thanks in advance!
Hi, Although this does not relate to kernel, you can still view the codes of common linux/unix commands. ftp.gnu.org hosts most of commands in different packaging. Like "coreutils", "findutils", "netutils" etc. And standalone codes are there for "grep", "ed" etc. You can also get a copy of freebsd dvd. Freebsd dvd's comes with full source code of the core system. cheers.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Thu, Jun 21, 2012 at 8:48 AM, 王哲 <wangzhe5004@gmail.com> wrote:
Hi all: I want to see some source code of some commands,for example,halt,reboot,uptime,and so on.
but i don't kown where to download? can you give me some advice?
Thanks in advance!
You need to figure out how your distro of choice lets you query the filelist for packages. I use openSUSE primarily and it has the Yast tool that lets you do that in the software management section. uptime => coreutils reboot => aaa_base halt => aaa_base Once you know the package your distro uses you can download the corresponding source package for it. You will have better luck learning the process you need to know by asking on a distro specific mailing list. Greg
If you use Debian or other distribution with apt package system. You can use whereis to locate this command. [~]$ whereis halt halt: /sbin/halt /usr/share/man/man5/halt.5.gz /usr/share/man/man8/halt.8.gz Then, use dpkg -S to show which package it's included. This one is: sysvinit. [~]$ dpkg -S /sbin/halt sysvinit: /sbin/halt Now, you can download the source from Debian source, use: [~]$ apt-get source sysvinit Or if you want the original source, use aptitude (or apt-cache) find it's homepage. [~]$ aptitude show sysvinit Package: sysvinit ...... Homepage: http://savannah.nongnu.org/projects/sysvinit At last, get it from there. As for other package systems, I think there should be a way too. Or you can google. On 2012-06-21 20:48:48 +0800, 王哲 wrote:
Hi all: I want to see some source code of some commands,for example,halt,reboot,uptime,and so on.
but i don't kown where to download? can you give me some advice?
Thanks in advance! _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Lei
2012/6/21 Wang Lei <f3d27b@gmail.com>
If you use Debian or other distribution with apt package system.
You can use whereis to locate this command. [~]$ whereis halt halt: /sbin/halt /usr/share/man/man5/halt.5.gz /usr/share/man/man8/halt.8.gz
Then, use dpkg -S to show which package it's included. This one is: sysvinit. [~]$ dpkg -S /sbin/halt sysvinit: /sbin/halt
Now, you can download the source from Debian source, use: [~]$ apt-get source sysvinit
Or if you want the original source, use aptitude (or apt-cache) find it's homepage. [~]$ aptitude show sysvinit Package: sysvinit ...... Homepage: http://savannah.nongnu.org/projects/sysvinit
At last, get it from there. As for other package systems, I think there should be a way too. Or you can google.
Thank you very much ! i follow your steps, and download the source code successfully. On 2012-06-21 20:48:48 +0800, 王哲 wrote:
Hi all: I want to see some source code of some commands,for example,halt,reboot,uptime,and so on.
but i don't kown where to download? can you give me some advice?
Thanks in advance!
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, Lei
participants (6)
-
AFT -
Ashish_Bunkar@Dell.com -
Denis Kirjanov -
Greg Freemyer -
Wang Lei -
王哲