I’ve been playing today with Bash on Windows 10. I blogged earlier about how to install it. Now to getting down to use it. I spent a few hours today as a NEW to Bash user and found some differences. If you know Linux, you may find some of these obvious but they do represent a difference new to Bash folks will find.
1. BOW is case sensitive LS is not the same as ls. Windows is not case sensitive, so LS and ls are the same.
2. Getting help for a command is different and inconsistent between commands. In some cases it's <cmd> -h, some times <cmd> --h, or <cmd> --help, etc. Each command has its own way of providing help.
3. The Unix MAN help system is alive and well in Bash. Type man <cmd name> for help. However, this takes you into a pager, from which you type q to escape.
4. You don’t have a graphical text editor in Bash. But you do have VI, and you can easily install emacs (apt-get install emacs23).
5. The Linux and Windows file systems are different. Windows has no single root, but a bunch of volumes C: d:, etc. With Linux there is one unified filesystem '/' with everything underneath it.
6. You can see the windows file system from bash /mnt/c is c:, /mnt/d would be d:, etc. But interop is limited. It would be nice to be able to edit, say, over in Windows but use over in bash. That doesn't really work fully. You can, for example, mkdir /xxx from the bash side, and that folder shows up in windows. But create a file in windows and you can't see it from bash. I suspect this is a work in progress.
7. No GWMI Win32_Processor, instead cat /proc/cpuinfo , or grep Intel /proc/cpuinfo (nb grep intel /proc/cpuinfo fails! - see rule 1)
8. The error messages are quite different.
9. Type Man Man and you can see where PowerShell help ideas came from!
10. Type the wrong command and you can often be told which where to find it (eg, type lsf and see what it offers you)
And since I can’t count well,
11. Getting packages is different - You use apt-get. apt-get install emacs, for example. PowerShellGet is modelled on APT-Get, it feels!
This is fun!
2 comments:
So much for standards eh? D'oh!
It's a little disconcerting seeing the Linux subsystem referred to as "Bash", when Bash is just a shell (command line) - akin to referring to Windows as being "cmd.exe". apt-get, for example, is completely unrelated to Bash.
It's *filenames* which are case-sensitive on Linux - and, optionally, on Windows NT's own kernel: it's the win32 translation layer which imposes case-insensitivity on non-native applications. Point 7 isn't actually linked to point 1: grep is a simple text searcher (and not part of Bash, just as notepad.exe isn't part of command.com or cmd.exe) and *defaults* to case-sensitive searches: add the -i switch to turn that off. "grep -i intel /proc/cpuinfo" will return what you're after. (There's a wealth of other information under /proc, like network and storage information, and much more accessible (IMO) than the Windows counterparts. Rather like the registry, but directly connected rather than needing a reboot for changes to take effect.)
Bash itself was available years ago, but it's amazing to see an entire Ubuntu environment available, particularly with official support from Microsoft themselves.
Very exciting development - time to switch my main Windows laptop back to the Fast Ring for a while, it seems!
Post a Comment