๐Ÿฅฃ ์ฒ ํ•™์ž๋“ค์˜ ์‹์‚ฌ. (์ž‘์„ฑ๋Œ€๊ธฐ์ค‘)

ALL OS Posted by Sunio on January 26, 2021 · 4 mins read

via Stanford University CS110 ..

Tools

1. Prologue


์‹์‚ฌํ•˜๋Š” ์ฒ ํ•™์ž๋“ค ๋ฌธ์ œ๋Š” Operating System์—์„œ Cocurrency๋ณ‘ํ–‰์„ฑ ์™€ deadlock ๊ต์ฐฉ์ƒํƒœ ์„ ์„ค๋ช…ํ•˜๋Š” ๋Œ€ํ‘œ์ ์ธ ๋ฌธ์ œ์ด๋‹ค.

๋‹ค์„ฏ ๋ช…์˜ ์ฒ ํ•™์ž๊ฐ€ ์›ํƒ์— ์•‰์•„ ์žˆ๊ณ , ๊ฐ์ž์˜ ์•ž์—๋Š” ์ŠคํŒŒ๊ฒŒํ‹ฐ๊ฐ€ ์žˆ๊ณ  ์–‘์˜†์— ํฌํฌ๊ฐ€ ํ•˜๋‚˜์”ฉ ์žˆ๋‹ค.  
๊ทธ๋ฆฌ๊ณ  ๊ฐ๊ฐ์˜ ์ฒ ํ•™์ž๋Š” ๋‹ค๋ฅธ ์ฒ ํ•™์ž์—๊ฒŒ ๋ง์„ ํ•  ์ˆ˜ ์—†๋‹ค. ์ด๋•Œ ์ฒ ํ•™์ž๊ฐ€ ์ŠคํŒŒ๊ฒŒํ‹ฐ๋ฅผ ๋จน๊ธฐ ์œ„ํ•ด์„œ๋Š”  
์–‘ ์˜†์˜ ํฌํฌ๋ฅผ ๋™์‹œ์— ๋“ค์–ด์•ผ ํ•œ๋‹ค.  
์ด๋•Œ ๊ฐ๊ฐ์˜ ์ฒ ํ•™์ž๊ฐ€ ์™ผ์ชฝ์˜ ํฌํฌ๋ฅผ ๋“ค๊ณ  ๊ทธ ๋‹ค์Œ ์˜ค๋ฅธ์ชฝ์˜ ํฌํฌ๋ฅผ ๋“ค์–ด์„œ ์ŠคํŒŒ๊ฒŒํ‹ฐ๋ฅผ ๋จน๋Š”  
์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉด, ๋‹ค์„ฏ ์ฒ ํ•™์ž๋Š” ๋™์‹œ์— ์™ผ์ชฝ์˜ ํฌํฌ๋ฅผ ๋“ค ์ˆ˜ ์žˆ์œผ๋‚˜  
์˜ค๋ฅธ์ชฝ์˜ ํฌํฌ๋Š” ์ด๋ฏธ ๊ฐ€์ ธ๊ฐ€์ง„ ์ƒํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์— ๋‹ค์„ฏ ๋ช… ๋ชจ๋‘๊ฐ€ ๋ฌดํ•œ์ • ์„œ๋กœ๋ฅผ ๊ธฐ๋‹ค๋ฆฌ๋Š”  
๊ต์ฐฉ ์ƒํƒœ์— ๋น ์ง€๊ฒŒ ๋  ์ˆ˜ ์žˆ๋‹ค.
# Wiki

๊ทธ๋ฆผ์œผ๋กœ ๋ณด๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

Px x๋ฒˆ์งธ ์ฒ ํ•™์ž , fx x๋ฒˆ์งธ ํฌํฌ ๋ผ๊ณ  ํ•  ๋•Œ,

2. Alias Command


3. On Command Line


# powershell
$profile # bashrc์™€ equivalantํ•œ powershell์˜ ๋ฌด์–ธ๊ฐ€์˜ ์œ„์น˜๋ฅผ ์ฐพ๋Š”๋‹ค.
function awsbegin aws ec2 start-instances --instance-ids {'id'}
function awsend aws ec2 stop-instances --instance-ids {'id'}
Set-Alias awsstart awsbegin
Set-Alias awsstop awsend

Windows Powershell์—์„œ๋Š” bashrc๋ฅผ ๋Œ€์‹ ํ•˜๋Š” profile ํŒŒ์ผ์„ ์ฐพ์•„ ์ˆ˜์ •ํ•ด์•ผํ•œ๋‹ค.
profile์˜ ๋‚ด์šฉ์€ powershell์ด init๋˜๋Š” ์ˆœ๊ฐ„์— ๋ช…๋ น์–ด๋ฅผ ๋ชจ๋‘ ๋™์ž‘ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์ƒ๊ฐ๋œ๋‹ค.
์ด๋ฅผ ํ†ตํ•ด, ๋ช…๋ น์–ด๋ฅผ ๋งค๋ฒˆ ์ž…๋ ฅํ•˜์—ฌ Alias๋ฅผ ๋“ฑ๋กํ•ด์•ผํ•˜๋Š” ์ˆ˜๊ณ ๋ฅผ ๋œ๊ฒŒ ๋˜์—ˆ๋‹ค.

# bash shell
vim ~/.bashrc
alias awsstart=โ€˜aws ec2 start-instances --instance-ids {'id'}โ€™ 
alias awsstop=โ€˜aws ec2 stop-instances --instance-ids {'id' }'

์œ„๋Š” AWS linux bash์—์„œ Alias๋ฅผ ๋“ฑ๋กํ•˜๋Š” ๊ณผ์ •์ด๋‹ค.

4. Result


  • awss function์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

  • awsstart ๋ผ๋Š” ๋ณ„๋ช…์— awss function์„ ์ ์šฉํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

  • Get-Alias command๋กœ ๋ช…๋ น์–ด ๋“ฑ๋ก์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • awsstart๋ฅผ ์‹คํ–‰ํ•ด๋ด…๋‹ˆ๋‹ค.

  • $profile์„ ํ†ตํ•ด ๋ช…๋ น์–ด๊ฐ€ ๋งค๋ฒˆ powershell์„ ๋ถ€ํŒ…ํ•  ๋•Œ, ์ ์šฉ๋˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. (save)

  • AWS EC2 Ubuntu shell ์ƒ์—์„œ awsstop ๋ช…๋ น์„ ์‹คํ–‰ํ•œ ๋ชจ์Šต์ด๋‹ค.

5. Epilogue


๊ธฐ์ˆ ์€ ์จ๋จน์–ด์•ผ ์˜๋ฏธ๊ฐ€ ์žˆ๋Š”๊ฑฐ์•ผ.

6. Reference


Thank For ์˜๋™zeroist๐Ÿคฉ

powershell์—์„œ .bashrc๋ฅผ? :: Does Powershell have any sort of .bashrc equivalent?
windows powershell alias commands :: powershell alias
powershell :: Creating aliases in PowerShell for git commands?


โ€ข 0 Comments