[PowerShell] Windows Terminal๊ณผ oh my posh๋กœ Powershell์„ ๋” ์ด์˜๊ฒŒ ์‚ฌ์šฉํ•˜๊ธฐ

๋ฐ˜์‘ํ˜•

๊ฐœ์ธ์ ์œผ๋กœ Windows๋ฅผ ์“ธ ์ผ์ด๋ผ๊ณค ๋งŽ์ด ์—†์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐœ๋ฐœ์€ ๋Œ€๋ถ€๋ถ„ Linux ํ˜น์€ OS X์—์„œ ์ง„ํ–‰ํ•˜๊ณ , Windows๋Š” ๊ฒŒ์ž„ ๋จธ์‹ ์ด๋‚˜ Windows binary ๊ฐœ๋ฐœ ์™ธ์—๋Š” ๊ฑฐ์˜ ์“ธ ์ผ์ด ์—†์—ˆ์œผ๋‹ˆ๊น์š”.

 

๊ทธ๋Ÿฐ๋ฐ, ์ตœ๊ทผ Windows Terminal์„ ๋ณด๊ณ  ์ด์ œ Powershell๋„ ๊พธ๋ฏธ๋Š” ์‹œ๋Œ€๊ฐ€ ์™”๋‹ค๋Š” ๊ฒƒ์„ ๋Š๋ผ๋ฉฐ ์‚ฌ์šฉ๊ธฐ์™€ ํ•จ๊ป˜ ์ด๋ป์ง„ Windows Terminal์„ ์†Œ๊ฐœํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

 

 

 

๋”ฑ๋”ฑํ•˜๋‹ค ๋ชปํ•ด ์นœ์ˆ™ํ•˜์ง€ ์•Š์€ Powershell๊ณผ CMD

Windows ๋ช…๋ น ํ”„๋กฌํฌํŠธ๋Š” ๊ทธ์•ผ๋ง๋กœ ๋ ˆ๊ฑฐ์‹œ๋ฅผ ์ƒ์ง•ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์ž…๋‹ˆ๋‹ค. 

 

๊ทธ๋ฅผ ๋Œ€์ฒดํ•˜๊ธฐ ์œ„ํ•ด Windows Server 2008๊ณผ Windows Vista์—์„œ๋ถ€ํ„ฐ Powershell์„ ๋„์ž…ํ–ˆ์ง€๋งŒ ์Šคํฌ๋ฆฝํŠธ๋Š” ํ’๋ถ€ํ•˜๊ฒŒ ์ง€์›ํ•˜๋”๋ผ๋„ ์นœ์ˆ™ํ•˜์ง€ ์•Š์€ UI ๋“ฑ์€ ์ €์—๊ฒŒ ๋Š˜ ์ด์งˆ๊ฐ์ด์—ˆ์Šต๋‹ˆ๋‹ค ใ…œใ…œ

 

 

 

Windows Terminal

Microsoft Store์—์„œ Windows Terminal์„ ๊ฒ€์ƒ‰ํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด Windows Terminal์„ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

Windows Terminal์€ ๊ณผ๊ฑฐ Microsoft์˜ ์ •์ฑ…๊ณผ ๋‹ฌ๋ฆฌ ์˜คํ”ˆ ์†Œ์Šค ์†Œํ”„ํŠธ์›จ์–ด์ด๋ฉฐ ์•„์ง์€ Windows OS ์™ธ์—๋Š” ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. 

 

https://github.com/microsoft/terminal

 

GitHub - microsoft/terminal: The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place! - GitHub - microsoft/terminal: The new Windows Terminal and the original Windows console host, all in the same...

github.com

 

Windows Terminal์„ ์‹คํ–‰์‹œ์ผœ๋ณด๋ฉด ๊ธฐ์กด Powershell, ๋ช…๋ น ํ”„๋กฌํฌํŠธ๋ณด๋‹ค ๊น”๋”ํ•œ ํฐํŠธ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ณ , ๊ฑฐ๊ธฐ์— ํƒญ๊นŒ์ง€ ์ง€์›ํ•˜๋Š” ๋ชจ์Šต์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด๊ฑธ๋กœ๋Š” ์•„์ง Windows Terminal์ด ๋งค๋ ฅ์ ์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

 

 

 

Oh my posh

Linux ํ˜น์€ Mac OS X๋ฅผ ์“ฐ์‹œ๋Š” ๋ถ„๋“ค์ด๋ผ๋ฉด bash ํ˜น์€ zsh๋ฅผ ์“ฐ์‹ค ๊ฒƒ์ž…๋‹ˆ๋‹ค. ํŠนํžˆ zsh๋ฅผ ์“ฐ์‹œ๋Š” ๋ถ„๋“ค ์ค‘ ์กฐ๊ธˆ ๊ฐ์„ฑ์ ์ด๋ผ๋ฉด oh my zsh๋ฅผ ์‚ฌ์šฉํ•˜์‹œ๋Š” ๋ถ„๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

 

Windows์—์„œ๋Š” Powershell์ด ๊ทธ๊ฒƒ์„ ๋Œ€์ฒดํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์ด๋ฆ„์„ Oh my posh(Powershell)์ด๋ผ๊ณ  ํ•˜๋ฉฐ Oh my zsh์™€ ์œ ์‚ฌํ•œ ์Šคํƒ€์ผ์„ ์ง€๋‹ˆ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

 

https://ohmyposh.dev/

 

Home | Oh My Posh

A prompt theme engine for any shell.

ohmyposh.dev

Oh My Posh๋Š” Windows์—์„œ ๊ณต์‹์ ์œผ๋กœ ์ œ๊ณตํ•˜๋Š” ํŒจํ‚ค์ง€ ๋งค๋‹ˆ์ €์ธ winget์„ ์ด์šฉํ•ด์„œ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

> winget install JanDeDobbeleer.OhMyPosh -s winget

> oh-my-posh.exe

Windows Terminal์„ ์ข…๋ฃŒํ•œ ๋’ค ์žฌ์‹คํ–‰ํ•˜๊ณ , ์œ„ ๋ช…๋ น์–ด๋ฅผ ์ณค์„ ๋–„ ์•„๋ž˜์˜ ํ™”๋ฉด์ด ๋‚˜์˜ค๋ฉด ์„ค์น˜๊ฐ€ ์ž˜ ๋๋‚œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

 

์ด์ œ ์„ค์น˜๊ฐ€ ๋๋‚ฌ์œผ๋‹ˆ ํ…Œ๋งˆ๋ฅผ ์„ ํƒํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

https://ohmyposh.dev/docs/themes

 

Themes | Oh My Posh

Oh My Posh comes with many themes included out-of-the-box. Below are some screenshots of the more common themes.

ohmyposh.dev

Oh My Posh์—์„œ ์ œ๊ณตํ•˜๋Š” ํ…Œ๋งˆ๋Š” ์œ„ ์‚ฌ์ดํŠธ์—์„œ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ €๋Š” ์—ฌ๊ธฐ์„œ iTerm2 ํ…Œ๋งˆ๋ฅผ ์ ์šฉํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

 

> oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\iterm2.omp.json" | Invoke-Expression

POSH_THEMES_PATH ๊ฒฝ๋กœ ๋’ค์ชฝ์— ์ž์‹ ์ด ์›ํ•˜๋Š” ํ…Œ๋งˆ ์ด๋ฆ„์„ ์ง€์ •ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

๊ทธ๋Ÿฐ๋ฐ... ์–ด๋ผ? ๊ธ€์ž๊ฐ€ ๊นจ์ ธ ๋ณด์ด๋„ค์š”.. ใ…œใ…œ

Oh my posh๋ฅผ ์™„๋ฒฝํ•˜๊ฒŒ ์‚ฌ์šฉํ•˜๋ ค๋ฉด Nerd Font๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์šฐ๋ฆฌ๋Š” Nerd font๋ฅผ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

> oh-my-posh font install

oh my posh ๋ช…๋ น์–ด๋กœ font install์„ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

 

ํ‚ค๋ณด๋“œ ์ƒํ•˜ ํ‚ค๋ฅผ ์ด์šฉํ•ด ์›ํ•˜๋Š” ํฐํŠธ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

(์ด ๋•Œ๋ถ€ํ„ฐ๋Š” Terminal์ด ๊ด€๋ฆฌ์ž ๋ชจ๋“œ๋กœ ์‹คํ–‰๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค!)

 

ํฐํŠธ ์„ค์น˜๊ฐ€ ๋๋‚ฌ์œผ๋ฉด Ctrl + Shift + , ๋‹จ์ถ•ํ‚ค๋ฅผ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด settings.json ํŒŒ์ผ์ด ํŽธ์ง‘๊ธฐ๋กœ ์‹คํ–‰๋˜๋Š”๋ฐ, 38๋ฒˆ ์ค„์— ์žˆ๋Š” default์— ์šฐ๋ฆฌ๊ฐ€ ์„ค์น˜ํ•œ ํฐํŠธ๋ฅผ ๋„ฃ์–ด์ค๋‹ˆ๋‹ค.

 

๊ทธ๋Ÿฌ๋ฉด ๊นจ์ง„ ๊ธ€์ž๊ฐ€ ์•„์ด์ฝ˜์œผ๋กœ ๋ณ€ํ•ฉ๋‹ˆ๋‹ค.

 

์—ฌ๊ธฐ์„œ ์šฐ๋ฆฌ๋Š” ํ…Œ๋งˆ๋ฅผ ์•„์ง ์™„๋ฒฝํ•˜๊ฒŒ ์ ์šฉํ•œ ๊ฒƒ์ด ์•„๋‹™๋‹ˆ๋‹ค. ๊ทธ์ € ํ•ด๋‹น ์‰˜์—์„œ๋งŒ ํ…Œ๋งˆ๋ฅผ ์ ์šฉํ•œ ๊ฒƒ์ด๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์Œ์— ๋‹ค์‹œ ์‰˜์„ ์‹คํ–‰ํ–ˆ์„ ๋•Œ๋„ ํ•ด๋‹น ํ…Œ๋งˆ๋กœ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ”„๋กœํ•„์— ์ €์žฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

ํ˜„์žฌ ํ…Œ๋งˆ๊ฐ€ ๋งˆ์Œ์— ๋“ ๋‹ค๋ฉด ๋‹ค์Œ ๊ณผ์ •์œผ๋กœ ๊ณ„์† ์ง„ํ–‰ํ•˜๊ณ , ํ…Œ๋งˆ๋ฅผ ๋ฐ”๊พธ๊ณ  ์‹ถ๋‹ค๋ฉด oh-my-posh init ๋ช…๋ น์–ด๋กœ ๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค.

 

> notepad.exe $PROFILE

๋ฉ”๋ชจ์žฅ์œผ๋กœ Powershell ํ”„๋กœํ•„์„ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค.

 

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\iterm2.omp.json" | Invoke-Expression

ํ…Œ๋งˆ๋ฅผ ์ง€์ •ํ•˜๋Š” ๋ช…๋ น์–ด๋ฅผ ํ”„๋กœํ•„์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  Windows Terminal์„ ์‹คํ–‰ํ•˜๋ฉด ์ด์   ํ•ด๋‹น ํ…Œ๋งˆ๋กœ Powershell์ด ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

 

 

 

Terminal-Icons

Powershell์—์„œ๋Š” ls ํ˜น์€ Get-Items ๋ช…๋ น์–ด๋กœ ํ˜„์žฌ ๋””๋ ‰ํ„ฐ๋ฆฌ์— ์žˆ๋Š” ํŒŒ์ผ์„ ํƒ์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

ํ•˜์ง€๋งŒ ๋””๋ ‰ํ„ฐ๋ฆฌ์™€ ํŒŒ์ผ ๊ตฌ๋ถ„์ด ์–ด๋ ต์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด Terminal Icons๋ฅผ ์ด์šฉํ•˜๋ฉด ์ข€ ๋” ๊น”๋”ํ•˜๊ฒŒ ํŒŒ์ผ์„ ํƒ์ƒ‰ํ•ด ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

> Install-Module -Name Terminal-Icons -Repository PSGallery

Nuget์œผ๋กœ Terminal-Icons๋ฅผ Github Repository์—์„œ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์Šต๋‹ˆ๋‹ค.

 

> Import-Module -Name Terminal-Icons

๊ทธ๋Ÿฐ ๋‹ค์Œ Import-Module๋กœ ์•„์ด์ฝ˜์„ Importํ•ฉ๋‹ˆ๋‹ค.

 

๊ทธ๋Ÿฌ๋ฉด ์ข€ ๋” ๊น”๋”ํ•œ ls ๋ช…๋ น์–ด๋กœ ๋ฐ”๋€๋‹ˆ๋‹ค.

 

 

 

๋งˆ์น˜๋ฉฐ...

์˜ค๋žœ๋งŒ์— Windows ํฌ์ŠคํŒ…์„ ์˜ฌ๋ฆฌ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. PowerShell์„ ๊พธ๋ฉฐ์„œ ์“ด์ง€๋Š” ๊ฝค ๋์ง€๋งŒ ๋‹น์‹œ์—” Windows Terminal์ด ์•„์ง Preview ๋ฒ„์ „์ด์—ˆ๊ธฐ์— ํฌ์ŠคํŒ…์„ ์กฐ๊ธˆ ๊บผ๋ คํ–ˆ์—ˆ์Šต๋‹ˆ๋‹ค.

 

์ด์   ์ •์‹ ๋ฒ„์ „์ด๊ณ , Windows CLI ํ™˜๊ฒฝ๋„ ๋ฐœ์ „ํ•ด๋‚˜๊ฐ€๋Š” ์ถ”์„ธ๋‹ˆ ์กฐ๊ธˆ์€ ์ง€์ผœ๋ณผ๋งŒํ•œ ์ปจํ…์ธ ๊ฐ€ ๋œ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

 

๋ฐ˜์‘ํ˜•
TAGS.

Tistory Comments