Do the common programs (for example: “ls”, “cat”) in Linux and BSD come from the same source code?...












26
















This question already has an answer here:




  • Were all Unix commands re-written in Linux?

    1 answer




Both Linux and BSD have common programs like ls and cat and echo and kill.



Do they come from the same source code, or do both and Linux and BSD own their own unique source code for these programs?










share|improve this question















marked as duplicate by a CVn, ilkkachu, Sergiy Kolodyazhnyy, Thomas, elbarna Mar 17 at 20:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 10





    Linux kernel itself doesn't have such code, it's just kernel. Depending on what kind of tool you use, these tools may or may not come from the same source code, fun fact is, they're usually not.

    – 炸鱼薯条德里克
    Mar 15 at 3:53






  • 1





    Most tools have at least a BSD or Gnu heritage, then there are some originating from the Linux community or embedded projects (busybox). There are nearly no low level commands with a single implementation (but this is often the case for applications, related to naming rights)

    – eckes
    Mar 15 at 11:09
















26
















This question already has an answer here:




  • Were all Unix commands re-written in Linux?

    1 answer




Both Linux and BSD have common programs like ls and cat and echo and kill.



Do they come from the same source code, or do both and Linux and BSD own their own unique source code for these programs?










share|improve this question















marked as duplicate by a CVn, ilkkachu, Sergiy Kolodyazhnyy, Thomas, elbarna Mar 17 at 20:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 10





    Linux kernel itself doesn't have such code, it's just kernel. Depending on what kind of tool you use, these tools may or may not come from the same source code, fun fact is, they're usually not.

    – 炸鱼薯条德里克
    Mar 15 at 3:53






  • 1





    Most tools have at least a BSD or Gnu heritage, then there are some originating from the Linux community or embedded projects (busybox). There are nearly no low level commands with a single implementation (but this is often the case for applications, related to naming rights)

    – eckes
    Mar 15 at 11:09














26












26








26


7







This question already has an answer here:




  • Were all Unix commands re-written in Linux?

    1 answer




Both Linux and BSD have common programs like ls and cat and echo and kill.



Do they come from the same source code, or do both and Linux and BSD own their own unique source code for these programs?










share|improve this question

















This question already has an answer here:




  • Were all Unix commands re-written in Linux?

    1 answer




Both Linux and BSD have common programs like ls and cat and echo and kill.



Do they come from the same source code, or do both and Linux and BSD own their own unique source code for these programs?





This question already has an answer here:




  • Were all Unix commands re-written in Linux?

    1 answer








linux source bsd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 15 at 21:17









Sergiy Kolodyazhnyy

10.7k42763




10.7k42763










asked Mar 15 at 3:46









user341875user341875

13423




13423




marked as duplicate by a CVn, ilkkachu, Sergiy Kolodyazhnyy, Thomas, elbarna Mar 17 at 20:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by a CVn, ilkkachu, Sergiy Kolodyazhnyy, Thomas, elbarna Mar 17 at 20:29


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 10





    Linux kernel itself doesn't have such code, it's just kernel. Depending on what kind of tool you use, these tools may or may not come from the same source code, fun fact is, they're usually not.

    – 炸鱼薯条德里克
    Mar 15 at 3:53






  • 1





    Most tools have at least a BSD or Gnu heritage, then there are some originating from the Linux community or embedded projects (busybox). There are nearly no low level commands with a single implementation (but this is often the case for applications, related to naming rights)

    – eckes
    Mar 15 at 11:09














  • 10





    Linux kernel itself doesn't have such code, it's just kernel. Depending on what kind of tool you use, these tools may or may not come from the same source code, fun fact is, they're usually not.

    – 炸鱼薯条德里克
    Mar 15 at 3:53






  • 1





    Most tools have at least a BSD or Gnu heritage, then there are some originating from the Linux community or embedded projects (busybox). There are nearly no low level commands with a single implementation (but this is often the case for applications, related to naming rights)

    – eckes
    Mar 15 at 11:09








10




10





Linux kernel itself doesn't have such code, it's just kernel. Depending on what kind of tool you use, these tools may or may not come from the same source code, fun fact is, they're usually not.

– 炸鱼薯条德里克
Mar 15 at 3:53





Linux kernel itself doesn't have such code, it's just kernel. Depending on what kind of tool you use, these tools may or may not come from the same source code, fun fact is, they're usually not.

– 炸鱼薯条德里克
Mar 15 at 3:53




1




1





Most tools have at least a BSD or Gnu heritage, then there are some originating from the Linux community or embedded projects (busybox). There are nearly no low level commands with a single implementation (but this is often the case for applications, related to naming rights)

– eckes
Mar 15 at 11:09





Most tools have at least a BSD or Gnu heritage, then there are some originating from the Linux community or embedded projects (busybox). There are nearly no low level commands with a single implementation (but this is often the case for applications, related to naming rights)

– eckes
Mar 15 at 11:09










5 Answers
5






active

oldest

votes


















40














Linux is a kernel. It does not have the code for applications programs in the first place.



Linux-based operating systems do not even necessarily use the same source code as one another, let alone the same code as on the BSDs. There are famously multiple implementations of several fairly basic programs.



These include, but are not limited to:





  • ifconfig had 2 implementations, one in GNU inetutils and the other in NET-3 net-tools. It now has 3, the third being mine. (See https://unix.stackexchange.com/a/504084/5132.)


  • su has 2 implementations, one in util-linux and the other in shadow. Debian switched from one to the other in 2018, making several old questions and answers here on this WWW site wrong. (See https://unix.stackexchange.com/a/460769/5132 and, for one example, "su vs su - (on Debian): why is PATH the same?".)

  • There are seemingly umpteen (actually 4 on Debian/Ubuntu) possible places whence one can obtain the mailx command: GNU Mailutils, BSD mailx, NMH, and s-nail. (See https://unix.stackexchange.com/a/489510/5132.)


The BSDs are operating systems. They do contain the code for these programs. However, there is no single BSD operating system, and the code for such programs does sometimes vary amongst NetBSD, FreeBSD, OpenBSD, and DragonFly BSD. Moreover, it is definitely different to the code used for the several Linux-based operating systems.



Famously, Apple/NeXT used BSD applications softwares in MacOS/NeXTSTEP but enhanced several programs to support ACLs in ways different to the ways that the (other) BSDs did. One sets access controls using the chmod command, for example. So the Darwin versions of these commands are different yet again.



There are three added twists.



Programs like kill and echo are usually shell builtins. So the code for these commands varies according to what shell you are using, rather than what operating system.



Then there are BusyBox and ToyBox, available both for Linux-based operating systems and the BSDs and even used as the primary implementations of such commands on a few of the former, which have their own implementations of many commands.



Then there is OpenSolaris, from which come the likes of Illumos and Schillix, with the Solaris implementations of all of these tools, which is different yet again.



There are whole histories here, encompassing the original split between BSD and AT&T Unix, through the efforts to "PD" clone many Unix programs in the late 1980s and 1990s, around three decades of shuffling around after that, the whole open-source release of the code for Solaris, and OpenBSD's reimplementations of several things. Even the histories of tools that one might be misled into thinking have one implementation such as cron (which a lot of people erroneously think is the original Unix tool, or erroneously think is at least one single flavour written as "PD cron" by Paul Vixie in 1987, or do not realize has workalike replacements written by other people in the years since) are non-trivial.






share|improve this answer





















  • 2





    There's even PacBSD which is BSD user on Linux kernel...

    – Mehrdad
    Mar 15 at 10:16











  • BSD was to my knowledged used in Mac OS X/NextStep because the license allowed them to use it with closed source software. NeXTStep included instructions for getting the source for the open source components. The same reasoning may have been used in Linux for providing a GPL userland with a GPL kernel.

    – Thorbjørn Ravn Andersen
    Mar 15 at 15:00











  • Good answer, but it would benefit from a little explanation of the origins of the common Linux userlands.

    – Russell Borogove
    Mar 15 at 15:17






  • 1





    That's really beyond the scope here, and should be a Q&A in its own right. We even have some such Q&As already. Consider unix.stackexchange.com/q/81302/5132 , for example. Q&As about the histories of the other toolsets would no doubt be welcome.

    – JdeBP
    Mar 15 at 15:25








  • 2





    Programs like kill and echo are usually shell builtins, true, but there's of course /bin/ implementations for POSIX compliance, and those will vary by operating system. GNU stuff on Linux, BSD versions in BSDs and Mac OS X. I don't know what AIX or HPUX would use, but probably their own implementations. Good answer, +1

    – Sergiy Kolodyazhnyy
    Mar 15 at 21:20



















13















Are these programs in Linux and BSD the same?




The short answer is: Not necessarily.



The source code of common programs such as ls, cat, echo, kill, etc. depend on what userland they come from. In other words, the userland your system uses. The most common userland used with the Linux kernel is GNU - hence the name GNU/Linux. Other userlands have been integrated with the Linux kernel, however.



The BSD's typically have their own userland that is developed separately from others like GNU. Even the BSD's themselves have different code bases. For example, both FreeBSD and OpenBSD have a "BSD userland", but their code base is different. If you look at their man pages (ps for example), they have different arguments that can be used.



One reason POSIX was developed was to address the issue of multiple code bases. If the common utilities delivered with a userland are POSIX compliant, you can assure that they will work (almost) the same whether they come from GNU, FreeBSD, OpenBSD, AIX, or other UNIX based systems.



As you probably know, the userlands listed above (except AIX) are open source. Feel free to poke around their code repositories and you will quickly see that they are not exactly the same.



Note: Even though GNU/Linux is the most popular, there have been attempts to use a GNU userland with FreeBSD/NetBSD kernels in the past. You can read more about them on wikipedia here.






share|improve this answer































    5














    They have diffent sources, for example: https://github.com/freebsd/freebsd/blob/master/bin/kill/kill.c and https://github.com/karelzak/util-linux/blob/master/misc-utils/kill.c






    share|improve this answer































      3














      First, I understand Linux as meaning GNU/Linux, which is the operating system, Linux is merely the kernel.



      Now, the source code is NOT the same. The GNU team created the utils, inspired by the UNIX tools that existed, and extended some of these.



      GNU kill and echo are shell built-ins in Bash, the default shell on most GNU systems, so they come with your shell, as in bash.



      ls, and cat are different, separate programs, inspired by UNIX ls and cat, respectively.



      There is a history of UNIX graph that explains where things come from, as you can see, GNU/Linux popped up without any direct ancestry.



      enter image description here



      Of the UNIX flavors, which relate to UNIX time sharing system, these commands all come from that, however, they could have been re-written multiple times.



      You can compare FreeBSD cat source code with GNU cat source code.



      Why do I not refer to GNU/Linux right through ? The waters are murky, you can install the GNU tools on the BSD's as well as on other UNIX systems, well, you can even install them on windows.



      Debian, of Debian GNU/Linux glory, on which Ubuntu and Mint are based (just two examples), offers a GNU distribution with a FreeBSD kernel: GNU/kFreeBSD



      Yes, the graph is outdated ...






      share|improve this answer


























      • I think this is the most comprehensive infographic on major *nixes I've seen thus far. +1 for that

        – Sergiy Kolodyazhnyy
        Mar 16 at 3:00






      • 2





        The infographic has several major issues IMHO. IRIX 5.x was based on BSD. Solaris is/was based on SVR5. Linux 0.01 did not contain any Minix code so a parent-child relationship may be stretching the relationship.

        – Doug O'Neal
        Mar 16 at 16:42



















      1














      In addition to the above correct answers, you will find that the default shell on (almost?) every Linux distro is bash, while the default shell on at least OpenBSD and FreeBSD is not bash. It probably is csh, or ksh, but it is a couple of years since I used any BSD variant, so I am not absolutely sure. Anyway it never had the functionality of bash, even the way in which the previous command can be repeated was confusingly different. The difference in shells may change which of the simpler commands are shell built-ins and which are freestanding programs.



      With several distros now providing the GNU userland with an xBSD kernel, and potentially vice-versa, there is no one absolutely definitive answer to the question. The only absolutely foolproof way of knowing what you have on your system is to use your package manager to download the source and examine it, or examine it on-line if your distro has browseable source, although checking the license which applies would give a fairly good indication.






      share|improve this answer



















      • 2





        Enjoy unix.stackexchange.com/q/322035/5132 , unix.stackexchange.com/q/193204/5132 , unix.stackexchange.com/q/496259/5132 , and many others here. And you'll stir up M. Chazelas if you claim that the C shell doesn't have the history expansion that the Bourne Again shell got from the C shell. (-:

        – JdeBP
        Mar 15 at 15:53


















      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      40














      Linux is a kernel. It does not have the code for applications programs in the first place.



      Linux-based operating systems do not even necessarily use the same source code as one another, let alone the same code as on the BSDs. There are famously multiple implementations of several fairly basic programs.



      These include, but are not limited to:





      • ifconfig had 2 implementations, one in GNU inetutils and the other in NET-3 net-tools. It now has 3, the third being mine. (See https://unix.stackexchange.com/a/504084/5132.)


      • su has 2 implementations, one in util-linux and the other in shadow. Debian switched from one to the other in 2018, making several old questions and answers here on this WWW site wrong. (See https://unix.stackexchange.com/a/460769/5132 and, for one example, "su vs su - (on Debian): why is PATH the same?".)

      • There are seemingly umpteen (actually 4 on Debian/Ubuntu) possible places whence one can obtain the mailx command: GNU Mailutils, BSD mailx, NMH, and s-nail. (See https://unix.stackexchange.com/a/489510/5132.)


      The BSDs are operating systems. They do contain the code for these programs. However, there is no single BSD operating system, and the code for such programs does sometimes vary amongst NetBSD, FreeBSD, OpenBSD, and DragonFly BSD. Moreover, it is definitely different to the code used for the several Linux-based operating systems.



      Famously, Apple/NeXT used BSD applications softwares in MacOS/NeXTSTEP but enhanced several programs to support ACLs in ways different to the ways that the (other) BSDs did. One sets access controls using the chmod command, for example. So the Darwin versions of these commands are different yet again.



      There are three added twists.



      Programs like kill and echo are usually shell builtins. So the code for these commands varies according to what shell you are using, rather than what operating system.



      Then there are BusyBox and ToyBox, available both for Linux-based operating systems and the BSDs and even used as the primary implementations of such commands on a few of the former, which have their own implementations of many commands.



      Then there is OpenSolaris, from which come the likes of Illumos and Schillix, with the Solaris implementations of all of these tools, which is different yet again.



      There are whole histories here, encompassing the original split between BSD and AT&T Unix, through the efforts to "PD" clone many Unix programs in the late 1980s and 1990s, around three decades of shuffling around after that, the whole open-source release of the code for Solaris, and OpenBSD's reimplementations of several things. Even the histories of tools that one might be misled into thinking have one implementation such as cron (which a lot of people erroneously think is the original Unix tool, or erroneously think is at least one single flavour written as "PD cron" by Paul Vixie in 1987, or do not realize has workalike replacements written by other people in the years since) are non-trivial.






      share|improve this answer





















      • 2





        There's even PacBSD which is BSD user on Linux kernel...

        – Mehrdad
        Mar 15 at 10:16











      • BSD was to my knowledged used in Mac OS X/NextStep because the license allowed them to use it with closed source software. NeXTStep included instructions for getting the source for the open source components. The same reasoning may have been used in Linux for providing a GPL userland with a GPL kernel.

        – Thorbjørn Ravn Andersen
        Mar 15 at 15:00











      • Good answer, but it would benefit from a little explanation of the origins of the common Linux userlands.

        – Russell Borogove
        Mar 15 at 15:17






      • 1





        That's really beyond the scope here, and should be a Q&A in its own right. We even have some such Q&As already. Consider unix.stackexchange.com/q/81302/5132 , for example. Q&As about the histories of the other toolsets would no doubt be welcome.

        – JdeBP
        Mar 15 at 15:25








      • 2





        Programs like kill and echo are usually shell builtins, true, but there's of course /bin/ implementations for POSIX compliance, and those will vary by operating system. GNU stuff on Linux, BSD versions in BSDs and Mac OS X. I don't know what AIX or HPUX would use, but probably their own implementations. Good answer, +1

        – Sergiy Kolodyazhnyy
        Mar 15 at 21:20
















      40














      Linux is a kernel. It does not have the code for applications programs in the first place.



      Linux-based operating systems do not even necessarily use the same source code as one another, let alone the same code as on the BSDs. There are famously multiple implementations of several fairly basic programs.



      These include, but are not limited to:





      • ifconfig had 2 implementations, one in GNU inetutils and the other in NET-3 net-tools. It now has 3, the third being mine. (See https://unix.stackexchange.com/a/504084/5132.)


      • su has 2 implementations, one in util-linux and the other in shadow. Debian switched from one to the other in 2018, making several old questions and answers here on this WWW site wrong. (See https://unix.stackexchange.com/a/460769/5132 and, for one example, "su vs su - (on Debian): why is PATH the same?".)

      • There are seemingly umpteen (actually 4 on Debian/Ubuntu) possible places whence one can obtain the mailx command: GNU Mailutils, BSD mailx, NMH, and s-nail. (See https://unix.stackexchange.com/a/489510/5132.)


      The BSDs are operating systems. They do contain the code for these programs. However, there is no single BSD operating system, and the code for such programs does sometimes vary amongst NetBSD, FreeBSD, OpenBSD, and DragonFly BSD. Moreover, it is definitely different to the code used for the several Linux-based operating systems.



      Famously, Apple/NeXT used BSD applications softwares in MacOS/NeXTSTEP but enhanced several programs to support ACLs in ways different to the ways that the (other) BSDs did. One sets access controls using the chmod command, for example. So the Darwin versions of these commands are different yet again.



      There are three added twists.



      Programs like kill and echo are usually shell builtins. So the code for these commands varies according to what shell you are using, rather than what operating system.



      Then there are BusyBox and ToyBox, available both for Linux-based operating systems and the BSDs and even used as the primary implementations of such commands on a few of the former, which have their own implementations of many commands.



      Then there is OpenSolaris, from which come the likes of Illumos and Schillix, with the Solaris implementations of all of these tools, which is different yet again.



      There are whole histories here, encompassing the original split between BSD and AT&T Unix, through the efforts to "PD" clone many Unix programs in the late 1980s and 1990s, around three decades of shuffling around after that, the whole open-source release of the code for Solaris, and OpenBSD's reimplementations of several things. Even the histories of tools that one might be misled into thinking have one implementation such as cron (which a lot of people erroneously think is the original Unix tool, or erroneously think is at least one single flavour written as "PD cron" by Paul Vixie in 1987, or do not realize has workalike replacements written by other people in the years since) are non-trivial.






      share|improve this answer





















      • 2





        There's even PacBSD which is BSD user on Linux kernel...

        – Mehrdad
        Mar 15 at 10:16











      • BSD was to my knowledged used in Mac OS X/NextStep because the license allowed them to use it with closed source software. NeXTStep included instructions for getting the source for the open source components. The same reasoning may have been used in Linux for providing a GPL userland with a GPL kernel.

        – Thorbjørn Ravn Andersen
        Mar 15 at 15:00











      • Good answer, but it would benefit from a little explanation of the origins of the common Linux userlands.

        – Russell Borogove
        Mar 15 at 15:17






      • 1





        That's really beyond the scope here, and should be a Q&A in its own right. We even have some such Q&As already. Consider unix.stackexchange.com/q/81302/5132 , for example. Q&As about the histories of the other toolsets would no doubt be welcome.

        – JdeBP
        Mar 15 at 15:25








      • 2





        Programs like kill and echo are usually shell builtins, true, but there's of course /bin/ implementations for POSIX compliance, and those will vary by operating system. GNU stuff on Linux, BSD versions in BSDs and Mac OS X. I don't know what AIX or HPUX would use, but probably their own implementations. Good answer, +1

        – Sergiy Kolodyazhnyy
        Mar 15 at 21:20














      40












      40








      40







      Linux is a kernel. It does not have the code for applications programs in the first place.



      Linux-based operating systems do not even necessarily use the same source code as one another, let alone the same code as on the BSDs. There are famously multiple implementations of several fairly basic programs.



      These include, but are not limited to:





      • ifconfig had 2 implementations, one in GNU inetutils and the other in NET-3 net-tools. It now has 3, the third being mine. (See https://unix.stackexchange.com/a/504084/5132.)


      • su has 2 implementations, one in util-linux and the other in shadow. Debian switched from one to the other in 2018, making several old questions and answers here on this WWW site wrong. (See https://unix.stackexchange.com/a/460769/5132 and, for one example, "su vs su - (on Debian): why is PATH the same?".)

      • There are seemingly umpteen (actually 4 on Debian/Ubuntu) possible places whence one can obtain the mailx command: GNU Mailutils, BSD mailx, NMH, and s-nail. (See https://unix.stackexchange.com/a/489510/5132.)


      The BSDs are operating systems. They do contain the code for these programs. However, there is no single BSD operating system, and the code for such programs does sometimes vary amongst NetBSD, FreeBSD, OpenBSD, and DragonFly BSD. Moreover, it is definitely different to the code used for the several Linux-based operating systems.



      Famously, Apple/NeXT used BSD applications softwares in MacOS/NeXTSTEP but enhanced several programs to support ACLs in ways different to the ways that the (other) BSDs did. One sets access controls using the chmod command, for example. So the Darwin versions of these commands are different yet again.



      There are three added twists.



      Programs like kill and echo are usually shell builtins. So the code for these commands varies according to what shell you are using, rather than what operating system.



      Then there are BusyBox and ToyBox, available both for Linux-based operating systems and the BSDs and even used as the primary implementations of such commands on a few of the former, which have their own implementations of many commands.



      Then there is OpenSolaris, from which come the likes of Illumos and Schillix, with the Solaris implementations of all of these tools, which is different yet again.



      There are whole histories here, encompassing the original split between BSD and AT&T Unix, through the efforts to "PD" clone many Unix programs in the late 1980s and 1990s, around three decades of shuffling around after that, the whole open-source release of the code for Solaris, and OpenBSD's reimplementations of several things. Even the histories of tools that one might be misled into thinking have one implementation such as cron (which a lot of people erroneously think is the original Unix tool, or erroneously think is at least one single flavour written as "PD cron" by Paul Vixie in 1987, or do not realize has workalike replacements written by other people in the years since) are non-trivial.






      share|improve this answer















      Linux is a kernel. It does not have the code for applications programs in the first place.



      Linux-based operating systems do not even necessarily use the same source code as one another, let alone the same code as on the BSDs. There are famously multiple implementations of several fairly basic programs.



      These include, but are not limited to:





      • ifconfig had 2 implementations, one in GNU inetutils and the other in NET-3 net-tools. It now has 3, the third being mine. (See https://unix.stackexchange.com/a/504084/5132.)


      • su has 2 implementations, one in util-linux and the other in shadow. Debian switched from one to the other in 2018, making several old questions and answers here on this WWW site wrong. (See https://unix.stackexchange.com/a/460769/5132 and, for one example, "su vs su - (on Debian): why is PATH the same?".)

      • There are seemingly umpteen (actually 4 on Debian/Ubuntu) possible places whence one can obtain the mailx command: GNU Mailutils, BSD mailx, NMH, and s-nail. (See https://unix.stackexchange.com/a/489510/5132.)


      The BSDs are operating systems. They do contain the code for these programs. However, there is no single BSD operating system, and the code for such programs does sometimes vary amongst NetBSD, FreeBSD, OpenBSD, and DragonFly BSD. Moreover, it is definitely different to the code used for the several Linux-based operating systems.



      Famously, Apple/NeXT used BSD applications softwares in MacOS/NeXTSTEP but enhanced several programs to support ACLs in ways different to the ways that the (other) BSDs did. One sets access controls using the chmod command, for example. So the Darwin versions of these commands are different yet again.



      There are three added twists.



      Programs like kill and echo are usually shell builtins. So the code for these commands varies according to what shell you are using, rather than what operating system.



      Then there are BusyBox and ToyBox, available both for Linux-based operating systems and the BSDs and even used as the primary implementations of such commands on a few of the former, which have their own implementations of many commands.



      Then there is OpenSolaris, from which come the likes of Illumos and Schillix, with the Solaris implementations of all of these tools, which is different yet again.



      There are whole histories here, encompassing the original split between BSD and AT&T Unix, through the efforts to "PD" clone many Unix programs in the late 1980s and 1990s, around three decades of shuffling around after that, the whole open-source release of the code for Solaris, and OpenBSD's reimplementations of several things. Even the histories of tools that one might be misled into thinking have one implementation such as cron (which a lot of people erroneously think is the original Unix tool, or erroneously think is at least one single flavour written as "PD cron" by Paul Vixie in 1987, or do not realize has workalike replacements written by other people in the years since) are non-trivial.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 15 at 11:38

























      answered Mar 15 at 8:03









      JdeBPJdeBP

      37.5k478180




      37.5k478180








      • 2





        There's even PacBSD which is BSD user on Linux kernel...

        – Mehrdad
        Mar 15 at 10:16











      • BSD was to my knowledged used in Mac OS X/NextStep because the license allowed them to use it with closed source software. NeXTStep included instructions for getting the source for the open source components. The same reasoning may have been used in Linux for providing a GPL userland with a GPL kernel.

        – Thorbjørn Ravn Andersen
        Mar 15 at 15:00











      • Good answer, but it would benefit from a little explanation of the origins of the common Linux userlands.

        – Russell Borogove
        Mar 15 at 15:17






      • 1





        That's really beyond the scope here, and should be a Q&A in its own right. We even have some such Q&As already. Consider unix.stackexchange.com/q/81302/5132 , for example. Q&As about the histories of the other toolsets would no doubt be welcome.

        – JdeBP
        Mar 15 at 15:25








      • 2





        Programs like kill and echo are usually shell builtins, true, but there's of course /bin/ implementations for POSIX compliance, and those will vary by operating system. GNU stuff on Linux, BSD versions in BSDs and Mac OS X. I don't know what AIX or HPUX would use, but probably their own implementations. Good answer, +1

        – Sergiy Kolodyazhnyy
        Mar 15 at 21:20














      • 2





        There's even PacBSD which is BSD user on Linux kernel...

        – Mehrdad
        Mar 15 at 10:16











      • BSD was to my knowledged used in Mac OS X/NextStep because the license allowed them to use it with closed source software. NeXTStep included instructions for getting the source for the open source components. The same reasoning may have been used in Linux for providing a GPL userland with a GPL kernel.

        – Thorbjørn Ravn Andersen
        Mar 15 at 15:00











      • Good answer, but it would benefit from a little explanation of the origins of the common Linux userlands.

        – Russell Borogove
        Mar 15 at 15:17






      • 1





        That's really beyond the scope here, and should be a Q&A in its own right. We even have some such Q&As already. Consider unix.stackexchange.com/q/81302/5132 , for example. Q&As about the histories of the other toolsets would no doubt be welcome.

        – JdeBP
        Mar 15 at 15:25








      • 2





        Programs like kill and echo are usually shell builtins, true, but there's of course /bin/ implementations for POSIX compliance, and those will vary by operating system. GNU stuff on Linux, BSD versions in BSDs and Mac OS X. I don't know what AIX or HPUX would use, but probably their own implementations. Good answer, +1

        – Sergiy Kolodyazhnyy
        Mar 15 at 21:20








      2




      2





      There's even PacBSD which is BSD user on Linux kernel...

      – Mehrdad
      Mar 15 at 10:16





      There's even PacBSD which is BSD user on Linux kernel...

      – Mehrdad
      Mar 15 at 10:16













      BSD was to my knowledged used in Mac OS X/NextStep because the license allowed them to use it with closed source software. NeXTStep included instructions for getting the source for the open source components. The same reasoning may have been used in Linux for providing a GPL userland with a GPL kernel.

      – Thorbjørn Ravn Andersen
      Mar 15 at 15:00





      BSD was to my knowledged used in Mac OS X/NextStep because the license allowed them to use it with closed source software. NeXTStep included instructions for getting the source for the open source components. The same reasoning may have been used in Linux for providing a GPL userland with a GPL kernel.

      – Thorbjørn Ravn Andersen
      Mar 15 at 15:00













      Good answer, but it would benefit from a little explanation of the origins of the common Linux userlands.

      – Russell Borogove
      Mar 15 at 15:17





      Good answer, but it would benefit from a little explanation of the origins of the common Linux userlands.

      – Russell Borogove
      Mar 15 at 15:17




      1




      1





      That's really beyond the scope here, and should be a Q&A in its own right. We even have some such Q&As already. Consider unix.stackexchange.com/q/81302/5132 , for example. Q&As about the histories of the other toolsets would no doubt be welcome.

      – JdeBP
      Mar 15 at 15:25







      That's really beyond the scope here, and should be a Q&A in its own right. We even have some such Q&As already. Consider unix.stackexchange.com/q/81302/5132 , for example. Q&As about the histories of the other toolsets would no doubt be welcome.

      – JdeBP
      Mar 15 at 15:25






      2




      2





      Programs like kill and echo are usually shell builtins, true, but there's of course /bin/ implementations for POSIX compliance, and those will vary by operating system. GNU stuff on Linux, BSD versions in BSDs and Mac OS X. I don't know what AIX or HPUX would use, but probably their own implementations. Good answer, +1

      – Sergiy Kolodyazhnyy
      Mar 15 at 21:20





      Programs like kill and echo are usually shell builtins, true, but there's of course /bin/ implementations for POSIX compliance, and those will vary by operating system. GNU stuff on Linux, BSD versions in BSDs and Mac OS X. I don't know what AIX or HPUX would use, but probably their own implementations. Good answer, +1

      – Sergiy Kolodyazhnyy
      Mar 15 at 21:20













      13















      Are these programs in Linux and BSD the same?




      The short answer is: Not necessarily.



      The source code of common programs such as ls, cat, echo, kill, etc. depend on what userland they come from. In other words, the userland your system uses. The most common userland used with the Linux kernel is GNU - hence the name GNU/Linux. Other userlands have been integrated with the Linux kernel, however.



      The BSD's typically have their own userland that is developed separately from others like GNU. Even the BSD's themselves have different code bases. For example, both FreeBSD and OpenBSD have a "BSD userland", but their code base is different. If you look at their man pages (ps for example), they have different arguments that can be used.



      One reason POSIX was developed was to address the issue of multiple code bases. If the common utilities delivered with a userland are POSIX compliant, you can assure that they will work (almost) the same whether they come from GNU, FreeBSD, OpenBSD, AIX, or other UNIX based systems.



      As you probably know, the userlands listed above (except AIX) are open source. Feel free to poke around their code repositories and you will quickly see that they are not exactly the same.



      Note: Even though GNU/Linux is the most popular, there have been attempts to use a GNU userland with FreeBSD/NetBSD kernels in the past. You can read more about them on wikipedia here.






      share|improve this answer




























        13















        Are these programs in Linux and BSD the same?




        The short answer is: Not necessarily.



        The source code of common programs such as ls, cat, echo, kill, etc. depend on what userland they come from. In other words, the userland your system uses. The most common userland used with the Linux kernel is GNU - hence the name GNU/Linux. Other userlands have been integrated with the Linux kernel, however.



        The BSD's typically have their own userland that is developed separately from others like GNU. Even the BSD's themselves have different code bases. For example, both FreeBSD and OpenBSD have a "BSD userland", but their code base is different. If you look at their man pages (ps for example), they have different arguments that can be used.



        One reason POSIX was developed was to address the issue of multiple code bases. If the common utilities delivered with a userland are POSIX compliant, you can assure that they will work (almost) the same whether they come from GNU, FreeBSD, OpenBSD, AIX, or other UNIX based systems.



        As you probably know, the userlands listed above (except AIX) are open source. Feel free to poke around their code repositories and you will quickly see that they are not exactly the same.



        Note: Even though GNU/Linux is the most popular, there have been attempts to use a GNU userland with FreeBSD/NetBSD kernels in the past. You can read more about them on wikipedia here.






        share|improve this answer


























          13












          13








          13








          Are these programs in Linux and BSD the same?




          The short answer is: Not necessarily.



          The source code of common programs such as ls, cat, echo, kill, etc. depend on what userland they come from. In other words, the userland your system uses. The most common userland used with the Linux kernel is GNU - hence the name GNU/Linux. Other userlands have been integrated with the Linux kernel, however.



          The BSD's typically have their own userland that is developed separately from others like GNU. Even the BSD's themselves have different code bases. For example, both FreeBSD and OpenBSD have a "BSD userland", but their code base is different. If you look at their man pages (ps for example), they have different arguments that can be used.



          One reason POSIX was developed was to address the issue of multiple code bases. If the common utilities delivered with a userland are POSIX compliant, you can assure that they will work (almost) the same whether they come from GNU, FreeBSD, OpenBSD, AIX, or other UNIX based systems.



          As you probably know, the userlands listed above (except AIX) are open source. Feel free to poke around their code repositories and you will quickly see that they are not exactly the same.



          Note: Even though GNU/Linux is the most popular, there have been attempts to use a GNU userland with FreeBSD/NetBSD kernels in the past. You can read more about them on wikipedia here.






          share|improve this answer














          Are these programs in Linux and BSD the same?




          The short answer is: Not necessarily.



          The source code of common programs such as ls, cat, echo, kill, etc. depend on what userland they come from. In other words, the userland your system uses. The most common userland used with the Linux kernel is GNU - hence the name GNU/Linux. Other userlands have been integrated with the Linux kernel, however.



          The BSD's typically have their own userland that is developed separately from others like GNU. Even the BSD's themselves have different code bases. For example, both FreeBSD and OpenBSD have a "BSD userland", but their code base is different. If you look at their man pages (ps for example), they have different arguments that can be used.



          One reason POSIX was developed was to address the issue of multiple code bases. If the common utilities delivered with a userland are POSIX compliant, you can assure that they will work (almost) the same whether they come from GNU, FreeBSD, OpenBSD, AIX, or other UNIX based systems.



          As you probably know, the userlands listed above (except AIX) are open source. Feel free to poke around their code repositories and you will quickly see that they are not exactly the same.



          Note: Even though GNU/Linux is the most popular, there have been attempts to use a GNU userland with FreeBSD/NetBSD kernels in the past. You can read more about them on wikipedia here.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 15 at 8:26









          PeschkePeschke

          2,841926




          2,841926























              5














              They have diffent sources, for example: https://github.com/freebsd/freebsd/blob/master/bin/kill/kill.c and https://github.com/karelzak/util-linux/blob/master/misc-utils/kill.c






              share|improve this answer




























                5














                They have diffent sources, for example: https://github.com/freebsd/freebsd/blob/master/bin/kill/kill.c and https://github.com/karelzak/util-linux/blob/master/misc-utils/kill.c






                share|improve this answer


























                  5












                  5








                  5







                  They have diffent sources, for example: https://github.com/freebsd/freebsd/blob/master/bin/kill/kill.c and https://github.com/karelzak/util-linux/blob/master/misc-utils/kill.c






                  share|improve this answer













                  They have diffent sources, for example: https://github.com/freebsd/freebsd/blob/master/bin/kill/kill.c and https://github.com/karelzak/util-linux/blob/master/misc-utils/kill.c







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 15 at 4:17









                  Fedor DikarevFedor Dikarev

                  1,103310




                  1,103310























                      3














                      First, I understand Linux as meaning GNU/Linux, which is the operating system, Linux is merely the kernel.



                      Now, the source code is NOT the same. The GNU team created the utils, inspired by the UNIX tools that existed, and extended some of these.



                      GNU kill and echo are shell built-ins in Bash, the default shell on most GNU systems, so they come with your shell, as in bash.



                      ls, and cat are different, separate programs, inspired by UNIX ls and cat, respectively.



                      There is a history of UNIX graph that explains where things come from, as you can see, GNU/Linux popped up without any direct ancestry.



                      enter image description here



                      Of the UNIX flavors, which relate to UNIX time sharing system, these commands all come from that, however, they could have been re-written multiple times.



                      You can compare FreeBSD cat source code with GNU cat source code.



                      Why do I not refer to GNU/Linux right through ? The waters are murky, you can install the GNU tools on the BSD's as well as on other UNIX systems, well, you can even install them on windows.



                      Debian, of Debian GNU/Linux glory, on which Ubuntu and Mint are based (just two examples), offers a GNU distribution with a FreeBSD kernel: GNU/kFreeBSD



                      Yes, the graph is outdated ...






                      share|improve this answer


























                      • I think this is the most comprehensive infographic on major *nixes I've seen thus far. +1 for that

                        – Sergiy Kolodyazhnyy
                        Mar 16 at 3:00






                      • 2





                        The infographic has several major issues IMHO. IRIX 5.x was based on BSD. Solaris is/was based on SVR5. Linux 0.01 did not contain any Minix code so a parent-child relationship may be stretching the relationship.

                        – Doug O'Neal
                        Mar 16 at 16:42
















                      3














                      First, I understand Linux as meaning GNU/Linux, which is the operating system, Linux is merely the kernel.



                      Now, the source code is NOT the same. The GNU team created the utils, inspired by the UNIX tools that existed, and extended some of these.



                      GNU kill and echo are shell built-ins in Bash, the default shell on most GNU systems, so they come with your shell, as in bash.



                      ls, and cat are different, separate programs, inspired by UNIX ls and cat, respectively.



                      There is a history of UNIX graph that explains where things come from, as you can see, GNU/Linux popped up without any direct ancestry.



                      enter image description here



                      Of the UNIX flavors, which relate to UNIX time sharing system, these commands all come from that, however, they could have been re-written multiple times.



                      You can compare FreeBSD cat source code with GNU cat source code.



                      Why do I not refer to GNU/Linux right through ? The waters are murky, you can install the GNU tools on the BSD's as well as on other UNIX systems, well, you can even install them on windows.



                      Debian, of Debian GNU/Linux glory, on which Ubuntu and Mint are based (just two examples), offers a GNU distribution with a FreeBSD kernel: GNU/kFreeBSD



                      Yes, the graph is outdated ...






                      share|improve this answer


























                      • I think this is the most comprehensive infographic on major *nixes I've seen thus far. +1 for that

                        – Sergiy Kolodyazhnyy
                        Mar 16 at 3:00






                      • 2





                        The infographic has several major issues IMHO. IRIX 5.x was based on BSD. Solaris is/was based on SVR5. Linux 0.01 did not contain any Minix code so a parent-child relationship may be stretching the relationship.

                        – Doug O'Neal
                        Mar 16 at 16:42














                      3












                      3








                      3







                      First, I understand Linux as meaning GNU/Linux, which is the operating system, Linux is merely the kernel.



                      Now, the source code is NOT the same. The GNU team created the utils, inspired by the UNIX tools that existed, and extended some of these.



                      GNU kill and echo are shell built-ins in Bash, the default shell on most GNU systems, so they come with your shell, as in bash.



                      ls, and cat are different, separate programs, inspired by UNIX ls and cat, respectively.



                      There is a history of UNIX graph that explains where things come from, as you can see, GNU/Linux popped up without any direct ancestry.



                      enter image description here



                      Of the UNIX flavors, which relate to UNIX time sharing system, these commands all come from that, however, they could have been re-written multiple times.



                      You can compare FreeBSD cat source code with GNU cat source code.



                      Why do I not refer to GNU/Linux right through ? The waters are murky, you can install the GNU tools on the BSD's as well as on other UNIX systems, well, you can even install them on windows.



                      Debian, of Debian GNU/Linux glory, on which Ubuntu and Mint are based (just two examples), offers a GNU distribution with a FreeBSD kernel: GNU/kFreeBSD



                      Yes, the graph is outdated ...






                      share|improve this answer















                      First, I understand Linux as meaning GNU/Linux, which is the operating system, Linux is merely the kernel.



                      Now, the source code is NOT the same. The GNU team created the utils, inspired by the UNIX tools that existed, and extended some of these.



                      GNU kill and echo are shell built-ins in Bash, the default shell on most GNU systems, so they come with your shell, as in bash.



                      ls, and cat are different, separate programs, inspired by UNIX ls and cat, respectively.



                      There is a history of UNIX graph that explains where things come from, as you can see, GNU/Linux popped up without any direct ancestry.



                      enter image description here



                      Of the UNIX flavors, which relate to UNIX time sharing system, these commands all come from that, however, they could have been re-written multiple times.



                      You can compare FreeBSD cat source code with GNU cat source code.



                      Why do I not refer to GNU/Linux right through ? The waters are murky, you can install the GNU tools on the BSD's as well as on other UNIX systems, well, you can even install them on windows.



                      Debian, of Debian GNU/Linux glory, on which Ubuntu and Mint are based (just two examples), offers a GNU distribution with a FreeBSD kernel: GNU/kFreeBSD



                      Yes, the graph is outdated ...







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Mar 18 at 7:48

























                      answered Mar 15 at 10:23









                      thecarpythecarpy

                      2,6501028




                      2,6501028













                      • I think this is the most comprehensive infographic on major *nixes I've seen thus far. +1 for that

                        – Sergiy Kolodyazhnyy
                        Mar 16 at 3:00






                      • 2





                        The infographic has several major issues IMHO. IRIX 5.x was based on BSD. Solaris is/was based on SVR5. Linux 0.01 did not contain any Minix code so a parent-child relationship may be stretching the relationship.

                        – Doug O'Neal
                        Mar 16 at 16:42



















                      • I think this is the most comprehensive infographic on major *nixes I've seen thus far. +1 for that

                        – Sergiy Kolodyazhnyy
                        Mar 16 at 3:00






                      • 2





                        The infographic has several major issues IMHO. IRIX 5.x was based on BSD. Solaris is/was based on SVR5. Linux 0.01 did not contain any Minix code so a parent-child relationship may be stretching the relationship.

                        – Doug O'Neal
                        Mar 16 at 16:42

















                      I think this is the most comprehensive infographic on major *nixes I've seen thus far. +1 for that

                      – Sergiy Kolodyazhnyy
                      Mar 16 at 3:00





                      I think this is the most comprehensive infographic on major *nixes I've seen thus far. +1 for that

                      – Sergiy Kolodyazhnyy
                      Mar 16 at 3:00




                      2




                      2





                      The infographic has several major issues IMHO. IRIX 5.x was based on BSD. Solaris is/was based on SVR5. Linux 0.01 did not contain any Minix code so a parent-child relationship may be stretching the relationship.

                      – Doug O'Neal
                      Mar 16 at 16:42





                      The infographic has several major issues IMHO. IRIX 5.x was based on BSD. Solaris is/was based on SVR5. Linux 0.01 did not contain any Minix code so a parent-child relationship may be stretching the relationship.

                      – Doug O'Neal
                      Mar 16 at 16:42











                      1














                      In addition to the above correct answers, you will find that the default shell on (almost?) every Linux distro is bash, while the default shell on at least OpenBSD and FreeBSD is not bash. It probably is csh, or ksh, but it is a couple of years since I used any BSD variant, so I am not absolutely sure. Anyway it never had the functionality of bash, even the way in which the previous command can be repeated was confusingly different. The difference in shells may change which of the simpler commands are shell built-ins and which are freestanding programs.



                      With several distros now providing the GNU userland with an xBSD kernel, and potentially vice-versa, there is no one absolutely definitive answer to the question. The only absolutely foolproof way of knowing what you have on your system is to use your package manager to download the source and examine it, or examine it on-line if your distro has browseable source, although checking the license which applies would give a fairly good indication.






                      share|improve this answer



















                      • 2





                        Enjoy unix.stackexchange.com/q/322035/5132 , unix.stackexchange.com/q/193204/5132 , unix.stackexchange.com/q/496259/5132 , and many others here. And you'll stir up M. Chazelas if you claim that the C shell doesn't have the history expansion that the Bourne Again shell got from the C shell. (-:

                        – JdeBP
                        Mar 15 at 15:53
















                      1














                      In addition to the above correct answers, you will find that the default shell on (almost?) every Linux distro is bash, while the default shell on at least OpenBSD and FreeBSD is not bash. It probably is csh, or ksh, but it is a couple of years since I used any BSD variant, so I am not absolutely sure. Anyway it never had the functionality of bash, even the way in which the previous command can be repeated was confusingly different. The difference in shells may change which of the simpler commands are shell built-ins and which are freestanding programs.



                      With several distros now providing the GNU userland with an xBSD kernel, and potentially vice-versa, there is no one absolutely definitive answer to the question. The only absolutely foolproof way of knowing what you have on your system is to use your package manager to download the source and examine it, or examine it on-line if your distro has browseable source, although checking the license which applies would give a fairly good indication.






                      share|improve this answer



















                      • 2





                        Enjoy unix.stackexchange.com/q/322035/5132 , unix.stackexchange.com/q/193204/5132 , unix.stackexchange.com/q/496259/5132 , and many others here. And you'll stir up M. Chazelas if you claim that the C shell doesn't have the history expansion that the Bourne Again shell got from the C shell. (-:

                        – JdeBP
                        Mar 15 at 15:53














                      1












                      1








                      1







                      In addition to the above correct answers, you will find that the default shell on (almost?) every Linux distro is bash, while the default shell on at least OpenBSD and FreeBSD is not bash. It probably is csh, or ksh, but it is a couple of years since I used any BSD variant, so I am not absolutely sure. Anyway it never had the functionality of bash, even the way in which the previous command can be repeated was confusingly different. The difference in shells may change which of the simpler commands are shell built-ins and which are freestanding programs.



                      With several distros now providing the GNU userland with an xBSD kernel, and potentially vice-versa, there is no one absolutely definitive answer to the question. The only absolutely foolproof way of knowing what you have on your system is to use your package manager to download the source and examine it, or examine it on-line if your distro has browseable source, although checking the license which applies would give a fairly good indication.






                      share|improve this answer













                      In addition to the above correct answers, you will find that the default shell on (almost?) every Linux distro is bash, while the default shell on at least OpenBSD and FreeBSD is not bash. It probably is csh, or ksh, but it is a couple of years since I used any BSD variant, so I am not absolutely sure. Anyway it never had the functionality of bash, even the way in which the previous command can be repeated was confusingly different. The difference in shells may change which of the simpler commands are shell built-ins and which are freestanding programs.



                      With several distros now providing the GNU userland with an xBSD kernel, and potentially vice-versa, there is no one absolutely definitive answer to the question. The only absolutely foolproof way of knowing what you have on your system is to use your package manager to download the source and examine it, or examine it on-line if your distro has browseable source, although checking the license which applies would give a fairly good indication.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Mar 15 at 15:29









                      tiger99tiger99

                      111




                      111








                      • 2





                        Enjoy unix.stackexchange.com/q/322035/5132 , unix.stackexchange.com/q/193204/5132 , unix.stackexchange.com/q/496259/5132 , and many others here. And you'll stir up M. Chazelas if you claim that the C shell doesn't have the history expansion that the Bourne Again shell got from the C shell. (-:

                        – JdeBP
                        Mar 15 at 15:53














                      • 2





                        Enjoy unix.stackexchange.com/q/322035/5132 , unix.stackexchange.com/q/193204/5132 , unix.stackexchange.com/q/496259/5132 , and many others here. And you'll stir up M. Chazelas if you claim that the C shell doesn't have the history expansion that the Bourne Again shell got from the C shell. (-:

                        – JdeBP
                        Mar 15 at 15:53








                      2




                      2





                      Enjoy unix.stackexchange.com/q/322035/5132 , unix.stackexchange.com/q/193204/5132 , unix.stackexchange.com/q/496259/5132 , and many others here. And you'll stir up M. Chazelas if you claim that the C shell doesn't have the history expansion that the Bourne Again shell got from the C shell. (-:

                      – JdeBP
                      Mar 15 at 15:53





                      Enjoy unix.stackexchange.com/q/322035/5132 , unix.stackexchange.com/q/193204/5132 , unix.stackexchange.com/q/496259/5132 , and many others here. And you'll stir up M. Chazelas if you claim that the C shell doesn't have the history expansion that the Bourne Again shell got from the C shell. (-:

                      – JdeBP
                      Mar 15 at 15:53



                      Popular posts from this blog

                      數位音樂下載

                      格利澤436b

                      When can things happen in Etherscan, such as the picture below?