Lidando com o Powershell e tornando o terminal Windows utilizável







Não é segredo que, por padrão, o terminal do Windows ainda é uma muleta. O terminal padrão foi substituído pelo terminal Powershell em 2006. Então, embora tenha sido uma inovação, o terminal ainda não era tão conveniente quanto no Linux com seu Bash. A Microsoft criou uma sintaxe de comando bastante ruim -



, que formava a base de toda a sintaxe do Powershell e não permitia que você trabalhasse rapidamente com o terminal. Não imediatamente, mas após vários lançamentos, aliases foram adicionados, primeiro eles imitaram comandos do cmd, e então adotaram comandos bash como cp, mv, rm, ps e assim por diante (na verdade, estes não são comandos, mas simplesmente abreviações que consulte os comandos Powershell padrão).







Neste mini-artigo tentarei resolver os problemas do inconveniente emulador de terminal do Windows, bem como a falta de algumas funcionalidades nele.







5- (Zsh, Bash, Fish..) - , . . Powershell . . , , . , , .







, Linux?



Linux. , , , . - , , Linux, - , , - , , , - - . , .







Windows , , , , , ( ) , .







Windows — . Linux-like.







Windows Terminal



Windows Terminal. .json



. — . , , (Ctrl + Alt + ,



), ,













colorScheme



, , . .







, , Linux, , .







Powershell



. , , . . 2 : , , , Git', , , , - , ( fish) — .







, , oh-my-posh. :







Install-Module oh-my-posh -Scope CurrentUser #   oh-my-posh
Install-Module posh-git -Scope CurrentUser #    ,    git'
      
      





, Get-Theme



, Set-Theme



:







PS C:\Users\Daniil_Shilo> Get-Theme

Name                  Type     Location
----                  ----     --------
Agnoster              Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\A...
AgnosterPlus          Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\A...
Avit                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\A...
cypher                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\c...
Darkblood             Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\D...
Emodipt               Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\E...
Fish                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\F...
Honukai               Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\H...
Lambda                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\L...
Material              Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\M...
Operator              Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\O...
Paradox               Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Pararussel            Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Powerlevel10k-Classic Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Powerlevel10k-Lean    Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Powerlevel9k          Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
PowerLine             Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
PowerlinePlus         Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
Punk                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\P...
pure                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\p...
qwerty                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\q...
robbyrussell          Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\r...
Sorin                 Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\S...
Star                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\S...
tehrob                Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\t...
ys                    Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\y...
Zash                  Defaults C:\Users\Daniil_Shilo\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.496\Themes\Z...

Set-Theme ys
      
      











. , .









, Chocolatey. , , Linux- ( ).







:







Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
      
      





Chocolatey, - Google Chrome, Firefox, Docker, VSCode, . , Windows,







, Chocolatey, . . , Approved.




Chocolatey Powershell, , Linux. search.







% choco search Google Chrome
Chocolatey v0.10.15
GoogleChrome 88.0.4324.146 [Approved]
google-hangouts-chrome 2017.110.418.20 [Approved]
google-translate-chrome 2.0.7 [Approved]
...
      
      







( ).







% choco install <_>
      
      





:







% choco list --local-only
      
      





- :







% choco uninstall <_>
      
      







Embora o terminal no Windows ainda não esteja tão funcional, acredito que mais cedo ou mais tarde isso vai mudar, mesmo que apenas devido à integração do Linux no Windows (WSL). Acho que você já pode usar o terminal com calma, porque as pessoas continuam inventando algo novo para dar uma nova vida ao emulador de terminal do Windows.







Se você se interessou, pode ler meu blog no carrinho , há muitas coisas interessantes sobre o mundo do Linux, assim como sobre desenvolvimento web.








All Articles