Are Linux commands interchangeable with Unix commands?
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Life in a Drop
--
Chapters
00:00 Are Linux Commands Interchangeable With Unix Commands?
00:39 Answer 1 Score 5
01:09 Answer 2 Score 4
01:43 Answer 3 Score 18
02:33 Accepted Answer Score 37
03:14 Thank you
--
Full question
https://superuser.com/questions/390107/a...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #unix
#avk47
ACCEPTED ANSWER
Score 37
Daniel Andersson's comment about POSIX is the real answer here: there is a standard called POSIX which defines the core of a UNIX-like system, both in terms of shell commands and system calls. In theory, if you write software to the POSIX spec, it should be possible to compile and run it on any UNIX, Linux, BSD etc system.
http://pubs.opengroup.org/onlinepubs/009695399/mindex.html will give you a definitive answer as to what constitutes POSIX, but that's not a useful answer for practical purposes. Someone else may have good command references for common differences between Linux systems and other UNIX-like systems.
One specific example: "killall" on Linux kills all processes with a particular name. On Solaris, it shuts the system down. Important not to use the wrong one.
ANSWER 2
Score 18
Most Linux distributions today come with lots of essential GNU software and the GNU Toolchain. GNU was a project to rewrite a free-as-in-freedom copy of Unix that later got paired together with the Linux kernel. When you use ls
on a Unix machine you're using the original/what's become of the original ls
. When you use ls
on GNU/Linux, you're using the GNU ls
which was written from scratch to be the same as ls
. However, not all GNU software is exactly the same as its Unix counterparts. Now that Unix has essentially turned into BSD, GNU/Linux distros may also contain the BSD version of that tool. For example, bsdtar
and tar
come to mind.
tl;dr: They aren't the exact same code, but they are meant to for the most part be exactly the same.
ANSWER 3
Score 5
You didn't specify which UNIX you're talking about (BSD, System V...). There's no universal (UNIX) answer. Each UNIX variant has its own custom commands (take Mac OS X for example), so even between UNIXes there are different commands. Usually old commands (like ls, pwd, cd, cp, mv, rm...) tend to be the same on all UNIX flavors (including Linux).
ANSWER 4
Score 4
What you need to consider first is that the commands are actually small programs, in that sense not necessarily a part of the operating system if you split hairs. The old and classic ones have been around for a long time, and are included in most *nix systems. Just how "complete" the OS is depends on what comes with the package.
As an example most recovery/emergency CDs you can boot from contain a slim Linux distro, you would find that some typical commands might not be featured in these systems, purely because they would not be needed in most cases.