I am been currently studying AWS, and my online instructor uses "Windows PowerShell", however, I have always used "Hyper Terminal" for MERN stack. What is the difference between the two, and what sets this two apart from the Command Prompt?
Here is the simple answer:
PowerShell Preview replaced PowerShell, and PowerShell replaced Command Prompt (CMD).
Windows Terminal is an application that simply provides tabs to open multiple instances of PowerShell (Preview or legacy) and Command Prompt, as well as Azure cloud shell.
In Linux. you'll often hear the terms 'terminal' and 'console' used interchangeably, but they mean the same in Linux as they do in Windows. That is, console is the Linux alternative to the DOS style command prompt.
I am not familiar with Hyper Terminal but I see there are terminal emulators online that go by that name therefore I assume you may be using a third party terminal emulator.
PowerShell is a newer shell and also happens to be an object-oriented scripting language.
As far as Windows shells go, I can use PowerShell to do anything I used to do with CMD. Generally speaking, I would say PowerShell really shines when it comes to Windows System administration which is my primary use for it and it saves me a great deal of time.
As far as terminal emulators go, I feel the default terminals for both PowerShell and CMD are pretty much the same and are very lacking compared to 3rd party offerings or even the default terminal that comes in any modern Linux OS.
For a free "Microsoft" alternative to replace your default terminal, I would recommend the open-source "Windows Terminal" app. The addition of tabs, panes, zoom function, easy to read text, and easy ways to start different shells (such and CMD or PowerShell) or even start a WSL session with your choice of Linux OS is a major improvement to the default Windows terminal app.
Related
I widely use Unix/Posix like commands in my daily activities.
I have only Windows environments.
For that reason I use utility called MobaXterm which is built on top of Cygwin and allow me to use utilities like awk, sed, Grep and etc.
I noticed that Power shell on my PC works significantly faster than MobaXterm hence I want to use it from inside the powershell.
E.g. instead of using poweshell ‘Select-String’ I want to use Cygwin’grep’
How should I do it? Could I change the path to MobaXterm bin directory to make powershell aware of it? Or something similar?
Note: I do not have admin privilege on my PC
Appreciate your help
Powershell ignores tab characters in copied-and-pasted code snippets. This is annoying because I like to write my Python code with single tabs instead of quadruple spaces, and in testing I frequently copy and paste snippets in to test them.
So far I've been using other terminals like Cygwin that properly address pasted tabs, but it would be more convenient for me to use Powershell. How can it be made to address these pasted tabs correctly?
The MWE is to copy and paste anything with a tab into Powershell. For example,
test
appears in Powershell as
>>> test
with no indentation. I've copied and pasted from both Notepad and Notepad++ with the same effect; I'm not using any formatted word processors or anything like that.
Caveat: The next section only applies to PowerShell's own interactive prompt. Different rules may apply to external programs launched from PowerShell that present their own interactive prompt, such as python and, preferably, ipython - see the bottom section for considerations specific to these programs.
Preserving tabs on pasting directly into PowerShell's interactive prompt:
Note: Strictly speaking, when it does work, tabs are converted to 4 spaces each on pasting.
Only works when all of the following prerequisites are met:
When running PowerShell (Core) 7+ (as opposed to Windows PowerShell)
When pasting via Ctrl-V rather than via right-click (the latter emulates typing and therefore triggers tab completion).
When running in one of the following console environments:
Regular console window (conhost.exe)
Windows Terminal
Note:
Does not work in Visual Studio Code's integrated terminal (which seemingly always emulates typing in PowerShell).
Haven't tried third-party consoles such as Cygwin and ConEmu.
Notably, this categorically excludes Windows PowerShell (where a tab ends up as ^I).
Preserving tabs on pasting into the interactive python / ipython REPL, from PowerShell or cmd.exe:
Note:
ipython provides a superior REPL experience compared to python.
Unlike the above, the following also applies to launching from Windows PowerShell, as well as from cmd.exe.
When it works, pasted tabs are converted to 4 spaces, except where noted otherwise.
ipython
Regular console windows (conhost.exe):
Works, with Ctrl-V only.
Windows Terminal:
Works, with Ctrl-V only.
Visual Studio Code's integrated terminal:
Does NOT work (strips tabs).
python
Regular console windows (conhost.exe):
Works, with both Ctrl-V and right-click, as long as Filter clipboard contents on paste is turned OFF on the Options tab of the console window's Properties dialog; pastes actual tabs.
Windows Terminal:
Works, with right-click only(!); pastes actual tabs.
Visual Studio Code's integrated terminal:
Works.
The only way I was able to make this work was by using Windows Terminal. Which is a new terminal application built by Microsoft that supports a bunch of new features.
I don't know the technical reasons why, but it appears it supports pasting both tabs and spaces appropriately, without loss or conversion into the Python CLI REPL.
I tested this using Windows Terminal while running Windows PowerShell, PowerShell Core 7+ and Command Prompt, while running the Python CLI and all supported pasting tabs.
You can install Windows Terminal through a number of sources...Windows Store, Binary download, WinGet, Choco, etc.
Here's the github repo with instructions on various ways to install.
https://github.com/microsoft/terminal
In general, control-v is better for pasting characters than right-click. Note control-v has to be bound to psreadline's paste function (so no emacs mode). Here's an example with an a and an em dash (0x2013). Right click will only paste the a.
a–
I am a beginniner user of Julia. According to the webpage of the Julia Programming Language, "We highly recommend running Julia using a modern terminal, such as installing the Windows Terminal from the Microsoft Store" (Julia 1.6 for Windows). In fact, PowerShell handles the Julia fonts in a better way.
However, the installation of Julia generates a start menu item that runs under cmd as default. How can I create run Julia so that it uses PowerShell as default?
I don't know if it is possible
You can add your julia installation folder to the PATH so that julia opens julia in Powershell
Or, if you want to be able to have multiple versions and chose which one to launch, you can use PowerShell aliases in $profile:
New-Alias julia1.6.0 C:\\Users\\user\\AppData\\Local\\Programs\\Julia-1.6.0\\bin\\julia.exe
New-Alias julia1.5.3 C:\\Users\\user\\AppData\\Local\\Programs\\Julia-1.5.3\\bin\\julia.exe
New-Alias julia julia1.6.0
to see where it is and edit it:
echo $profile
notepad $profile
I strongly recommend the Open Source ConEmu.
Set your Windows Julia shortcut to (this assumes that the folder with julia.exe is in your system PATH environment variable):
"C:\Program Files\ConEmu\ConEmu64.exe" -run julia
you can not get better Windows user experience than that :-)
I'm new to Visual Studio code so thanks in advance for the help.
I often use the PowerShell ISE with an interactive PowerShell window. I open it, type a few commands, then run a script (such as opening a PowerShell session with Office 365) and then type a few more commands.
Is there any way to do the same thing with Visual Studio code? I see a way to run scripts and debug them but not have them complete but the PowerShell window still stay around so I can continue working.
Decided to convert to answer, since this is a bit too much for comments:
Go to settings > user settings and change "terminal.integrated.shell.windows" to:
"C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
Ctrl + Shift + ` opens the terminal. Using the + button on the terminal window you can launch additional powershell instances.
Also there's an extension that allows for launching several different terminals under the same VSCode process (cmd,powershell,bash,etc). Minor nuance, shells are being started with the same permissions VSCode has, but you can re-elevate once inside the shell.
References:
https://code.visualstudio.com/docs/editor/integrated-terminal
https://code.visualstudio.com/docs/customization/userandworkspace
https://github.com/Microsoft/vscode/issues/10893
Edit: but I would say its not really convenient, terminal takes away too much space on the screen (well, unless you have like 2k or 4k display), so I use powershell + vscode.
On a daily basis I:
use multiple workstations running either Linux, Windows, or MacOS X
edit files on additional Linux hosts that are not any of the workstations mentioned above
The only common element here is that the internet connects all of these hosts: workstations and servers. I can keep all of the config files in sync on my workstations too and can run an X server on all of them. What's the right way of running emacs? I don't want to sacrifice any features.
In my ideal world I can type 'emacs foo.txt' on a remote host and some magic happens via X forwarding to display the file in my workstation's existing emacs session.
Non-solutions
tramp: when I'm manipulating a remote host an editor is just part of my workflow. I need a terminal open so I can run other commands quickly. tramp is all wrong for this.
ncurses emacs: sucks, I want the graphical kind
If you don't have a positive answer to my question, please don't just guess. Thanks.
Have you tried tramp with eshell? You can "cd /remote.host:/some/path" and edit files from there, and if you type a non-built-in, it fires up a ssh pipe to run it. Quite slick.
I fail to see why tramp is not a solution. You can edit using tramp, and do whatever you need in a terminal using xterm+ssh.
Well, if you can setup X clients on your Windows and OSX boxes, you should be able to run an X version of emacs on any of those platforms and set the display back to your workstation. That would give you your nice WIMP interface.
However there are a couple of solutions to keeping a terminal open to the same box. One is to just telnet into it twice. Once for your emacs session, and once for a shell.
The other option of course is to use meta-x shell to bring up a shell buffer inside of emacs. A true emacs guru prefers to run their OS inside of emacs, rather than the other way around. :-)
The approach I use is based on source controlling the Emacs scripts and important common files (using Git). This gives me a consistent code base so I don't have to remember which host has which script or file (or version of what I'm looking for). Git is particularly well suited to supporting this mechanism and I've pretty much got in the habit of updating the master origin repo daily. Within the scripts (both Emacs and bash shell scripts) I use machine tailored code to handle local requirements. This system has been in place now for well over a year and I find it to be quite effective. This is a technique I've seen recommended for some number of years. I found it clunky with CVS and Subversion but git feels tailored for the job. That said, I like the solution you selected as a complimentary tool and look forward to adding that to the mix.