why does windows have so many shells and command line interfaces? [closed] - windows

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 5 years ago.
Improve this question
I have recently switched from MacOSX to Windows, and having had much experience using the OSX Terminal, I've been surprised by how many different CLI's there are in Windows. Specifically, it seems that in addition to cmd.exe and powershell, when I have installed some programs that require CLI usage, they create their own CLI's, i.e. git cmd, git bash, etc.
I'm used to working within one single app (terminal) for all of my projects/tasks, and switching between different CLI's for various tasks is proving annoying and confusing.
I'm not sure I'm asking the right question, so please let me know if you need a different one...: For those of you who have experience working at the command line in windows, is it 'normal' to keep switching between CLI's for different needs, or is it reasonable to get to a point with one CLI (i.e. powershell)? And if so, what should I be looking into?
Thanks in advance!

Standard Cmd/Windows Command windows is basically your backwards compatible shell for Windows that will run everything specifically developed for it, including DOS batch files, etc.
Powershell is a supercharged, newer command window that allows scripting that is compatible with modern system administration for server environments in organizations, similar to vbscript or javascript. Admins can run more compatible/modern scripting than the old DOS Batch files. It's really a new/separate scripting language, while still supporting most basic Windows Cmd window commands.
Git installs Git-cmd, which basically acts like a normal windows command terminal, and Git-Bash launches a unix-style Bash shell, because Git originated on Linux (and for Linux development..) and it's core operations expect a lot of core Linux commands, libraries and/or utilities. So the Git-Bash is part of the standard install, giving you essentially a mini Linux install (or perhaps better phrasing would be a POSIX-compliant one?) and allows you to run a lot of tools/aliases/scripts developed for Git directly on Linux, and should be no different from a Linux Bash shell if you just happen to prefer that to Windows Cmd, with all basic command differences.
So I wouldn't say that there are "so many" different terminals. Unix/Linux has many different flavors as well (C-shell, Bash, Ksh, etc.). Powershell is rarely required for a regular user (per the comments, much more by developers), and Git Bash is unnecessary to run Git.
Isn't more options better - use what you like? :)

Related

Moving from Bash Linux shell for any window's shell tool. How to start and which tools to use? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I've been using Linux for developing for at least 7 years, but in my new job I have to work with windows and I'll have to learn about it, so I decided to start learning some window's shell.
I'm quite comfortable with bash and I'd like to know what is the best way to move from bash to any window's shell and which shell choices that I have?
Keep in mind that I'll have to work with a lot of different servers (all windows) and maybe I will not have all permissions to install software as cygwin, so I think that my best choices would be using native solutions available in windows servers.
What are the pros and cons about CMD and powershell? Is there any other option?
Is there any good tutorial or reference that I've could learn?
What is your experience in this scenario?
What Hyper Anthony said: https://stackoverflow.com/a/573861/775544
-- What are the pros and cons about CMD and powershell ?
PROs:
o Microsoft provides cmdlet modules for many of their Tier-1 products so that you can manage them directory from Powershell (e.g.: Windows Server, AD, SQL Server).
o Powershell can utilize many .Net functions (if not all of them, but some require tricky delegation code) giving you access to everything on the server.
o Powershell works natively with COM, WMI, ADSI, the Registry, the cert store, etc. (1)
o Object-oriented
o Multi-tasking/mutli-threaded jobs. The new workflow capabilities allow complex workflows to be (relatively) easily encoded.
CONs:
o CMD shell. Once you start using the Powershell, you may never need the CMD shell (the only times I use CMD is when I know a command that works in CMD but not in Powershell and I'm too lazy to find the Powershell variant).
o CMD can't do multithreaded.
-- Is there any other option?
As others have mentioned, cygwin. I used cygwin for about a year when I switched from Solaris admin to Windows. Eventually I had to migrate to CMD just because there were some instances where cygwin wasn't mature enough to handle some tasks (I don't recall what those were).
-- Is there any good tutorial or reference that I could learn?
Tons! I typically search for code samples on internet and learn from those. I also follow the Scripting Guy blog http://blogs.technet.com/b/heyscriptingguy/.
What is your experience in this scenario?
I was a Solaris admin that scripted in Bourne shell and moved to Windows admins in the Time-Before-Powershell. I used hybrid cygwin/cmd shell for a while then moved on to VBScript/WMI until Powershell v2 came out. I have a background in SW development so I really took to Powershell's OOD.
I typically home-brew my own cmdlet modules rather than download from the web, but there are a lot of well-written cmdlet modules on the web that you can utilize.
(1) From Jeffery Snover's article at Is PowerShell ready to replace my Cygwin shell on Windows?

Migrating from cmd.exe to PowerShell or using PowerShell in place of other tool. When is it better to use PowerShell? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have been contemplating moving forward from using the cmd.exe command line program which provides a command line interface and a batch programming environment that extends the one
available using the old command.com program on the old DOS operating system. The cmd.exe
program has been available on Windows system for a very long time. However, I feel that
it has its limitations in terms of usability and flexibility.
I have heard that PowerShell can be used to manage various Microsoft products, and also
supports snap-in modules for third-party vendors, supports several very useful programming
constructs such as pipelines, and above all is tightly integrated with the .NET framework,
which of course makes the PowerShell programming language very powerful.
Perhaps this question is somewhat broad, but in view of the existence of several alternative
programming environments such as Python and Perl which are used for system administration
(these in many ways have slowly replaced shell scripts on Unix systems for more complex
tasks quite some time ago), I was wondering where PowerShell fits into the ecosystem,
and above all whether it is worth learning, and especially if it is worth learning
when someone already knows a tool such as Python or Perl which is also used for
system administration. Is PowerShell more of a system administration tool, or
is it a more general programming tool that does not require compilation,
unlike, say, C#?
What I can see as advantages is that it comes preinstalled, and that you can invoke
.NET API functions from within it.
If anyone can sort out a few scenarios demanding that it be learned, especially in the
case where other programming tools are already known, I would appreciate it. In particular
I would like to know, besides quick .NET scripting, what sort of tasks are generally speaking
more suitable to PowerShell programming.
Thanks.
The number one reason to use Powershell is that Microsoft is starting to push all it's product management tools to PowerShell. In fact, when working with things like Exchange, there are some things you can only accomplish with powershell anymore.
The second reason is that powershell is a full scripting language, dos batch command language is not.
The third reason, is that anything that is possible in .Net is possible in PowerShell (sometimes with a bit more work, sometimes with a bit less).
Also, there are some companies, like VMware that the only command line based interface released for their products is via a powershell snap in or module.
And, in my humble opinion, it is a pretty fun environment to work in.
Piping objects is an extremely powerful feature.
Going from DOS to Powershell is like suddenly acquiring opposable thumbs. It's bigger, more complicated, and for some few very simple tasks it's more cumbersome, and it doesn't take very long to wonder how you ever did without it.

Easy Git Starter for Windows? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I really need to understand how to use git on Windows, but all the guides are too complex. For example, I understand we need to use a command line for git. But when I open a command prompt in Windows using "cmd.exe", where do I go? Do I navigate to the folder where git is installed? What is "git bash"?
Why do all the examples on the Internet have this $ sign in front? How do I add an existing folder to git version control? What does "checkout" mean? I keep hearing about a tool called "powershell". What does it do and how is it different from a DOS prompt?
To use the "git" command I'll probably have to add it to my environment variables so the computer can find it and I get "'git' is not recognized as an internal or external command,
operable program or batch file."
I've never used a version control system for my programming before - I've just saved folders with numbers in front of them so far and I need to use git to publish a project folder I have on Amazon AWS Beanstalk.
I basically just want to add a folder to git and save changes regularly so I have a back up of all the stuff I've done before.
Edit: Is git a single program, or are there many "gits". The first result for "git" in google takes me here: http://git-scm.com/ and yet lots of people talk about something called "msysgit". Is this a different git application?
Edit: I'm looking more at a command line for Windows tutorial. It's here that I'm having the most trouble.
If you want to understand some of the concepts of Git (and only then you can use it effectively), you should read the Pro Git book (available online and for download, or even to buy on paper). This is a really good book, teaching you the very basics you need with good examples, and having sections on more advanced stuff if you want to know more.
The book assumes that you use a Unix-/Linux-like shell (like Bash). Msysgit (a.k.a. "Git for Windows") brings Bash with it, pre-configured for easy use of Git. (And no, there are not many gits, Msysgit is just a bundle that brings some other dependencies of Git which are not usually installed on Windows.)
A shell (also named console or terminal) is in this case a command-line interpreter, just like cmd.exe is on Windows; on the *nix-like systems, there are many more alternatives than on Windows (where one alternative is Powershell), but that's just some side info here.
The $ sign in the examples you see is a typical prompt delimiter on *nix-like shells; on Windows (cmd.exe), you usually have ">" as the delimiter. It has no special meaning and just serves as a delimiter.
What "checkout" means and how you add files and folders to version control, is explained very well in the mentioned book. You also do not need to know anything about version control in general, the book is really written for absolute beginners (in fact, to start using Git it might be an advantage not to know other VCSs).
If you need any help with the stuff that's in the book (or in other tutorials mentioned there, here, or on Google), feel free to drop by the #git IRC channel (more info on the git-scm.com community page, where people can help you immediately and with small questions.
There are a bunch of tutorials that worked for me:
http://www.youtube.com/results?search_query=git+windows&oq=git+windows&gs_l=youtube.3...250.879.0.972.7.6.0.0.0.0.0.0..0.0...0.0...1ac.1.
They show you how to install the various components and then how to use Git with Windows.
Github* has GUI application for Windows (as well as for Mac) which is pretty friendly to novices. You won't get a lot of insight, but this might help you to get up and running.
*git-repository hosting, e.g. place where you can store your repos and sync with them from time to time. It's free and awesome.

How to improve one's bash/command-line skills? [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 11 years ago.
Improve this question
Unfortunately I come from the Windows world and quite a newbie to Linux. I see people who are really productive due to their skills with BASH. Any pointers, tutorials, bools or suggestions to improve one's command-line skills? Something like http://www.commandlinefu.com/.
Check out superuser.stackexchange too, lots of good stuff there!
This is what I reference at least a few times a week:
Advanced Bash-Scripting Guide
And here is an actual List of Bash online-tutorials!
I would also like to emphasize what #serk's answer says:
Remove your GUI and you'll be forced to do everything via BASH
This is Very good advice! (and a well earned competing answer +1 vote ;)
In /etc/inittab change the runlevel to 3 from 5 and consequently you have to learn the shell because runlevel 3 means no GUI at all!
Remove your GUI and you'll be forced to do everything via BASH. That will force you to do the same tasks via the command line that you would have normally done via the GUI.
In addition to what's already been listed you can run man <command> to give you the "manual page" for a particular program. These are usually pretty good.
Many people you likely work with have customized bash and tools like vim/emacs to varying degrees. To see how people have customized things, you can go to their home directories and check out their "dot" files. "dot" files are hidden so to view them you'll have to run:
ls -a
Standard "dot" files/directories:
.bashrc
.bash_profile
.vimrc
.screenrc
.inputrc
Common dot file names:
.alias(es)
.function(s)
People sometimes also write common scripts and put them in bin or scripts directories.
You can learn a TON of stuff by checking out what others have done.
If you are just checking out linux on your own, you can look for these types of files online.
Since you're coming from windows, you may be using cygwin. If so, you can check out C:\cygwin\bin and C:\cygwin\usr\sbin for typical bash programs. You can also use cygwin on windows in general to allow you to continue to use bash when using your windows computer.

better command for Windows? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
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.
Improve this question
While I grew up using MSWindows, I transitioned to my much-loved Mac years ago. I don't want to start a flame war here on operating systems. I do, however, want a terminal a litle closer to what I'm used to.
I'm not asking for full POSIX support - I don't have the patience to install Cygwin - but I miss tabbed terminals, being able to easily cut and paste, and my good friends ls, mkdir, rm, et al. (For these last ones, I could always put .bat files on my path, but that's going to get old fast.)
Anybody have a terminal application for MSWindows XP ?
I'm using powershell, its awesome to keep you from going crazy, and it has rm and mkdir and ls.
Tabbed terminals is still not in powershell, and copy paste is similar to cmd, but its way better than cmd.exe.
Some more options:
MSYS: a Minimal SYStem providing a POSIX compatible Bourne shell environment, with a small collection of UNIX command line tools. Primarily developed as a means to execute the configure scripts and Makefiles used to build Open Source software, but also useful as a general purpose command line interface to replace Windows cmd.exe.
GNU utilities for Win32: ports of common GNU utilities to native Win32. In this context, native means the executables do only depend on the Microsoft C-runtime (msvcrt.dll) and not an emulation layer like that provided by Cygwin tools.
PowerCmd is great, with a ton of features including tabs, cut/copy/past, etc.
Console is also a great replacement and is a bit more stripped down than PowerCmd (which can sometimes be a little too feature rich.
Also, with both of these, if you have powershell installed, it is possible to run powershell from withing either.
If you are a bit of a Pythonista then iPython is tough to beat. It has some of the more common shell commands coded in (i.e. ls, pwd, cd etc.), can also run any other shell command by prefixing with '!' (i.e. !latex file.tex) but also is a full Python shell with history, tab-complete, multiline editor support, logging etc. etc.
Moreover, you can install iPython back on your UNIX boxes as well as Windows meaning your environment can follow wherever you go.
There is a new-ish open source Console Emulator called cmder. It looks really nice and has some advanced features that make it nicer to use. You can also use powershell with it. Best of all, it's portable!
I've never found anything I like more than Cygwin.
I also went ahead and installed Cygwin/X w/ Openbox so I can get something like this:
It's got multiple workspaces inside the main Openbox window so I can easily have up to 20 non-overlapping xterms that I can easily cycle through.
I know you said you don't want to install anything, but I strongly suggest you give Services For Unix a shot:
http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx
I use Console with unxutils
Console for the tabs and easier to manage select/copy/paste
unxutils for ls, rm, grep, uniq, sort ... and other goodness.
PowerShell is amazing, however for anything other than the most basic commands there is a learning curve when switching from bash etc.
I went back to using cygwin.
PowerShell is worth looking into.

Resources