Why does powershell and ubuntu's terminal share commands

I started learning the terminal in ubuntu and noticed that powershell also uses commands like ls, cd. Any reason why they share these?

Any reason not to share them?

are all the commands the same between the two? I noticed that other linux distros use a different set of commands so i was surprised they were shared between a linux distro and windows

No there is allot of Linux Commands that Won't work in PowerShell.

Microsoft added aliases for things to help Linux admins run windows server easier.

I think it's time for a bit of clarification.

The ubuntu terminal is just a graphical interface to the bash shell. The terminal sends commands to the shell, nothing more. The shell interprets commands, and runs programs. What commands will or will not work does not depend on the Linux distribution, or terminal. Some shells differ (there are alternative shells such as zsh, which add some cool functionality which is not found in bash), but they're all generally consistent. Commands like ls, mkdir, rm etc are actual programs. These are not a part of the terminal, or shell. These are stand-alone programs. These programs are a very important part of a system.

Most, if not all, Linux distributions come with a suite of programs called gnu-coreutils. This suite contains all these programs, and other important programs. That's why ls will work on arch, Ubuntu, Fedora, CentOS... They simply must be there.

However, there are less important programs, which are up to preference. For example, I like the text editor emacs so in my system I have it installed. I know a lot of Linux distributions don't come with this bundled, and that's completely reasonable. Not a lot of people use emacs, and not a lot of programs depend on it either.

Just like emacs, package managers are also not a thing you need in a system. However, it's very convenient, and there can be different opinion on how to do things. That's why there are multiple different package managers. For example in Debian based distributions (eg Ubuntu) you use apt-get to install software. On Arch we use pacman, and on Fedora I think yum is used. But all in all, commands/programs will be pretty much the same on every distro.

Windows will most likely not use GNU's coreutils, but they've got their own programs with same names. That makes a more uniform experience for admins using Linux and Powershell. Plus it might just make it easier to port shell scripts between Bash/zsh/'Linux' -> Powershell.

2 Likes

Don't forget to add "everything in Linux/Unix is a file" unlike Windows/DOS.

It is good to see some uniformity in PowerShell. Windows was the odd man out pre PowerShell. All other OSs use bash or something similar.

1 Like