Unix utilities portability / compatibility table [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
For example, to convert from integer UNIX timestamp to a readable date, one can use date utility. However, the syntax is different on different platforms:
on Linux - date --date='#123456789'
on BSD - date -r 123456789
I'm not sure about Mac OS X, AIX, HP-UX and all the other flavors.
So programs are very different across the system, i.e. even bear a different name and usage syntax. For example, it's seq 1 10 on Linux, but it's jot 10 1 on BSD.
I know that there is a POSIX standard for shell (i.e. sh), but as far as I know, there is no POSIX standards for all the other utilities (like, manpage of date in Linux says nothing about conformance to something like POSIX / SysV / BSD standards).
This question - Portability between Unix shells - am I thinking about the issue correctly? - tackles the issue, but only about the shell itself, not the all other utilities.
So, I have 2 questions:
Is there some sort of compatibility / portability comparison table available, that lists relevant differences on various major implementations of popular UNIX CLI tools, like date, sed, awk, etc?
Is there some sort of compatibility layer available, i.e. a minimal subset of what I can use to make sure that my shell scripts are portable, or some sort of shims (like in HTML / JavaScript) that bring missing functionality to alternative systems?

There is definitely a standard for basic commands like date. There is however no support for "time since epoch in seconds' with it.
seq and jot are not specified by POSIX but it would be trivial to implement them with a shell script.
The minimal subset or compatibility layer you are looking for is the POSIX standard. Have a look to http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html

For this sort of thing I'd highly recommend O'Reilly's UNIX in a Nutshell which does an excellent job of collating the options for various flavors of UNIX for each command.

Related

Cross platform shell scripts [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is there a tool which translates windows batch to bash files and visa versa?
Yes, cross-platform coding is possible.
cross-platform scripting for windows, Linux, MacOS X
PowerShell is cross-platform (Windows, Linux, Mac):
See these links (yes, I know links are generally frowned upon, but this is a very general question!)
https://www.google.co.uk/search?q=powershell+cross+platform+scripting
cross-platform scripting for windows, Linux, MacOS X
https://blogs.msdn.microsoft.com/dotnet/2016/08/18/powershell-is-now-open-source-and-cross-platform/
https://blogs.msdn.microsoft.com/scxplat/2009/12/11/cross-platform-powershell-scripts-released/
https://github.com/PowerShell/PowerShell
Perl is also cross platform
How to write cross-platform perl code
Python can be, as long as no OS-specific libraries are used.
For some standard operations it is an easy task because some commands do the same job (e.g. more and less, cd, ipconfig and ifconfig, md and mkdir, ...). So for a basic prototype you just have to replace some commands.
But the majority of commands differs a lot regarding parameters etc. So it won't be a hard job, but a very time consuming one to look at every shell command including allowed parameters and expected parameter values and to "translate" them to the appropriate form for another OS.
I think that there are two main options for your task:
install bash on Windows10 (if you already switched to it) which offers you a basic bash shell so you can use linux commands on windows
use powershell and install it on Mac and Linux as well
Another option is to use interpreted programming languages which can run on both platforms (e.g. Perl or Python can do that job quite good)

What is the difference between UNIX and LINUX 'commands'? Difference in context of Commands [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I have searched for answer of this question at many places on internet but none was satisfactory. Can anyone please tell me the main difference between a UNIX and LINUX OS. Is there any difference in commands of both?
Unix is a type of OS, linux is a specific kind of UNIX.
http://www.cyberciti.biz/faq/what-is-the-difference-between-linux-and-unix/
This should help!
My assumption is that you want to know about commands for different terminals.
To know that, you would have to know you version and terminal. You can also pull up the man page for your terminal or look for online documentation.
The most common terminal is bash.
UNIX tm. is a trademark of the Open Group:
http://www.opengroup.org/subjectareas/platform/unix
Linux is an operating system developed initially by Linus Torvalds.
Linux is not even POSIX certified much less a UNIX under Open Group Standards. More because of cost of certification than anything else.
Unix is the father of all modern OS, but its commercial.
Linux is the remake of unix with a GPL licence.

How similar are Unix and Linux exactly? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am a computer science minor and I do appreciate *nix a lot more since i started to delve into computer science. I used to be a windows fan boy and now i own two macs (as well as my PC which has windows and ubuntu on it).
I want to learn more about how linux was developed. I know that linux is only the kernel and the GNU is actually the most of what i am interfacing with. So when i type ls -al on my mac which uses unix how is it different from when i type ls -al on my Ubuntu boot on my PC? Does the difference actually lie in the differences between linux and unix? Or does unix use a non-GNU libraries for stuff like ls and cd?
So what exactly are the difference of linux and unix? Does Unix use GNU libraries for ls, cd, and all those common terminal operations?
First of all, you need to know that ... Linux Is Not UniX. :)
Good question, but it's difficult to give a straight answer.
The kernel is different. The design is different. The software is different (!)
That said, if you have Mac OS X (UNIX), you can build almost any command-line tool that was written for Linux.
Most of the free open-source software is compatible with both Linux ans UNIX, so depending on your level, you might never know the difference.
But technically, there's a huge difference. If you're on a hardware and driver-level you will start noticing differences, but if you're above those levels, you can easily write portable code.
Some people would claim that Linux is the poor-man's UNIX (which is probably also true), while others would say that Linux fixes the problems that UNIX has.
Due to the nature of the question (it's fairly broad), it's difficult to go in details.
I work with both and do not feel a huge difference. My UNIX was set up for me, so I'm basically a novice user there, but I had to install and configure parts of my Linux system myself.
I would say (in my own opinion) that most of the time, Linux is something you build yourself, you decide which components you want. UNIX on the other hand is a little more "one big package", though you can still add components.
Looking at it from a different angle: Linux is open-source and free, where some versions of UNIX aren't. UNIX is often found in enterprise servers from large companies.
Take a command like 'ls' as you mentioned. Older versions of UNIX had a command called 'lc' which listed directories instead of files (as far as I recall). This command does not exist in the UNIX that Mac OS X is based upon, so there's a difference between UNIX and UNIX.
On the other hand, Linux did not make a straight copy of the UNIX command 'ls'. The output often differ slightly, and the switches are different. But!
If you're running Bash, then Bash on your Mac OS X is most likely exactly the same Bash you've got on Linux, just the version differ.
If you got 'curl' on your Mac, and 'curl' on Linux, then it IS the same tool, because it's built from the same sources; it's just built for two different Operating Systems.
GCC is the same as well. (GNU is Not Unix - but it works well on UNIX).
If you install the gitolite server (which I'm quite fond of), you will experience that it will not install on the stock Mac OS X 10.5.8; this is because the arguments for the 'cp' command differ. The author refused to correct the problem, when I suggested him a solution that would work on all platforms. So 'cp' may not always be 100% compatible, and I do not know whether or not it would be a good idea to 'upgrade', because the 'cp' that you have now is compatible with the scripts that Apple provided with your system. Upgrading 'cp' to a different version could break compatibility, which could mean that your system got corrupted and would need a re-install. -So it's better to not upgrade that particular command. ;)

What does "opt" mean (as in the "opt" directory)? Is it an abbreviation? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
The community is reviewing whether to reopen this question as of 8 days ago.
Improve this question
What does "opt" mean (as in the "opt" directory)? I commonly see this directory in Unix systems with development tools inside.
Is it an abbreviation?
In the old days, "/opt" was used by UNIX vendors like AT&T, Sun, DEC and 3rd-party vendors to hold "Option" packages; i.e. packages that you might have paid extra money for. I don't recall seeing "/opt" on Berkeley BSD UNIX. They used "/usr/local" for stuff that you installed yourself.
But of course, the true "meaning" of the different directories has always been somewhat vague. That is arguably a good thing, because if these directories had precise (and rigidly enforced) meanings you'd end up with a proliferation of different directory names.
The Filesystem Hierarchy Standard says this about "/opt/*":
"/opt is reserved for the installation of add-on application software packages."
By contrast it says this about "/usr/local/*":
"The /usr/local hierarchy is for use by the system administrator when installing software locally."
These days, "/usr/local/*" is typically used for installing software that has been built locally, possibly after tweaking configuration options, etcetera.
It's usually describes as for optional add-on software packagessource, or anything that isn't part of the base system. Only some distributions use it, others simply use /usr/local.
OPTional
It holds optional software and packages that you install that are not required for the system to run.
Add-on software packages.
See http://www.pathname.com/fhs/2.2/fhs-3.12.html for details.
Also described at Wikipedia.
Its use dates back at least to the late 1980s, when it was a standard part of System V UNIX. These days, it's also seen in Linux, Solaris (which is SysV), OSX Cygwin, etc. Other BSD unixes (FreeBSD, NetBSD, etc) tend to follow other rules, so you don't usually see BSD systems with an /opt unless they're administered by someone who is more comfortable in other environments.
It is an abbreviation for 'optional' , used for optional software in some distros.

Linux POSIX Compliance list [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm looking for a list cross reference matrix of POSIX implemented functions for a specified linux kernel.
For example, I want to use linux kernel 2.6.0, but I would like to see the compmlete list of POSIX implemented functions for this kernel. Where can I find this information?
Linux follows the Linux Standard Base as opposed to POSIX. However, LSB is mostly a superset of POSIX. You can find a list of all observed conflicts between LSB and POSIX here. I doubt something as detailed as what it seems you want exists.
2.6.0 is really an old kernel (there are big differences with 2.6.38). Try using something less old.
The linux syscalls man page gives you a list of system calls and in what kernel version they appears, so answers the question for syscalls. For library functions, I have no idea.
In practice, Linux seems to me quite Posix compliant... And the Posix standard also evolved.

Resources